Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ VERSION = $(shell cat package.json | grep version | sed -E 's/ *"version": "//'

.PHONY: all typecheck test-typeschema test-register test-codegen test-typescript-r4-example

all: test-codegen test-typescript-r4-example test-typescript-ccda-example test-typescript-sql-on-fhir-example lint-unsafe test-all-example-generation
all: test-codegen test-typescript-r4-example test-typescript-us-core-example test-typescript-ccda-example test-typescript-sql-on-fhir-example lint-unsafe test-all-example-generation

generate-types:
bun run scripts/generate-types.ts
Expand Down Expand Up @@ -65,6 +65,11 @@ test-typescript-r4-example: typecheck format lint
$(TYPECHECK) --project examples/typescript-r4/tsconfig.json
$(TEST) ./examples/typescript-r4/

test-typescript-us-core-example: typecheck format lint
bun run examples/typescript-us-core/generate.ts
$(TYPECHECK) --project examples/typescript-us-core/tsconfig.json
$(TEST) ./examples/typescript-us-core/

test-typescript-sql-on-fhir-example: typecheck format lint
bun run examples/typescript-sql-on-fhir/generate.ts
$(TYPECHECK) --project examples/typescript-sql-on-fhir/tsconfig.json
Expand Down
23,942 changes: 23,942 additions & 0 deletions examples/typescript-us-core/fhir-types/examples/typescript-us-core/type-tree.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface AccountGuarantor extends BackboneElement {
period?: Period;
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Account
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Account (pkg: hl7.fhir.r4.core#4.0.1)
export interface Account extends DomainResource {
resourceType: "Account";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface ActivityDefinitionParticipant extends BackboneElement {
type: ("patient" | "practitioner" | "related-person" | "device");
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/ActivityDefinition
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/ActivityDefinition (pkg: hl7.fhir.r4.core#4.0.1)
export interface ActivityDefinition extends DomainResource {
resourceType: "ActivityDefinition";

Expand Down Expand Up @@ -80,7 +80,7 @@ export interface ActivityDefinition extends DomainResource {
lastReviewDate?: string;
_lastReviewDate?: Element;
library?: string[];
_library?: Element;
_library?: (Element | null)[];
location?: Reference<"Location">;
name?: string;
_name?: Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Period } from "../hl7-fhir-r4-core/Period";
export type { Element } from "../hl7-fhir-r4-core/Element";
export type { Period } from "../hl7-fhir-r4-core/Period";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Address
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Address (pkg: hl7.fhir.r4.core#4.0.1)
export interface Address extends Element {
city?: string;
_city?: Element;
Expand All @@ -17,7 +17,7 @@ export interface Address extends Element {
district?: string;
_district?: Element;
line?: string[];
_line?: Element;
_line?: (Element | null)[];
period?: Period;
postalCode?: string;
_postalCode?: Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export interface AdverseEventSuspectEntityCausality extends BackboneElement {
productRelatedness?: string;
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AdverseEvent
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AdverseEvent (pkg: hl7.fhir.r4.core#4.0.1)
export interface AdverseEvent extends DomainResource {
resourceType: "AdverseEvent";

actuality: ("actual" | "potential");
_actuality?: Element;
category?: CodeableConcept[];
category?: CodeableConcept<("product-problem" | "product-quality" | "product-use-error" | "wrong-dose" | "incorrect-prescribing-information" | "wrong-technique" | "wrong-route-of-administration" | "wrong-rate" | "wrong-duration" | "wrong-time" | "expired-drug" | "medical-device-use-error" | "problem-different-manufacturer" | "unsafe-physical-environment" | string)>[];
contributor?: Reference<"Device" | "Practitioner" | "PractitionerRole">[];
date?: string;
_date?: Element;
Expand All @@ -42,14 +42,14 @@ export interface AdverseEvent extends DomainResource {
event?: CodeableConcept;
identifier?: Identifier;
location?: Reference<"Location">;
outcome?: CodeableConcept;
outcome?: CodeableConcept<("resolved" | "recovering" | "ongoing" | "resolvedWithSequelae" | "fatal" | "unknown")>;
recordedDate?: string;
_recordedDate?: Element;
recorder?: Reference<"Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">;
referenceDocument?: Reference<"DocumentReference">[];
resultingCondition?: Reference<"Condition">[];
seriousness?: CodeableConcept;
severity?: CodeableConcept;
severity?: CodeableConcept<("mild" | "moderate" | "severe")>;
study?: Reference<"ResearchStudy">[];
subject: Reference<"Group" | "Patient" | "Practitioner" | "RelatedPerson">;
subjectMedicalHistory?: Reference<"AllergyIntolerance" | "Condition" | "DocumentReference" | "FamilyMemberHistory" | "Immunization" | "Media" | "Observation" | "Procedure">[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import type { Quantity } from "../hl7-fhir-r4-core/Quantity";

export type { Quantity } from "../hl7-fhir-r4-core/Quantity";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Age
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Age (pkg: hl7.fhir.r4.core#4.0.1)
export interface Age extends Quantity {
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export interface AllergyIntoleranceReaction extends BackboneElement {
substance?: CodeableConcept;
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AllergyIntolerance
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AllergyIntolerance (pkg: hl7.fhir.r4.core#4.0.1)
export interface AllergyIntolerance extends DomainResource {
resourceType: "AllergyIntolerance";

asserter?: Reference<"Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">;
category?: ("food" | "medication" | "environment" | "biologic")[];
_category?: Element;
clinicalStatus?: CodeableConcept;
_category?: (Element | null)[];
clinicalStatus?: CodeableConcept<("active" | "inactive" | "resolved")>;
code?: CodeableConcept;
criticality?: ("low" | "high" | "unable-to-assess");
_criticality?: Element;
Expand All @@ -62,7 +62,7 @@ export interface AllergyIntolerance extends DomainResource {
recorder?: Reference<"Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">;
type?: ("allergy" | "intolerance");
_type?: Element;
verificationStatus?: CodeableConcept;
verificationStatus?: CodeableConcept<("unconfirmed" | "confirmed" | "refuted" | "entered-in-error")>;
}
export const isAllergyIntolerance = (resource: unknown): resource is AllergyIntolerance => {
return resource !== null && typeof resource === "object" && (resource as {resourceType: string}).resourceType === "AllergyIntolerance";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Reference } from "../hl7-fhir-r4-core/Reference";
export type { Element } from "../hl7-fhir-r4-core/Element";
export type { Reference } from "../hl7-fhir-r4-core/Reference";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Annotation
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Annotation (pkg: hl7.fhir.r4.core#4.0.1)
export interface Annotation extends Element {
authorReference?: Reference<"Organization" | "Patient" | "Practitioner" | "RelatedPerson">;
authorString?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export interface AppointmentParticipant extends BackboneElement {
period?: Period;
required?: ("required" | "optional" | "information-only");
status: ("accepted" | "declined" | "tentative" | "needs-action");
type?: CodeableConcept[];
type?: CodeableConcept<("SPRF" | "PPRF" | "PART" | "translator" | "emergency" | string)>[];
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Appointment
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Appointment (pkg: hl7.fhir.r4.core#4.0.1)
export interface Appointment extends DomainResource {
resourceType: "Appointment";

appointmentType?: CodeableConcept;
appointmentType?: CodeableConcept<("CHECKUP" | "EMERGENCY" | "FOLLOWUP" | "ROUTINE" | "WALKIN" | string)>;
basedOn?: Reference<"ServiceRequest">[];
cancelationReason?: CodeableConcept;
comment?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type { CodeableConcept } from "../hl7-fhir-r4-core/CodeableConcept";
export type { Identifier } from "../hl7-fhir-r4-core/Identifier";
export type { Reference } from "../hl7-fhir-r4-core/Reference";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AppointmentResponse
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AppointmentResponse (pkg: hl7.fhir.r4.core#4.0.1)
export interface AppointmentResponse extends DomainResource {
resourceType: "AppointmentResponse";

Expand All @@ -25,7 +25,7 @@ export interface AppointmentResponse extends DomainResource {
identifier?: Identifier[];
participantStatus: ("accepted" | "declined" | "tentative" | "needs-action");
_participantStatus?: Element;
participantType?: CodeableConcept[];
participantType?: CodeableConcept<("SPRF" | "PPRF" | "PART" | "translator" | "emergency" | string)>[];
start?: string;
_start?: Element;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { Element } from "../hl7-fhir-r4-core/Element";

export type { Element } from "../hl7-fhir-r4-core/Element";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Attachment
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Attachment (pkg: hl7.fhir.r4.core#4.0.1)
export interface Attachment extends Element {
contentType?: string;
_contentType?: Element;
Expand All @@ -16,7 +16,7 @@ export interface Attachment extends Element {
_data?: Element;
hash?: string;
_hash?: Element;
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);
_language?: Element;
size?: number;
_size?: Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export type { Reference } from "../hl7-fhir-r4-core/Reference";
export interface AuditEventAgent extends BackboneElement {
altId?: string;
location?: Reference<"Location">;
media?: Coding;
media?: Coding<("110030" | "110031" | "110032" | "110033" | "110034" | "110035" | "110036" | "110037" | "110010" | "110038" | string)>;
name?: string;
network?: AuditEventAgentNetwork;
policy?: string[];
purposeOfUse?: CodeableConcept[];
requestor: boolean;
role?: CodeableConcept[];
type?: CodeableConcept;
type?: CodeableConcept<("AMENDER" | "COAUTH" | "CONT" | "EVTWIT" | "PRIMAUTH" | "REVIEWER" | "SOURCE" | "TRANS" | "VALID" | "VERF" | "AFFL" | "AGNT" | "ASSIGNED" | "CLAIM" | "COVPTY" | "DEPEN" | "ECON" | "EMP" | "GUARD" | "INVSBJ" | "NAMED" | "NOK" | "PAT" | "PROV" | "NOT" | "CLASSIFIER" | "CONSENTER" | "CONSWIT" | "COPART" | "DECLASSIFIER" | "DELEGATEE" | "DELEGATOR" | "DOWNGRDER" | "DPOWATT" | "EXCEST" | "GRANTEE" | "GRANTOR" | "GT" | "GUADLTM" | "HPOWATT" | "INTPRTER" | "POWATT" | "RESPRSN" | "SPOWATT" | "AUCG" | "AULR" | "AUTM" | "AUWA" | "PROMSK" | "AUT" | "CST" | "INF" | "IRCP" | "LA" | "IRCP" | "TRC" | "WIT" | "authserver" | "datacollector" | "dataprocessor" | "datasubject" | "humanuser" | "110150" | "110151" | "110152" | "110153" | "110154" | "110155" | string)>;
who?: Reference<"Device" | "Organization" | "Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">;
}

Expand All @@ -38,10 +38,10 @@ export interface AuditEventAgentNetwork extends BackboneElement {
export interface AuditEventEntity extends BackboneElement {
description?: string;
detail?: AuditEventEntityDetail[];
lifecycle?: Coding;
lifecycle?: Coding<("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "access" | "hold" | "amend" | "archive" | "attest" | "decrypt" | "deidentify" | "deprecate" | "destroy" | "disclose" | "encrypt" | "extract" | "link" | "merge" | "originate" | "pseudonymize" | "reactivate" | "receive" | "reidentify" | "unhold" | "report" | "restore" | "transform" | "transmit" | "unlink" | "unmerge" | "verify" | string)>;
name?: string;
query?: string;
role?: Coding;
role?: Coding<("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | string)>;
securityLabel?: Coding[];
type?: Coding;
what?: Reference<"Resource">;
Expand All @@ -56,10 +56,10 @@ export interface AuditEventEntityDetail extends BackboneElement {
export interface AuditEventSource extends BackboneElement {
observer: Reference<"Device" | "Organization" | "Patient" | "Practitioner" | "PractitionerRole" | "RelatedPerson">;
site?: string;
type?: Coding[];
type?: Coding<("1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | string)>[];
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AuditEvent
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/AuditEvent (pkg: hl7.fhir.r4.core#4.0.1)
export interface AuditEvent extends DomainResource {
resourceType: "AuditEvent";

Expand All @@ -76,8 +76,8 @@ export interface AuditEvent extends DomainResource {
recorded: string;
_recorded?: Element;
source: AuditEventSource;
subtype?: Coding[];
type: Coding;
subtype?: Coding<("110120" | "110121" | "110122" | "110123" | "110124" | "110125" | "110126" | "110127" | "110128" | "110129" | "110130" | "110131" | "110132" | "110133" | "110134" | "110135" | "110136" | "110137" | "110138" | "110139" | "110140" | "110141" | "110142" | "read" | "vread" | "update" | "patch" | "delete" | "history" | "history-instance" | "history-type" | "history-system" | "create" | "search" | "search-type" | "search-system" | "capabilities" | "transaction" | "batch" | "operation" | string)>[];
type: Coding<("110100" | "110101" | "110102" | "110103" | "110104" | "110105" | "110106" | "110107" | "110108" | "110109" | "110110" | "110111" | "110112" | "110113" | "110114" | "rest" | "access" | "hold" | "amend" | "archive" | "attest" | "decrypt" | "deidentify" | "deprecate" | "destroy" | "disclose" | "encrypt" | "extract" | "link" | "merge" | "originate" | "pseudonymize" | "reactivate" | "receive" | "reidentify" | "unhold" | "report" | "restore" | "transform" | "transmit" | "unlink" | "unmerge" | "verify" | string)>;
}
export const isAuditEvent = (resource: unknown): resource is AuditEvent => {
return resource !== null && typeof resource === "object" && (resource as {resourceType: string}).resourceType === "AuditEvent";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Extension } from "../hl7-fhir-r4-core/Extension";
export type { Element } from "../hl7-fhir-r4-core/Element";
export type { Extension } from "../hl7-fhir-r4-core/Extension";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/BackboneElement
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/BackboneElement (pkg: hl7.fhir.r4.core#4.0.1)
export interface BackboneElement extends Element {
modifierExtension?: Extension[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type { CodeableConcept } from "../hl7-fhir-r4-core/CodeableConcept";
export type { Identifier } from "../hl7-fhir-r4-core/Identifier";
export type { Reference } from "../hl7-fhir-r4-core/Reference";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Basic
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Basic (pkg: hl7.fhir.r4.core#4.0.1)
export interface Basic extends DomainResource {
resourceType: "Basic";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Resource } from "../hl7-fhir-r4-core/Resource";
import type { Element } from "../hl7-fhir-r4-core/Element";
export type { Reference } from "../hl7-fhir-r4-core/Reference";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Binary
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Binary (pkg: hl7.fhir.r4.core#4.0.1)
export interface Binary extends Resource {
resourceType: "Binary";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface BiologicallyDerivedProductStorage extends BackboneElement {
temperature?: number;
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct (pkg: hl7.fhir.r4.core#4.0.1)
export interface BiologicallyDerivedProduct extends DomainResource {
resourceType: "BiologicallyDerivedProduct";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type { CodeableConcept } from "../hl7-fhir-r4-core/CodeableConcept";
export type { Identifier } from "../hl7-fhir-r4-core/Identifier";
export type { Reference } from "../hl7-fhir-r4-core/Reference";

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/BodyStructure
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/BodyStructure (pkg: hl7.fhir.r4.core#4.0.1)
export interface BodyStructure extends DomainResource {
resourceType: "BodyStructure";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface BundleLink extends BackboneElement {
url: string;
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Bundle
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/Bundle (pkg: hl7.fhir.r4.core#4.0.1)
export interface Bundle extends Resource {
resourceType: "Bundle";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface CapabilityStatementMessaging extends BackboneElement {

export interface CapabilityStatementMessagingEndpoint extends BackboneElement {
address: string;
protocol: Coding;
protocol: Coding<("http" | "ftp" | "mllp" | string)>;
}

export interface CapabilityStatementMessagingSupportedMessage extends BackboneElement {
Expand Down Expand Up @@ -104,7 +104,7 @@ export interface CapabilityStatementRestResourceSearchParam extends BackboneElem
export interface CapabilityStatementRestSecurity extends BackboneElement {
cors?: boolean;
description?: string;
service?: CodeableConcept[];
service?: CodeableConcept<("OAuth" | "SMART-on-FHIR" | "NTLM" | "Basic" | "Kerberos" | "Certificates" | string)>[];
}

export interface CapabilityStatementSoftware extends BackboneElement {
Expand All @@ -113,7 +113,7 @@ export interface CapabilityStatementSoftware extends BackboneElement {
version?: string;
}

// CanonicalURL: http://hl7.org/fhir/StructureDefinition/CapabilityStatement
// CanonicalURL: http://hl7.org/fhir/StructureDefinition/CapabilityStatement (pkg: hl7.fhir.r4.core#4.0.1)
export interface CapabilityStatement extends DomainResource {
resourceType: "CapabilityStatement";

Expand All @@ -130,22 +130,22 @@ export interface CapabilityStatement 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");
_fhirVersion?: Element;
format: string[];
_format?: Element;
_format?: (Element | null)[];
implementation?: CapabilityStatementImplementation;
implementationGuide?: string[];
_implementationGuide?: Element;
_implementationGuide?: (Element | null)[];
imports?: string[];
_imports?: Element;
_imports?: (Element | null)[];
instantiates?: string[];
_instantiates?: Element;
_instantiates?: (Element | null)[];
jurisdiction?: CodeableConcept[];
kind: ("instance" | "capability" | "requirements");
_kind?: Element;
messaging?: CapabilityStatementMessaging[];
name?: string;
_name?: Element;
patchFormat?: string[];
_patchFormat?: Element;
_patchFormat?: (Element | null)[];
publisher?: string;
_publisher?: Element;
purpose?: string;
Expand Down
Loading
Loading