From f6ac18f6c83df5daa30775ce59960e0763dc41b5 Mon Sep 17 00:00:00 2001 From: Aleksandr Penskoi Date: Wed, 4 Mar 2026 13:27:11 +0100 Subject: [PATCH 1/3] Auto-populate required slices in profile createResource() Array fields with required slices (min >= 1) are now auto-populated with their discriminator match values in the generated factory methods. This removes them from required params so users don't need to pass empty arrays and manually call slice setters. --- .../writer-generator/typescript/profile.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/api/writer-generator/typescript/profile.ts b/src/api/writer-generator/typescript/profile.ts index a93b5952b..2f7387cb8 100644 --- a/src/api/writer-generator/typescript/profile.ts +++ b/src/api/writer-generator/typescript/profile.ts @@ -75,6 +75,14 @@ const tryPromoteChoice = ( promotedChoices.add(choiceName); }; +const collectRequiredSliceMatches = (field: RegularField): Record[] | undefined => { + if (!field.array || !field.slicing?.slices) return undefined; + const matches = Object.values(field.slicing.slices) + .filter((s) => s.min !== undefined && s.min >= 1 && s.match && Object.keys(s.match).length > 0) + .map((s) => s.match as Record); + return matches.length > 0 ? matches : undefined; +}; + const collectProfileFactoryInfo = (flatProfile: ProfileTypeSchema): ProfileFactoryInfo => { const autoFields: ProfileFactoryInfo["autoFields"] = []; const params: ProfileFactoryInfo["params"] = []; @@ -105,6 +113,19 @@ const collectProfileFactoryInfo = (flatProfile: ProfileTypeSchema): ProfileFacto continue; } + if (isNotChoiceDeclarationField(field)) { + const requiredMatches = collectRequiredSliceMatches(field); + if (requiredMatches) { + const value = `[${requiredMatches.map((m) => JSON.stringify(m)).join(",")}]`; + autoFields.push({ name, value }); + if (field.type) { + const tsType = resolveFieldTsType("", "", field) + (field.array ? "[]" : ""); + autoAccessors.push({ name, tsType, typeId: field.type }); + } + continue; + } + } + if (field.required) { const tsType = resolveFieldTsType("", "", field) + (field.array ? "[]" : ""); params.push({ name, tsType, typeId: field.type }); From c01f6039d7e63fba0fb65006f5eb1db1f743684a Mon Sep 17 00:00:00 2001 From: Aleksandr Penskoi Date: Wed, 4 Mar 2026 13:27:16 +0100 Subject: [PATCH 2/3] Update tests for auto-populated required slices Remove category:[] from create() calls in bodyweight and BP tests. Update validation expectations and slice accessor tests to reflect auto-populated discriminator values. Update snapshots. --- .../typescript-r4/profile-bodyweight.test.ts | 32 ++++++------- examples/typescript-r4/profile-bp.test.ts | 27 +++++------ .../__snapshots__/typescript.test.ts.snap | 48 +++++++++++-------- 3 files changed, 56 insertions(+), 51 deletions(-) diff --git a/examples/typescript-r4/profile-bodyweight.test.ts b/examples/typescript-r4/profile-bodyweight.test.ts index c002e5acd..79cacb5ce 100644 --- a/examples/typescript-r4/profile-bodyweight.test.ts +++ b/examples/typescript-r4/profile-bodyweight.test.ts @@ -14,7 +14,6 @@ describe("bodyweight profile creation", () => { test("create() returns a profile wrapping the resource with auto-set code", () => { const profile = bodyweightProfile.create({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); fromCreate = profile.toResource(); @@ -29,7 +28,6 @@ describe("bodyweight profile creation", () => { test("createResource() returns a plain Observation with auto-set code", () => { fromCreateResource = bodyweightProfile.createResource({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); @@ -46,7 +44,14 @@ describe("bodyweight profile creation", () => { profile .setStatus("final") .setCode({ coding: [{ code: "29463-7", system: "http://loinc.org" }] }) - .setCategory([]) + .setCategory([ + { + coding: { + code: "vital-signs", + system: "http://terminology.hl7.org/CodeSystem/observation-category", + }, + } as any, + ]) .setSubject({ reference: "Patient/pt-1" }); fromFrom = profile.toResource(); @@ -73,7 +78,6 @@ describe("bodyweight profile creation", () => { describe("bodyweight profile getters and setters", () => { const profile = bodyweightProfile.create({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); @@ -93,7 +97,8 @@ describe("bodyweight profile getters and setters", () => { }); test("getCategory / setCategory", () => { - expect(profile.getCategory()).toEqual([]); + // category is auto-populated with VSCat discriminator + expect(profile.getCategory()).toHaveLength(1); const newCategory = [{ text: "Laboratory" }]; profile.setCategory(newCategory); expect(profile.getCategory()).toEqual(newCategory); @@ -109,23 +114,19 @@ describe("bodyweight profile getters and setters", () => { describe("bodyweight profile slice accessors", () => { const profile = bodyweightProfile.create({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); - test("getVscat returns undefined when no matching slice", () => { - expect(profile.getVscat()).toBeUndefined(); - expect(profile.getVscatRaw()).toBeUndefined(); - }); - - test("setVscat with no args inserts discriminator-only element", () => { - profile.setVscat(); - + test("getVscat returns empty simplified view from auto-populated stub", () => { + // category is auto-populated with VSCat discriminator match + expect(profile.getVscatRaw()).toBeDefined(); const raw = profile.getVscatRaw()!; expect(raw.coding as unknown).toEqual({ code: "vital-signs", system: "http://terminology.hl7.org/CodeSystem/observation-category", }); + // simplified view strips discriminator keys, leaving empty object + expect(profile.getVscat()).toEqual({}); }); test("setVscat adds category with discriminator values", () => { @@ -162,7 +163,6 @@ describe("bodyweight profile slice accessors", () => { describe("bodyweight profile choice type accessors", () => { const profile = bodyweightProfile.create({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); @@ -199,7 +199,6 @@ describe("bodyweight profile choice type accessors", () => { test("choice accessors mutate the underlying resource", () => { const obs = bodyweightProfile.createResource({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); const p = bodyweightProfile.from(obs); @@ -222,7 +221,6 @@ describe("bodyweight profile mutability", () => { test("profile mutates the underlying resource", () => { const obs = bodyweightProfile.createResource({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); const profile = bodyweightProfile.from(obs); diff --git a/examples/typescript-r4/profile-bp.test.ts b/examples/typescript-r4/profile-bp.test.ts index 9da30e8dd..480ac8e6e 100644 --- a/examples/typescript-r4/profile-bp.test.ts +++ b/examples/typescript-r4/profile-bp.test.ts @@ -3,20 +3,17 @@ */ import { describe, expect, test } from "bun:test"; -import type { Observation } from "./fhir-types/hl7-fhir-r4-core/Observation"; import { observation_bpProfile as bpProfile } from "./fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bp"; const createBp = () => bpProfile.create({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); describe("blood pressure profile", () => { const profile = bpProfile.create({ status: "final", - category: [], subject: { reference: "Patient/pt-1" }, }); @@ -32,20 +29,21 @@ describe("blood pressure profile", () => { expect(obs.meta?.profile).toEqual(["http://hl7.org/fhir/StructureDefinition/bp"]); }); - test("freshly created profile is not yet valid (missing slices/effective)", () => { + test("freshly created profile is not yet valid (missing effective)", () => { const errors = profile.validate(); - expect(errors).toEqual([ - "observation-bp.category: slice 'VSCat' requires at least 1 item(s), found 0", - "effective: at least one of effectiveDateTime, effectivePeriod is required", - "observation-bp.component: slice 'SystolicBP' requires at least 1 item(s), found 0", - "observation-bp.component: slice 'DiastolicBP' requires at least 1 item(s), found 0", - ]); + expect(errors).toEqual(["effective: at least one of effectiveDateTime, effectivePeriod is required"]); }); - test("setSystolicBp / getSystolicBp / getSystolicBpRaw", () => { - expect(profile.getSystolicBp()).toBeUndefined(); - expect(profile.getSystolicBpRaw()).toBeUndefined(); + test("create() auto-populates component with systolic/diastolic stubs", () => { + const fresh = createBp(); + const obs = fresh.toResource(); + expect(obs.component).toHaveLength(2); + // stubs contain only discriminator match values + expect(fresh.getSystolicBpRaw()).toBeDefined(); + expect(fresh.getDiastolicBpRaw()).toBeDefined(); + }); + test("setSystolicBp / getSystolicBp / getSystolicBpRaw", () => { profile.setSystolicBp({ valueQuantity: { value: 120, unit: "mmHg", system: "http://unitsofmeasure.org", code: "mm[Hg]" }, }); @@ -75,8 +73,9 @@ describe("blood pressure profile", () => { }); }); - test("both systolic and diastolic populate the component array", () => { + test("both systolic and diastolic are in the component array", () => { const obs = profile.toResource(); + // auto-populated stubs + set values = still 2 items (set replaces stubs) expect(obs.component).toHaveLength(2); const systolicCode = profile.getSystolicBpRaw()!.code as Record; diff --git a/test/api/write-generator/__snapshots__/typescript.test.ts.snap b/test/api/write-generator/__snapshots__/typescript.test.ts.snap index d582d00ae..5283cdf9a 100644 --- a/test/api/write-generator/__snapshots__/typescript.test.ts.snap +++ b/test/api/write-generator/__snapshots__/typescript.test.ts.snap @@ -333,7 +333,6 @@ import { applySliceMatch, matchesSlice, extractSliceSimplified, validateRequired export type observation_bodyweightProfileParams = { status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"); - category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]; subject: Reference<"Patient">; } @@ -358,9 +357,9 @@ export class observation_bodyweightProfile { static createResource (args: observation_bodyweightProfileParams) : Observation { const resource: Observation = { resourceType: "Observation", + category: [{"coding":{"code":"vital-signs","system":"http://terminology.hl7.org/CodeSystem/observation-category"}}], code: {"coding":[{"code":"29463-7","system":"http://loinc.org"}]}, status: args.status, - category: args.category, subject: args.subject, meta: { profile: ["http://hl7.org/fhir/StructureDefinition/bodyweight"] }, } as unknown as Observation @@ -384,21 +383,21 @@ export class observation_bodyweightProfile { return this } - getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { - return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined + getSubject () : Reference<"Patient"> | undefined { + return this.resource.subject as Reference<"Patient"> | undefined } - setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { - Object.assign(this.resource, { category: value }) + setSubject (value: Reference<"Patient">) : this { + Object.assign(this.resource, { subject: value }) return this } - getSubject () : Reference<"Patient"> | undefined { - return this.resource.subject as Reference<"Patient"> | undefined + getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { + return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined } - setSubject (value: Reference<"Patient">) : this { - Object.assign(this.resource, { subject: value }) + setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { + Object.assign(this.resource, { category: value }) return this } @@ -521,7 +520,6 @@ import { applySliceMatch, matchesSlice, extractSliceSimplified, validateRequired export type observation_bpProfileParams = { status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"); - category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]; subject: Reference<"Patient">; } @@ -546,9 +544,10 @@ export class observation_bpProfile { static createResource (args: observation_bpProfileParams) : Observation { const resource: Observation = { resourceType: "Observation", + category: [{"coding":{"code":"vital-signs","system":"http://terminology.hl7.org/CodeSystem/observation-category"}}], code: {"coding":[{"code":"85354-9","system":"http://loinc.org"}]}, + component: [{"code":{"coding":{"code":"8480-6","system":"http://loinc.org"}}},{"code":{"coding":{"code":"8462-4","system":"http://loinc.org"}}}], status: args.status, - category: args.category, subject: args.subject, meta: { profile: ["http://hl7.org/fhir/StructureDefinition/bp"] }, } as unknown as Observation @@ -572,21 +571,21 @@ export class observation_bpProfile { return this } - getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { - return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined + getSubject () : Reference<"Patient"> | undefined { + return this.resource.subject as Reference<"Patient"> | undefined } - setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { - Object.assign(this.resource, { category: value }) + setSubject (value: Reference<"Patient">) : this { + Object.assign(this.resource, { subject: value }) return this } - getSubject () : Reference<"Patient"> | undefined { - return this.resource.subject as Reference<"Patient"> | undefined + getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { + return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined } - setSubject (value: Reference<"Patient">) : this { - Object.assign(this.resource, { subject: value }) + setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { + Object.assign(this.resource, { category: value }) return this } @@ -599,6 +598,15 @@ export class observation_bpProfile { return this } + getComponent () : ObservationComponent[] | undefined { + return this.resource.component as ObservationComponent[] | undefined + } + + setComponent (value: ObservationComponent[]) : this { + Object.assign(this.resource, { component: value }) + return this + } + getEffectiveDateTime () : string | undefined { return this.resource.effectiveDateTime as string | undefined } From c484521ba7b36e9c3516e65fb07da1ee7c47fa26 Mon Sep 17 00:00:00 2001 From: Aleksandr Penskoi Date: Wed, 4 Mar 2026 13:27:25 +0100 Subject: [PATCH 3/3] Regenerate R4 profile examples with auto-populated slices --- .../Observation_observation_bodyweight.ts | 19 ++++++------ .../profiles/Observation_observation_bp.ts | 29 ++++++++++++------- .../Observation_observation_vitalsigns.ts | 21 +++++++------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bodyweight.ts b/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bodyweight.ts index 9f07bc353..f74b3b374 100644 --- a/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bodyweight.ts +++ b/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bodyweight.ts @@ -19,7 +19,6 @@ import { applySliceMatch, matchesSlice, extractSliceSimplified, validateRequired export type observation_bodyweightProfileParams = { status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"); - category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]; subject: Reference<"Patient">; } @@ -44,9 +43,9 @@ export class observation_bodyweightProfile { static createResource (args: observation_bodyweightProfileParams) : Observation { const resource: Observation = { resourceType: "Observation", + category: [{"coding":{"code":"vital-signs","system":"http://terminology.hl7.org/CodeSystem/observation-category"}}], code: {"coding":[{"code":"29463-7","system":"http://loinc.org"}]}, status: args.status, - category: args.category, subject: args.subject, meta: { profile: ["http://hl7.org/fhir/StructureDefinition/bodyweight"] }, } as unknown as Observation @@ -70,21 +69,21 @@ export class observation_bodyweightProfile { return this } - getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { - return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined + getSubject () : Reference<"Patient"> | undefined { + return this.resource.subject as Reference<"Patient"> | undefined } - setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { - Object.assign(this.resource, { category: value }) + setSubject (value: Reference<"Patient">) : this { + Object.assign(this.resource, { subject: value }) return this } - getSubject () : Reference<"Patient"> | undefined { - return this.resource.subject as Reference<"Patient"> | undefined + getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { + return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined } - setSubject (value: Reference<"Patient">) : this { - Object.assign(this.resource, { subject: value }) + setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { + Object.assign(this.resource, { category: value }) return this } diff --git a/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bp.ts b/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bp.ts index 130d3fe0b..43aa12a2a 100644 --- a/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bp.ts +++ b/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_bp.ts @@ -22,7 +22,6 @@ import { applySliceMatch, matchesSlice, extractSliceSimplified, validateRequired export type observation_bpProfileParams = { status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"); - category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]; subject: Reference<"Patient">; } @@ -47,9 +46,10 @@ export class observation_bpProfile { static createResource (args: observation_bpProfileParams) : Observation { const resource: Observation = { resourceType: "Observation", + category: [{"coding":{"code":"vital-signs","system":"http://terminology.hl7.org/CodeSystem/observation-category"}}], code: {"coding":[{"code":"85354-9","system":"http://loinc.org"}]}, + component: [{"code":{"coding":{"code":"8480-6","system":"http://loinc.org"}}},{"code":{"coding":{"code":"8462-4","system":"http://loinc.org"}}}], status: args.status, - category: args.category, subject: args.subject, meta: { profile: ["http://hl7.org/fhir/StructureDefinition/bp"] }, } as unknown as Observation @@ -73,21 +73,21 @@ export class observation_bpProfile { return this } - getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { - return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined + getSubject () : Reference<"Patient"> | undefined { + return this.resource.subject as Reference<"Patient"> | undefined } - setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { - Object.assign(this.resource, { category: value }) + setSubject (value: Reference<"Patient">) : this { + Object.assign(this.resource, { subject: value }) return this } - getSubject () : Reference<"Patient"> | undefined { - return this.resource.subject as Reference<"Patient"> | undefined + getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { + return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined } - setSubject (value: Reference<"Patient">) : this { - Object.assign(this.resource, { subject: value }) + setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { + Object.assign(this.resource, { category: value }) return this } @@ -100,6 +100,15 @@ export class observation_bpProfile { return this } + getComponent () : ObservationComponent[] | undefined { + return this.resource.component as ObservationComponent[] | undefined + } + + setComponent (value: ObservationComponent[]) : this { + Object.assign(this.resource, { component: value }) + return this + } + getEffectiveDateTime () : string | undefined { return this.resource.effectiveDateTime as string | undefined } diff --git a/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_vitalsigns.ts b/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_vitalsigns.ts index ca2260348..bf5e9c9ee 100644 --- a/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_vitalsigns.ts +++ b/examples/typescript-r4/fhir-types/hl7-fhir-r4-core/profiles/Observation_observation_vitalsigns.ts @@ -18,7 +18,6 @@ import { applySliceMatch, matchesSlice, extractSliceSimplified, validateRequired export type observation_vitalsignsProfileParams = { status: ("registered" | "preliminary" | "final" | "amended" | "corrected" | "cancelled" | "entered-in-error" | "unknown"); - category: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]; 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)>; subject: Reference<"Patient">; } @@ -44,8 +43,8 @@ export class observation_vitalsignsProfile { static createResource (args: observation_vitalsignsProfileParams) : Observation { const resource: Observation = { resourceType: "Observation", + category: [{"coding":{"code":"vital-signs","system":"http://terminology.hl7.org/CodeSystem/observation-category"}}], status: args.status, - category: args.category, code: args.code, subject: args.subject, meta: { profile: ["http://hl7.org/fhir/StructureDefinition/vitalsigns"] }, @@ -70,15 +69,6 @@ export class observation_vitalsignsProfile { return this } - getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { - return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined - } - - setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { - Object.assign(this.resource, { category: value }) - return this - } - 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 { 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 } @@ -97,6 +87,15 @@ export class observation_vitalsignsProfile { return this } + getCategory () : CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined { + return this.resource.category as CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[] | undefined + } + + setCategory (value: CodeableConcept<("social-history" | "vital-signs" | "imaging" | "laboratory" | "procedure" | "survey" | "exam" | "therapy" | "activity" | string)>[]) : this { + Object.assign(this.resource, { category: value }) + return this + } + getEffectiveDateTime () : string | undefined { return this.resource.effectiveDateTime as string | undefined }