From f1e438c7a41259dbbd2c2a199d2c36c65982f0be Mon Sep 17 00:00:00 2001 From: Aleksandr Penskoi Date: Tue, 24 Mar 2026 16:57:11 +0100 Subject: [PATCH 1/2] ref: Update @atomic-ehr/fhirschema to 0.0.9, remove DiscriminatorType Use upstream FHIRSchemaDiscriminator type directly, removing the local DiscriminatorType alias and the validDiscriminatorTypes runtime filter. --- bun.lock | 5 ++--- package.json | 2 +- src/typeschema/core/field-builder.ts | 16 ++++------------ src/typeschema/types.ts | 4 +--- test/unit/typeschema/transformer.test.ts | 8 ++++---- 5 files changed, 12 insertions(+), 23 deletions(-) diff --git a/bun.lock b/bun.lock index 16b8f5e2a..9328b39bc 100644 --- a/bun.lock +++ b/bun.lock @@ -1,12 +1,11 @@ { "lockfileVersion": 1, - "configVersion": 0, "workspaces": { "": { "name": "@atomic-ehr/codegen", "dependencies": { "@atomic-ehr/fhir-canonical-manager": "^0.0.21", - "@atomic-ehr/fhirschema": "^0.0.8", + "@atomic-ehr/fhirschema": "0.0.9", "mustache": "^4.2.0", "picocolors": "^1.1.1", "tinyglobby": "^0.2.15", @@ -32,7 +31,7 @@ "packages": { "@atomic-ehr/fhir-canonical-manager": ["@atomic-ehr/fhir-canonical-manager@0.0.21", "", { "peerDependencies": { "typescript": "^5" }, "bin": { "fcm": "dist/cli/index.js" } }, "sha512-MTmPXWixNJ6Wa2b9AqTeo4wg37w9u9ebDnVj0eRDwspDrNHhcgM/XYtEV3Oio7Mnzam3n9m0IPsto8iPQ87ilA=="], - "@atomic-ehr/fhirschema": ["@atomic-ehr/fhirschema@0.0.8", "", { "peerDependencies": { "typescript": "^5" } }, "sha512-RB3ZlFHYYfP4ZaOA0YStGaxrm3T1MzpJLPAzAxW/7u2yfdmQz160e3mGYVv0mglHKtGhZ0fuuk2qqhDwUiGncg=="], + "@atomic-ehr/fhirschema": ["@atomic-ehr/fhirschema@0.0.9", "", { "peerDependencies": { "typescript": "^5" } }, "sha512-1RfyESETkGUy1VJbCF67T5jDEULMKuEMOjspxgINp+vnmTv+dr9ts1dgtvbgiWSTBdkrfDHFFKmCwHAYjatPyw=="], "@biomejs/biome": ["@biomejs/biome@2.4.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.4.4", "@biomejs/cli-darwin-x64": "2.4.4", "@biomejs/cli-linux-arm64": "2.4.4", "@biomejs/cli-linux-arm64-musl": "2.4.4", "@biomejs/cli-linux-x64": "2.4.4", "@biomejs/cli-linux-x64-musl": "2.4.4", "@biomejs/cli-win32-arm64": "2.4.4", "@biomejs/cli-win32-x64": "2.4.4" }, "bin": { "biome": "bin/biome" } }, "sha512-tigwWS5KfJf0cABVd52NVaXyAVv4qpUXOWJ1rxFL8xF1RVoeS2q/LK+FHgYoKMclJCuRoCWAPy1IXaN9/mS61Q=="], diff --git a/package.json b/package.json index 260110f32..fed70af00 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "homepage": "https://github.com/atomic-ehr/codegen#readme", "dependencies": { "@atomic-ehr/fhir-canonical-manager": "^0.0.21", - "@atomic-ehr/fhirschema": "^0.0.8", + "@atomic-ehr/fhirschema": "0.0.9", "mustache": "^4.2.0", "picocolors": "^1.1.1", "tinyglobby": "^0.2.15", diff --git a/src/typeschema/core/field-builder.ts b/src/typeschema/core/field-builder.ts index 08e94f2aa..cdbc3afd3 100644 --- a/src/typeschema/core/field-builder.ts +++ b/src/typeschema/core/field-builder.ts @@ -4,13 +4,12 @@ * Functions for transforming FHIRSchema elements into TypeSchema fields */ -import type { FHIRSchemaElement } from "@atomic-ehr/fhirschema"; +import type { FHIRSchemaDiscriminator, FHIRSchemaElement } from "@atomic-ehr/fhirschema"; import type { Register } from "@root/typeschema/register"; import type { CodegenLog } from "@root/utils/log"; import { packageMetaToFhir } from "@typeschema/types"; import type { BindingIdentifier, - DiscriminatorType, EnumDefinition, Field, FieldSlice, @@ -200,16 +199,9 @@ const computeTypeDiscriminatorMatch = ( * Used when a slice has an empty match but the discriminator values are nested deeper * (e.g., component slices in BP where the discriminator crosses a nested slicing boundary). */ -const validDiscriminatorTypes = new Set(["value", "exists", "pattern", "type", "profile"]); - -// TODO: Update type in FHIR Schema to prevent this casting. -const toDiscriminators = ( - raw: { type: string; path: string }[] | undefined, -): { type: DiscriminatorType; path: string }[] => - (raw ?? []).filter((d) => validDiscriminatorTypes.has(d.type)) as { type: DiscriminatorType; path: string }[]; const computeMatchFromSchema = ( - discriminators: { type: DiscriminatorType; path: string }[], + discriminators: FHIRSchemaDiscriminator[], schema: FHIRSchemaElement | undefined, ): Record | undefined => { if (!schema || !discriminators || discriminators.length === 0) return undefined; @@ -239,7 +231,7 @@ const buildSlicing = (element: FHIRSchemaElement): FieldSlicing | undefined => { min: slice.min, max: slice.max, match: isEmptyMatch(slice.match) - ? computeMatchFromSchema(toDiscriminators(slicing.discriminator), slice.schema) + ? computeMatchFromSchema(slicing.discriminator ?? [], slice.schema) : (slice.match as Record | undefined), required, excluded, @@ -248,7 +240,7 @@ const buildSlicing = (element: FHIRSchemaElement): FieldSlicing | undefined => { } return { - discriminator: toDiscriminators(slicing.discriminator), + discriminator: slicing.discriminator ?? [], rules: slicing.rules, ordered: slicing.ordered, slices: Object.keys(slices).length > 0 ? slices : undefined, diff --git a/src/typeschema/types.ts b/src/typeschema/types.ts index 6dc751591..6fb8a0c47 100644 --- a/src/typeschema/types.ts +++ b/src/typeschema/types.ts @@ -246,10 +246,8 @@ export interface ProfileTypeSchema { nested?: NestedTypeSchema[]; } -export type DiscriminatorType = "value" | "exists" | "pattern" | "type" | "profile"; - export interface FieldSlicing { - discriminator?: { type: DiscriminatorType; path: string }[]; + discriminator?: FS.FHIRSchemaDiscriminator[]; rules?: string; ordered?: boolean; slices?: Record; diff --git a/test/unit/typeschema/transformer.test.ts b/test/unit/typeschema/transformer.test.ts index 810947456..df0fc14da 100644 --- a/test/unit/typeschema/transformer.test.ts +++ b/test/unit/typeschema/transformer.test.ts @@ -24,7 +24,7 @@ describe("TypeSchema Transformer Core Logic", async () => { id: { type: "id" }, name: { type: "string" }, }, - class: "", + class: "resource", }; const result = await registerFsAndMkTs(r4, fhirSchema, logger); @@ -42,7 +42,7 @@ describe("TypeSchema Transformer Core Logic", async () => { base: "Patient", url: "http://example.org/CustomPatient", elements: {}, - class: "", + class: "resource", }; const result = await registerFsAndMkTs(r4, fhirSchema, logger); @@ -60,7 +60,7 @@ describe("TypeSchema Transformer Core Logic", async () => { kind: "primitive-type", base: "http://hl7.org/fhir/StructureDefinition/Element", url: "http://hl7.org/fhir/StructureDefinition/string", - class: "", + class: "resource", }; const result = await registerFsAndMkTs(r4, fhirSchema, logger); @@ -126,7 +126,7 @@ describe("TypeSchema Transformer Core Logic", async () => { }, }, }, - class: "", + class: "resource", }; const result = await registerFsAndMkTs(r4, fhirSchema, logger); From 0bf19197a37d49f13bb894068a8a0244db146452 Mon Sep 17 00:00:00 2001 From: Aleksandr Penskoi Date: Tue, 24 Mar 2026 17:15:03 +0100 Subject: [PATCH 2/2] chore: Regenerate src/fhir-types --- src/fhir-types/README.md | 62 +++++++++++++++++++ src/fhir-types/hl7-fhir-r4-core/Attachment.ts | 2 +- src/fhir-types/hl7-fhir-r4-core/CodeSystem.ts | 4 +- .../hl7-fhir-r4-core/CodeableConcept.ts | 4 +- src/fhir-types/hl7-fhir-r4-core/Coding.ts | 4 +- .../hl7-fhir-r4-core/DataRequirement.ts | 6 +- .../hl7-fhir-r4-core/DomainResource.ts | 4 +- src/fhir-types/hl7-fhir-r4-core/Dosage.ts | 2 +- .../hl7-fhir-r4-core/ElementDefinition.ts | 16 ++--- src/fhir-types/hl7-fhir-r4-core/Expression.ts | 2 +- src/fhir-types/hl7-fhir-r4-core/Identifier.ts | 2 +- src/fhir-types/hl7-fhir-r4-core/Resource.ts | 2 +- src/fhir-types/hl7-fhir-r4-core/Signature.ts | 2 +- .../hl7-fhir-r4-core/StructureDefinition.ts | 2 +- src/fhir-types/hl7-fhir-r4-core/Timing.ts | 4 +- .../hl7-fhir-r4-core/UsageContext.ts | 2 +- src/fhir-types/hl7-fhir-r4-core/ValueSet.ts | 4 +- 17 files changed, 93 insertions(+), 31 deletions(-) diff --git a/src/fhir-types/README.md b/src/fhir-types/README.md index 7878497c2..6caf9481f 100644 --- a/src/fhir-types/README.md +++ b/src/fhir-types/README.md @@ -2576,3 +2576,65 @@ Skipped fields: - `urn:fhir:binding:validation-process` - `urn:fhir:binding:validation-status` - `urn:fhir:binding:validation-type` + +## Schema Collisions + +The following canonicals have multiple schema versions with different content. +To inspect collision versions, export TypeSchemas using `.introspection({ typeSchemas: 'path' })` +and check `/collisions//1.json, 2.json, ...` files. + +### `shared` + +- `urn:fhir:binding:CommunicationReason` (2 versions) + - Version 1 (auto): Communication (hl7.fhir.r4.core#4.0.1) + - Version 2: CommunicationRequest (hl7.fhir.r4.core#4.0.1) +- `urn:fhir:binding:ObservationCategory` (2 versions) + - Version 1 (auto): Observation (hl7.fhir.r4.core#4.0.1), vitalsigns (hl7.fhir.r4.core#4.0.1) + - Version 2: ObservationDefinition (hl7.fhir.r4.core#4.0.1) +- `urn:fhir:binding:ObservationRangeMeaning` (2 versions) + - Version 1 (auto): cholesterol (hl7.fhir.r4.core#4.0.1), hdlcholesterol (hl7.fhir.r4.core#4.0.1), ldlcholesterol (hl7.fhir.r4.core#4.0.1), Observation (hl7.fhir.r4.core#4.0.1), triglyceride (hl7.fhir.r4.core#4.0.1) + - Version 2: ObservationDefinition (hl7.fhir.r4.core#4.0.1) +- `urn:fhir:binding:PaymentType` (2 versions) + - Version 1 (auto): ClaimResponse (hl7.fhir.r4.core#4.0.1), ExplanationOfBenefit (hl7.fhir.r4.core#4.0.1) + - Version 2: PaymentReconciliation (hl7.fhir.r4.core#4.0.1) +- `urn:fhir:binding:ProcessPriority` (2 versions) + - Version 1 (auto): Claim (hl7.fhir.r4.core#4.0.1), CoverageEligibilityRequest (hl7.fhir.r4.core#4.0.1) + - Version 2: ExplanationOfBenefit (hl7.fhir.r4.core#4.0.1) +- `urn:fhir:binding:TargetDisease` (2 versions) + - Version 1 (auto): Immunization (hl7.fhir.r4.core#4.0.1) + - Version 2: ImmunizationRecommendation (hl7.fhir.r4.core#4.0.1) + +### Suggested `resolveCollisions` config + +Add to `.typeSchema({ resolveCollisions: { ... } })` to resolve remaining collisions: + +```typescript +.typeSchema({ + resolveCollisions: { + "urn:fhir:binding:CommunicationReason": { + package: "hl7.fhir.r4.core#4.0.1", + canonical: "http://hl7.org/fhir/StructureDefinition/Communication", + }, + "urn:fhir:binding:ObservationCategory": { + package: "hl7.fhir.r4.core#4.0.1", + canonical: "http://hl7.org/fhir/StructureDefinition/Observation", + }, + "urn:fhir:binding:ObservationRangeMeaning": { + package: "hl7.fhir.r4.core#4.0.1", + canonical: "http://hl7.org/fhir/StructureDefinition/cholesterol", + }, + "urn:fhir:binding:PaymentType": { + package: "hl7.fhir.r4.core#4.0.1", + canonical: "http://hl7.org/fhir/StructureDefinition/ClaimResponse", + }, + "urn:fhir:binding:ProcessPriority": { + package: "hl7.fhir.r4.core#4.0.1", + canonical: "http://hl7.org/fhir/StructureDefinition/Claim", + }, + "urn:fhir:binding:TargetDisease": { + package: "hl7.fhir.r4.core#4.0.1", + canonical: "http://hl7.org/fhir/StructureDefinition/Immunization", + }, + }, +}) +``` diff --git a/src/fhir-types/hl7-fhir-r4-core/Attachment.ts b/src/fhir-types/hl7-fhir-r4-core/Attachment.ts index 83f82b591..afe66fbfa 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Attachment.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Attachment.ts @@ -12,7 +12,7 @@ export interface Attachment extends Element { creation?: string; data?: string; hash?: string; - language?: string; + language?: ("ar" | "bn" | "cs" | "da" | "de" | "de-AT" | "de-CH" | "de-DE" | "el" | "en" | "en-AU" | "en-CA" | "en-GB" | "en-IN" | "en-NZ" | "en-SG" | "en-US" | "es" | "es-AR" | "es-ES" | "es-UY" | "fi" | "fr" | "fr-BE" | "fr-CH" | "fr-FR" | "fy" | "fy-NL" | "hi" | "hr" | "it" | "it-CH" | "it-IT" | "ja" | "ko" | "nl" | "nl-BE" | "nl-NL" | "no" | "no-NO" | "pa" | "pl" | "pt" | "pt-BR" | "ru" | "ru-RU" | "sr" | "sr-RS" | "sv" | "sv-SE" | "te" | "zh" | "zh-CN" | "zh-HK" | "zh-SG" | "zh-TW" | string); size?: number; title?: string; url?: string; diff --git a/src/fhir-types/hl7-fhir-r4-core/CodeSystem.ts b/src/fhir-types/hl7-fhir-r4-core/CodeSystem.ts index 4c38ee259..111c02adc 100644 --- a/src/fhir-types/hl7-fhir-r4-core/CodeSystem.ts +++ b/src/fhir-types/hl7-fhir-r4-core/CodeSystem.ts @@ -27,8 +27,8 @@ export interface CodeSystemConcept extends BackboneElement { } export interface CodeSystemConceptDesignation extends BackboneElement { - language?: string; - use?: Coding; + language?: ("ar" | "bn" | "cs" | "da" | "de" | "de-AT" | "de-CH" | "de-DE" | "el" | "en" | "en-AU" | "en-CA" | "en-GB" | "en-IN" | "en-NZ" | "en-SG" | "en-US" | "es" | "es-AR" | "es-ES" | "es-UY" | "fi" | "fr" | "fr-BE" | "fr-CH" | "fr-FR" | "fy" | "fy-NL" | "hi" | "hr" | "it" | "it-CH" | "it-IT" | "ja" | "ko" | "nl" | "nl-BE" | "nl-NL" | "no" | "no-NO" | "pa" | "pl" | "pt" | "pt-BR" | "ru" | "ru-RU" | "sr" | "sr-RS" | "sv" | "sv-SE" | "te" | "zh" | "zh-CN" | "zh-HK" | "zh-SG" | "zh-TW" | string); + use?: Coding<("900000000000003001" | "900000000000013009" | string)>; value: string; } diff --git a/src/fhir-types/hl7-fhir-r4-core/CodeableConcept.ts b/src/fhir-types/hl7-fhir-r4-core/CodeableConcept.ts index a9bf03b73..dfa61f219 100644 --- a/src/fhir-types/hl7-fhir-r4-core/CodeableConcept.ts +++ b/src/fhir-types/hl7-fhir-r4-core/CodeableConcept.ts @@ -9,7 +9,7 @@ export type { Coding } from "../hl7-fhir-r4-core/Coding"; export type { Element } from "../hl7-fhir-r4-core/Element"; // CanonicalURL: http://hl7.org/fhir/StructureDefinition/CodeableConcept (pkg: hl7.fhir.r4.core#4.0.1) -export interface CodeableConcept extends Element { - coding?: Coding[]; +export interface CodeableConcept extends Element { + coding?: Coding[]; text?: string; } diff --git a/src/fhir-types/hl7-fhir-r4-core/Coding.ts b/src/fhir-types/hl7-fhir-r4-core/Coding.ts index a37b67842..d904b269f 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Coding.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Coding.ts @@ -7,8 +7,8 @@ import type { Element } from "../hl7-fhir-r4-core/Element"; export type { Element } from "../hl7-fhir-r4-core/Element"; // CanonicalURL: http://hl7.org/fhir/StructureDefinition/Coding (pkg: hl7.fhir.r4.core#4.0.1) -export interface Coding extends Element { - code?: string; +export interface Coding extends Element { + code?: T; display?: string; system?: string; userSelected?: boolean; diff --git a/src/fhir-types/hl7-fhir-r4-core/DataRequirement.ts b/src/fhir-types/hl7-fhir-r4-core/DataRequirement.ts index 3479c163e..174c45e51 100644 --- a/src/fhir-types/hl7-fhir-r4-core/DataRequirement.ts +++ b/src/fhir-types/hl7-fhir-r4-core/DataRequirement.ts @@ -38,12 +38,12 @@ export interface DataRequirementSort extends Element { // CanonicalURL: http://hl7.org/fhir/StructureDefinition/DataRequirement (pkg: hl7.fhir.r4.core#4.0.1) export interface DataRequirement extends Element { - codeFilter?: Element[]; - dateFilter?: Element[]; + codeFilter?: DataRequirementCodeFilter[]; + dateFilter?: DataRequirementDateFilter[]; limit?: number; mustSupport?: string[]; profile?: string[]; - sort?: Element[]; + sort?: DataRequirementSort[]; subjectCodeableConcept?: CodeableConcept; subjectReference?: Reference<"Group">; type: string; diff --git a/src/fhir-types/hl7-fhir-r4-core/DomainResource.ts b/src/fhir-types/hl7-fhir-r4-core/DomainResource.ts index 2a3328388..275a698b0 100644 --- a/src/fhir-types/hl7-fhir-r4-core/DomainResource.ts +++ b/src/fhir-types/hl7-fhir-r4-core/DomainResource.ts @@ -10,10 +10,10 @@ export type { Extension } from "../hl7-fhir-r4-core/Extension"; export type { Narrative } from "../hl7-fhir-r4-core/Narrative"; // CanonicalURL: http://hl7.org/fhir/StructureDefinition/DomainResource (pkg: hl7.fhir.r4.core#4.0.1) -export interface DomainResource extends Resource { +export interface DomainResource extends Resource { resourceType: "CodeSystem" | "DomainResource" | "StructureDefinition" | "ValueSet"; - contained?: Resource[]; + contained?: T[]; extension?: Extension[]; modifierExtension?: Extension[]; text?: Narrative; diff --git a/src/fhir-types/hl7-fhir-r4-core/Dosage.ts b/src/fhir-types/hl7-fhir-r4-core/Dosage.ts index 2155d7036..108c37eba 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Dosage.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Dosage.ts @@ -32,7 +32,7 @@ export interface Dosage extends BackboneElement { additionalInstruction?: CodeableConcept[]; asNeededBoolean?: boolean; asNeededCodeableConcept?: CodeableConcept; - doseAndRate?: Element[]; + doseAndRate?: DosageDoseAndRate[]; maxDosePerAdministration?: Quantity; maxDosePerLifetime?: Quantity; maxDosePerPeriod?: Ratio; diff --git a/src/fhir-types/hl7-fhir-r4-core/ElementDefinition.ts b/src/fhir-types/hl7-fhir-r4-core/ElementDefinition.ts index c9dd61bd4..8372f3e04 100644 --- a/src/fhir-types/hl7-fhir-r4-core/ElementDefinition.ts +++ b/src/fhir-types/hl7-fhir-r4-core/ElementDefinition.ts @@ -155,7 +155,7 @@ export interface ElementDefinitionMapping extends Element { export interface ElementDefinitionSlicing extends Element { description?: string; - discriminator?: Element[]; + discriminator?: ElementDefinitionSlicingDiscriminator[]; ordered?: boolean; rules: ("closed" | "open" | "openAtEnd"); } @@ -176,12 +176,12 @@ export interface ElementDefinitionType extends Element { // CanonicalURL: http://hl7.org/fhir/StructureDefinition/ElementDefinition (pkg: hl7.fhir.r4.core#4.0.1) export interface ElementDefinition extends BackboneElement { alias?: string[]; - base?: Element; - binding?: Element; + base?: ElementDefinitionBase; + binding?: ElementDefinitionBinding; code?: Coding[]; comment?: string; condition?: string[]; - constraint?: Element[]; + constraint?: ElementDefinitionConstraint[]; contentReference?: string; defaultValueAddress?: Address; defaultValueAge?: Age; @@ -234,7 +234,7 @@ export interface ElementDefinition extends BackboneElement { defaultValueUsageContext?: UsageContext; defaultValueUuid?: string; definition?: string; - example?: Element[]; + example?: ElementDefinitionExample[]; fixedAddress?: Address; fixedAge?: Age; fixedAnnotation?: Annotation; @@ -289,7 +289,7 @@ export interface ElementDefinition extends BackboneElement { isModifierReason?: string; isSummary?: boolean; label?: string; - mapping?: Element[]; + mapping?: ElementDefinitionMapping[]; max?: string; maxLength?: number; maxValueDate?: string; @@ -370,6 +370,6 @@ export interface ElementDefinition extends BackboneElement { short?: string; sliceIsConstraining?: boolean; sliceName?: string; - slicing?: Element; - type?: Element[]; + slicing?: ElementDefinitionSlicing; + type?: ElementDefinitionType[]; } diff --git a/src/fhir-types/hl7-fhir-r4-core/Expression.ts b/src/fhir-types/hl7-fhir-r4-core/Expression.ts index 628335707..d374c732c 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Expression.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Expression.ts @@ -10,7 +10,7 @@ export type { Element } from "../hl7-fhir-r4-core/Element"; export interface Expression extends Element { description?: string; expression?: string; - language: string; + language: ("text/cql" | "text/fhirpath" | "application/x-fhir-query" | string); name?: string; reference?: string; } diff --git a/src/fhir-types/hl7-fhir-r4-core/Identifier.ts b/src/fhir-types/hl7-fhir-r4-core/Identifier.ts index 47bbda511..de6e2ebbe 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Identifier.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Identifier.ts @@ -17,7 +17,7 @@ export interface Identifier extends Element { assigner?: Reference<"Organization">; period?: Period; system?: string; - type?: CodeableConcept; + type?: CodeableConcept<("DL" | "PPN" | "BRN" | "MR" | "MCN" | "EN" | "TAX" | "NIIP" | "PRN" | "MD" | "DR" | "ACSN" | "UDI" | "SNO" | "SB" | "PLAC" | "FILL" | "JHN" | string)>; use?: ("usual" | "official" | "temp" | "secondary" | "old"); value?: string; } diff --git a/src/fhir-types/hl7-fhir-r4-core/Resource.ts b/src/fhir-types/hl7-fhir-r4-core/Resource.ts index aeb28254a..ee7ec7d67 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Resource.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Resource.ts @@ -12,7 +12,7 @@ export interface Resource { id?: string; implicitRules?: string; - language?: string; + language?: ("ar" | "bn" | "cs" | "da" | "de" | "de-AT" | "de-CH" | "de-DE" | "el" | "en" | "en-AU" | "en-CA" | "en-GB" | "en-IN" | "en-NZ" | "en-SG" | "en-US" | "es" | "es-AR" | "es-ES" | "es-UY" | "fi" | "fr" | "fr-BE" | "fr-CH" | "fr-FR" | "fy" | "fy-NL" | "hi" | "hr" | "it" | "it-CH" | "it-IT" | "ja" | "ko" | "nl" | "nl-BE" | "nl-NL" | "no" | "no-NO" | "pa" | "pl" | "pt" | "pt-BR" | "ru" | "ru-RU" | "sr" | "sr-RS" | "sv" | "sv-SE" | "te" | "zh" | "zh-CN" | "zh-HK" | "zh-SG" | "zh-TW" | string); meta?: Meta; } export const isResource = (resource: unknown): resource is Resource => { diff --git a/src/fhir-types/hl7-fhir-r4-core/Signature.ts b/src/fhir-types/hl7-fhir-r4-core/Signature.ts index 09f7fac2d..a9610a84b 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Signature.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Signature.ts @@ -16,7 +16,7 @@ export interface Signature extends Element { onBehalfOf?: Reference<"Device" | "Organization" | "Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">; sigFormat?: string; targetFormat?: string; - type: Coding[]; + type: Coding<("1.2.840.10065.1.12.1.1" | "1.2.840.10065.1.12.1.2" | "1.2.840.10065.1.12.1.3" | "1.2.840.10065.1.12.1.4" | "1.2.840.10065.1.12.1.5" | "1.2.840.10065.1.12.1.6" | "1.2.840.10065.1.12.1.7" | "1.2.840.10065.1.12.1.8" | "1.2.840.10065.1.12.1.9" | "1.2.840.10065.1.12.1.10" | "1.2.840.10065.1.12.1.11" | "1.2.840.10065.1.12.1.12" | "1.2.840.10065.1.12.1.13" | "1.2.840.10065.1.12.1.14" | "1.2.840.10065.1.12.1.15" | "1.2.840.10065.1.12.1.16" | "1.2.840.10065.1.12.1.17" | "1.2.840.10065.1.12.1.18" | string)>[]; when: string; who: Reference<"Device" | "Organization" | "Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">; } diff --git a/src/fhir-types/hl7-fhir-r4-core/StructureDefinition.ts b/src/fhir-types/hl7-fhir-r4-core/StructureDefinition.ts index c1b347178..5deb0b4e5 100644 --- a/src/fhir-types/hl7-fhir-r4-core/StructureDefinition.ts +++ b/src/fhir-types/hl7-fhir-r4-core/StructureDefinition.ts @@ -57,7 +57,7 @@ export interface StructureDefinition extends DomainResource { fhirVersion?: ("0.01" | "0.05" | "0.06" | "0.11" | "0.0.80" | "0.0.81" | "0.0.82" | "0.4.0" | "0.5.0" | "1.0.0" | "1.0.1" | "1.0.2" | "1.1.0" | "1.4.0" | "1.6.0" | "1.8.0" | "3.0.0" | "3.0.1" | "3.3.0" | "3.5.0" | "4.0.0" | "4.0.1"); identifier?: Identifier[]; jurisdiction?: CodeableConcept[]; - keyword?: Coding[]; + keyword?: Coding<("fhir-structure" | "custom-resource" | "dam" | "wire-format" | "archetype" | "template" | string)>[]; kind: ("primitive-type" | "complex-type" | "resource" | "logical"); mapping?: StructureDefinitionMapping[]; name: string; diff --git a/src/fhir-types/hl7-fhir-r4-core/Timing.ts b/src/fhir-types/hl7-fhir-r4-core/Timing.ts index 34f7caf3d..412678e0f 100644 --- a/src/fhir-types/hl7-fhir-r4-core/Timing.ts +++ b/src/fhir-types/hl7-fhir-r4-core/Timing.ts @@ -38,7 +38,7 @@ export interface TimingRepeat extends Element { // CanonicalURL: http://hl7.org/fhir/StructureDefinition/Timing (pkg: hl7.fhir.r4.core#4.0.1) export interface Timing extends BackboneElement { - code?: CodeableConcept; + code?: CodeableConcept<("BID" | "TID" | "QID" | "AM" | "PM" | "QD" | "QOD" | "Q1H" | "Q2H" | "Q3H" | "Q4H" | "Q6H" | "Q8H" | "BED" | "WK" | "MO" | string)>; event?: string[]; - repeat?: Element; + repeat?: TimingRepeat; } diff --git a/src/fhir-types/hl7-fhir-r4-core/UsageContext.ts b/src/fhir-types/hl7-fhir-r4-core/UsageContext.ts index b3b7180af..1969171ea 100644 --- a/src/fhir-types/hl7-fhir-r4-core/UsageContext.ts +++ b/src/fhir-types/hl7-fhir-r4-core/UsageContext.ts @@ -18,7 +18,7 @@ export type { Reference } from "../hl7-fhir-r4-core/Reference"; // CanonicalURL: http://hl7.org/fhir/StructureDefinition/UsageContext (pkg: hl7.fhir.r4.core#4.0.1) export interface UsageContext extends Element { - code: Coding; + code: Coding<("gender" | "age" | "focus" | "user" | "workflow" | "task" | "venue" | "species" | "program" | string)>; valueCodeableConcept?: CodeableConcept; valueQuantity?: Quantity; valueRange?: Range; diff --git a/src/fhir-types/hl7-fhir-r4-core/ValueSet.ts b/src/fhir-types/hl7-fhir-r4-core/ValueSet.ts index 4307619e4..6ccc444a3 100644 --- a/src/fhir-types/hl7-fhir-r4-core/ValueSet.ts +++ b/src/fhir-types/hl7-fhir-r4-core/ValueSet.ts @@ -39,8 +39,8 @@ export interface ValueSetComposeIncludeConcept extends BackboneElement { } export interface ValueSetComposeIncludeConceptDesignation extends BackboneElement { - language?: string; - use?: Coding; + language?: ("ar" | "bn" | "cs" | "da" | "de" | "de-AT" | "de-CH" | "de-DE" | "el" | "en" | "en-AU" | "en-CA" | "en-GB" | "en-IN" | "en-NZ" | "en-SG" | "en-US" | "es" | "es-AR" | "es-ES" | "es-UY" | "fi" | "fr" | "fr-BE" | "fr-CH" | "fr-FR" | "fy" | "fy-NL" | "hi" | "hr" | "it" | "it-CH" | "it-IT" | "ja" | "ko" | "nl" | "nl-BE" | "nl-NL" | "no" | "no-NO" | "pa" | "pl" | "pt" | "pt-BR" | "ru" | "ru-RU" | "sr" | "sr-RS" | "sv" | "sv-SE" | "te" | "zh" | "zh-CN" | "zh-HK" | "zh-SG" | "zh-TW" | string); + use?: Coding<("900000000000003001" | "900000000000013009" | string)>; value: string; }