@cosyte/synth 0.0.7 → 0.0.8

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 (57) hide show
  1. package/CHANGELOG.md +135 -17
  2. package/README.md +47 -45
  3. package/dist/astm/index.cjs +7 -7
  4. package/dist/astm/index.cjs.map +1 -1
  5. package/dist/astm/index.d.cts +47 -47
  6. package/dist/astm/index.d.ts +47 -47
  7. package/dist/astm/index.mjs +7 -7
  8. package/dist/astm/index.mjs.map +1 -1
  9. package/dist/ccda/index.cjs +15 -15
  10. package/dist/ccda/index.cjs.map +1 -1
  11. package/dist/ccda/index.d.cts +31 -31
  12. package/dist/ccda/index.d.ts +31 -31
  13. package/dist/ccda/index.mjs +15 -15
  14. package/dist/ccda/index.mjs.map +1 -1
  15. package/dist/deid/index.cjs +15 -15
  16. package/dist/deid/index.cjs.map +1 -1
  17. package/dist/deid/index.d.cts +37 -37
  18. package/dist/deid/index.d.ts +37 -37
  19. package/dist/deid/index.mjs +15 -15
  20. package/dist/deid/index.mjs.map +1 -1
  21. package/dist/{example-codes-DeXcnCSK.d.cts → example-codes-88f3_bQZ.d.cts} +8 -8
  22. package/dist/{example-codes-DeXcnCSK.d.ts → example-codes-88f3_bQZ.d.ts} +8 -8
  23. package/dist/fhir/index.cjs +12 -12
  24. package/dist/fhir/index.cjs.map +1 -1
  25. package/dist/fhir/index.d.cts +46 -46
  26. package/dist/fhir/index.d.ts +46 -46
  27. package/dist/fhir/index.mjs +12 -12
  28. package/dist/fhir/index.mjs.map +1 -1
  29. package/dist/hl7/index.cjs +6 -6
  30. package/dist/hl7/index.cjs.map +1 -1
  31. package/dist/hl7/index.d.cts +45 -45
  32. package/dist/hl7/index.d.ts +45 -45
  33. package/dist/hl7/index.mjs +6 -6
  34. package/dist/hl7/index.mjs.map +1 -1
  35. package/dist/index.cjs +9 -9
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +49 -49
  38. package/dist/index.d.ts +49 -49
  39. package/dist/index.mjs +9 -9
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/ncpdp/index.cjs +3 -3
  42. package/dist/ncpdp/index.cjs.map +1 -1
  43. package/dist/ncpdp/index.d.cts +42 -42
  44. package/dist/ncpdp/index.d.ts +42 -42
  45. package/dist/ncpdp/index.mjs +3 -3
  46. package/dist/ncpdp/index.mjs.map +1 -1
  47. package/dist/{providers-OLz3zAc-.d.cts → providers-B9uVinAe.d.cts} +24 -24
  48. package/dist/{providers-OLz3zAc-.d.ts → providers-B9uVinAe.d.ts} +24 -24
  49. package/dist/{quirk-C9t9CkPS.d.ts → quirk-HZdznAkM.d.ts} +23 -23
  50. package/dist/{quirk-DYMDojVw.d.cts → quirk-IaHp4z7N.d.cts} +23 -23
  51. package/dist/x12/index.cjs +6 -6
  52. package/dist/x12/index.cjs.map +1 -1
  53. package/dist/x12/index.d.cts +44 -44
  54. package/dist/x12/index.d.ts +44 -44
  55. package/dist/x12/index.mjs +6 -6
  56. package/dist/x12/index.mjs.map +1 -1
  57. package/package.json +3 -2
@@ -1,15 +1,15 @@
1
- import { S as SyntheticName, a as SyntheticIdentifier, R as Rng, C as Corpus } from '../providers-OLz3zAc-.cjs';
1
+ import { S as SyntheticName, a as SyntheticIdentifier, R as Rng, C as Corpus } from '../providers-B9uVinAe.cjs';
2
2
  import { CcdaDocument, BuildCcdaPatient, BuildCode, BuildQuantity } from '@cosyte/ccda';
3
- import { C as CodeConcept, Q as QuantConcept } from '../example-codes-DeXcnCSK.cjs';
4
- import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-DYMDojVw.cjs';
3
+ import { C as CodeConcept, Q as QuantConcept } from '../example-codes-88f3_bQZ.cjs';
4
+ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-IaHp4z7N.cjs';
5
5
 
6
6
  /**
7
- * Synthetic **C-CDA document generation** — a spec-clean Continuity of Care Document
7
+ * Synthetic **C-CDA document generation**: a spec-clean Continuity of Care Document
8
8
  * (CCD) or Referral Note built **through `@cosyte/ccda`'s `buildCcda`**, so template IDs, LOINC section
9
9
  * codes, and structured/narrative agreement are the builder's own (spec-clean *by construction*), and
10
10
  * every `recordTarget` / clinical identifier is drawn from the synthetic-safety providers.
11
11
  *
12
- * The document round-trips through `parseCcda` with **zero warnings** — the builder's round-trip-by-
12
+ * The document round-trips through `parseCcda` with **zero warnings**: the builder's round-trip-by-
13
13
  * construction guarantee, re-verified independently by {@link ./round-trip.roundTrip}. Coverage tracks
14
14
  * `buildCcda`'s section/doc-type maturity: the CCD SHALL sections (Problems,
15
15
  * Allergies, Medications, Results, Vital Signs) plus Immunizations, Procedures, and Social History
@@ -19,11 +19,11 @@ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as Quirk
19
19
  * @module
20
20
  */
21
21
 
22
- /** The C-CDA document type a generator emits — the two `buildCcda` supports. */
22
+ /** The C-CDA document type a generator emits: the two `buildCcda` supports. */
23
23
  type CcdaDocumentType = "ccd" | "referralNote";
24
24
  /** Options common to every C-CDA generator. */
25
25
  interface GenerateCcdaOptions {
26
- /** The seed (deterministic — same seed yields a byte-identical document). Defaults to `0`. */
26
+ /** The seed (deterministic: same seed yields a byte-identical document). Defaults to `0`. */
27
27
  readonly seed?: number;
28
28
  /** The document type to emit. Defaults to `"ccd"`. */
29
29
  readonly documentType?: CcdaDocumentType;
@@ -56,7 +56,7 @@ declare function generateCcda(options?: GenerateCcdaOptions): CcdaDocument;
56
56
  */
57
57
  declare function generateCcd(options?: Omit<GenerateCcdaOptions, "documentType">): CcdaDocument;
58
58
  /**
59
- * Generate a spec-clean synthetic **Referral Note** — the second document type `buildCcda` supports,
59
+ * Generate a spec-clean synthetic **Referral Note**: the second document type `buildCcda` supports,
60
60
  * with its own US Realm Header specialization and Reason-for-Referral / Assessment narrative sections.
61
61
  *
62
62
  * @param options - Seed (deterministic). See {@link GenerateCcdaOptions}.
@@ -70,14 +70,14 @@ declare function generateCcd(options?: Omit<GenerateCcdaOptions, "documentType">
70
70
  declare function generateReferralNote(options?: Omit<GenerateCcdaOptions, "documentType">): CcdaDocument;
71
71
 
72
72
  /**
73
- * The **round-trip-through-the-parser harness** for C-CDA — the headline gate for the synthetic-fixture
74
- * generator. A generated document is "spec-clean" only if `@cosyte/ccda` — not
75
- * `@cosyte/synth`'s own opinion — reads it back cleanly. This harness serializes a generated document,
73
+ * The **round-trip-through-the-parser harness** for C-CDA: the headline gate for the synthetic-fixture
74
+ * generator. A generated document is "spec-clean" only if `@cosyte/ccda`, not
75
+ * `@cosyte/synth`'s own opinion, reads it back cleanly. This harness serializes a generated document,
76
76
  * parses it straight back through `parseCcda`, and reports what the parser found, so a false
77
77
  * "spec-clean" claim cannot hide.
78
78
  *
79
79
  * `@cosyte/ccda`'s `buildCcda` is round-trip-by-construction (it emits through the same DOM the parser
80
- * reads), so a clean build carries zero warnings — but this harness re-verifies that *independently*,
80
+ * reads), so a clean build carries zero warnings, but this harness re-verifies that *independently*,
81
81
  * against the parser, because the parser is the judge.
82
82
  *
83
83
  * @module
@@ -110,19 +110,19 @@ interface RoundTripResult {
110
110
  declare function roundTrip(doc: CcdaDocument): RoundTripResult;
111
111
 
112
112
  /**
113
- * Synthetic C-CDA patient identity — the `recordTarget` demographics for a generated document, every
113
+ * Synthetic C-CDA patient identity: the `recordTarget` demographics for a generated document, every
114
114
  * field minted from the synthetic-safety providers in `../safe`. No value a generated
115
115
  * C-CDA carries at a PHI locus can be real or plausibly-real: the name is from the shipped fake-name
116
116
  * pool, the MRN lives under the synthetic assigning-authority OID (never a real facility namespace),
117
117
  * and the birth date comes from the seeded generator (never wall-clock).
118
118
  *
119
- * The draw order is **fixed** (name → MRN → DOB → gender) so the same seed yields the same identity —
119
+ * The draw order is **fixed** (name → MRN → DOB → gender) so the same seed yields the same identity,
120
120
  * the reproducibility contract.
121
121
  *
122
122
  * @module
123
123
  */
124
124
 
125
- /** A synthetic C-CDA patient identity — the values threaded into a document's `recordTarget`. */
125
+ /** A synthetic C-CDA patient identity: the values threaded into a document's `recordTarget`. */
126
126
  interface CcdaPatientIdentity {
127
127
  /** The `BuildCcdaPatient` `@cosyte/ccda` consumes for the single `recordTarget`. */
128
128
  readonly patient: BuildCcdaPatient;
@@ -133,7 +133,7 @@ interface CcdaPatientIdentity {
133
133
  }
134
134
  /**
135
135
  * Mint a complete synthetic {@link CcdaPatientIdentity}. Every value comes from a synthetic-safety
136
- * provider — no code path here can return a real identifier. The MRN is scoped to the
136
+ * provider, no code path here can return a real identifier. The MRN is scoped to the
137
137
  * synthetic assigning-authority OID (`mrnRoot`), so it is non-colliding by *namespace*, not by value.
138
138
  *
139
139
  * @param rng - The seeded generator.
@@ -148,12 +148,12 @@ interface CcdaPatientIdentity {
148
148
  declare function ccdaPatientIdentity(rng: Rng): CcdaPatientIdentity;
149
149
 
150
150
  /**
151
- * The C-CDA example-code pool — a thin adapter that **reuses** the same license-clean, public
151
+ * The C-CDA example-code pool: a thin adapter that **reuses** the same license-clean, public
152
152
  * code facts the FHIR generators ship (`../fhir/example-codes.ts`), reshaped into `@cosyte/ccda`'s
153
153
  * `BuildCode` tuple (an OID `codeSystem` instead of a FHIR `system` URI). Reusing one source of truth
154
154
  * keeps the LOINC / RxNorm / SNOMED / CVX pools consistent across the FHIR and C-CDA surfaces;
155
155
  * `@cosyte/synth` still bundles
156
- * **no** terminology content — these are public spec-example codes, not copyrighted tables.
156
+ * **no** terminology content: these are public spec-example codes, not copyrighted tables.
157
157
  *
158
158
  * Nothing here is PHI: codes and their display text are not patient identifiers. The synthetic-safety
159
159
  * invariant governs identity fields (name / DOB / MRN / telecom), which come from `../safe`.
@@ -178,7 +178,7 @@ declare function ccdaPatientIdentity(rng: Rng): CcdaPatientIdentity;
178
178
  */
179
179
  declare function toBuildCode(concept: CodeConcept): BuildCode;
180
180
  /**
181
- * Draw a synthetic-but-structurally-sane {@link BuildQuantity} for a quantitative concept — a value in
181
+ * Draw a synthetic-but-structurally-sane {@link BuildQuantity} for a quantitative concept: a value in
182
182
  * the concept's plausible band (from the seeded generator, so reproducible) rendered to the concept's
183
183
  * decimal precision, with its UCUM unit. The value implies **no** real measurement.
184
184
  *
@@ -225,7 +225,7 @@ declare const ROUTES: readonly BuildCode[];
225
225
  /**
226
226
  * C-CDA **vendor-quirk generation**. A quirk deviates the
227
227
  * *structure* of an otherwise spec-clean document (built through `@cosyte/ccda`'s `buildCcda`) so it
228
- * round-trips through `parseCcda` to **exactly** one intended, stable warning code — the tolerance a
228
+ * round-trips through `parseCcda` to **exactly** one intended, stable warning code: the tolerance a
229
229
  * `defineCcdaProfile` profile encodes. With the matching built-in profile active, that warning is
230
230
  * **re-badged** to the value-free `PROFILE_QUIRK_APPLIED` marker (`expected: true`, `toleratedCode` = the
231
231
  * original), exactly as the parser's `profileQuirkApplied` does.
@@ -234,14 +234,14 @@ declare const ROUTES: readonly BuildCode[];
234
234
  * publicly grounded and re-badged by a built-in public profile:
235
235
  *
236
236
  * - **`template-extension-absent`** → `TEMPLATE_EXTENSION_ABSENT` (profile `legacyR11`). The R2.1
237
- * `@extension="2015-08-01"` version stamp is dropped from the document-type templateId — a legacy
237
+ * `@extension="2015-08-01"` version stamp is dropped from the document-type templateId: a legacy
238
238
  * R1.1-era document shape.
239
239
  * - **`deprecated-loinc`** → `DEPRECATED_LOINC` (profile `smartScorecard`). A result/vital observation
240
240
  * LOINC code is swapped to a known-deprecated LOINC (`41909-3`).
241
241
  * - **`deprecated-code-system`** → `DEPRECATED_CODE_SYSTEM` (profile `smartScorecard`). A problem
242
242
  * observation's value is swapped to a deprecated code system (ICD-9-CM `2.16.840.1.113883.6.103`).
243
243
  *
244
- * A quirk **never** introduces a real-looking value — it changes a template stamp or a code, never a PHI
244
+ * A quirk **never** introduces a real-looking value: it changes a template stamp or a code, never a PHI
245
245
  * locus, so the synthetic-safety gate still runs and stays zero.
246
246
  *
247
247
  * @module
@@ -249,11 +249,11 @@ declare const ROUTES: readonly BuildCode[];
249
249
 
250
250
  /** Every C-CDA quirk this package ships. */
251
251
  type CcdaQuirkName = "template-extension-absent" | "deprecated-loinc" | "deprecated-code-system";
252
- /** The C-CDA quirk registry — each recipe bound to the exact `@cosyte/ccda` warning code it targets. */
252
+ /** The C-CDA quirk registry: each recipe bound to the exact `@cosyte/ccda` warning code it targets. */
253
253
  declare const CCDA_QUIRKS: Readonly<Record<CcdaQuirkName, QuirkDescriptor>>;
254
254
  /**
255
255
  * Apply a C-CDA quirk transform to a spec-clean document, or **fail closed**. Refuses to return a
256
- * document that does not carry the intended deviation (a quirk whose structural anchor is absent) —
256
+ * document that does not carry the intended deviation (a quirk whose structural anchor is absent):
257
257
  * a fixture that silently lost its quirk would test the wrong thing.
258
258
  *
259
259
  * @param quirk - The quirk to inject.
@@ -270,7 +270,7 @@ declare const CCDA_QUIRKS: Readonly<Record<CcdaQuirkName, QuirkDescriptor>>;
270
270
  declare function injectCcdaQuirk(quirk: CcdaQuirkName, cleanXml: string): string;
271
271
  /** Options for {@link generateCcdaQuirk}. */
272
272
  interface GenerateCcdaQuirkOptions {
273
- /** The seed — the same seed + quirk yields a byte-identical document. Defaults to `0`. */
273
+ /** The seed: the same seed + quirk yields a byte-identical document. Defaults to `0`. */
274
274
  readonly seed?: number;
275
275
  /** The quirk to inject. Required. */
276
276
  readonly quirk: CcdaQuirkName;
@@ -283,14 +283,14 @@ interface GenerateCcdaQuirkOptions {
283
283
  * `quirk` + `documentType`.
284
284
  *
285
285
  * @param options - Seed, quirk, and base document type. See {@link GenerateCcdaQuirkOptions}.
286
- * @returns The {@link QuirkArtifact} — its `content` round-trips to `intendedWarnings` exactly.
286
+ * @returns The {@link QuirkArtifact}: its `content` round-trips to `intendedWarnings` exactly.
287
287
  * @throws SynthError `SYNTH_UNSUPPORTED_QUIRK` if `quirk` is not a supported C-CDA quirk.
288
288
  * @throws Error if the base document does not contain the structural anchor the quirk targets.
289
289
  * @example
290
290
  * ```ts
291
291
  * import { generateCcdaQuirk, ccdaQuirkRoundTrip } from "@cosyte/synth/ccda";
292
292
  * const rt = ccdaQuirkRoundTrip(generateCcdaQuirk({ seed: 1, quirk: "deprecated-loinc" }));
293
- * rt.withProfile?.tolerated; // true — `smartScorecard` re-badges DEPRECATED_LOINC
293
+ * rt.withProfile?.tolerated; // true, `smartScorecard` re-badges DEPRECATED_LOINC
294
294
  * ```
295
295
  */
296
296
  declare function generateCcdaQuirk(options: GenerateCcdaQuirkOptions): QuirkArtifact;
@@ -338,11 +338,11 @@ declare function ccdaQuirkCorpus(options: CcdaQuirkCorpusOptions): Corpus;
338
338
  declare const ccdaQuirkProfile: SynthProfile;
339
339
 
340
340
  /**
341
- * `@cosyte/synth/ccda` — the C-CDA generation surface, exposed as its own subpath so importing the
341
+ * `@cosyte/synth/ccda`: the C-CDA generation surface, exposed as its own subpath so importing the
342
342
  * package root does **not** pull `@cosyte/ccda`. This is the **lazy, per-format** boundary: a consumer
343
343
  * who only needs C-CDA fixtures imports `@cosyte/synth/ccda`; one who needs only the core primitives
344
344
  * never loads a parser.
345
- * `@cosyte/ccda` is an **optional peer dependency** — present only for this subpath.
345
+ * `@cosyte/ccda` is an **optional peer dependency**, present only for this subpath.
346
346
  *
347
347
  * This subpath ships spec-clean C-CDA document generation via `@cosyte/ccda`'s
348
348
  * `buildCcda`: a **CCD** (`generateCcd`) and a **Referral Note** (`generateReferralNote`), each built
@@ -352,7 +352,7 @@ declare const ccdaQuirkProfile: SynthProfile;
352
352
  * @module
353
353
  */
354
354
 
355
- /** Every C-CDA document kind {@link ccdaCorpus} generates — the `documentType` used as the corpus `kind`. */
355
+ /** Every C-CDA document kind {@link ccdaCorpus} generates: the `documentType` used as the corpus `kind`. */
356
356
  type CcdaCorpusKind = CcdaDocumentType;
357
357
  /** Options for {@link ccdaCorpus}. */
358
358
  interface CcdaCorpusOptions {
@@ -374,7 +374,7 @@ interface CcdaCorpusOptions {
374
374
  * ```ts
375
375
  * import { ccdaCorpus } from "@cosyte/synth/ccda";
376
376
  * const corpus = ccdaCorpus({ seed: 42, count: 4 });
377
- * corpus.artifacts.every((a) => a.warnings.length === 0); // true — spec-clean
377
+ * corpus.artifacts.every((a) => a.warnings.length === 0); // true, spec-clean
378
378
  * ```
379
379
  */
380
380
  declare function ccdaCorpus(options: CcdaCorpusOptions): Corpus;
@@ -1,15 +1,15 @@
1
- import { S as SyntheticName, a as SyntheticIdentifier, R as Rng, C as Corpus } from '../providers-OLz3zAc-.js';
1
+ import { S as SyntheticName, a as SyntheticIdentifier, R as Rng, C as Corpus } from '../providers-B9uVinAe.js';
2
2
  import { CcdaDocument, BuildCcdaPatient, BuildCode, BuildQuantity } from '@cosyte/ccda';
3
- import { C as CodeConcept, Q as QuantConcept } from '../example-codes-DeXcnCSK.js';
4
- import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-C9t9CkPS.js';
3
+ import { C as CodeConcept, Q as QuantConcept } from '../example-codes-88f3_bQZ.js';
4
+ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-HZdznAkM.js';
5
5
 
6
6
  /**
7
- * Synthetic **C-CDA document generation** — a spec-clean Continuity of Care Document
7
+ * Synthetic **C-CDA document generation**: a spec-clean Continuity of Care Document
8
8
  * (CCD) or Referral Note built **through `@cosyte/ccda`'s `buildCcda`**, so template IDs, LOINC section
9
9
  * codes, and structured/narrative agreement are the builder's own (spec-clean *by construction*), and
10
10
  * every `recordTarget` / clinical identifier is drawn from the synthetic-safety providers.
11
11
  *
12
- * The document round-trips through `parseCcda` with **zero warnings** — the builder's round-trip-by-
12
+ * The document round-trips through `parseCcda` with **zero warnings**: the builder's round-trip-by-
13
13
  * construction guarantee, re-verified independently by {@link ./round-trip.roundTrip}. Coverage tracks
14
14
  * `buildCcda`'s section/doc-type maturity: the CCD SHALL sections (Problems,
15
15
  * Allergies, Medications, Results, Vital Signs) plus Immunizations, Procedures, and Social History
@@ -19,11 +19,11 @@ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as Quirk
19
19
  * @module
20
20
  */
21
21
 
22
- /** The C-CDA document type a generator emits — the two `buildCcda` supports. */
22
+ /** The C-CDA document type a generator emits: the two `buildCcda` supports. */
23
23
  type CcdaDocumentType = "ccd" | "referralNote";
24
24
  /** Options common to every C-CDA generator. */
25
25
  interface GenerateCcdaOptions {
26
- /** The seed (deterministic — same seed yields a byte-identical document). Defaults to `0`. */
26
+ /** The seed (deterministic: same seed yields a byte-identical document). Defaults to `0`. */
27
27
  readonly seed?: number;
28
28
  /** The document type to emit. Defaults to `"ccd"`. */
29
29
  readonly documentType?: CcdaDocumentType;
@@ -56,7 +56,7 @@ declare function generateCcda(options?: GenerateCcdaOptions): CcdaDocument;
56
56
  */
57
57
  declare function generateCcd(options?: Omit<GenerateCcdaOptions, "documentType">): CcdaDocument;
58
58
  /**
59
- * Generate a spec-clean synthetic **Referral Note** — the second document type `buildCcda` supports,
59
+ * Generate a spec-clean synthetic **Referral Note**: the second document type `buildCcda` supports,
60
60
  * with its own US Realm Header specialization and Reason-for-Referral / Assessment narrative sections.
61
61
  *
62
62
  * @param options - Seed (deterministic). See {@link GenerateCcdaOptions}.
@@ -70,14 +70,14 @@ declare function generateCcd(options?: Omit<GenerateCcdaOptions, "documentType">
70
70
  declare function generateReferralNote(options?: Omit<GenerateCcdaOptions, "documentType">): CcdaDocument;
71
71
 
72
72
  /**
73
- * The **round-trip-through-the-parser harness** for C-CDA — the headline gate for the synthetic-fixture
74
- * generator. A generated document is "spec-clean" only if `@cosyte/ccda` — not
75
- * `@cosyte/synth`'s own opinion — reads it back cleanly. This harness serializes a generated document,
73
+ * The **round-trip-through-the-parser harness** for C-CDA: the headline gate for the synthetic-fixture
74
+ * generator. A generated document is "spec-clean" only if `@cosyte/ccda`, not
75
+ * `@cosyte/synth`'s own opinion, reads it back cleanly. This harness serializes a generated document,
76
76
  * parses it straight back through `parseCcda`, and reports what the parser found, so a false
77
77
  * "spec-clean" claim cannot hide.
78
78
  *
79
79
  * `@cosyte/ccda`'s `buildCcda` is round-trip-by-construction (it emits through the same DOM the parser
80
- * reads), so a clean build carries zero warnings — but this harness re-verifies that *independently*,
80
+ * reads), so a clean build carries zero warnings, but this harness re-verifies that *independently*,
81
81
  * against the parser, because the parser is the judge.
82
82
  *
83
83
  * @module
@@ -110,19 +110,19 @@ interface RoundTripResult {
110
110
  declare function roundTrip(doc: CcdaDocument): RoundTripResult;
111
111
 
112
112
  /**
113
- * Synthetic C-CDA patient identity — the `recordTarget` demographics for a generated document, every
113
+ * Synthetic C-CDA patient identity: the `recordTarget` demographics for a generated document, every
114
114
  * field minted from the synthetic-safety providers in `../safe`. No value a generated
115
115
  * C-CDA carries at a PHI locus can be real or plausibly-real: the name is from the shipped fake-name
116
116
  * pool, the MRN lives under the synthetic assigning-authority OID (never a real facility namespace),
117
117
  * and the birth date comes from the seeded generator (never wall-clock).
118
118
  *
119
- * The draw order is **fixed** (name → MRN → DOB → gender) so the same seed yields the same identity —
119
+ * The draw order is **fixed** (name → MRN → DOB → gender) so the same seed yields the same identity,
120
120
  * the reproducibility contract.
121
121
  *
122
122
  * @module
123
123
  */
124
124
 
125
- /** A synthetic C-CDA patient identity — the values threaded into a document's `recordTarget`. */
125
+ /** A synthetic C-CDA patient identity: the values threaded into a document's `recordTarget`. */
126
126
  interface CcdaPatientIdentity {
127
127
  /** The `BuildCcdaPatient` `@cosyte/ccda` consumes for the single `recordTarget`. */
128
128
  readonly patient: BuildCcdaPatient;
@@ -133,7 +133,7 @@ interface CcdaPatientIdentity {
133
133
  }
134
134
  /**
135
135
  * Mint a complete synthetic {@link CcdaPatientIdentity}. Every value comes from a synthetic-safety
136
- * provider — no code path here can return a real identifier. The MRN is scoped to the
136
+ * provider, no code path here can return a real identifier. The MRN is scoped to the
137
137
  * synthetic assigning-authority OID (`mrnRoot`), so it is non-colliding by *namespace*, not by value.
138
138
  *
139
139
  * @param rng - The seeded generator.
@@ -148,12 +148,12 @@ interface CcdaPatientIdentity {
148
148
  declare function ccdaPatientIdentity(rng: Rng): CcdaPatientIdentity;
149
149
 
150
150
  /**
151
- * The C-CDA example-code pool — a thin adapter that **reuses** the same license-clean, public
151
+ * The C-CDA example-code pool: a thin adapter that **reuses** the same license-clean, public
152
152
  * code facts the FHIR generators ship (`../fhir/example-codes.ts`), reshaped into `@cosyte/ccda`'s
153
153
  * `BuildCode` tuple (an OID `codeSystem` instead of a FHIR `system` URI). Reusing one source of truth
154
154
  * keeps the LOINC / RxNorm / SNOMED / CVX pools consistent across the FHIR and C-CDA surfaces;
155
155
  * `@cosyte/synth` still bundles
156
- * **no** terminology content — these are public spec-example codes, not copyrighted tables.
156
+ * **no** terminology content: these are public spec-example codes, not copyrighted tables.
157
157
  *
158
158
  * Nothing here is PHI: codes and their display text are not patient identifiers. The synthetic-safety
159
159
  * invariant governs identity fields (name / DOB / MRN / telecom), which come from `../safe`.
@@ -178,7 +178,7 @@ declare function ccdaPatientIdentity(rng: Rng): CcdaPatientIdentity;
178
178
  */
179
179
  declare function toBuildCode(concept: CodeConcept): BuildCode;
180
180
  /**
181
- * Draw a synthetic-but-structurally-sane {@link BuildQuantity} for a quantitative concept — a value in
181
+ * Draw a synthetic-but-structurally-sane {@link BuildQuantity} for a quantitative concept: a value in
182
182
  * the concept's plausible band (from the seeded generator, so reproducible) rendered to the concept's
183
183
  * decimal precision, with its UCUM unit. The value implies **no** real measurement.
184
184
  *
@@ -225,7 +225,7 @@ declare const ROUTES: readonly BuildCode[];
225
225
  /**
226
226
  * C-CDA **vendor-quirk generation**. A quirk deviates the
227
227
  * *structure* of an otherwise spec-clean document (built through `@cosyte/ccda`'s `buildCcda`) so it
228
- * round-trips through `parseCcda` to **exactly** one intended, stable warning code — the tolerance a
228
+ * round-trips through `parseCcda` to **exactly** one intended, stable warning code: the tolerance a
229
229
  * `defineCcdaProfile` profile encodes. With the matching built-in profile active, that warning is
230
230
  * **re-badged** to the value-free `PROFILE_QUIRK_APPLIED` marker (`expected: true`, `toleratedCode` = the
231
231
  * original), exactly as the parser's `profileQuirkApplied` does.
@@ -234,14 +234,14 @@ declare const ROUTES: readonly BuildCode[];
234
234
  * publicly grounded and re-badged by a built-in public profile:
235
235
  *
236
236
  * - **`template-extension-absent`** → `TEMPLATE_EXTENSION_ABSENT` (profile `legacyR11`). The R2.1
237
- * `@extension="2015-08-01"` version stamp is dropped from the document-type templateId — a legacy
237
+ * `@extension="2015-08-01"` version stamp is dropped from the document-type templateId: a legacy
238
238
  * R1.1-era document shape.
239
239
  * - **`deprecated-loinc`** → `DEPRECATED_LOINC` (profile `smartScorecard`). A result/vital observation
240
240
  * LOINC code is swapped to a known-deprecated LOINC (`41909-3`).
241
241
  * - **`deprecated-code-system`** → `DEPRECATED_CODE_SYSTEM` (profile `smartScorecard`). A problem
242
242
  * observation's value is swapped to a deprecated code system (ICD-9-CM `2.16.840.1.113883.6.103`).
243
243
  *
244
- * A quirk **never** introduces a real-looking value — it changes a template stamp or a code, never a PHI
244
+ * A quirk **never** introduces a real-looking value: it changes a template stamp or a code, never a PHI
245
245
  * locus, so the synthetic-safety gate still runs and stays zero.
246
246
  *
247
247
  * @module
@@ -249,11 +249,11 @@ declare const ROUTES: readonly BuildCode[];
249
249
 
250
250
  /** Every C-CDA quirk this package ships. */
251
251
  type CcdaQuirkName = "template-extension-absent" | "deprecated-loinc" | "deprecated-code-system";
252
- /** The C-CDA quirk registry — each recipe bound to the exact `@cosyte/ccda` warning code it targets. */
252
+ /** The C-CDA quirk registry: each recipe bound to the exact `@cosyte/ccda` warning code it targets. */
253
253
  declare const CCDA_QUIRKS: Readonly<Record<CcdaQuirkName, QuirkDescriptor>>;
254
254
  /**
255
255
  * Apply a C-CDA quirk transform to a spec-clean document, or **fail closed**. Refuses to return a
256
- * document that does not carry the intended deviation (a quirk whose structural anchor is absent) —
256
+ * document that does not carry the intended deviation (a quirk whose structural anchor is absent):
257
257
  * a fixture that silently lost its quirk would test the wrong thing.
258
258
  *
259
259
  * @param quirk - The quirk to inject.
@@ -270,7 +270,7 @@ declare const CCDA_QUIRKS: Readonly<Record<CcdaQuirkName, QuirkDescriptor>>;
270
270
  declare function injectCcdaQuirk(quirk: CcdaQuirkName, cleanXml: string): string;
271
271
  /** Options for {@link generateCcdaQuirk}. */
272
272
  interface GenerateCcdaQuirkOptions {
273
- /** The seed — the same seed + quirk yields a byte-identical document. Defaults to `0`. */
273
+ /** The seed: the same seed + quirk yields a byte-identical document. Defaults to `0`. */
274
274
  readonly seed?: number;
275
275
  /** The quirk to inject. Required. */
276
276
  readonly quirk: CcdaQuirkName;
@@ -283,14 +283,14 @@ interface GenerateCcdaQuirkOptions {
283
283
  * `quirk` + `documentType`.
284
284
  *
285
285
  * @param options - Seed, quirk, and base document type. See {@link GenerateCcdaQuirkOptions}.
286
- * @returns The {@link QuirkArtifact} — its `content` round-trips to `intendedWarnings` exactly.
286
+ * @returns The {@link QuirkArtifact}: its `content` round-trips to `intendedWarnings` exactly.
287
287
  * @throws SynthError `SYNTH_UNSUPPORTED_QUIRK` if `quirk` is not a supported C-CDA quirk.
288
288
  * @throws Error if the base document does not contain the structural anchor the quirk targets.
289
289
  * @example
290
290
  * ```ts
291
291
  * import { generateCcdaQuirk, ccdaQuirkRoundTrip } from "@cosyte/synth/ccda";
292
292
  * const rt = ccdaQuirkRoundTrip(generateCcdaQuirk({ seed: 1, quirk: "deprecated-loinc" }));
293
- * rt.withProfile?.tolerated; // true — `smartScorecard` re-badges DEPRECATED_LOINC
293
+ * rt.withProfile?.tolerated; // true, `smartScorecard` re-badges DEPRECATED_LOINC
294
294
  * ```
295
295
  */
296
296
  declare function generateCcdaQuirk(options: GenerateCcdaQuirkOptions): QuirkArtifact;
@@ -338,11 +338,11 @@ declare function ccdaQuirkCorpus(options: CcdaQuirkCorpusOptions): Corpus;
338
338
  declare const ccdaQuirkProfile: SynthProfile;
339
339
 
340
340
  /**
341
- * `@cosyte/synth/ccda` — the C-CDA generation surface, exposed as its own subpath so importing the
341
+ * `@cosyte/synth/ccda`: the C-CDA generation surface, exposed as its own subpath so importing the
342
342
  * package root does **not** pull `@cosyte/ccda`. This is the **lazy, per-format** boundary: a consumer
343
343
  * who only needs C-CDA fixtures imports `@cosyte/synth/ccda`; one who needs only the core primitives
344
344
  * never loads a parser.
345
- * `@cosyte/ccda` is an **optional peer dependency** — present only for this subpath.
345
+ * `@cosyte/ccda` is an **optional peer dependency**, present only for this subpath.
346
346
  *
347
347
  * This subpath ships spec-clean C-CDA document generation via `@cosyte/ccda`'s
348
348
  * `buildCcda`: a **CCD** (`generateCcd`) and a **Referral Note** (`generateReferralNote`), each built
@@ -352,7 +352,7 @@ declare const ccdaQuirkProfile: SynthProfile;
352
352
  * @module
353
353
  */
354
354
 
355
- /** Every C-CDA document kind {@link ccdaCorpus} generates — the `documentType` used as the corpus `kind`. */
355
+ /** Every C-CDA document kind {@link ccdaCorpus} generates: the `documentType` used as the corpus `kind`. */
356
356
  type CcdaCorpusKind = CcdaDocumentType;
357
357
  /** Options for {@link ccdaCorpus}. */
358
358
  interface CcdaCorpusOptions {
@@ -374,7 +374,7 @@ interface CcdaCorpusOptions {
374
374
  * ```ts
375
375
  * import { ccdaCorpus } from "@cosyte/synth/ccda";
376
376
  * const corpus = ccdaCorpus({ seed: 42, count: 4 });
377
- * corpus.artifacts.every((a) => a.warnings.length === 0); // true — spec-clean
377
+ * corpus.artifacts.every((a) => a.warnings.length === 0); // true, spec-clean
378
378
  * ```
379
379
  */
380
380
  declare function ccdaCorpus(options: CcdaCorpusOptions): Corpus;
@@ -32,32 +32,32 @@ function sfc32Next(s) {
32
32
  // src/codes.ts
33
33
  var SYNTH_FATAL_CODES = {
34
34
  /**
35
- * A vendor quirk was requested that the target format's profile system does not support. Fatal —
35
+ * A vendor quirk was requested that the target format's profile system does not support. Fatal,
36
36
  * never a silent no-op and never a fabricated quirk.
37
37
  */
38
38
  SYNTH_UNSUPPORTED_QUIRK: "SYNTH_UNSUPPORTED_QUIRK",
39
39
  /**
40
40
  * A quirk transform found no structural anchor to mutate, so the fixture would not carry the
41
- * deviation it is labelled with. Fatal — a golden file that lies about its parser verdict is worse
41
+ * deviation it is labelled with. Fatal: a golden file that lies about its parser verdict is worse
42
42
  * than no golden file.
43
43
  */
44
44
  SYNTH_QUIRK_ANCHOR_ABSENT: "SYNTH_QUIRK_ANCHOR_ABSENT",
45
45
  /**
46
46
  * A bare parse of a freshly-generated quirk artifact did not produce exactly the declared intended
47
- * warning code(s). Fatal — never emit a mislabeled fixture.
47
+ * warning code(s). Fatal, never emit a mislabeled fixture.
48
48
  */
49
49
  SYNTH_INTENDED_WARNING_MISMATCH: "SYNTH_INTENDED_WARNING_MISMATCH",
50
50
  /** A concept's code-system URI has no OID mapping in the C-CDA example-code table. Fatal. */
51
51
  SYNTH_UNMAPPED_CODE_SYSTEM: "SYNTH_UNMAPPED_CODE_SYSTEM",
52
52
  /** An integer range was requested with its maximum below its minimum. Fatal. */
53
53
  SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE",
54
- /** A value was drawn from an empty pool. Fatal — never a fabricated substitute. */
54
+ /** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
55
55
  SYNTH_EMPTY_POOL: "SYNTH_EMPTY_POOL",
56
56
  /** A `defineSynthProfile` spec was not usable (a missing or blank `name`). Fatal. */
57
57
  SYNTH_INVALID_PROFILE: "SYNTH_INVALID_PROFILE",
58
58
  /**
59
59
  * A caller-supplied selector (a message kind, a document type, a corpus mix entry, a claim
60
- * variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal —
60
+ * variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal:
61
61
  * see `resolveKind`: a selector union is erased at run time, and a selector that falls through
62
62
  * either mislabels the fixture or hands the value to a peer builder that quotes it back.
63
63
  */
@@ -151,7 +151,7 @@ function makeCorpus(seed, artifacts, quirks = []) {
151
151
  var SYNTHETIC_ASSIGNING_AUTHORITY = Object.freeze({
152
152
  /** The human-readable assigning-authority namespace id (HL7 HD.1). */
153
153
  namespaceId: "COSYTE-SYNTH",
154
- /** The universal id — an OID under HL7's example arc `2.16.840.1.113883.19` (HD.2). */
154
+ /** The universal id, an OID under HL7's example arc `2.16.840.1.113883.19` (HD.2). */
155
155
  universalId: "2.16.840.1.113883.19.999",
156
156
  /** The universal id type (HD.3). */
157
157
  universalIdType: "ISO"
@@ -433,23 +433,23 @@ var SYSTEM = Object.freeze({
433
433
  IDENTIFIER_TYPE: "http://terminology.hl7.org/CodeSystem/v2-0203",
434
434
  /** OMB race & ethnicity category system (US Core race/ethnicity `ombCategory`). */
435
435
  OMB_RACE_ETHNICITY: "urn:oid:2.16.840.1.113883.6.238",
436
- /** LOINC — `Observation.code` (lab + vital-signs). */
436
+ /** LOINC, `Observation.code` (lab + vital-signs). */
437
437
  LOINC: "http://loinc.org",
438
- /** SNOMED CT — `Condition.code`. */
438
+ /** SNOMED CT, `Condition.code`. */
439
439
  SNOMED: "http://snomed.info/sct",
440
- /** RxNorm — `MedicationRequest.medicationCodeableConcept` + an allergen substance. */
440
+ /** RxNorm, `MedicationRequest.medicationCodeableConcept` + an allergen substance. */
441
441
  RXNORM: "http://www.nlm.nih.gov/research/umls/rxnorm",
442
- /** UCUM — `Quantity.system` for units of measure. */
442
+ /** UCUM, `Quantity.system` for units of measure. */
443
443
  UCUM: "http://unitsofmeasure.org",
444
- /** CVX (CDC vaccine administered) — `Immunization.vaccineCode`. */
444
+ /** CVX (CDC vaccine administered), `Immunization.vaccineCode`. */
445
445
  CVX: "http://hl7.org/fhir/sid/cvx",
446
- /** HL7 v3 `ActCode` — `Encounter.class`. */
446
+ /** HL7 v3 `ActCode`, `Encounter.class`. */
447
447
  V3_ACT_CODE: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
448
- /** HL7 v2 `0074` diagnostic-service-section — `DiagnosticReport.category` (`LAB`). */
448
+ /** HL7 v2 `0074` diagnostic-service-section, `DiagnosticReport.category` (`LAB`). */
449
449
  DIAGNOSTIC_SERVICE_SECTION: "http://terminology.hl7.org/CodeSystem/v2-0074",
450
- /** HL7 Terminology `allergyintolerance-clinical` — `AllergyIntolerance.clinicalStatus`. */
450
+ /** HL7 Terminology `allergyintolerance-clinical`, `AllergyIntolerance.clinicalStatus`. */
451
451
  ALLERGY_CLINICAL: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
452
- /** HL7 Terminology `allergyintolerance-verification` — `AllergyIntolerance.verificationStatus`. */
452
+ /** HL7 Terminology `allergyintolerance-verification`, `AllergyIntolerance.verificationStatus`. */
453
453
  ALLERGY_VERIFICATION: "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification"
454
454
  });
455
455