@cosyte/synth 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +21 -12
  3. package/dist/astm/index.cjs +18 -6
  4. package/dist/astm/index.cjs.map +1 -1
  5. package/dist/astm/index.d.cts +2 -2
  6. package/dist/astm/index.d.ts +2 -2
  7. package/dist/astm/index.mjs +18 -6
  8. package/dist/astm/index.mjs.map +1 -1
  9. package/dist/ccda/index.cjs +23 -7
  10. package/dist/ccda/index.cjs.map +1 -1
  11. package/dist/ccda/index.d.cts +2 -2
  12. package/dist/ccda/index.d.ts +2 -2
  13. package/dist/ccda/index.mjs +23 -7
  14. package/dist/ccda/index.mjs.map +1 -1
  15. package/dist/deid/index.cjs +26 -8
  16. package/dist/deid/index.cjs.map +1 -1
  17. package/dist/deid/index.d.cts +2 -2
  18. package/dist/deid/index.d.ts +2 -2
  19. package/dist/deid/index.mjs +26 -8
  20. package/dist/deid/index.mjs.map +1 -1
  21. package/dist/fhir/index.cjs +174 -7
  22. package/dist/fhir/index.cjs.map +1 -1
  23. package/dist/fhir/index.d.cts +163 -2
  24. package/dist/fhir/index.d.ts +163 -2
  25. package/dist/fhir/index.mjs +171 -9
  26. package/dist/fhir/index.mjs.map +1 -1
  27. package/dist/hl7/index.cjs +18 -6
  28. package/dist/hl7/index.cjs.map +1 -1
  29. package/dist/hl7/index.d.cts +2 -2
  30. package/dist/hl7/index.d.ts +2 -2
  31. package/dist/hl7/index.mjs +18 -6
  32. package/dist/hl7/index.mjs.map +1 -1
  33. package/dist/index.cjs +37 -6
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +172 -38
  36. package/dist/index.d.ts +172 -38
  37. package/dist/index.mjs +36 -7
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/ncpdp/index.cjs +18 -6
  40. package/dist/ncpdp/index.cjs.map +1 -1
  41. package/dist/ncpdp/index.d.cts +1 -1
  42. package/dist/ncpdp/index.d.ts +1 -1
  43. package/dist/ncpdp/index.mjs +18 -6
  44. package/dist/ncpdp/index.mjs.map +1 -1
  45. package/dist/{providers-B9uVinAe.d.cts → providers-BQtPk3PN.d.cts} +18 -4
  46. package/dist/{providers-B9uVinAe.d.ts → providers-BQtPk3PN.d.ts} +18 -4
  47. package/dist/{quirk-HZdznAkM.d.ts → quirk-Bzx9g8KG.d.ts} +1 -1
  48. package/dist/{quirk-IaHp4z7N.d.cts → quirk-C_lZrspq.d.cts} +1 -1
  49. package/dist/x12/index.cjs +18 -6
  50. package/dist/x12/index.cjs.map +1 -1
  51. package/dist/x12/index.d.cts +1 -1
  52. package/dist/x12/index.d.ts +1 -1
  53. package/dist/x12/index.mjs +18 -6
  54. package/dist/x12/index.mjs.map +1 -1
  55. package/package.json +54 -30
@@ -1,5 +1,5 @@
1
1
  import { FhirComplex, StructureDefinition, FhirNode } from '@cosyte/fhir';
2
- import { C as Corpus, R as Rng, S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress } from '../providers-B9uVinAe.cjs';
2
+ import { C as Corpus, R as Rng, S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress } from '../providers-BQtPk3PN.cjs';
3
3
  export { C as CodeConcept, E as EXAMPLE_ALLERGENS, a as EXAMPLE_ALLERGY_MANIFESTATIONS, b as EXAMPLE_CONDITIONS, c as EXAMPLE_DIAGNOSTIC_REPORTS, d as EXAMPLE_ENCOUNTER_CLASSES, e as EXAMPLE_ENCOUNTER_TYPES, f as EXAMPLE_ETHNICITY_CATEGORIES, g as EXAMPLE_LAB_OBSERVATIONS, h as EXAMPLE_MEDICATIONS, i as EXAMPLE_PROCEDURES, j as EXAMPLE_RACE_CATEGORIES, k as EXAMPLE_VACCINES, l as EXAMPLE_VITAL_SIGNS, Q as QuantConcept } from '../example-codes-88f3_bQZ.cjs';
4
4
 
5
5
  /**
@@ -273,6 +273,48 @@ interface GenerateProcedureOptions {
273
273
  */
274
274
  declare function generateProcedure(options?: GenerateProcedureOptions): FhirComplex;
275
275
 
276
+ /**
277
+ * Synthetic FHIR R4 **`Provenance`** generation: a US Core Provenance, the record of who authored and
278
+ * transmitted a resource. Built through `@cosyte/fhir`'s model constructors like every other resource
279
+ * here, so it is spec-clean by construction and needs no upstream builder of its own.
280
+ *
281
+ * The profile's required elements (`target`, `recorded`, `agent.who`) are always present, as is the
282
+ * must-support `agent.onBehalfOf`, which also discharges the profile's `provenance-1` invariant
283
+ * ("onBehalfOf SHALL be present when Provenance.agent.who is a Practitioner or Device") outright
284
+ * rather than leaving it to a resolver.
285
+ *
286
+ * **The single agent is typed as both author and transmitter, deliberately.** US Core slices
287
+ * `Provenance.agent` on a `type` pattern into a `ProvenanceAuthor` slice and a `ProvenanceTransmitter`
288
+ * slice, both must-support and both optional. One synthetic source system authored this record and
289
+ * transmitted it, so one agent carries both participation codings: a `CodeableConcept` is a set of
290
+ * codings for exactly this reason, and the slicing is `open`. Splitting it into two agents would say
291
+ * two parties were involved, which is not what a self-contained synthetic fixture models.
292
+ *
293
+ * @module
294
+ */
295
+
296
+ /** Options for {@link generateProvenance}. */
297
+ interface GenerateProvenanceOptions {
298
+ /** The seed (deterministic). Defaults to `0`. */
299
+ readonly seed?: number;
300
+ /** The `target` reference this provenance is about (e.g. `"Patient/syn-patient-1"`). */
301
+ readonly target?: string;
302
+ /** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
303
+ readonly usCore?: boolean;
304
+ }
305
+ /**
306
+ * Generate a spec-clean synthetic US Core `Provenance`, built through `@cosyte/fhir`.
307
+ *
308
+ * @param options - Seed, target reference, and US Core posture. See {@link GenerateProvenanceOptions}.
309
+ * @returns The `Provenance` resource model (a `FhirComplex`).
310
+ * @example
311
+ * ```ts
312
+ * import { generateProvenance } from "@cosyte/synth/fhir";
313
+ * const provenance = generateProvenance({ seed: 19, target: "Patient/syn-patient-1" });
314
+ * ```
315
+ */
316
+ declare function generateProvenance(options?: GenerateProvenanceOptions): FhirComplex;
317
+
276
318
  /**
277
319
  * Synthetic FHIR R4 **`DiagnosticReport`** generation: the US Core DiagnosticReport Profile for
278
320
  * Laboratory Results Reporting. Built through `@cosyte/fhir`;
@@ -721,7 +763,44 @@ declare const US_CORE_PROFILE: Readonly<{
721
763
  readonly ALLERGY_INTOLERANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance";
722
764
  /** US Core Procedure. */
723
765
  readonly PROCEDURE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure";
766
+ /** US Core Provenance. */
767
+ readonly PROVENANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance";
724
768
  }>;
769
+ /**
770
+ * The canonical prefix every US Core 6.1.0 resource profile's `url` shares. A profile's canonical is
771
+ * this prefix followed by its profile id.
772
+ *
773
+ * @example
774
+ * ```ts
775
+ * import { US_CORE_PROFILE_BASE } from "@cosyte/synth/fhir";
776
+ * `${US_CORE_PROFILE_BASE}us-core-provenance`;
777
+ * ```
778
+ */
779
+ declare const US_CORE_PROFILE_BASE = "http://hl7.org/fhir/us/core/StructureDefinition/";
780
+ /**
781
+ * The **adopted set**: the profile ids of every US Core 6.1.0 **resource profile** the implementation
782
+ * guide publishes, transcribed from the guide's own artifact index ("Structures: Resource Profiles").
783
+ * This is the closed set a profile-addressed request is resolved against, and it is *identifiers
784
+ * only*, never IG content, exactly like {@link US_CORE_PROFILE}.
785
+ *
786
+ * `45 CFR 170.215` adopts FHIR R4.0.1 and US Core STU 6.1.0, so this is the profile set a developer
787
+ * building to `45 CFR 170.315(g)(10)` addresses. It is **not** the count of
788
+ * `StructureDefinition-us-core-*.json` files in the guide's source tree: that directory also holds
789
+ * the guide's extension definitions and omits profiles the guide publishes.
790
+ *
791
+ * The guide's 10 **extension definitions** (`us-core-race`, `us-core-birthsex`, …) are deliberately
792
+ * absent: an extension is not a standalone artifact, so a request naming one is refused like any
793
+ * other name outside this set.
794
+ *
795
+ * @example
796
+ * ```ts
797
+ * import { US_CORE_ADOPTED_PROFILES } from "@cosyte/synth/fhir";
798
+ * US_CORE_ADOPTED_PROFILES.includes("us-core-provenance"); // true
799
+ * ```
800
+ */
801
+ declare const US_CORE_ADOPTED_PROFILES: readonly ["head-occipital-frontal-circumference-percentile", "pediatric-bmi-for-age", "pediatric-weight-for-height", "us-core-allergyintolerance", "us-core-blood-pressure", "us-core-bmi", "us-core-body-height", "us-core-body-temperature", "us-core-body-weight", "us-core-careplan", "us-core-careteam", "us-core-condition-encounter-diagnosis", "us-core-condition-problems-health-concerns", "us-core-coverage", "us-core-diagnosticreport-lab", "us-core-diagnosticreport-note", "us-core-documentreference", "us-core-encounter", "us-core-goal", "us-core-head-circumference", "us-core-heart-rate", "us-core-immunization", "us-core-implantable-device", "us-core-location", "us-core-medication", "us-core-medicationdispense", "us-core-medicationrequest", "us-core-observation-clinical-result", "us-core-observation-lab", "us-core-observation-occupation", "us-core-observation-pregnancyintent", "us-core-observation-pregnancystatus", "us-core-observation-screening-assessment", "us-core-observation-sexual-orientation", "us-core-organization", "us-core-patient", "us-core-practitioner", "us-core-practitionerrole", "us-core-procedure", "us-core-provenance", "us-core-pulse-oximetry", "us-core-questionnaireresponse", "us-core-relatedperson", "us-core-respiratory-rate", "us-core-servicerequest", "us-core-simple-observation", "us-core-smokingstatus", "us-core-specimen", "us-core-vital-signs"];
802
+ /** One profile id from the adopted US Core 6.1.0 set. Erased at run time, so it is resolved, not trusted. */
803
+ type UsCoreProfileId = (typeof US_CORE_ADOPTED_PROFILES)[number];
725
804
  /** The US Core `us-core-race` extension URL (a Patient must-support extension). */
726
805
  declare const US_CORE_RACE_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race";
727
806
  /** The US Core `us-core-ethnicity` extension URL (a Patient must-support extension). */
@@ -765,8 +844,90 @@ declare const SYSTEM: Readonly<{
765
844
  readonly ALLERGY_CLINICAL: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical";
766
845
  /** HL7 Terminology `allergyintolerance-verification`, `AllergyIntolerance.verificationStatus`. */
767
846
  readonly ALLERGY_VERIFICATION: "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification";
847
+ /** HL7 Terminology `provenance-participant-type`, `Provenance.agent.type` (`author`). */
848
+ readonly PROVENANCE_PARTICIPANT_TYPE: "http://terminology.hl7.org/CodeSystem/provenance-participant-type";
849
+ /** US Core `us-core-provenance-participant-type`, `Provenance.agent.type` (`transmitter`). */
850
+ readonly US_CORE_PROVENANCE_PARTICIPANT_TYPE: "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type";
768
851
  }>;
769
852
  /** A US Core profile canonical URL. */
770
853
  type UsCoreProfileUrl = (typeof US_CORE_PROFILE)[keyof typeof US_CORE_PROFILE];
771
854
 
772
- export { type BuildCompositionInput, type CompositionSection, type FhirBundleType, type FhirCorpusOptions, type FhirPatientIdentity, type FhirResourceKind, type GenerateAllergyIntoleranceOptions, type GenerateBundleOptions, type GenerateConditionOptions, type GenerateDiagnosticReportOptions, type GenerateEncounterOptions, type GenerateImmunizationOptions, type GenerateMedicationRequestOptions, type GenerateObservationOptions, type GeneratePatientOptions, type GenerateProcedureOptions, type Prop, type RoundTripOptions, type RoundTripResult, SYSTEM, US_CORE_BIRTHSEX_EXTENSION, US_CORE_ETHNICITY_EXTENSION, US_CORE_PROFILE, US_CORE_RACE_EXTENSION, type UsCoreProfileUrl, bool, buildComposition, codeableConcept, coding, dec, fhirCorpus, fhirPatientIdentity, generateAllergyIntolerance, generateBundle, generateCondition, generateDiagnosticReport, generateEncounter, generateImmunization, generateMedicationRequest, generateObservationLab, generatePatient, generateProcedure, generateVitalSign, meta, mrnIdentifier, narrative, prop, reference, roundTrip, str, toFhirDate };
855
+ /**
856
+ * **Profile-addressed generation, and the coverage surface it is resolved against.**
857
+ *
858
+ * A consumer building to `45 CFR 170.315(g)(10)` does not think in this package's generator names: it
859
+ * thinks in US Core 6.1.0 profile names, because that is what the regulation adopts. So this module
860
+ * offers exactly two things, and the pair is the whole contract:
861
+ *
862
+ * 1. {@link usCoreCoverage} reports one entry for **every** profile the adopted guide publishes, each
863
+ * carrying its canonical URL and whether this build generates it. "The guide does not publish this"
864
+ * and "we do not generate this yet" are different answers, and without a published closed set
865
+ * nothing could tell them apart.
866
+ * 2. {@link generateUsCoreProfile} takes a profile name and either returns an artifact claiming that
867
+ * profile, or **fails closed before anything is generated**, on the `resolveKind` discipline every
868
+ * other caller-supplied selector here already holds. Two distinct codes: `SYNTH_UNSUPPORTED_KIND`
869
+ * for a name outside the adopted set (an extension definition, a typo, a blank, a non-string), and
870
+ * `SYNTH_PROFILE_NOT_GENERATED` for an adopted profile this build does not yet cover. Neither
871
+ * quotes the requested name, so no caller string reaches a diagnostic surface.
872
+ *
873
+ * **Coverage is derived, never declared twice.** The `generated` flag is read off the generator map
874
+ * below, so a profile cannot be advertised as covered without a generator behind it, and the
875
+ * conformance suite additionally requires a committed `StructureDefinition` for every profile this
876
+ * surface reports as generated.
877
+ *
878
+ * No IG content is bundled: what is encoded here is a set of identifiers, exactly like `./us-core.js`.
879
+ *
880
+ * @module
881
+ */
882
+
883
+ /** One adopted US Core 6.1.0 resource profile, and whether this build generates a fixture for it. */
884
+ interface UsCoreProfileCoverage {
885
+ /** The profile id, as the guide's artifact index spells it. */
886
+ readonly profile: UsCoreProfileId;
887
+ /** The profile's canonical URL: the value a generated artifact's `meta.profile` claims. */
888
+ readonly canonical: string;
889
+ /** `true` when {@link generateUsCoreProfile} returns an artifact for this profile. */
890
+ readonly generated: boolean;
891
+ }
892
+ /**
893
+ * Report this build's US Core 6.1.0 coverage: one entry per **adopted** resource profile, in the
894
+ * guide's own order, each carrying its canonical URL and whether this build generates it.
895
+ *
896
+ * The report is exhaustive over the adopted set by construction, so a profile the guide publishes and
897
+ * this build does not generate is *named* here rather than being indistinguishable from a typo.
898
+ *
899
+ * @returns One frozen {@link UsCoreProfileCoverage} entry per adopted profile.
900
+ * @example
901
+ * ```ts
902
+ * import { usCoreCoverage } from "@cosyte/synth/fhir";
903
+ * usCoreCoverage().filter((entry) => !entry.generated).map((entry) => entry.profile);
904
+ * ```
905
+ */
906
+ declare function usCoreCoverage(): readonly UsCoreProfileCoverage[];
907
+ /** Options for {@link generateUsCoreProfile}. */
908
+ interface GenerateUsCoreProfileOptions {
909
+ /**
910
+ * The US Core 6.1.0 profile id to generate. Resolved against the adopted set **before** anything is
911
+ * generated; there is deliberately no default, so a blank or absent name refuses rather than
912
+ * falling through to some other profile's artifact.
913
+ */
914
+ readonly profile: UsCoreProfileId;
915
+ /** The seed (deterministic). Defaults to `0`. */
916
+ readonly seed?: number;
917
+ }
918
+ /**
919
+ * Generate a fixture **by US Core 6.1.0 profile name**, or fail closed before anything is generated.
920
+ *
921
+ * @param options - The profile name and seed. See {@link GenerateUsCoreProfileOptions}.
922
+ * @returns The resource model (a `FhirComplex`) claiming that profile in `meta.profile`.
923
+ * @throws SynthError `SYNTH_UNSUPPORTED_KIND` when the name is not in the adopted set.
924
+ * @throws SynthError `SYNTH_PROFILE_NOT_GENERATED` when the profile is adopted and not generated here.
925
+ * @example
926
+ * ```ts
927
+ * import { generateUsCoreProfile } from "@cosyte/synth/fhir";
928
+ * const provenance = generateUsCoreProfile({ profile: "us-core-provenance", seed: 42 });
929
+ * ```
930
+ */
931
+ declare function generateUsCoreProfile(options: GenerateUsCoreProfileOptions): FhirComplex;
932
+
933
+ export { type BuildCompositionInput, type CompositionSection, type FhirBundleType, type FhirCorpusOptions, type FhirPatientIdentity, type FhirResourceKind, type GenerateAllergyIntoleranceOptions, type GenerateBundleOptions, type GenerateConditionOptions, type GenerateDiagnosticReportOptions, type GenerateEncounterOptions, type GenerateImmunizationOptions, type GenerateMedicationRequestOptions, type GenerateObservationOptions, type GeneratePatientOptions, type GenerateProcedureOptions, type GenerateProvenanceOptions, type GenerateUsCoreProfileOptions, type Prop, type RoundTripOptions, type RoundTripResult, SYSTEM, US_CORE_ADOPTED_PROFILES, US_CORE_BIRTHSEX_EXTENSION, US_CORE_ETHNICITY_EXTENSION, US_CORE_PROFILE, US_CORE_PROFILE_BASE, US_CORE_RACE_EXTENSION, type UsCoreProfileCoverage, type UsCoreProfileId, type UsCoreProfileUrl, bool, buildComposition, codeableConcept, coding, dec, fhirCorpus, fhirPatientIdentity, generateAllergyIntolerance, generateBundle, generateCondition, generateDiagnosticReport, generateEncounter, generateImmunization, generateMedicationRequest, generateObservationLab, generatePatient, generateProcedure, generateProvenance, generateUsCoreProfile, generateVitalSign, meta, mrnIdentifier, narrative, prop, reference, roundTrip, str, toFhirDate, usCoreCoverage };
@@ -1,5 +1,5 @@
1
1
  import { FhirComplex, StructureDefinition, FhirNode } from '@cosyte/fhir';
2
- import { C as Corpus, R as Rng, S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress } from '../providers-B9uVinAe.js';
2
+ import { C as Corpus, R as Rng, S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress } from '../providers-BQtPk3PN.js';
3
3
  export { C as CodeConcept, E as EXAMPLE_ALLERGENS, a as EXAMPLE_ALLERGY_MANIFESTATIONS, b as EXAMPLE_CONDITIONS, c as EXAMPLE_DIAGNOSTIC_REPORTS, d as EXAMPLE_ENCOUNTER_CLASSES, e as EXAMPLE_ENCOUNTER_TYPES, f as EXAMPLE_ETHNICITY_CATEGORIES, g as EXAMPLE_LAB_OBSERVATIONS, h as EXAMPLE_MEDICATIONS, i as EXAMPLE_PROCEDURES, j as EXAMPLE_RACE_CATEGORIES, k as EXAMPLE_VACCINES, l as EXAMPLE_VITAL_SIGNS, Q as QuantConcept } from '../example-codes-88f3_bQZ.js';
4
4
 
5
5
  /**
@@ -273,6 +273,48 @@ interface GenerateProcedureOptions {
273
273
  */
274
274
  declare function generateProcedure(options?: GenerateProcedureOptions): FhirComplex;
275
275
 
276
+ /**
277
+ * Synthetic FHIR R4 **`Provenance`** generation: a US Core Provenance, the record of who authored and
278
+ * transmitted a resource. Built through `@cosyte/fhir`'s model constructors like every other resource
279
+ * here, so it is spec-clean by construction and needs no upstream builder of its own.
280
+ *
281
+ * The profile's required elements (`target`, `recorded`, `agent.who`) are always present, as is the
282
+ * must-support `agent.onBehalfOf`, which also discharges the profile's `provenance-1` invariant
283
+ * ("onBehalfOf SHALL be present when Provenance.agent.who is a Practitioner or Device") outright
284
+ * rather than leaving it to a resolver.
285
+ *
286
+ * **The single agent is typed as both author and transmitter, deliberately.** US Core slices
287
+ * `Provenance.agent` on a `type` pattern into a `ProvenanceAuthor` slice and a `ProvenanceTransmitter`
288
+ * slice, both must-support and both optional. One synthetic source system authored this record and
289
+ * transmitted it, so one agent carries both participation codings: a `CodeableConcept` is a set of
290
+ * codings for exactly this reason, and the slicing is `open`. Splitting it into two agents would say
291
+ * two parties were involved, which is not what a self-contained synthetic fixture models.
292
+ *
293
+ * @module
294
+ */
295
+
296
+ /** Options for {@link generateProvenance}. */
297
+ interface GenerateProvenanceOptions {
298
+ /** The seed (deterministic). Defaults to `0`. */
299
+ readonly seed?: number;
300
+ /** The `target` reference this provenance is about (e.g. `"Patient/syn-patient-1"`). */
301
+ readonly target?: string;
302
+ /** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
303
+ readonly usCore?: boolean;
304
+ }
305
+ /**
306
+ * Generate a spec-clean synthetic US Core `Provenance`, built through `@cosyte/fhir`.
307
+ *
308
+ * @param options - Seed, target reference, and US Core posture. See {@link GenerateProvenanceOptions}.
309
+ * @returns The `Provenance` resource model (a `FhirComplex`).
310
+ * @example
311
+ * ```ts
312
+ * import { generateProvenance } from "@cosyte/synth/fhir";
313
+ * const provenance = generateProvenance({ seed: 19, target: "Patient/syn-patient-1" });
314
+ * ```
315
+ */
316
+ declare function generateProvenance(options?: GenerateProvenanceOptions): FhirComplex;
317
+
276
318
  /**
277
319
  * Synthetic FHIR R4 **`DiagnosticReport`** generation: the US Core DiagnosticReport Profile for
278
320
  * Laboratory Results Reporting. Built through `@cosyte/fhir`;
@@ -721,7 +763,44 @@ declare const US_CORE_PROFILE: Readonly<{
721
763
  readonly ALLERGY_INTOLERANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance";
722
764
  /** US Core Procedure. */
723
765
  readonly PROCEDURE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure";
766
+ /** US Core Provenance. */
767
+ readonly PROVENANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance";
724
768
  }>;
769
+ /**
770
+ * The canonical prefix every US Core 6.1.0 resource profile's `url` shares. A profile's canonical is
771
+ * this prefix followed by its profile id.
772
+ *
773
+ * @example
774
+ * ```ts
775
+ * import { US_CORE_PROFILE_BASE } from "@cosyte/synth/fhir";
776
+ * `${US_CORE_PROFILE_BASE}us-core-provenance`;
777
+ * ```
778
+ */
779
+ declare const US_CORE_PROFILE_BASE = "http://hl7.org/fhir/us/core/StructureDefinition/";
780
+ /**
781
+ * The **adopted set**: the profile ids of every US Core 6.1.0 **resource profile** the implementation
782
+ * guide publishes, transcribed from the guide's own artifact index ("Structures: Resource Profiles").
783
+ * This is the closed set a profile-addressed request is resolved against, and it is *identifiers
784
+ * only*, never IG content, exactly like {@link US_CORE_PROFILE}.
785
+ *
786
+ * `45 CFR 170.215` adopts FHIR R4.0.1 and US Core STU 6.1.0, so this is the profile set a developer
787
+ * building to `45 CFR 170.315(g)(10)` addresses. It is **not** the count of
788
+ * `StructureDefinition-us-core-*.json` files in the guide's source tree: that directory also holds
789
+ * the guide's extension definitions and omits profiles the guide publishes.
790
+ *
791
+ * The guide's 10 **extension definitions** (`us-core-race`, `us-core-birthsex`, …) are deliberately
792
+ * absent: an extension is not a standalone artifact, so a request naming one is refused like any
793
+ * other name outside this set.
794
+ *
795
+ * @example
796
+ * ```ts
797
+ * import { US_CORE_ADOPTED_PROFILES } from "@cosyte/synth/fhir";
798
+ * US_CORE_ADOPTED_PROFILES.includes("us-core-provenance"); // true
799
+ * ```
800
+ */
801
+ declare const US_CORE_ADOPTED_PROFILES: readonly ["head-occipital-frontal-circumference-percentile", "pediatric-bmi-for-age", "pediatric-weight-for-height", "us-core-allergyintolerance", "us-core-blood-pressure", "us-core-bmi", "us-core-body-height", "us-core-body-temperature", "us-core-body-weight", "us-core-careplan", "us-core-careteam", "us-core-condition-encounter-diagnosis", "us-core-condition-problems-health-concerns", "us-core-coverage", "us-core-diagnosticreport-lab", "us-core-diagnosticreport-note", "us-core-documentreference", "us-core-encounter", "us-core-goal", "us-core-head-circumference", "us-core-heart-rate", "us-core-immunization", "us-core-implantable-device", "us-core-location", "us-core-medication", "us-core-medicationdispense", "us-core-medicationrequest", "us-core-observation-clinical-result", "us-core-observation-lab", "us-core-observation-occupation", "us-core-observation-pregnancyintent", "us-core-observation-pregnancystatus", "us-core-observation-screening-assessment", "us-core-observation-sexual-orientation", "us-core-organization", "us-core-patient", "us-core-practitioner", "us-core-practitionerrole", "us-core-procedure", "us-core-provenance", "us-core-pulse-oximetry", "us-core-questionnaireresponse", "us-core-relatedperson", "us-core-respiratory-rate", "us-core-servicerequest", "us-core-simple-observation", "us-core-smokingstatus", "us-core-specimen", "us-core-vital-signs"];
802
+ /** One profile id from the adopted US Core 6.1.0 set. Erased at run time, so it is resolved, not trusted. */
803
+ type UsCoreProfileId = (typeof US_CORE_ADOPTED_PROFILES)[number];
725
804
  /** The US Core `us-core-race` extension URL (a Patient must-support extension). */
726
805
  declare const US_CORE_RACE_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race";
727
806
  /** The US Core `us-core-ethnicity` extension URL (a Patient must-support extension). */
@@ -765,8 +844,90 @@ declare const SYSTEM: Readonly<{
765
844
  readonly ALLERGY_CLINICAL: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical";
766
845
  /** HL7 Terminology `allergyintolerance-verification`, `AllergyIntolerance.verificationStatus`. */
767
846
  readonly ALLERGY_VERIFICATION: "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification";
847
+ /** HL7 Terminology `provenance-participant-type`, `Provenance.agent.type` (`author`). */
848
+ readonly PROVENANCE_PARTICIPANT_TYPE: "http://terminology.hl7.org/CodeSystem/provenance-participant-type";
849
+ /** US Core `us-core-provenance-participant-type`, `Provenance.agent.type` (`transmitter`). */
850
+ readonly US_CORE_PROVENANCE_PARTICIPANT_TYPE: "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type";
768
851
  }>;
769
852
  /** A US Core profile canonical URL. */
770
853
  type UsCoreProfileUrl = (typeof US_CORE_PROFILE)[keyof typeof US_CORE_PROFILE];
771
854
 
772
- export { type BuildCompositionInput, type CompositionSection, type FhirBundleType, type FhirCorpusOptions, type FhirPatientIdentity, type FhirResourceKind, type GenerateAllergyIntoleranceOptions, type GenerateBundleOptions, type GenerateConditionOptions, type GenerateDiagnosticReportOptions, type GenerateEncounterOptions, type GenerateImmunizationOptions, type GenerateMedicationRequestOptions, type GenerateObservationOptions, type GeneratePatientOptions, type GenerateProcedureOptions, type Prop, type RoundTripOptions, type RoundTripResult, SYSTEM, US_CORE_BIRTHSEX_EXTENSION, US_CORE_ETHNICITY_EXTENSION, US_CORE_PROFILE, US_CORE_RACE_EXTENSION, type UsCoreProfileUrl, bool, buildComposition, codeableConcept, coding, dec, fhirCorpus, fhirPatientIdentity, generateAllergyIntolerance, generateBundle, generateCondition, generateDiagnosticReport, generateEncounter, generateImmunization, generateMedicationRequest, generateObservationLab, generatePatient, generateProcedure, generateVitalSign, meta, mrnIdentifier, narrative, prop, reference, roundTrip, str, toFhirDate };
855
+ /**
856
+ * **Profile-addressed generation, and the coverage surface it is resolved against.**
857
+ *
858
+ * A consumer building to `45 CFR 170.315(g)(10)` does not think in this package's generator names: it
859
+ * thinks in US Core 6.1.0 profile names, because that is what the regulation adopts. So this module
860
+ * offers exactly two things, and the pair is the whole contract:
861
+ *
862
+ * 1. {@link usCoreCoverage} reports one entry for **every** profile the adopted guide publishes, each
863
+ * carrying its canonical URL and whether this build generates it. "The guide does not publish this"
864
+ * and "we do not generate this yet" are different answers, and without a published closed set
865
+ * nothing could tell them apart.
866
+ * 2. {@link generateUsCoreProfile} takes a profile name and either returns an artifact claiming that
867
+ * profile, or **fails closed before anything is generated**, on the `resolveKind` discipline every
868
+ * other caller-supplied selector here already holds. Two distinct codes: `SYNTH_UNSUPPORTED_KIND`
869
+ * for a name outside the adopted set (an extension definition, a typo, a blank, a non-string), and
870
+ * `SYNTH_PROFILE_NOT_GENERATED` for an adopted profile this build does not yet cover. Neither
871
+ * quotes the requested name, so no caller string reaches a diagnostic surface.
872
+ *
873
+ * **Coverage is derived, never declared twice.** The `generated` flag is read off the generator map
874
+ * below, so a profile cannot be advertised as covered without a generator behind it, and the
875
+ * conformance suite additionally requires a committed `StructureDefinition` for every profile this
876
+ * surface reports as generated.
877
+ *
878
+ * No IG content is bundled: what is encoded here is a set of identifiers, exactly like `./us-core.js`.
879
+ *
880
+ * @module
881
+ */
882
+
883
+ /** One adopted US Core 6.1.0 resource profile, and whether this build generates a fixture for it. */
884
+ interface UsCoreProfileCoverage {
885
+ /** The profile id, as the guide's artifact index spells it. */
886
+ readonly profile: UsCoreProfileId;
887
+ /** The profile's canonical URL: the value a generated artifact's `meta.profile` claims. */
888
+ readonly canonical: string;
889
+ /** `true` when {@link generateUsCoreProfile} returns an artifact for this profile. */
890
+ readonly generated: boolean;
891
+ }
892
+ /**
893
+ * Report this build's US Core 6.1.0 coverage: one entry per **adopted** resource profile, in the
894
+ * guide's own order, each carrying its canonical URL and whether this build generates it.
895
+ *
896
+ * The report is exhaustive over the adopted set by construction, so a profile the guide publishes and
897
+ * this build does not generate is *named* here rather than being indistinguishable from a typo.
898
+ *
899
+ * @returns One frozen {@link UsCoreProfileCoverage} entry per adopted profile.
900
+ * @example
901
+ * ```ts
902
+ * import { usCoreCoverage } from "@cosyte/synth/fhir";
903
+ * usCoreCoverage().filter((entry) => !entry.generated).map((entry) => entry.profile);
904
+ * ```
905
+ */
906
+ declare function usCoreCoverage(): readonly UsCoreProfileCoverage[];
907
+ /** Options for {@link generateUsCoreProfile}. */
908
+ interface GenerateUsCoreProfileOptions {
909
+ /**
910
+ * The US Core 6.1.0 profile id to generate. Resolved against the adopted set **before** anything is
911
+ * generated; there is deliberately no default, so a blank or absent name refuses rather than
912
+ * falling through to some other profile's artifact.
913
+ */
914
+ readonly profile: UsCoreProfileId;
915
+ /** The seed (deterministic). Defaults to `0`. */
916
+ readonly seed?: number;
917
+ }
918
+ /**
919
+ * Generate a fixture **by US Core 6.1.0 profile name**, or fail closed before anything is generated.
920
+ *
921
+ * @param options - The profile name and seed. See {@link GenerateUsCoreProfileOptions}.
922
+ * @returns The resource model (a `FhirComplex`) claiming that profile in `meta.profile`.
923
+ * @throws SynthError `SYNTH_UNSUPPORTED_KIND` when the name is not in the adopted set.
924
+ * @throws SynthError `SYNTH_PROFILE_NOT_GENERATED` when the profile is adopted and not generated here.
925
+ * @example
926
+ * ```ts
927
+ * import { generateUsCoreProfile } from "@cosyte/synth/fhir";
928
+ * const provenance = generateUsCoreProfile({ profile: "us-core-provenance", seed: 42 });
929
+ * ```
930
+ */
931
+ declare function generateUsCoreProfile(options: GenerateUsCoreProfileOptions): FhirComplex;
932
+
933
+ export { type BuildCompositionInput, type CompositionSection, type FhirBundleType, type FhirCorpusOptions, type FhirPatientIdentity, type FhirResourceKind, type GenerateAllergyIntoleranceOptions, type GenerateBundleOptions, type GenerateConditionOptions, type GenerateDiagnosticReportOptions, type GenerateEncounterOptions, type GenerateImmunizationOptions, type GenerateMedicationRequestOptions, type GenerateObservationOptions, type GeneratePatientOptions, type GenerateProcedureOptions, type GenerateProvenanceOptions, type GenerateUsCoreProfileOptions, type Prop, type RoundTripOptions, type RoundTripResult, SYSTEM, US_CORE_ADOPTED_PROFILES, US_CORE_BIRTHSEX_EXTENSION, US_CORE_ETHNICITY_EXTENSION, US_CORE_PROFILE, US_CORE_PROFILE_BASE, US_CORE_RACE_EXTENSION, type UsCoreProfileCoverage, type UsCoreProfileId, type UsCoreProfileUrl, bool, buildComposition, codeableConcept, coding, dec, fhirCorpus, fhirPatientIdentity, generateAllergyIntolerance, generateBundle, generateCondition, generateDiagnosticReport, generateEncounter, generateImmunization, generateMedicationRequest, generateObservationLab, generatePatient, generateProcedure, generateProvenance, generateUsCoreProfile, generateVitalSign, meta, mrnIdentifier, narrative, prop, reference, roundTrip, str, toFhirDate, usCoreCoverage };
@@ -1,4 +1,4 @@
1
- import { primitive, decimal, complex, list, serializeResource, parseResource, validateResource } from '@cosyte/fhir';
1
+ import { list, complex, primitive, decimal, serializeResource, parseResource, validateResource } from '@cosyte/fhir';
2
2
 
3
3
  // src/fhir/patient.ts
4
4
 
@@ -43,7 +43,16 @@ var SYNTH_FATAL_CODES = {
43
43
  * see `resolveKind`: a selector union is erased at run time, and a selector that falls through
44
44
  * either mislabels the fixture or hands the value to a peer builder that quotes it back.
45
45
  */
46
- SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"
46
+ SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND",
47
+ /**
48
+ * A requested profile IS published by the adopted implementation guide, and this build does not
49
+ * generate it. Deliberately distinct from `SYNTH_UNSUPPORTED_KIND`, which says the name is not in
50
+ * the adopted set at all: "the guide does not publish this" and "we do not generate this yet" are
51
+ * different answers, and a caller building to a regulatory profile set has to be able to tell them
52
+ * apart without matching message text. Fatal, and raised **before** anything is generated: a
53
+ * mislabelled artifact is worse than no artifact.
54
+ */
55
+ SYNTH_PROFILE_NOT_GENERATED: "SYNTH_PROFILE_NOT_GENERATED"
47
56
  };
48
57
  var SYNTH_FATAL_MESSAGES = Object.freeze({
49
58
  SYNTH_UNSUPPORTED_FORMAT: "The requested format is not generable by this build. A generator has no byte fallback: it builds through a parser's own serializer or it refuses.",
@@ -55,7 +64,8 @@ var SYNTH_FATAL_MESSAGES = Object.freeze({
55
64
  SYNTH_INVALID_RANGE: "An integer range was requested with its maximum below its minimum.",
56
65
  SYNTH_EMPTY_POOL: "A value was drawn from an empty pool.",
57
66
  SYNTH_INVALID_PROFILE: "defineSynthProfile requires a non-empty string name.",
58
- SYNTH_UNSUPPORTED_KIND: "The requested kind, document type, corpus mix entry, variant or profile is not one this generator supports. The supported set is the exported union for that option."
67
+ SYNTH_UNSUPPORTED_KIND: "The requested kind, document type, corpus mix entry, variant or profile is not one this generator supports. The supported set is the exported union for that option.",
68
+ SYNTH_PROFILE_NOT_GENERATED: "The requested profile is published by the adopted implementation guide, and this build does not generate it. The coverage surface reports, per adopted profile, whether it is generated."
59
69
  });
60
70
  var SynthError = class extends Error {
61
71
  /** The stable fatal code. */
@@ -112,7 +122,7 @@ function createRng(seed) {
112
122
  var SYNTHETIC_ASSIGNING_AUTHORITY = Object.freeze({
113
123
  /** The human-readable assigning-authority namespace id (HL7 HD.1). */
114
124
  namespaceId: "COSYTE-SYNTH",
115
- /** The universal id, an OID under HL7's example arc `2.16.840.1.113883.19` (HD.2). */
125
+ /** The universal id, an OID this package chose under the root `2.16.840.1.113883.19` (HD.2). */
116
126
  universalId: "2.16.840.1.113883.19.999",
117
127
  /** The universal id type (HD.3). */
118
128
  universalIdType: "ISO"
@@ -131,6 +141,18 @@ var TEST_NET_V4_PREFIXES = Object.freeze([
131
141
  // TEST-NET-3
132
142
  ]);
133
143
  var DOC_V6_PREFIX = "2001:db8";
144
+ var ITIN_GROUP_RANGES = Object.freeze([
145
+ Object.freeze({ min: 50, max: 65 }),
146
+ Object.freeze({ min: 70, max: 88 }),
147
+ Object.freeze({ min: 90, max: 92 }),
148
+ Object.freeze({ min: 94, max: 99 })
149
+ ]);
150
+ var ITIN_EXCLUDED_GROUPS = Object.freeze([89, 93]);
151
+ var SSN_SYNTHETIC_GROUPS = Object.freeze(
152
+ Array.from({ length: 100 }, (_unused, group) => group).filter(
153
+ (group) => !ITIN_GROUP_RANGES.some((range) => group >= range.min && group <= range.max) && !ITIN_EXCLUDED_GROUPS.includes(group)
154
+ ).map((group) => String(group).padStart(2, "0"))
155
+ );
134
156
  var NPI_LUHN_PREFIX = "80840";
135
157
  function luhnMod10(digits) {
136
158
  let sum = 0;
@@ -239,10 +261,10 @@ var SYNTHETIC_CITY_NAMES = Object.freeze([
239
261
  // src/safe/providers.ts
240
262
  function ssn(rng, block = "never-issued") {
241
263
  if (block === "advertising") {
242
- return `987-65-432${String(rng.int(0, 9))}`;
264
+ return `987-00-432${String(rng.int(0, 9))}`;
243
265
  }
244
266
  const area = rng.int(900, 999);
245
- const group = rng.digits(2);
267
+ const group = rng.pick(SSN_SYNTHETIC_GROUPS);
246
268
  const serial = rng.digits(4);
247
269
  return `${String(area)}-${group}-${serial}`;
248
270
  }
@@ -401,8 +423,62 @@ var US_CORE_PROFILE = Object.freeze({
401
423
  /** US Core AllergyIntolerance. */
402
424
  ALLERGY_INTOLERANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance",
403
425
  /** US Core Procedure. */
404
- PROCEDURE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure"
426
+ PROCEDURE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure",
427
+ /** US Core Provenance. */
428
+ PROVENANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-provenance"
405
429
  });
430
+ var US_CORE_PROFILE_BASE = "http://hl7.org/fhir/us/core/StructureDefinition/";
431
+ var US_CORE_ADOPTED_PROFILES = Object.freeze([
432
+ "head-occipital-frontal-circumference-percentile",
433
+ "pediatric-bmi-for-age",
434
+ "pediatric-weight-for-height",
435
+ "us-core-allergyintolerance",
436
+ "us-core-blood-pressure",
437
+ "us-core-bmi",
438
+ "us-core-body-height",
439
+ "us-core-body-temperature",
440
+ "us-core-body-weight",
441
+ "us-core-careplan",
442
+ "us-core-careteam",
443
+ "us-core-condition-encounter-diagnosis",
444
+ "us-core-condition-problems-health-concerns",
445
+ "us-core-coverage",
446
+ "us-core-diagnosticreport-lab",
447
+ "us-core-diagnosticreport-note",
448
+ "us-core-documentreference",
449
+ "us-core-encounter",
450
+ "us-core-goal",
451
+ "us-core-head-circumference",
452
+ "us-core-heart-rate",
453
+ "us-core-immunization",
454
+ "us-core-implantable-device",
455
+ "us-core-location",
456
+ "us-core-medication",
457
+ "us-core-medicationdispense",
458
+ "us-core-medicationrequest",
459
+ "us-core-observation-clinical-result",
460
+ "us-core-observation-lab",
461
+ "us-core-observation-occupation",
462
+ "us-core-observation-pregnancyintent",
463
+ "us-core-observation-pregnancystatus",
464
+ "us-core-observation-screening-assessment",
465
+ "us-core-observation-sexual-orientation",
466
+ "us-core-organization",
467
+ "us-core-patient",
468
+ "us-core-practitioner",
469
+ "us-core-practitionerrole",
470
+ "us-core-procedure",
471
+ "us-core-provenance",
472
+ "us-core-pulse-oximetry",
473
+ "us-core-questionnaireresponse",
474
+ "us-core-relatedperson",
475
+ "us-core-respiratory-rate",
476
+ "us-core-servicerequest",
477
+ "us-core-simple-observation",
478
+ "us-core-smokingstatus",
479
+ "us-core-specimen",
480
+ "us-core-vital-signs"
481
+ ]);
406
482
  var US_CORE_RACE_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race";
407
483
  var US_CORE_ETHNICITY_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity";
408
484
  var US_CORE_BIRTHSEX_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex";
@@ -438,7 +514,11 @@ var SYSTEM = Object.freeze({
438
514
  /** HL7 Terminology `allergyintolerance-clinical`, `AllergyIntolerance.clinicalStatus`. */
439
515
  ALLERGY_CLINICAL: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
440
516
  /** HL7 Terminology `allergyintolerance-verification`, `AllergyIntolerance.verificationStatus`. */
441
- ALLERGY_VERIFICATION: "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification"
517
+ ALLERGY_VERIFICATION: "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
518
+ /** HL7 Terminology `provenance-participant-type`, `Provenance.agent.type` (`author`). */
519
+ PROVENANCE_PARTICIPANT_TYPE: "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
520
+ /** US Core `us-core-provenance-participant-type`, `Provenance.agent.type` (`transmitter`). */
521
+ US_CORE_PROVENANCE_PARTICIPANT_TYPE: "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type"
442
522
  });
443
523
 
444
524
  // src/fhir/builder.ts
@@ -1125,6 +1205,53 @@ function generateProcedure(options = {}) {
1125
1205
  props.push(prop("performedDateTime", str(`${performed}T10:00:00Z`)));
1126
1206
  return complex(props);
1127
1207
  }
1208
+ function generateProvenance(options = {}) {
1209
+ const { seed = 0, target = "Patient/syn-patient-1", usCore = true } = options;
1210
+ const rng = createRng(seed);
1211
+ const recorded = toFhirDate(safe.dateYmd(rng, 2018, 2024));
1212
+ const practitioner = `Practitioner/syn-practitioner-${rng.digits(8)}`;
1213
+ const organization = `Organization/syn-org-${rng.digits(8)}`;
1214
+ const props = [
1215
+ prop("resourceType", str("Provenance")),
1216
+ prop("id", str(`syn-prov-${rng.digits(8)}`))
1217
+ ];
1218
+ if (usCore) props.push(prop("meta", meta([US_CORE_PROFILE.PROVENANCE])));
1219
+ props.push(prop("text", narrative("Synthetic provenance for a generated fixture.")));
1220
+ props.push(prop("target", list([reference(target)])));
1221
+ props.push(prop("recorded", str(`${recorded}T10:00:00Z`)));
1222
+ props.push(
1223
+ prop(
1224
+ "agent",
1225
+ list([
1226
+ complex([
1227
+ prop(
1228
+ "type",
1229
+ complex([
1230
+ prop(
1231
+ "coding",
1232
+ list([
1233
+ coding({
1234
+ system: SYSTEM.PROVENANCE_PARTICIPANT_TYPE,
1235
+ code: "author",
1236
+ display: "Author"
1237
+ }),
1238
+ coding({
1239
+ system: SYSTEM.US_CORE_PROVENANCE_PARTICIPANT_TYPE,
1240
+ code: "transmitter",
1241
+ display: "Transmitter"
1242
+ })
1243
+ ])
1244
+ )
1245
+ ])
1246
+ ),
1247
+ prop("who", reference(practitioner)),
1248
+ prop("onBehalfOf", reference(organization))
1249
+ ])
1250
+ ])
1251
+ )
1252
+ );
1253
+ return complex(props);
1254
+ }
1128
1255
  function generateDiagnosticReport(options = {}) {
1129
1256
  const { seed = 0, subject = "Patient/syn-patient-1", results = [], usCore = true } = options;
1130
1257
  const rng = createRng(seed);
@@ -1452,6 +1579,41 @@ function fhirCorpus(options) {
1452
1579
  return makeCorpus(seed, artifacts);
1453
1580
  }
1454
1581
 
1455
- export { EXAMPLE_ALLERGENS, EXAMPLE_ALLERGY_MANIFESTATIONS, EXAMPLE_CONDITIONS, EXAMPLE_DIAGNOSTIC_REPORTS, EXAMPLE_ENCOUNTER_CLASSES, EXAMPLE_ENCOUNTER_TYPES, EXAMPLE_ETHNICITY_CATEGORIES, EXAMPLE_LAB_OBSERVATIONS, EXAMPLE_MEDICATIONS, EXAMPLE_PROCEDURES, EXAMPLE_RACE_CATEGORIES, EXAMPLE_VACCINES, EXAMPLE_VITAL_SIGNS, SYSTEM, US_CORE_BIRTHSEX_EXTENSION, US_CORE_ETHNICITY_EXTENSION, US_CORE_PROFILE, US_CORE_RACE_EXTENSION, bool, buildComposition, codeableConcept, coding, dec, fhirCorpus, fhirPatientIdentity, generateAllergyIntolerance, generateBundle, generateCondition, generateDiagnosticReport, generateEncounter, generateImmunization, generateMedicationRequest, generateObservationLab, generatePatient, generateProcedure, generateVitalSign, meta, mrnIdentifier, narrative, prop, reference, roundTrip, str, toFhirDate };
1582
+ // src/fhir/coverage.ts
1583
+ var GENERATORS = Object.freeze({
1584
+ "us-core-allergyintolerance": (seed) => generateAllergyIntolerance({ seed }),
1585
+ "us-core-condition-problems-health-concerns": (seed) => generateCondition({ seed }),
1586
+ "us-core-diagnosticreport-lab": (seed) => generateDiagnosticReport({ seed }),
1587
+ "us-core-encounter": (seed) => generateEncounter({ seed }),
1588
+ "us-core-immunization": (seed) => generateImmunization({ seed }),
1589
+ "us-core-medicationrequest": (seed) => generateMedicationRequest({ seed }),
1590
+ "us-core-observation-lab": (seed) => generateObservationLab({ seed }),
1591
+ "us-core-patient": (seed) => generatePatient({ seed, profile: "us-core" }),
1592
+ "us-core-procedure": (seed) => generateProcedure({ seed }),
1593
+ "us-core-provenance": (seed) => generateProvenance({ seed }),
1594
+ "us-core-vital-signs": (seed) => generateVitalSign({ seed })
1595
+ });
1596
+ var COVERAGE = Object.freeze(
1597
+ US_CORE_ADOPTED_PROFILES.map(
1598
+ (profile) => Object.freeze({
1599
+ profile,
1600
+ canonical: `${US_CORE_PROFILE_BASE}${profile}`,
1601
+ generated: GENERATORS[profile] !== void 0
1602
+ })
1603
+ )
1604
+ );
1605
+ function usCoreCoverage() {
1606
+ return COVERAGE;
1607
+ }
1608
+ function generateUsCoreProfile(options) {
1609
+ const profile = resolveKind(US_CORE_ADOPTED_PROFILES, options.profile);
1610
+ const generate = GENERATORS[profile];
1611
+ if (generate === void 0) {
1612
+ throw new SynthError(SYNTH_FATAL_CODES.SYNTH_PROFILE_NOT_GENERATED);
1613
+ }
1614
+ return generate(options.seed ?? 0);
1615
+ }
1616
+
1617
+ export { EXAMPLE_ALLERGENS, EXAMPLE_ALLERGY_MANIFESTATIONS, EXAMPLE_CONDITIONS, EXAMPLE_DIAGNOSTIC_REPORTS, EXAMPLE_ENCOUNTER_CLASSES, EXAMPLE_ENCOUNTER_TYPES, EXAMPLE_ETHNICITY_CATEGORIES, EXAMPLE_LAB_OBSERVATIONS, EXAMPLE_MEDICATIONS, EXAMPLE_PROCEDURES, EXAMPLE_RACE_CATEGORIES, EXAMPLE_VACCINES, EXAMPLE_VITAL_SIGNS, SYSTEM, US_CORE_ADOPTED_PROFILES, US_CORE_BIRTHSEX_EXTENSION, US_CORE_ETHNICITY_EXTENSION, US_CORE_PROFILE, US_CORE_PROFILE_BASE, US_CORE_RACE_EXTENSION, bool, buildComposition, codeableConcept, coding, dec, fhirCorpus, fhirPatientIdentity, generateAllergyIntolerance, generateBundle, generateCondition, generateDiagnosticReport, generateEncounter, generateImmunization, generateMedicationRequest, generateObservationLab, generatePatient, generateProcedure, generateProvenance, generateUsCoreProfile, generateVitalSign, meta, mrnIdentifier, narrative, prop, reference, roundTrip, str, toFhirDate, usCoreCoverage };
1456
1618
  //# sourceMappingURL=index.mjs.map
1457
1619
  //# sourceMappingURL=index.mjs.map