@cosyte/synth 0.0.1
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.
- package/CHANGELOG.md +414 -0
- package/LICENSE +21 -0
- package/README.md +325 -0
- package/dist/astm/index.cjs +847 -0
- package/dist/astm/index.cjs.map +1 -0
- package/dist/astm/index.d.cts +418 -0
- package/dist/astm/index.d.ts +418 -0
- package/dist/astm/index.mjs +828 -0
- package/dist/astm/index.mjs.map +1 -0
- package/dist/ccda/index.cjs +1103 -0
- package/dist/ccda/index.cjs.map +1 -0
- package/dist/ccda/index.d.cts +380 -0
- package/dist/ccda/index.d.ts +380 -0
- package/dist/ccda/index.mjs +1077 -0
- package/dist/ccda/index.mjs.map +1 -0
- package/dist/deid/index.cjs +2809 -0
- package/dist/deid/index.cjs.map +1 -0
- package/dist/deid/index.d.cts +464 -0
- package/dist/deid/index.d.ts +464 -0
- package/dist/deid/index.mjs +2793 -0
- package/dist/deid/index.mjs.map +1 -0
- package/dist/example-codes-DeXcnCSK.d.cts +105 -0
- package/dist/example-codes-DeXcnCSK.d.ts +105 -0
- package/dist/fhir/index.cjs +1429 -0
- package/dist/fhir/index.cjs.map +1 -0
- package/dist/fhir/index.d.cts +772 -0
- package/dist/fhir/index.d.ts +772 -0
- package/dist/fhir/index.mjs +1384 -0
- package/dist/fhir/index.mjs.map +1 -0
- package/dist/hl7/index.cjs +1012 -0
- package/dist/hl7/index.cjs.map +1 -0
- package/dist/hl7/index.d.cts +548 -0
- package/dist/hl7/index.d.ts +548 -0
- package/dist/hl7/index.mjs +990 -0
- package/dist/hl7/index.mjs.map +1 -0
- package/dist/index.cjs +535 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +407 -0
- package/dist/index.d.ts +407 -0
- package/dist/index.mjs +488 -0
- package/dist/index.mjs.map +1 -0
- package/dist/ncpdp/index.cjs +714 -0
- package/dist/ncpdp/index.cjs.map +1 -0
- package/dist/ncpdp/index.d.cts +432 -0
- package/dist/ncpdp/index.d.ts +432 -0
- package/dist/ncpdp/index.mjs +695 -0
- package/dist/ncpdp/index.mjs.map +1 -0
- package/dist/providers-OLz3zAc-.d.cts +343 -0
- package/dist/providers-OLz3zAc-.d.ts +343 -0
- package/dist/quirk-DmkgoZdh.d.cts +239 -0
- package/dist/quirk-JLyO1Ncj.d.ts +239 -0
- package/dist/x12/index.cjs +920 -0
- package/dist/x12/index.cjs.map +1 -0
- package/dist/x12/index.d.cts +484 -0
- package/dist/x12/index.d.ts +484 -0
- package/dist/x12/index.mjs +892 -0
- package/dist/x12/index.mjs.map +1 -0
- package/package.json +210 -0
|
@@ -0,0 +1,772 @@
|
|
|
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-OLz3zAc-.cjs';
|
|
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-DeXcnCSK.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Synthetic FHIR R4 **`Patient`** generation — the anchor of the US Core clinical spine. Built through
|
|
7
|
+
* `@cosyte/fhir`'s model constructors, every identity field drawn from the
|
|
8
|
+
* synthetic-safety providers. In `us-core` mode the resource claims US Core Patient via
|
|
9
|
+
* `meta.profile`, satisfies its required elements (`identifier` + `system` + `value`, `name`, `gender`),
|
|
10
|
+
* and carries the must-support race / ethnicity / birthsex extensions.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Options for {@link generatePatient}. */
|
|
16
|
+
interface GeneratePatientOptions {
|
|
17
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
18
|
+
readonly seed?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The profile posture. `"base"` (default) emits a spec-clean base-R4 `Patient`; `"us-core"` adds the
|
|
21
|
+
* US Core `meta.profile` and the race/ethnicity/birthsex must-support extensions (the required
|
|
22
|
+
* elements — identifier/name/gender — are always present).
|
|
23
|
+
*/
|
|
24
|
+
readonly profile?: "base" | "us-core";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Generate a spec-clean synthetic FHIR R4 `Patient` (base or US Core), built through `@cosyte/fhir`.
|
|
28
|
+
*
|
|
29
|
+
* @param options - Seed and profile posture. See {@link GeneratePatientOptions}.
|
|
30
|
+
* @returns The `Patient` resource model (a `FhirComplex`).
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { generatePatient } from "@cosyte/synth/fhir";
|
|
34
|
+
* import { serializeResource } from "@cosyte/fhir";
|
|
35
|
+
* const patient = generatePatient({ seed: 42, profile: "us-core" });
|
|
36
|
+
* serializeResource(patient);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function generatePatient(options?: GeneratePatientOptions): FhirComplex;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Synthetic FHIR R4 **`Condition`** generation — a US Core "Problems and Health Concerns" problem-list
|
|
43
|
+
* item. Built through `@cosyte/fhir`; the `code` comes from the license-clean SNOMED
|
|
44
|
+
* example pool, the `subject` from a supplied or derived synthetic Patient reference.
|
|
45
|
+
*
|
|
46
|
+
* @module
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/** Options for {@link generateCondition}. */
|
|
50
|
+
interface GenerateConditionOptions {
|
|
51
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
52
|
+
readonly seed?: number;
|
|
53
|
+
/** The `subject` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
54
|
+
readonly subject?: string;
|
|
55
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
56
|
+
readonly usCore?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Generate a spec-clean synthetic US Core `Condition` (problem-list item), built through `@cosyte/fhir`.
|
|
60
|
+
*
|
|
61
|
+
* @param options - Seed, subject reference, and US Core posture. See {@link GenerateConditionOptions}.
|
|
62
|
+
* @returns The `Condition` resource model (a `FhirComplex`).
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { generateCondition } from "@cosyte/synth/fhir";
|
|
66
|
+
* const condition = generateCondition({ seed: 7, subject: "Patient/syn-patient-1" });
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
declare function generateCondition(options?: GenerateConditionOptions): FhirComplex;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Synthetic FHIR R4 **`Observation`** generation — US Core Laboratory Result and US Core Vital Signs. Built
|
|
73
|
+
* through `@cosyte/fhir`; `code` and the measured `valueQuantity` come from
|
|
74
|
+
* the license-clean LOINC/UCUM example pool, `subject` from a supplied or derived Patient reference.
|
|
75
|
+
* The measured value is drawn from the seeded generator within a structurally-sane band — it implies no
|
|
76
|
+
* real measurement.
|
|
77
|
+
*
|
|
78
|
+
* @module
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/** Options for {@link generateObservationLab} / {@link generateVitalSign}. */
|
|
82
|
+
interface GenerateObservationOptions {
|
|
83
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
84
|
+
readonly seed?: number;
|
|
85
|
+
/** The `subject` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
86
|
+
readonly subject?: string;
|
|
87
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
88
|
+
readonly usCore?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Generate a spec-clean synthetic US Core **Laboratory Result** `Observation`.
|
|
92
|
+
*
|
|
93
|
+
* @param options - Seed, subject reference, US Core posture. See {@link GenerateObservationOptions}.
|
|
94
|
+
* @returns The `Observation` resource model (a `FhirComplex`).
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { generateObservationLab } from "@cosyte/synth/fhir";
|
|
98
|
+
* const obs = generateObservationLab({ seed: 3, subject: "Patient/syn-patient-1" });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
declare function generateObservationLab(options?: GenerateObservationOptions): FhirComplex;
|
|
102
|
+
/**
|
|
103
|
+
* Generate a spec-clean synthetic US Core **Vital Signs** `Observation` (a single-value vital such as
|
|
104
|
+
* heart rate or body weight; `effectiveDateTime` is required by the vital-signs profile).
|
|
105
|
+
*
|
|
106
|
+
* @param options - Seed, subject reference, US Core posture. See {@link GenerateObservationOptions}.
|
|
107
|
+
* @returns The `Observation` resource model (a `FhirComplex`).
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { generateVitalSign } from "@cosyte/synth/fhir";
|
|
111
|
+
* const vs = generateVitalSign({ seed: 5, subject: "Patient/syn-patient-1" });
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
declare function generateVitalSign(options?: GenerateObservationOptions): FhirComplex;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Synthetic FHIR R4 **`MedicationRequest`** generation — a US Core MedicationRequest with an inline
|
|
118
|
+
* `medicationCodeableConcept`. Built through `@cosyte/fhir`; the medication comes
|
|
119
|
+
* from the license-clean RxNorm example pool. US Core invariant `us-core-21` requires a `requester`
|
|
120
|
+
* whenever `intent = order`, so a synthetic requester reference is always emitted.
|
|
121
|
+
*
|
|
122
|
+
* @module
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/** Options for {@link generateMedicationRequest}. */
|
|
126
|
+
interface GenerateMedicationRequestOptions {
|
|
127
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
128
|
+
readonly seed?: number;
|
|
129
|
+
/** The `subject` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
130
|
+
readonly subject?: string;
|
|
131
|
+
/** The `requester` reference. Defaults to a synthetic `Practitioner` reference. */
|
|
132
|
+
readonly requester?: string;
|
|
133
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
134
|
+
readonly usCore?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Generate a spec-clean synthetic US Core `MedicationRequest`, built through `@cosyte/fhir`.
|
|
138
|
+
*
|
|
139
|
+
* @param options - Seed, subject/requester references, US Core posture.
|
|
140
|
+
* @returns The `MedicationRequest` resource model (a `FhirComplex`).
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* import { generateMedicationRequest } from "@cosyte/synth/fhir";
|
|
144
|
+
* const mr = generateMedicationRequest({ seed: 9, subject: "Patient/syn-patient-1" });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function generateMedicationRequest(options?: GenerateMedicationRequestOptions): FhirComplex;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Synthetic FHIR R4 **`Encounter`** generation — a US Core Encounter. Built through `@cosyte/fhir`'s model
|
|
151
|
+
* constructors; `class` and `type` come from the
|
|
152
|
+
* license-clean v3-ActCode / SNOMED example pools, `subject` from a supplied or derived synthetic
|
|
153
|
+
* Patient reference. The required elements (`status`, `class`, `type`, `subject`) are always present.
|
|
154
|
+
*
|
|
155
|
+
* @module
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/** Options for {@link generateEncounter}. */
|
|
159
|
+
interface GenerateEncounterOptions {
|
|
160
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
161
|
+
readonly seed?: number;
|
|
162
|
+
/** The `subject` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
163
|
+
readonly subject?: string;
|
|
164
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
165
|
+
readonly usCore?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Generate a spec-clean synthetic US Core `Encounter`, built through `@cosyte/fhir`.
|
|
169
|
+
*
|
|
170
|
+
* @param options - Seed, subject reference, and US Core posture. See {@link GenerateEncounterOptions}.
|
|
171
|
+
* @returns The `Encounter` resource model (a `FhirComplex`).
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* import { generateEncounter } from "@cosyte/synth/fhir";
|
|
175
|
+
* const encounter = generateEncounter({ seed: 11, subject: "Patient/syn-patient-1" });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare function generateEncounter(options?: GenerateEncounterOptions): FhirComplex;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Synthetic FHIR R4 **`Immunization`** generation — a US Core Immunization. Built through `@cosyte/fhir`;
|
|
182
|
+
* `vaccineCode` comes from the license-clean CVX example
|
|
183
|
+
* pool, `patient` from a supplied or derived synthetic Patient reference. The required elements
|
|
184
|
+
* (`status`, `vaccineCode`, `patient`, `occurrenceDateTime`) are always present.
|
|
185
|
+
*
|
|
186
|
+
* @module
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
/** Options for {@link generateImmunization}. */
|
|
190
|
+
interface GenerateImmunizationOptions {
|
|
191
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
192
|
+
readonly seed?: number;
|
|
193
|
+
/** The `patient` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
194
|
+
readonly patient?: string;
|
|
195
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
196
|
+
readonly usCore?: boolean;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Generate a spec-clean synthetic US Core `Immunization`, built through `@cosyte/fhir`.
|
|
200
|
+
*
|
|
201
|
+
* @param options - Seed, patient reference, and US Core posture. See {@link GenerateImmunizationOptions}.
|
|
202
|
+
* @returns The `Immunization` resource model (a `FhirComplex`).
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* import { generateImmunization } from "@cosyte/synth/fhir";
|
|
206
|
+
* const imm = generateImmunization({ seed: 13, patient: "Patient/syn-patient-1" });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
declare function generateImmunization(options?: GenerateImmunizationOptions): FhirComplex;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Synthetic FHIR R4 **`AllergyIntolerance`** generation — a US Core AllergyIntolerance. Built through
|
|
213
|
+
* `@cosyte/fhir`; the allergen `code` and reaction
|
|
214
|
+
* `manifestation` come from the license-clean RxNorm/SNOMED example pools, `patient` from a supplied or
|
|
215
|
+
* derived synthetic Patient reference. `clinicalStatus` + `verificationStatus` are emitted together so
|
|
216
|
+
* the base `ait-1`/`ait-2` invariants hold; the required `code` and `patient` are always present.
|
|
217
|
+
*
|
|
218
|
+
* @module
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
/** Options for {@link generateAllergyIntolerance}. */
|
|
222
|
+
interface GenerateAllergyIntoleranceOptions {
|
|
223
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
224
|
+
readonly seed?: number;
|
|
225
|
+
/** The `patient` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
226
|
+
readonly patient?: string;
|
|
227
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
228
|
+
readonly usCore?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Generate a spec-clean synthetic US Core `AllergyIntolerance`, built through `@cosyte/fhir`.
|
|
232
|
+
*
|
|
233
|
+
* @param options - Seed, patient reference, and US Core posture. See
|
|
234
|
+
* {@link GenerateAllergyIntoleranceOptions}.
|
|
235
|
+
* @returns The `AllergyIntolerance` resource model (a `FhirComplex`).
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* import { generateAllergyIntolerance } from "@cosyte/synth/fhir";
|
|
239
|
+
* const allergy = generateAllergyIntolerance({ seed: 15, patient: "Patient/syn-patient-1" });
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
declare function generateAllergyIntolerance(options?: GenerateAllergyIntoleranceOptions): FhirComplex;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Synthetic FHIR R4 **`Procedure`** generation — a US Core Procedure. Built through `@cosyte/fhir`; the
|
|
246
|
+
* `code` comes from the license-clean SNOMED procedure
|
|
247
|
+
* example pool (never CPT), `subject` from a supplied or derived synthetic Patient
|
|
248
|
+
* reference. The required elements (`status`, `code`, `subject`) plus the must-support
|
|
249
|
+
* `performedDateTime` are always present.
|
|
250
|
+
*
|
|
251
|
+
* @module
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
/** Options for {@link generateProcedure}. */
|
|
255
|
+
interface GenerateProcedureOptions {
|
|
256
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
257
|
+
readonly seed?: number;
|
|
258
|
+
/** The `subject` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
259
|
+
readonly subject?: string;
|
|
260
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
261
|
+
readonly usCore?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Generate a spec-clean synthetic US Core `Procedure`, built through `@cosyte/fhir`.
|
|
265
|
+
*
|
|
266
|
+
* @param options - Seed, subject reference, and US Core posture. See {@link GenerateProcedureOptions}.
|
|
267
|
+
* @returns The `Procedure` resource model (a `FhirComplex`).
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* import { generateProcedure } from "@cosyte/synth/fhir";
|
|
271
|
+
* const procedure = generateProcedure({ seed: 17, subject: "Patient/syn-patient-1" });
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
declare function generateProcedure(options?: GenerateProcedureOptions): FhirComplex;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Synthetic FHIR R4 **`DiagnosticReport`** generation — the US Core DiagnosticReport Profile for
|
|
278
|
+
* Laboratory Results Reporting. Built through `@cosyte/fhir`;
|
|
279
|
+
* the report `code` comes from the license-clean LOINC example pool, `subject` from a supplied or
|
|
280
|
+
* derived synthetic Patient reference. The required `category` carries the profile's mandated `LAB`
|
|
281
|
+
* slice, and `effectiveDateTime` + `issued` are always present so the `us-core-8`/`us-core-9`
|
|
282
|
+
* invariants hold for a `final` report. Optional `result` references wire the report to its
|
|
283
|
+
* `Observation`s (used by the `document` Bundle).
|
|
284
|
+
*
|
|
285
|
+
* @module
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
/** Options for {@link generateDiagnosticReport}. */
|
|
289
|
+
interface GenerateDiagnosticReportOptions {
|
|
290
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
291
|
+
readonly seed?: number;
|
|
292
|
+
/** The `subject` reference (e.g. `"Patient/syn-patient-1"` or a `urn:uuid:` fullUrl). */
|
|
293
|
+
readonly subject?: string;
|
|
294
|
+
/** `result` references to the report's `Observation`s (empty ⇒ omitted). */
|
|
295
|
+
readonly results?: readonly string[];
|
|
296
|
+
/** Whether to claim US Core via `meta.profile`. Defaults to `true`. */
|
|
297
|
+
readonly usCore?: boolean;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Generate a spec-clean synthetic US Core Laboratory `DiagnosticReport`, built through `@cosyte/fhir`.
|
|
301
|
+
*
|
|
302
|
+
* @param options - Seed, subject, result references, US Core posture. See
|
|
303
|
+
* {@link GenerateDiagnosticReportOptions}.
|
|
304
|
+
* @returns The `DiagnosticReport` resource model (a `FhirComplex`).
|
|
305
|
+
* @example
|
|
306
|
+
* ```ts
|
|
307
|
+
* import { generateDiagnosticReport } from "@cosyte/synth/fhir";
|
|
308
|
+
* const report = generateDiagnosticReport({ seed: 19, subject: "Patient/syn-patient-1" });
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
declare function generateDiagnosticReport(options?: GenerateDiagnosticReportOptions): FhirComplex;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Synthetic FHIR R4 **`Bundle`** generation — a self-contained `collection`,
|
|
315
|
+
* `transaction`, or `document` Bundle assembling a synthetic US Core `Patient` and its full clinical
|
|
316
|
+
* spine (`Condition`, lab + vital-sign `Observation`s, `MedicationRequest`, `Encounter`,
|
|
317
|
+
* `Immunization`, `AllergyIntolerance`, `Procedure`, `DiagnosticReport`), wired by `urn:uuid:`
|
|
318
|
+
* `fullUrl`s so every intra-bundle reference resolves. Built through `@cosyte/fhir`. The `document`
|
|
319
|
+
* shape prepends the FHIR-mandated `Composition` (invariant `bdl-11`) and a synthetic
|
|
320
|
+
* `Organization` author/custodian, and carries the required `identifier` + `timestamp` (`bdl-9`/`bdl-10`).
|
|
321
|
+
*
|
|
322
|
+
* @module
|
|
323
|
+
*/
|
|
324
|
+
|
|
325
|
+
/** The Bundle shapes `@cosyte/synth` supports. */
|
|
326
|
+
type FhirBundleType = "collection" | "transaction" | "document";
|
|
327
|
+
/** Options for {@link generateBundle}. */
|
|
328
|
+
interface GenerateBundleOptions {
|
|
329
|
+
/** The seed (deterministic). Defaults to `0`. */
|
|
330
|
+
readonly seed?: number;
|
|
331
|
+
/** The Bundle shape. Defaults to `"collection"`. */
|
|
332
|
+
readonly type?: FhirBundleType;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Generate a spec-clean synthetic FHIR `Bundle` (`collection`, `transaction`, or `document`) built
|
|
336
|
+
* through `@cosyte/fhir`, containing a US Core `Patient` and its full clinical spine wired by
|
|
337
|
+
* `urn:uuid:` references so every reference resolves in-bundle.
|
|
338
|
+
*
|
|
339
|
+
* @param options - Seed and Bundle shape. See {@link GenerateBundleOptions}.
|
|
340
|
+
* @returns The `Bundle` resource model (a `FhirComplex`).
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* import { generateBundle } from "@cosyte/synth/fhir";
|
|
344
|
+
* const bundle = generateBundle({ seed: 42, type: "document" });
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
declare function generateBundle(options?: GenerateBundleOptions): FhirComplex;
|
|
348
|
+
/** A FHIR resource kind the {@link fhirCorpus} can generate. */
|
|
349
|
+
type FhirResourceKind = "Patient" | "USCorePatient" | "Condition" | "ObservationLab" | "VitalSign" | "MedicationRequest" | "Encounter" | "Immunization" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Bundle" | "DocumentBundle";
|
|
350
|
+
/** Options for {@link fhirCorpus}. */
|
|
351
|
+
interface FhirCorpusOptions {
|
|
352
|
+
/** The seed for the whole corpus (deterministic). */
|
|
353
|
+
readonly seed: number;
|
|
354
|
+
/** How many resources to generate. Defaults to `1`. */
|
|
355
|
+
readonly count?: number;
|
|
356
|
+
/** The resource kinds to cycle through. Defaults to the full US Core clinical spine + a Bundle. */
|
|
357
|
+
readonly mix?: readonly FhirResourceKind[];
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Build a reproducible {@link Corpus} of spec-clean FHIR resources across the supported kinds. Each
|
|
361
|
+
* resource is generated from a distinct sub-seed derived from the corpus seed and round-tripped through
|
|
362
|
+
* `@cosyte/fhir`; the per-artifact `warnings` record the validator's non-informational findings (empty
|
|
363
|
+
* ⇒ spec-clean, no US Core profiles supplied). Pass US Core `StructureDefinition`s to a per-resource
|
|
364
|
+
* {@link roundTrip} call to additionally assert profile conformance (BYO — none is bundled).
|
|
365
|
+
*
|
|
366
|
+
* @param options - Seed, count, and the resource mix. See {@link FhirCorpusOptions}.
|
|
367
|
+
* @returns A deep-frozen {@link Corpus}.
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* import { fhirCorpus } from "@cosyte/synth/fhir";
|
|
371
|
+
* const corpus = fhirCorpus({ seed: 42, count: 6 });
|
|
372
|
+
* corpus.artifacts.every((a) => a.warnings.length === 0); // spec-clean (structural)
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
declare function fhirCorpus(options: FhirCorpusOptions): Corpus;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Synthetic FHIR R4 **`Composition`** generation — the mandatory first resource of a `document` Bundle
|
|
379
|
+
* (FHIR invariant `bdl-11`), built through `@cosyte/fhir`.
|
|
380
|
+
* A Composition is a base-R4 resource (US Core 6.1.0 defines no Composition profile), so it is grounded
|
|
381
|
+
* against base FHIR R4; every reference it carries (`subject`, `author`, `custodian`, section `entry`s)
|
|
382
|
+
* is an in-bundle `urn:uuid:` fullUrl so the document is self-contained and its references resolve.
|
|
383
|
+
*
|
|
384
|
+
* @module
|
|
385
|
+
*/
|
|
386
|
+
|
|
387
|
+
/** A document section: a LOINC section code, a human title, and the entry references it summarizes. */
|
|
388
|
+
interface CompositionSection {
|
|
389
|
+
/** The LOINC section code. */
|
|
390
|
+
readonly code: string;
|
|
391
|
+
/** The section's human title / display. */
|
|
392
|
+
readonly title: string;
|
|
393
|
+
/** In-bundle `urn:uuid:` references to the resources the section summarizes. */
|
|
394
|
+
readonly entries: readonly string[];
|
|
395
|
+
}
|
|
396
|
+
/** Inputs for {@link buildComposition}. */
|
|
397
|
+
interface BuildCompositionInput {
|
|
398
|
+
/** The `subject` reference (the patient's in-bundle fullUrl). */
|
|
399
|
+
readonly subject: string;
|
|
400
|
+
/** The `author` + `custodian` reference (an in-bundle Organization fullUrl). */
|
|
401
|
+
readonly organization: string;
|
|
402
|
+
/** The document date (`YYYY-MM-DD`). */
|
|
403
|
+
readonly date: string;
|
|
404
|
+
/** The document sections. */
|
|
405
|
+
readonly sections: readonly CompositionSection[];
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Build a spec-clean synthetic base-R4 `Composition` for a `document` Bundle, through `@cosyte/fhir`.
|
|
409
|
+
*
|
|
410
|
+
* @param rng - The seeded generator (for the resource id).
|
|
411
|
+
* @param input - Subject/organization references, date, and sections. See {@link BuildCompositionInput}.
|
|
412
|
+
* @returns The `Composition` resource model (a `FhirComplex`).
|
|
413
|
+
* @example
|
|
414
|
+
* ```ts
|
|
415
|
+
* import { createRng } from "@cosyte/synth";
|
|
416
|
+
* import { buildComposition } from "@cosyte/synth/fhir";
|
|
417
|
+
* // buildComposition(createRng(1), { subject, organization, date: "2020-01-01", sections: [] });
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
declare function buildComposition(rng: Rng, input: BuildCompositionInput): FhirComplex;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* The **round-trip-through-the-parser harness** for FHIR — the headline gate for the synthetic-fixture
|
|
424
|
+
* generator. A generated resource is "spec-clean" only if `@cosyte/fhir` — not
|
|
425
|
+
* `@cosyte/synth`'s own opinion — reads it back, validates it, and re-serializes it byte-identically.
|
|
426
|
+
* This harness serializes a generated resource, parses it back, validates it (optionally against
|
|
427
|
+
* supplied US Core / vendor `StructureDefinition`s), and re-serializes, reporting what the parser found
|
|
428
|
+
* so a false "spec-clean" claim cannot hide.
|
|
429
|
+
*
|
|
430
|
+
* `@cosyte/synth` bundles **no** profile content: to validate US Core conformance, a caller supplies
|
|
431
|
+
* the `StructureDefinition`s via {@link RoundTripOptions.profiles} — exactly the content-free posture of
|
|
432
|
+
* `@cosyte/fhir.validateResource({ profiles })`.
|
|
433
|
+
*
|
|
434
|
+
* @module
|
|
435
|
+
*/
|
|
436
|
+
|
|
437
|
+
/** Options for {@link roundTrip}. */
|
|
438
|
+
interface RoundTripOptions {
|
|
439
|
+
/**
|
|
440
|
+
* US Core / vendor profiles (`StructureDefinition`s) to validate against. **None is bundled** — a
|
|
441
|
+
* caller supplies them (BYO), matching `@cosyte/fhir`'s content-free posture.
|
|
442
|
+
*/
|
|
443
|
+
readonly profiles?: readonly StructureDefinition[];
|
|
444
|
+
}
|
|
445
|
+
/** The verdict of one round-trip through `@cosyte/fhir`. */
|
|
446
|
+
interface RoundTripResult {
|
|
447
|
+
/** The serialized FHIR JSON text (the parser's own conservative emit). */
|
|
448
|
+
readonly content: string;
|
|
449
|
+
/**
|
|
450
|
+
* The validation issue codes at `error`/`fatal` severity (empty ⇒ valid). `information`/`warning`
|
|
451
|
+
* findings (e.g. `MUST_SUPPORT_ABSENT`, `INVARIANT_UNCHECKED`, base `dom-6`) are advisory and are
|
|
452
|
+
* excluded here — they never make a resource invalid.
|
|
453
|
+
*/
|
|
454
|
+
readonly errors: readonly string[];
|
|
455
|
+
/** All non-informational issue codes (errors **and** warnings), for the `Corpus` artifact record. */
|
|
456
|
+
readonly warnings: readonly string[];
|
|
457
|
+
/** Whether re-serializing the re-parsed resource is byte-identical to `content`. */
|
|
458
|
+
readonly byteStable: boolean;
|
|
459
|
+
/** Whether `@cosyte/fhir.validateResource` reported no `error`/`fatal` findings. */
|
|
460
|
+
readonly valid: boolean;
|
|
461
|
+
/** `true` iff the artifact is spec-clean: **valid** (zero errors) **and** byte-stable. */
|
|
462
|
+
readonly specClean: boolean;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Round-trip a generated FHIR resource through serialize → parse → validate → serialize and report the
|
|
466
|
+
* verdict. A spec-clean artifact validates with **zero errors** and re-serializes byte-identically.
|
|
467
|
+
*
|
|
468
|
+
* @param resource - The resource model to check (typically from a `generate*` function).
|
|
469
|
+
* @param options - Optional US Core / vendor profiles to validate against. See {@link RoundTripOptions}.
|
|
470
|
+
* @returns The {@link RoundTripResult}.
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* import { generatePatient, roundTrip } from "@cosyte/synth/fhir";
|
|
474
|
+
* const { specClean, errors } = roundTrip(generatePatient({ seed: 1 }));
|
|
475
|
+
* // specClean === true, errors.length === 0
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
declare function roundTrip(resource: FhirComplex, options?: RoundTripOptions): RoundTripResult;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Shared FHIR model-construction helpers — the small vocabulary every resource generator uses
|
|
482
|
+
* to build **through `@cosyte/fhir`'s own model constructors** (`complex` / `list` / `primitive` /
|
|
483
|
+
* `decimal`). A generated resource is a `FhirComplex` tree assembled here and serialized by
|
|
484
|
+
* `@cosyte/fhir`'s conservative writer, so it is **spec-clean by construction** — the same mechanism
|
|
485
|
+
* that makes the parser's emit side spec-clean. Nothing here hand-writes JSON
|
|
486
|
+
* bytes.
|
|
487
|
+
*
|
|
488
|
+
* Identity fields (`name`, `identifier`, `birthDate`, `telecom`, `address`) are minted from the
|
|
489
|
+
* synthetic-safety providers in `../safe`, so no value a resource carries can be real or plausibly-real
|
|
490
|
+
* PHI. The `fhirPatientIdentity` bundle draws them in a **fixed order** for the
|
|
491
|
+
* reproducibility contract.
|
|
492
|
+
*
|
|
493
|
+
* @module
|
|
494
|
+
*/
|
|
495
|
+
|
|
496
|
+
/** A named FHIR property (`{ name, value }`) — the shape `complex` consumes. */
|
|
497
|
+
type Prop = {
|
|
498
|
+
readonly name: string;
|
|
499
|
+
readonly value: FhirNode;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Build a named FHIR property.
|
|
503
|
+
*
|
|
504
|
+
* @param name - The property name.
|
|
505
|
+
* @param value - The property's node value.
|
|
506
|
+
* @returns A {@link Prop}.
|
|
507
|
+
* @example
|
|
508
|
+
* ```ts
|
|
509
|
+
* import { prop, str } from "@cosyte/synth/fhir";
|
|
510
|
+
* prop("gender", str("female"));
|
|
511
|
+
* ```
|
|
512
|
+
*/
|
|
513
|
+
declare function prop(name: string, value: FhirNode): Prop;
|
|
514
|
+
/**
|
|
515
|
+
* A `string`/`code`/`uri`/`date` primitive leaf.
|
|
516
|
+
*
|
|
517
|
+
* @param value - The lexical string value.
|
|
518
|
+
* @returns A primitive `FhirNode`.
|
|
519
|
+
* @example
|
|
520
|
+
* ```ts
|
|
521
|
+
* import { str } from "@cosyte/synth/fhir";
|
|
522
|
+
* str("final");
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
declare function str(value: string): FhirNode;
|
|
526
|
+
/**
|
|
527
|
+
* A `decimal` primitive leaf, precision-preserving via `@cosyte/fhir`'s string-backed `FhirDecimal`.
|
|
528
|
+
*
|
|
529
|
+
* @param raw - The exact decimal lexical form (never routed through a JS `number`).
|
|
530
|
+
* @returns A primitive `FhirNode`.
|
|
531
|
+
* @example
|
|
532
|
+
* ```ts
|
|
533
|
+
* import { dec } from "@cosyte/synth/fhir";
|
|
534
|
+
* dec("6.3");
|
|
535
|
+
* ```
|
|
536
|
+
*/
|
|
537
|
+
declare function dec(raw: string): FhirNode;
|
|
538
|
+
/**
|
|
539
|
+
* A `boolean` primitive leaf.
|
|
540
|
+
*
|
|
541
|
+
* @param value - The boolean value.
|
|
542
|
+
* @returns A primitive `FhirNode`.
|
|
543
|
+
* @example
|
|
544
|
+
* ```ts
|
|
545
|
+
* import { bool } from "@cosyte/synth/fhir";
|
|
546
|
+
* bool(true);
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
549
|
+
declare function bool(value: boolean): FhirNode;
|
|
550
|
+
/**
|
|
551
|
+
* A single `Coding` element (`system` + `code` + `display`).
|
|
552
|
+
*
|
|
553
|
+
* @param concept - The coding's `system`, `code`, and `display`.
|
|
554
|
+
* @returns A `Coding` `FhirComplex`.
|
|
555
|
+
* @example
|
|
556
|
+
* ```ts
|
|
557
|
+
* import { coding } from "@cosyte/synth/fhir";
|
|
558
|
+
* coding({ system: "http://loinc.org", code: "2345-7", display: "Glucose" });
|
|
559
|
+
* ```
|
|
560
|
+
*/
|
|
561
|
+
declare function coding(concept: {
|
|
562
|
+
system: string;
|
|
563
|
+
code: string;
|
|
564
|
+
display: string;
|
|
565
|
+
}): FhirComplex;
|
|
566
|
+
/**
|
|
567
|
+
* A `CodeableConcept` wrapping a single `Coding`.
|
|
568
|
+
*
|
|
569
|
+
* @param concept - The coding's `system`, `code`, and `display`.
|
|
570
|
+
* @returns A `CodeableConcept` `FhirComplex`.
|
|
571
|
+
* @example
|
|
572
|
+
* ```ts
|
|
573
|
+
* import { codeableConcept } from "@cosyte/synth/fhir";
|
|
574
|
+
* codeableConcept({ system: "http://snomed.info/sct", code: "59621000", display: "Essential hypertension" });
|
|
575
|
+
* ```
|
|
576
|
+
*/
|
|
577
|
+
declare function codeableConcept(concept: {
|
|
578
|
+
system: string;
|
|
579
|
+
code: string;
|
|
580
|
+
display: string;
|
|
581
|
+
}): FhirComplex;
|
|
582
|
+
/**
|
|
583
|
+
* A literal `Reference` element (`{ reference: "<Type>/<id>" }` or a `urn:uuid:` fullUrl).
|
|
584
|
+
*
|
|
585
|
+
* @param ref - The reference string.
|
|
586
|
+
* @returns A `Reference` `FhirComplex`.
|
|
587
|
+
* @example
|
|
588
|
+
* ```ts
|
|
589
|
+
* import { reference } from "@cosyte/synth/fhir";
|
|
590
|
+
* reference("Patient/syn-patient-1");
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
declare function reference(ref: string): FhirComplex;
|
|
594
|
+
/**
|
|
595
|
+
* A generated `Narrative` (`text`) with `status: "generated"` and an XHTML `div` carrying only
|
|
596
|
+
* synthetic text — satisfies the base `dom-6` best-practice constraint so a generated resource is
|
|
597
|
+
* robust as well as valid. The `div` is XHTML-namespaced and carries no markup beyond a paragraph, so
|
|
598
|
+
* it round-trips byte-for-byte through `@cosyte/fhir`'s codec.
|
|
599
|
+
*
|
|
600
|
+
* @param text - The plain synthetic summary text (no PHI — it is composed from synthetic values).
|
|
601
|
+
* @returns A `Narrative` `FhirComplex`.
|
|
602
|
+
* @example
|
|
603
|
+
* ```ts
|
|
604
|
+
* import { narrative } from "@cosyte/synth/fhir";
|
|
605
|
+
* narrative("Synthetic patient summary.");
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
declare function narrative(text: string): FhirComplex;
|
|
609
|
+
/**
|
|
610
|
+
* A `meta.profile` element pinning the resource to one or more canonical profile URLs (US Core
|
|
611
|
+
* conformance is claimed via `meta.profile`). No version is pinned, so validating against any supplied
|
|
612
|
+
* version of the named profile never raises a version-mismatch.
|
|
613
|
+
*
|
|
614
|
+
* @param profiles - The canonical profile URLs to claim.
|
|
615
|
+
* @returns A `meta` `FhirComplex`.
|
|
616
|
+
* @example
|
|
617
|
+
* ```ts
|
|
618
|
+
* import { meta, US_CORE_PROFILE } from "@cosyte/synth/fhir";
|
|
619
|
+
* meta([US_CORE_PROFILE.PATIENT]);
|
|
620
|
+
* ```
|
|
621
|
+
*/
|
|
622
|
+
declare function meta(profiles: readonly string[]): FhirComplex;
|
|
623
|
+
/** A synthetic FHIR patient identity — every field drawn from `../safe`. */
|
|
624
|
+
interface FhirPatientIdentity {
|
|
625
|
+
/** A synthetic resource `id` (a seeded UUID) — never a real record key. */
|
|
626
|
+
readonly id: string;
|
|
627
|
+
/** Name from the shipped fake-name pool. */
|
|
628
|
+
readonly person: SyntheticName;
|
|
629
|
+
/** Medical-record identifier scoped to the synthetic assigning authority. */
|
|
630
|
+
readonly mrn: SyntheticIdentifier;
|
|
631
|
+
/** Date of birth as a FHIR `date` (`YYYY-MM-DD`) from the seeded generator. */
|
|
632
|
+
readonly birthDate: string;
|
|
633
|
+
/** FHIR administrative-gender code. */
|
|
634
|
+
readonly gender: "male" | "female";
|
|
635
|
+
/** Synthetic postal address (reserved non-real ZIP). */
|
|
636
|
+
readonly address: SyntheticAddress;
|
|
637
|
+
/** Reserved `555-01xx` phone number. */
|
|
638
|
+
readonly phone: string;
|
|
639
|
+
/** Synthetic email at a reserved (`example.*`) domain. */
|
|
640
|
+
readonly email: string;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Reformat a `YYYYMMDD` synthetic date (from `safe.dateYmd`) as a FHIR `date` (`YYYY-MM-DD`).
|
|
644
|
+
*
|
|
645
|
+
* @param ymd - The `YYYYMMDD` date string.
|
|
646
|
+
* @returns The `YYYY-MM-DD` FHIR date string.
|
|
647
|
+
* @example
|
|
648
|
+
* ```ts
|
|
649
|
+
* import { toFhirDate } from "@cosyte/synth/fhir";
|
|
650
|
+
* toFhirDate("19700131"); // "1970-01-31"
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
declare function toFhirDate(ymd: string): string;
|
|
654
|
+
/**
|
|
655
|
+
* Mint a complete synthetic {@link FhirPatientIdentity}. Every value comes from a synthetic-safety
|
|
656
|
+
* provider — no code path here can return a real or plausibly-real identifier. The draw
|
|
657
|
+
* order is fixed (id → name → MRN → DOB → gender → address → phone → email) so the same seed yields the
|
|
658
|
+
* same identity.
|
|
659
|
+
*
|
|
660
|
+
* @param rng - The seeded generator.
|
|
661
|
+
* @returns A synthetic {@link FhirPatientIdentity}.
|
|
662
|
+
* @example
|
|
663
|
+
* ```ts
|
|
664
|
+
* import { createRng } from "@cosyte/synth";
|
|
665
|
+
* // const id = fhirPatientIdentity(createRng(1)); // id.person, id.mrn, …
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
declare function fhirPatientIdentity(rng: Rng): FhirPatientIdentity;
|
|
669
|
+
/**
|
|
670
|
+
* The US Core Patient `identifier` element for a synthetic MRN — `type` (`MR`), the synthetic
|
|
671
|
+
* assigning-authority OID as `system`, and the synthetic value. Satisfies US Core Patient's required
|
|
672
|
+
* `identifier.system` + `identifier.value`.
|
|
673
|
+
*
|
|
674
|
+
* @param mrn - The synthetic identifier from `safe.identifier`.
|
|
675
|
+
* @returns An `Identifier` `FhirComplex`.
|
|
676
|
+
* @example
|
|
677
|
+
* ```ts
|
|
678
|
+
* import { createRng, safe } from "@cosyte/synth";
|
|
679
|
+
* import { mrnIdentifier } from "@cosyte/synth/fhir";
|
|
680
|
+
* mrnIdentifier(safe.identifier(createRng(1), "MR"));
|
|
681
|
+
* ```
|
|
682
|
+
*/
|
|
683
|
+
declare function mrnIdentifier(mrn: SyntheticIdentifier): FhirComplex;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* US Core + base-FHIR **canonical URLs and code-system identifiers** — the facts `@cosyte/synth` needs
|
|
687
|
+
* to emit US-Core-conformant resources, and nothing more.
|
|
688
|
+
*
|
|
689
|
+
* **Content-free, exactly like `@cosyte/fhir`.** These are *identifiers* — canonical URLs and code
|
|
690
|
+
* `system` URIs — not the copyrighted terminology tables or the profile `StructureDefinition` content
|
|
691
|
+
* they name. `@cosyte/synth` bundles **no** US Core IG: a consumer who wants to *validate* generated
|
|
692
|
+
* output against US Core supplies the `StructureDefinition`s themselves (BYO), exactly as
|
|
693
|
+
* `@cosyte/fhir.validateResource({ profiles })` requires. What is encoded here is only which canonical
|
|
694
|
+
* URL a resource's `meta.profile` claims and which `system` a coding carries — public facts.
|
|
695
|
+
*
|
|
696
|
+
* The URLs target **US Core 6.1.0** (the USCDI v3 / ONC HTI-1 §170.315(g)(10) anchor, FHIR R4 4.0.1),
|
|
697
|
+
* grounded firsthand against the published IG (`hl7.org/fhir/us/core/STU6.1`) — the same version the
|
|
698
|
+
* test corpus validates against.
|
|
699
|
+
*
|
|
700
|
+
* @module
|
|
701
|
+
*/
|
|
702
|
+
/** The canonical `meta.profile` URLs for the US Core 6.1.0 profiles `@cosyte/synth` generates. */
|
|
703
|
+
declare const US_CORE_PROFILE: Readonly<{
|
|
704
|
+
/** US Core Patient. */
|
|
705
|
+
readonly PATIENT: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient";
|
|
706
|
+
/** US Core Condition (Problems and Health Concerns). */
|
|
707
|
+
readonly CONDITION: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-problems-health-concerns";
|
|
708
|
+
/** US Core Laboratory Result Observation. */
|
|
709
|
+
readonly OBSERVATION_LAB: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab";
|
|
710
|
+
/** US Core Vital Signs (derived from the base FHIR vital-signs profile). */
|
|
711
|
+
readonly VITAL_SIGNS: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-vital-signs";
|
|
712
|
+
/** US Core MedicationRequest. */
|
|
713
|
+
readonly MEDICATION_REQUEST: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest";
|
|
714
|
+
/** US Core Encounter. */
|
|
715
|
+
readonly ENCOUNTER: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter";
|
|
716
|
+
/** US Core DiagnosticReport Profile for Laboratory Results Reporting. */
|
|
717
|
+
readonly DIAGNOSTIC_REPORT_LAB: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab";
|
|
718
|
+
/** US Core Immunization. */
|
|
719
|
+
readonly IMMUNIZATION: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization";
|
|
720
|
+
/** US Core AllergyIntolerance. */
|
|
721
|
+
readonly ALLERGY_INTOLERANCE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance";
|
|
722
|
+
/** US Core Procedure. */
|
|
723
|
+
readonly PROCEDURE: "http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure";
|
|
724
|
+
}>;
|
|
725
|
+
/** The US Core `us-core-race` extension URL (a Patient must-support extension). */
|
|
726
|
+
declare const US_CORE_RACE_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race";
|
|
727
|
+
/** The US Core `us-core-ethnicity` extension URL (a Patient must-support extension). */
|
|
728
|
+
declare const US_CORE_ETHNICITY_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity";
|
|
729
|
+
/** The US Core `us-core-birthsex` extension URL (a Patient must-support extension). */
|
|
730
|
+
declare const US_CORE_BIRTHSEX_EXTENSION = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex";
|
|
731
|
+
/**
|
|
732
|
+
* The code-system `system` URIs the generators reference. Public identity URIs (HL7-published),
|
|
733
|
+
* never the code-system *content* — no SNOMED/LOINC/RxNorm table is bundled.
|
|
734
|
+
*/
|
|
735
|
+
declare const SYSTEM: Readonly<{
|
|
736
|
+
/** FHIR `administrative-gender` (`Patient.gender`). */
|
|
737
|
+
readonly ADMINISTRATIVE_GENDER: "http://hl7.org/fhir/administrative-gender";
|
|
738
|
+
/** HL7 Terminology `observation-category`. */
|
|
739
|
+
readonly OBSERVATION_CATEGORY: "http://terminology.hl7.org/CodeSystem/observation-category";
|
|
740
|
+
/** HL7 Terminology `condition-category`. */
|
|
741
|
+
readonly CONDITION_CATEGORY: "http://terminology.hl7.org/CodeSystem/condition-category";
|
|
742
|
+
/** HL7 Terminology `condition-clinical`. */
|
|
743
|
+
readonly CONDITION_CLINICAL: "http://terminology.hl7.org/CodeSystem/condition-clinical";
|
|
744
|
+
/** HL7 Terminology `condition-ver-status`. */
|
|
745
|
+
readonly CONDITION_VER_STATUS: "http://terminology.hl7.org/CodeSystem/condition-ver-status";
|
|
746
|
+
/** HL7 v2 `0203` identifier-type (`Identifier.type.coding.code` = `MR`). */
|
|
747
|
+
readonly IDENTIFIER_TYPE: "http://terminology.hl7.org/CodeSystem/v2-0203";
|
|
748
|
+
/** OMB race & ethnicity category system (US Core race/ethnicity `ombCategory`). */
|
|
749
|
+
readonly OMB_RACE_ETHNICITY: "urn:oid:2.16.840.1.113883.6.238";
|
|
750
|
+
/** LOINC — `Observation.code` (lab + vital-signs). */
|
|
751
|
+
readonly LOINC: "http://loinc.org";
|
|
752
|
+
/** SNOMED CT — `Condition.code`. */
|
|
753
|
+
readonly SNOMED: "http://snomed.info/sct";
|
|
754
|
+
/** RxNorm — `MedicationRequest.medicationCodeableConcept` + an allergen substance. */
|
|
755
|
+
readonly RXNORM: "http://www.nlm.nih.gov/research/umls/rxnorm";
|
|
756
|
+
/** UCUM — `Quantity.system` for units of measure. */
|
|
757
|
+
readonly UCUM: "http://unitsofmeasure.org";
|
|
758
|
+
/** CVX (CDC vaccine administered) — `Immunization.vaccineCode`. */
|
|
759
|
+
readonly CVX: "http://hl7.org/fhir/sid/cvx";
|
|
760
|
+
/** HL7 v3 `ActCode` — `Encounter.class`. */
|
|
761
|
+
readonly V3_ACT_CODE: "http://terminology.hl7.org/CodeSystem/v3-ActCode";
|
|
762
|
+
/** HL7 v2 `0074` diagnostic-service-section — `DiagnosticReport.category` (`LAB`). */
|
|
763
|
+
readonly DIAGNOSTIC_SERVICE_SECTION: "http://terminology.hl7.org/CodeSystem/v2-0074";
|
|
764
|
+
/** HL7 Terminology `allergyintolerance-clinical` — `AllergyIntolerance.clinicalStatus`. */
|
|
765
|
+
readonly ALLERGY_CLINICAL: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical";
|
|
766
|
+
/** HL7 Terminology `allergyintolerance-verification` — `AllergyIntolerance.verificationStatus`. */
|
|
767
|
+
readonly ALLERGY_VERIFICATION: "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification";
|
|
768
|
+
}>;
|
|
769
|
+
/** A US Core profile canonical URL. */
|
|
770
|
+
type UsCoreProfileUrl = (typeof US_CORE_PROFILE)[keyof typeof US_CORE_PROFILE];
|
|
771
|
+
|
|
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 };
|