Skip to content

Commit 54ec676

Browse files
committed
Update docs with preserved slice name casing
1 parent e4d1e4a commit 54ec676

4 files changed

Lines changed: 30 additions & 30 deletions

File tree

‎docs/design/profiles.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const obs: Observation = JSON.parse(json)
9090

9191
// Wrap with profile
9292
const bodyweight = observation_bodyweightProfile.from(obs)
93-
bodyweight.getVscat() // access slice
93+
bodyweight.getVSCat() // access slice
9494
bodyweight.toResource() // back to Observation (same object)
9595
```
9696

@@ -136,9 +136,9 @@ export class observation_bodyweightProfile {
136136
setStatus(value: ...): this { ... }
137137

138138
// Slice accessors (see slices.md)
139-
setVscat(input?: Observation_bodyweight_Category_VSCatSliceInput): this { ... }
140-
getVscat(): Observation_bodyweight_Category_VSCatSliceInput | undefined { ... }
141-
getVscatRaw(): CodeableConcept | undefined { ... }
139+
setVSCat(input?: Observation_bodyweight_Category_VSCatSliceInput): this { ... }
140+
getVSCat(): Observation_bodyweight_Category_VSCatSliceInput | undefined { ... }
141+
getVSCatRaw(): CodeableConcept | undefined { ... }
142142

143143
// Conversion
144144
toResource(): Observation { ... }

‎docs/design/slices.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class observation_bodyweightProfile {
3434
// ...
3535

3636
// Setter: finds existing slice by discriminator or appends
37-
setVscat(input?: Observation_bodyweight_Category_VSCatSliceInput): this {
37+
setVSCat(input?: Observation_bodyweight_Category_VSCatSliceInput): this {
3838
const match = {
3939
"coding": {
4040
"code": "vital-signs",
@@ -53,14 +53,14 @@ export class observation_bodyweightProfile {
5353
}
5454

5555
// Getter: returns simplified view (discriminator fields stripped)
56-
getVscat(): Observation_bodyweight_Category_VSCatSliceInput | undefined {
56+
getVSCat(): Observation_bodyweight_Category_VSCatSliceInput | undefined {
5757
const match = { ... }
5858
const item = list.find((item) => matchesSlice(item, match))
5959
return extractSliceSimplified(item, ["coding"])
6060
}
6161

6262
// Raw getter: returns the full element including discriminator fields
63-
getVscatRaw(): CodeableConcept | undefined { ... }
63+
getVSCatRaw(): CodeableConcept | undefined { ... }
6464
}
6565
```
6666

@@ -70,7 +70,7 @@ The input type for a slice setter uses `Omit<>` to remove discriminator fields.
7070

7171
```typescript
7272
// User provides text, coding is applied automatically
73-
profile.setVscat({ text: "Vital Signs" })
73+
profile.setVSCat({ text: "Vital Signs" })
7474

7575
// Discriminator values are merged in:
7676
// { text: "Vital Signs", coding: [{ code: "vital-signs", system: "..." }] }

‎docs/posts/typescript-profiles-deep-dive.md‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ export class observation_bodyweightProfile {
8585
setSubject(value: Reference<"Patient">): this;
8686

8787
// Slice accessors
88-
setVscat(input?: Observation_bodyweight_Category_VSCatSliceInput): this;
89-
getVscat(): Observation_bodyweight_Category_VSCatSliceInput | undefined;
90-
getVscatRaw(): CodeableConcept | undefined;
88+
setVSCat(input?: Observation_bodyweight_Category_VSCatSliceInput): this;
89+
getVSCat(): Observation_bodyweight_Category_VSCatSliceInput | undefined;
90+
getVSCatRaw(): CodeableConcept | undefined;
9191

9292
// Conversion
9393
toResource(): Observation;
@@ -111,7 +111,7 @@ const profile = observation_bodyweightProfile.create({
111111
subject: { reference: "Patient/pt-1" },
112112
});
113113

114-
profile.setVscat({ text: "Vital Signs" });
114+
profile.setVSCat({ text: "Vital Signs" });
115115

116116
const obs = profile.toResource();
117117
```
@@ -124,11 +124,11 @@ const obs = profile.toResource();
124124
const obs: Observation = await fhirClient.read("Observation", "bodyweight-123");
125125
const profile = observation_bodyweightProfile.from(obs);
126126

127-
const vscat = profile.getVscat();
127+
const vscat = profile.getVSCat();
128128
console.log(vscat?.text); // "Vital Signs"
129129
```
130130

131-
`from()` wraps an existing resource. The profile class doesn't validate that the resource actually conforms to the profile -- it's a convenience API, not a validator. If the resource doesn't have a VSCat slice, `getVscat()` returns `undefined`.
131+
`from()` wraps an existing resource. The profile class doesn't validate that the resource actually conforms to the profile -- it's a convenience API, not a validator. If the resource doesn't have a VSCat slice, `getVSCat()` returns `undefined`.
132132

133133
### Mutability
134134

@@ -148,13 +148,13 @@ Slicing is where profiles get interesting. A slice defines a named "view" into a
148148

149149
The generator produces three methods for each slice:
150150

151-
### `setVscat(input?)`
151+
### `setVSCat(input?)`
152152

153153
Finds an existing element matching the discriminator, or appends a new one. The discriminator values are merged into your input automatically. The parameter is optional -- when called with no arguments, an element containing only the discriminator values is inserted:
154154

155155
```typescript
156156
// You provide only the non-discriminator fields:
157-
profile.setVscat({ text: "Vital Signs" });
157+
profile.setVSCat({ text: "Vital Signs" });
158158

159159
// The generated code merges in the discriminator:
160160
// {
@@ -168,22 +168,22 @@ profile.setVscat({ text: "Vital Signs" });
168168

169169
The input type uses `Omit<CodeableConcept, "coding">` -- the discriminator field `coding` is stripped from the input because it's applied automatically.
170170

171-
### `getVscat()`
171+
### `getVSCat()`
172172

173173
Finds the matching element and returns a simplified view with discriminator fields stripped:
174174

175175
```typescript
176-
const vscat = profile.getVscat();
176+
const vscat = profile.getVSCat();
177177
// Returns: { text: "Vital Signs" }
178178
// The coding discriminator is stripped from the result
179179
```
180180

181-
### `getVscatRaw()`
181+
### `getVSCatRaw()`
182182

183183
Returns the full element as-is, including discriminator fields:
184184

185185
```typescript
186-
const raw = profile.getVscatRaw();
186+
const raw = profile.getVSCatRaw();
187187
// Returns: { text: "Vital Signs", coding: [{ code: "vital-signs", system: "..." }] }
188188
```
189189

@@ -349,10 +349,10 @@ bp.validate();
349349
Fill in the required slices and choice fields, and validation passes:
350350

351351
```typescript
352-
bp.setVscat({ text: "Vital Signs" })
352+
bp.setVSCat({ text: "Vital Signs" })
353353
.setEffectiveDateTime("2024-06-15")
354-
.setSystolicBp({ valueQuantity: { value: 120, unit: "mmHg" } })
355-
.setDiastolicBp({ valueQuantity: { value: 80, unit: "mmHg" } });
354+
.setSystolicBP({ valueQuantity: { value: 120, unit: "mmHg" } })
355+
.setDiastolicBP({ valueQuantity: { value: 80, unit: "mmHg" } });
356356

357357
bp.validate(); // [] — valid
358358
```

‎docs/posts/typescript-profiles-quick.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ const bp = observation_bpProfile.create({
1313
});
1414

1515
// Slice setters -- discriminator values (LOINC codes) applied automatically
16-
bp.setVscat({ text: "Vital Signs" })
17-
.setSystolicBp({ valueQuantity: { value: 120, unit: "mmHg" } })
18-
.setDiastolicBp({ valueQuantity: { value: 80, unit: "mmHg" } })
16+
bp.setVSCat({ text: "Vital Signs" })
17+
.setSystolicBP({ valueQuantity: { value: 120, unit: "mmHg" } })
18+
.setDiastolicBP({ valueQuantity: { value: 80, unit: "mmHg" } })
1919
.setEffectiveDateTime("2024-06-15");
2020

2121
// Validate against profile constraints
@@ -40,13 +40,13 @@ const obs = bp.toResource();
4040
// Wrap any Observation back into a profile to read slices
4141
const bp2 = observation_bpProfile.from(obs);
4242

43-
bp2.getSystolicBp(); // { valueQuantity: { value: 120, unit: "mmHg" } }
44-
bp2.getDiastolicBp(); // { valueQuantity: { value: 80, unit: "mmHg" } }
45-
bp2.getVscat(); // { text: "Vital Signs" }
43+
bp2.getSystolicBP(); // { valueQuantity: { value: 120, unit: "mmHg" } }
44+
bp2.getDiastolicBP(); // { valueQuantity: { value: 80, unit: "mmHg" } }
45+
bp2.getVSCat(); // { text: "Vital Signs" }
4646
bp2.getEffectiveDateTime(); // "2024-06-15"
4747

4848
// Raw getters return the full FHIR element including discriminator values
49-
bp2.getSystolicBpRaw(); // { code: { coding: [{ code: "8480-6", ... }] }, valueQuantity: { value: 120, ... } }
49+
bp2.getSystolicBPRaw(); // { code: { coding: [{ code: "8480-6", ... }] }, valueQuantity: { value: 120, ... } }
5050
```
5151

5252
Supports resource profiles, simple/complex extension profiles, slice accessors, choice types, and `validate()` checking required fields, fixed values, slice cardinality, enum bindings, and reference types.

0 commit comments

Comments
 (0)