Skip to content

Commit df2bfb1

Browse files
committed
Update profile test import path and regenerate R4 examples
- Fix profile.test.ts import to use new naming (Observation_observation_bodyweight) - Regenerate profile files with corrected types and casts
1 parent 5bbafe1 commit df2bfb1

8 files changed

Lines changed: 59 additions & 59 deletions

File tree

examples/typescript-r4/extension-profile.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
import { expect, test } from "bun:test";
88
import type { HumanName } from "./fhir-types/hl7-fhir-r4-core/HumanName";
9-
import type { Patient, } from "./fhir-types/hl7-fhir-r4-core/Patient";
10-
import { own_prefixProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Extension_own_prefix";
9+
import type { Patient } from "./fhir-types/hl7-fhir-r4-core/Patient";
1110
import { birthPlaceProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Extension_birthPlace";
1211
import { birthTimeProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Extension_birthTime";
1312
import { nationalityProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Extension_nationality";
13+
import { own_prefixProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Extension_own_prefix";
1414

1515
test("Patient with extensions built from profiles", () => {
1616
const name: HumanName = {

examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Extension_birthPlace.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class birthPlaceProfile {
2525
const resource: Extension = {
2626
url: "http://hl7.org/fhir/StructureDefinition/patient-birthPlace",
2727
valueAddress: args.valueAddress,
28-
} as Extension
28+
} as unknown as Extension
2929
return resource
3030
}
3131

@@ -38,11 +38,11 @@ export class birthPlaceProfile {
3838
}
3939

4040
getValueAddress () : Address | undefined {
41-
return this.resource.valueAddress
41+
return this.resource.valueAddress as Address | undefined
4242
}
4343

4444
setValueAddress (value: Address) : this {
45-
this.resource.valueAddress = value
45+
(this.resource as any).valueAddress = value
4646
return this
4747
}
4848

examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Extension_birthTime.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class birthTimeProfile {
2424
const resource: Extension = {
2525
url: "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
2626
valueDateTime: args.valueDateTime,
27-
} as Extension
27+
} as unknown as Extension
2828
return resource
2929
}
3030

@@ -37,11 +37,11 @@ export class birthTimeProfile {
3737
}
3838

3939
getValueDateTime () : string | undefined {
40-
return this.resource.valueDateTime
40+
return this.resource.valueDateTime as string | undefined
4141
}
4242

4343
setValueDateTime (value: string) : this {
44-
this.resource.valueDateTime = value
44+
(this.resource as any).valueDateTime = value
4545
return this
4646
}
4747

examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Extension_nationality.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class nationalityProfile {
2121
static createResource () : Extension {
2222
const resource: Extension = {
2323
url: "http://hl7.org/fhir/StructureDefinition/patient-nationality",
24-
} as Extension
24+
} as unknown as Extension
2525
return resource
2626
}
2727

@@ -35,19 +35,19 @@ export class nationalityProfile {
3535

3636
public setCode (value: CodeableConcept): this {
3737
const list = (this.resource.extension ??= [])
38-
list.push({ url: "code", valueCodeableConcept: value })
38+
list.push({ url: "code", valueCodeableConcept: value } as Extension)
3939
return this
4040
}
4141

4242
public setPeriod (value: Period): this {
4343
const list = (this.resource.extension ??= [])
44-
list.push({ url: "period", valuePeriod: value })
44+
list.push({ url: "period", valuePeriod: value } as Extension)
4545
return this
4646
}
4747

4848
public getCode (): CodeableConcept | undefined {
4949
const ext = this.resource.extension?.find(e => e.url === "code")
50-
return ext?.valueCodeableConcept
50+
return (ext as Record<string, unknown> | undefined)?.valueCodeableConcept as CodeableConcept | undefined
5151
}
5252

5353
public getCodeExtension (): Extension | undefined {
@@ -57,7 +57,7 @@ export class nationalityProfile {
5757

5858
public getPeriod (): Period | undefined {
5959
const ext = this.resource.extension?.find(e => e.url === "period")
60-
return ext?.valuePeriod
60+
return (ext as Record<string, unknown> | undefined)?.valuePeriod as Period | undefined
6161
}
6262

6363
public getPeriodExtension (): Extension | undefined {

examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Extension_own_prefix.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class own_prefixProfile {
2424
const resource: Extension = {
2525
url: "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
2626
valueString: args.valueString,
27-
} as Extension
27+
} as unknown as Extension
2828
return resource
2929
}
3030

@@ -37,11 +37,11 @@ export class own_prefixProfile {
3737
}
3838

3939
getValueString () : string | undefined {
40-
return this.resource.valueString
40+
return this.resource.valueString as string | undefined
4141
}
4242

4343
setValueString (value: string) : this {
44-
this.resource.valueString = value
44+
(this.resource as any).valueString = value
4545
return this
4646
}
4747

examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bodyweight.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export type Observation_bodyweight_Category_VSCatSliceInput = Omit<CodeableConce
1616
import { applySliceMatch, matchesSlice, extractSliceSimplified } from "../../profile-helpers";
1717

1818
export type observation_bodyweightProfileParams = {
19-
status: string;
20-
category: CodeableConcept[];
21-
code: CodeableConcept;
22-
subject: Reference;
19+
status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown");
20+
category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[];
21+
code: CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)>;
22+
subject: Reference<"Patient">;
2323
}
2424

2525
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/bodyweight (pkg: hl7.fhir.r4.core#4.0.1)
@@ -41,7 +41,7 @@ export class observation_bodyweightProfile {
4141
category: args.category,
4242
code: args.code,
4343
subject: args.subject,
44-
} as Observation
44+
} as unknown as Observation
4545
return resource
4646
}
4747

@@ -53,39 +53,39 @@ export class observation_bodyweightProfile {
5353
return this.resource
5454
}
5555

56-
getStatus () : string | undefined {
57-
return this.resource.status
56+
getStatus () : ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown") | undefined {
57+
return this.resource.status as ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown") | undefined
5858
}
5959

60-
setStatus (value: string) : this {
61-
this.resource.status = value
60+
setStatus (value: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown")) : this {
61+
(this.resource as any).status = value
6262
return this
6363
}
6464

65-
getCategory () : CodeableConcept[] | undefined {
66-
return this.resource.category
65+
getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined {
66+
return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined
6767
}
6868

69-
setCategory (value: CodeableConcept[]) : this {
70-
this.resource.category = value
69+
setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this {
70+
(this.resource as any).category = value
7171
return this
7272
}
7373

74-
getCode () : CodeableConcept | undefined {
75-
return this.resource.code
74+
getCode () : CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)> | undefined {
75+
return this.resource.code as CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)> | undefined
7676
}
7777

78-
setCode (value: CodeableConcept) : this {
79-
this.resource.code = value
78+
setCode (value: CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)>) : this {
79+
(this.resource as any).code = value
8080
return this
8181
}
8282

83-
getSubject () : Reference | undefined {
84-
return this.resource.subject
83+
getSubject () : Reference<"Patient"> | undefined {
84+
return this.resource.subject as Reference<"Patient"> | undefined
8585
}
8686

87-
setSubject (value: Reference) : this {
88-
this.resource.subject = value
87+
setSubject (value: Reference<"Patient">) : this {
88+
(this.resource as any).subject = value
8989
return this
9090
}
9191

examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_vitalsigns.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export type Observation_vitalsigns_Category_VSCatSliceInput = Omit<CodeableConce
1616
import { applySliceMatch, matchesSlice, extractSliceSimplified } from "../../profile-helpers";
1717

1818
export type observation_vitalsignsProfileParams = {
19-
status: string;
20-
category: CodeableConcept[];
21-
code: CodeableConcept;
22-
subject: Reference;
19+
status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown");
20+
category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[];
21+
code: CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)>;
22+
subject: Reference<"Patient">;
2323
}
2424

2525
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/vitalsigns (pkg: hl7.fhir.r4.core#4.0.1)
@@ -41,7 +41,7 @@ export class observation_vitalsignsProfile {
4141
category: args.category,
4242
code: args.code,
4343
subject: args.subject,
44-
} as Observation
44+
} as unknown as Observation
4545
return resource
4646
}
4747

@@ -53,39 +53,39 @@ export class observation_vitalsignsProfile {
5353
return this.resource
5454
}
5555

56-
getStatus () : string | undefined {
57-
return this.resource.status
56+
getStatus () : ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown") | undefined {
57+
return this.resource.status as ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown") | undefined
5858
}
5959

60-
setStatus (value: string) : this {
61-
this.resource.status = value
60+
setStatus (value: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown")) : this {
61+
(this.resource as any).status = value
6262
return this
6363
}
6464

65-
getCategory () : CodeableConcept[] | undefined {
66-
return this.resource.category
65+
getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined {
66+
return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined
6767
}
6868

69-
setCategory (value: CodeableConcept[]) : this {
70-
this.resource.category = value
69+
setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this {
70+
(this.resource as any).category = value
7171
return this
7272
}
7373

74-
getCode () : CodeableConcept | undefined {
75-
return this.resource.code
74+
getCode () : CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)> | undefined {
75+
return this.resource.code as CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)> | undefined
7676
}
7777

78-
setCode (value: CodeableConcept) : this {
79-
this.resource.code = value
78+
setCode (value: CodeableConcept<("85353-1" | "9279-1" | "8867-4" | "2708-6" | "8310-5" | "8302-2" | "9843-4" | "29463-7" | "39156-5" | "85354-9" | "8480-6" | "8462-4" | "8478-0" | string)>) : this {
79+
(this.resource as any).code = value
8080
return this
8181
}
8282

83-
getSubject () : Reference | undefined {
84-
return this.resource.subject
83+
getSubject () : Reference<"Patient"> | undefined {
84+
return this.resource.subject as Reference<"Patient"> | undefined
8585
}
8686

87-
setSubject (value: Reference) : this {
88-
this.resource.subject = value
87+
setSubject (value: Reference<"Patient">) : this {
88+
(this.resource as any).subject = value
8989
return this
9090
}
9191

examples/typescript-r4/profile.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { expect, test } from "bun:test";
88
import type { Observation } from "./fhir-types/hl7-fhir-r4-core/Observation";
9-
import { bodyweightProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Observation_bodyweight";
9+
import { observation_bodyweightProfile as bodyweightProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bodyweight";
1010

1111
function createBodyWeightObservation(): Observation {
1212
const baseObservation: Observation = {

0 commit comments

Comments
 (0)