@cosyte/synth 0.0.6 → 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 +165 -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
1
  import { Hl7Message, RawField } from '@cosyte/hl7';
2
- import { S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress, R as Rng, C as Corpus } from '../providers-OLz3zAc-.cjs';
3
- import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-DYMDojVw.cjs';
2
+ import { S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress, R as Rng, C as Corpus } from '../providers-B9uVinAe.cjs';
3
+ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-IaHp4z7N.cjs';
4
4
 
5
5
  /**
6
6
  * Spec-clean HL7 v2 `ADT` generation, built **through `@cosyte/hl7`'s `buildMessage`** so MSH
7
- * delimiters, segment layout, and escaping are the parser's own conservative emit — spec-clean *by
7
+ * delimiters, segment layout, and escaping are the parser's own conservative emit: spec-clean *by
8
8
  * construction*. Every PHI-bearing field (name, DOB, SSN, MRN,
9
9
  * address, phone) is drawn from the synthetic-safety providers (`../safe`), so no value can be real.
10
10
  *
11
11
  * `ADT^A01/A04/A08` all require the `PID` (patient) + `PV1` (visit) groups the parser's structure net
12
- * checks for — so a generated message round-trips through `@cosyte/hl7` with **zero warnings**.
12
+ * checks for, so a generated message round-trips through `@cosyte/hl7` with **zero warnings**.
13
13
  *
14
14
  * @module
15
15
  */
@@ -18,7 +18,7 @@ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as Quirk
18
18
  type AdtTrigger = "A01" | "A04" | "A08";
19
19
  /** Options for {@link generateAdt}. */
20
20
  interface GenerateAdtOptions {
21
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
21
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
22
22
  readonly seed?: number;
23
23
  /** The ADT trigger event. Defaults to `"A01"`. */
24
24
  readonly trigger?: AdtTrigger;
@@ -54,7 +54,7 @@ declare function generateAdt(options?: GenerateAdtOptions): Hl7Message;
54
54
 
55
55
  /** Options for {@link generateOru}. */
56
56
  interface GenerateOruOptions {
57
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
57
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
58
58
  readonly seed?: number;
59
59
  }
60
60
  /**
@@ -87,13 +87,13 @@ declare function generateOru(options?: GenerateOruOptions): Hl7Message;
87
87
 
88
88
  /** Options for {@link generateOrm}. */
89
89
  interface GenerateOrmOptions {
90
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
90
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
91
91
  readonly seed?: number;
92
92
  }
93
93
  /**
94
94
  * Generate a spec-clean `ORM^O01` {@link Hl7Message} through `@cosyte/hl7`. Deterministic in `seed`.
95
95
  *
96
- * Layout: MSH, `PID` (synthetic identity), `ORC` (common order — control `NW`, new order), and a
96
+ * Layout: MSH, `PID` (synthetic identity), `ORC` (common order, control `NW`, new order), and a
97
97
  * matching `OBR` (order detail). The `ORC` satisfies the parser's `ORM^O01` structure net, so the
98
98
  * message re-parses with **zero warnings** (proven by {@link ./round-trip}).
99
99
  *
@@ -119,13 +119,13 @@ declare function generateOrm(options?: GenerateOrmOptions): Hl7Message;
119
119
 
120
120
  /** Options for {@link generateSiu}. */
121
121
  interface GenerateSiuOptions {
122
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
122
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
123
123
  readonly seed?: number;
124
124
  }
125
125
  /**
126
126
  * Generate a spec-clean `SIU^S12` {@link Hl7Message} through `@cosyte/hl7`. Deterministic in `seed`.
127
127
  *
128
- * Layout: MSH, `SCH` (schedule activity — the required group), `PID` (synthetic identity), `RGS`
128
+ * Layout: MSH, `SCH` (schedule activity, the required group), `PID` (synthetic identity), `RGS`
129
129
  * (resource group), `AIL` (location resource). The `SCH` satisfies the parser's `SIU^S12` structure
130
130
  * net, so the message re-parses with **zero warnings** (proven by {@link ./round-trip}).
131
131
  *
@@ -152,13 +152,13 @@ declare function generateSiu(options?: GenerateSiuOptions): Hl7Message;
152
152
 
153
153
  /** Options for {@link generateVxu}. */
154
154
  interface GenerateVxuOptions {
155
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
155
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
156
156
  readonly seed?: number;
157
157
  }
158
158
  /**
159
159
  * Generate a spec-clean `VXU^V04` {@link Hl7Message} through `@cosyte/hl7`. Deterministic in `seed`.
160
160
  *
161
- * Layout: MSH, `PID` (synthetic identity — the required group), `ORC` (common order), `RXA` (vaccine
161
+ * Layout: MSH, `PID` (synthetic identity, the required group), `ORC` (common order), `RXA` (vaccine
162
162
  * administration, CVX example code), `RXR` (route). The `PID` satisfies the parser's `VXU^V04`
163
163
  * structure net, so the message re-parses with **zero warnings** (proven by {@link ./round-trip}).
164
164
  *
@@ -174,9 +174,9 @@ interface GenerateVxuOptions {
174
174
  declare function generateVxu(options?: GenerateVxuOptions): Hl7Message;
175
175
 
176
176
  /**
177
- * The **round-trip-through-the-parser harness** — the headline gate for the synthetic-fixture
178
- * generator. A generated artifact is "spec-clean" only if `@cosyte/hl7` — not
179
- * `@cosyte/synth`'s own opinion — reads it back cleanly. This harness feeds a generated message
177
+ * The **round-trip-through-the-parser harness**: the headline gate for the synthetic-fixture
178
+ * generator. A generated artifact is "spec-clean" only if `@cosyte/hl7`, not
179
+ * `@cosyte/synth`'s own opinion, reads it back cleanly. This harness feeds a generated message
180
180
  * straight back into the parser and reports what the parser found, so a false "spec-clean" claim
181
181
  * cannot hide.
182
182
  *
@@ -213,7 +213,7 @@ declare function roundTrip(message: Hl7Message): RoundTripResult;
213
213
  * Thin helpers that build `@cosyte/hl7` `RawField` objects with **components** for `addSegment`.
214
214
  *
215
215
  * Why this exists: `Hl7Message.addSegment` accepts a field as either a plain string or a structured
216
- * `RawField`. A plain string is emitted **verbatim** — a literal `^` in it is escaped to `\S\`, not
216
+ * `RawField`. A plain string is emitted **verbatim**: a literal `^` in it is escaped to `\S\`, not
217
217
  * treated as a component separator (the parser re-escapes on serialize, by design). To place true
218
218
  * components (a name's family/given, a CX's id/authority/type) we must hand `addSegment` a `RawField`
219
219
  * with explicit `components`, so the parser's own conservative serializer lays out the separators.
@@ -237,11 +237,11 @@ declare function roundTrip(message: Hl7Message): RoundTripResult;
237
237
  declare function componentsField(components: readonly string[]): RawField;
238
238
 
239
239
  /**
240
- * Shared HL7 v2 building blocks for every message family `@cosyte/synth` generates — the MSH scaffold,
240
+ * Shared HL7 v2 building blocks for every message family `@cosyte/synth` generates: the MSH scaffold,
241
241
  * the seeded timestamp, and the patient-identity bundle + its `PID` segment. Factored out so `ADT`,
242
242
  * `ORU`, `ORM`, `SIU`, and `VXU` all mint identity from the **same** synthetic-safety providers in the
243
243
  * **same** draw order, and all emit through `@cosyte/hl7`'s conservative serializer. Nothing here draws a
244
- * value that is not sourced from `../safe` — the synthetic-by-construction
244
+ * value that is not sourced from `../safe`: the synthetic-by-construction
245
245
  * invariant holds by construction for every family.
246
246
  *
247
247
  * @module
@@ -262,7 +262,7 @@ declare function componentsField(components: readonly string[]): RawField;
262
262
  declare function seededTimestamp(rng: Rng): string;
263
263
  /** The MSH scaffold shared by every generated message: the built message plus its seeded MSH values. */
264
264
  interface MessageScaffold {
265
- /** The `Hl7Message` with a complete MSH — chain `.addSegment(...)` to append the payload. */
265
+ /** The `Hl7Message` with a complete MSH: chain `.addSegment(...)` to append the payload. */
266
266
  readonly message: Hl7Message;
267
267
  /** The seeded `YYYYMMDDHHMMSS` message timestamp (MSH-7), reused for event/observation times. */
268
268
  readonly timestamp: string;
@@ -272,7 +272,7 @@ interface MessageScaffold {
272
272
  /**
273
273
  * Build the MSH scaffold for a message of the given `MSH-9` type through `@cosyte/hl7`'s `buildMessage`,
274
274
  * so the delimiters, control id, and header layout are the parser's own conservative emit. Draws the
275
- * timestamp then the control id from `rng` (a fixed order — the reproducibility contract).
275
+ * timestamp then the control id from `rng` (a fixed order: the reproducibility contract).
276
276
  *
277
277
  * @param rng - The seeded generator.
278
278
  * @param type - The `MSH-9` message type, e.g. `"ORU^R01"`.
@@ -284,7 +284,7 @@ interface MessageScaffold {
284
284
  * ```
285
285
  */
286
286
  declare function mshScaffold(rng: Rng, type: string): MessageScaffold;
287
- /** A complete synthetic patient identity — every field drawn from `../safe`. */
287
+ /** A complete synthetic patient identity: every field drawn from `../safe`. */
288
288
  interface PatientIdentity {
289
289
  /** Name from the shipped fake-name pool. */
290
290
  readonly person: SyntheticName;
@@ -302,8 +302,8 @@ interface PatientIdentity {
302
302
  readonly ssnDigits: string;
303
303
  }
304
304
  /**
305
- * Mint a complete synthetic {@link PatientIdentity}. Every value comes from a synthetic-safety provider
306
- * — no code path here can return a real or plausibly-real identifier. The draw order is
305
+ * Mint a complete synthetic {@link PatientIdentity}. Every value comes from a synthetic-safety provider,
306
+ * so no code path here can return a real or plausibly-real identifier. The draw order is
307
307
  * fixed (name → MRN → DOB → sex → address → phone → SSN) so the same seed yields the same identity.
308
308
  *
309
309
  * @param rng - The seeded generator.
@@ -316,7 +316,7 @@ interface PatientIdentity {
316
316
  */
317
317
  declare function patientIdentity(rng: Rng): PatientIdentity;
318
318
  /**
319
- * Lay out a fully-populated `PID` segment from a {@link PatientIdentity} as `addSegment` fields — the
319
+ * Lay out a fully-populated `PID` segment from a {@link PatientIdentity} as `addSegment` fields: the
320
320
  * PHI-dense segment shared by every family. Components go through {@link componentsField} so the parser
321
321
  * lays out the `^` separators (building *through* the parser).
322
322
  *
@@ -332,12 +332,12 @@ declare function pidSegment(id: PatientIdentity): readonly (string | RawField)[]
332
332
  /**
333
333
  * A tiny, curated, **license-clean** pool of example codes used to fill coded fields in generated HL7
334
334
  * messages (`OBR`/`OBX` observations, `ORC`/`OBR` orders, `RXA` vaccines). These are **public code
335
- * facts** — the spec examples' own values — not copyrighted terminology tables: `@cosyte/synth` bundles
335
+ * facts** (the spec examples' own values), not copyrighted terminology tables: `@cosyte/synth` bundles
336
336
  * **no** SNOMED/CPT/LOINC/RxNorm content. The pool exists only so a generated message is *structurally*
337
337
  * realistic; a consumer who
338
338
  * needs their own codes supplies them.
339
339
  *
340
- * Nothing here is PHI — codes and their display text are not identifiers. The synthetic-safety
340
+ * Nothing here is PHI: codes and their display text are not identifiers. The synthetic-safety
341
341
  * invariant governs identity fields (name/DOB/SSN/MRN/phone/address), which come from `../safe`.
342
342
  *
343
343
  * @module
@@ -372,20 +372,20 @@ declare const EXAMPLE_VACCINES: readonly ExampleCode[];
372
372
  /**
373
373
  * HL7 v2 **vendor-quirk generation**. A quirk deviates the
374
374
  * *structure* of an otherwise spec-clean message so it round-trips through `@cosyte/hl7` to **exactly**
375
- * one intended, stable warning code — the tolerance a `defineProfile` profile encodes. The deviation is
375
+ * one intended, stable warning code: the tolerance a `defineProfile` profile encodes. The deviation is
376
376
  * applied **post-serialize**.
377
377
  *
378
378
  * Two publicly-groundable quirks ship (cited-public, never a private vendor corpus):
379
379
  *
380
380
  * - **`unknown-zsegment`** → `UNKNOWN_SEGMENT`. HL7 v2.x §2.5 permits site-defined `Z`-segments; a
381
381
  * receiver with no profile flags them. `@cosyte/hl7`'s public imaging/PACS profiles (`visage`,
382
- * `philips`, `va` — each grounded in a downloadable vendor/federal interface spec) declare `ZDS`, so a
382
+ * `philips`, `va`: each grounded in a downloadable vendor/federal interface spec) declare `ZDS`, so a
383
383
  * `defineProfile` that claims the segment **suppresses** the warning.
384
- * - **`unknown-escape`** → `UNKNOWN_ESCAPE_SEQUENCE`. HL7 v2.x §2.7 escaping — a locally-defined
384
+ * - **`unknown-escape`** → `UNKNOWN_ESCAPE_SEQUENCE`. HL7 v2.x §2.7 escaping: a locally-defined
385
385
  * `\Z..\` escape is preserved verbatim and flagged. HL7 v2 has no re-badge mechanism, so this is a
386
386
  * `"bare"` quirk (no built-in profile downgrades it).
387
387
  *
388
- * A quirk **never** introduces a real-looking value — it changes the message *shape*, never the
388
+ * A quirk **never** introduces a real-looking value: it changes the message *shape*, never the
389
389
  * *provenance* of the data, so the synthetic-safety gate still runs and stays zero.
390
390
  *
391
391
  * @module
@@ -396,13 +396,13 @@ type Hl7QuirkName = "unknown-zsegment" | "unknown-escape";
396
396
  /** The HL7 v2 message families a quirk can be injected into (the spec-clean base). */
397
397
  type Hl7QuirkKind = "ADT^A01" | "ADT^A04" | "ADT^A08" | "ORU^R01" | "ORM^O01" | "SIU^S12" | "VXU^V04";
398
398
  /**
399
- * The HL7 v2 quirk registry — each recipe bound to the exact `@cosyte/hl7` warning code it targets and
399
+ * The HL7 v2 quirk registry: each recipe bound to the exact `@cosyte/hl7` warning code it targets and
400
400
  * its public grounding.
401
401
  */
402
402
  declare const HL7_QUIRKS: Readonly<Record<Hl7QuirkName, QuirkDescriptor>>;
403
403
  /** Options for {@link generateHl7Quirk}. */
404
404
  interface GenerateHl7QuirkOptions {
405
- /** The seed — the same seed + quirk yields a byte-identical message. Defaults to `0`. */
405
+ /** The seed: the same seed + quirk yields a byte-identical message. Defaults to `0`. */
406
406
  readonly seed?: number;
407
407
  /** The quirk to inject. Required. */
408
408
  readonly quirk: Hl7QuirkName;
@@ -414,20 +414,20 @@ interface GenerateHl7QuirkOptions {
414
414
  * requested vendor deviation injected post-serialize. Deterministic in `seed` + `quirk` + `kind`.
415
415
  *
416
416
  * @param options - Seed, quirk, and base kind. See {@link GenerateHl7QuirkOptions}.
417
- * @returns The {@link QuirkArtifact} — its `content` round-trips to `intendedWarnings` exactly.
417
+ * @returns The {@link QuirkArtifact}: its `content` round-trips to `intendedWarnings` exactly.
418
418
  * @throws SynthError `SYNTH_UNSUPPORTED_QUIRK` if `quirk` is not a supported HL7 quirk.
419
419
  * @example
420
420
  * ```ts
421
421
  * import { generateHl7Quirk, hl7QuirkRoundTrip } from "@cosyte/synth/hl7";
422
422
  * const artifact = generateHl7Quirk({ seed: 1, quirk: "unknown-zsegment" });
423
- * hl7QuirkRoundTrip(artifact).intendedWarningHeld; // true — exactly UNKNOWN_SEGMENT
423
+ * hl7QuirkRoundTrip(artifact).intendedWarningHeld; // true, exactly UNKNOWN_SEGMENT
424
424
  * ```
425
425
  */
426
426
  declare function generateHl7Quirk(options: GenerateHl7QuirkOptions): QuirkArtifact;
427
427
  /**
428
428
  * Round-trip an HL7 v2 quirk artifact through `@cosyte/hl7` and report the intended-warning verdict: a bare
429
- * parse must produce **exactly** the intended code(s), and — when a built-in public
430
- * profile tolerates the quirk — the profiled parse must suppress it.
429
+ * parse must produce **exactly** the intended code(s), and, when a built-in public
430
+ * profile tolerates the quirk, the profiled parse must suppress it.
431
431
  *
432
432
  * @param artifact - The quirk artifact (from {@link generateHl7Quirk}).
433
433
  * @returns The {@link QuirkRoundTripResult}.
@@ -435,7 +435,7 @@ declare function generateHl7Quirk(options: GenerateHl7QuirkOptions): QuirkArtifa
435
435
  * ```ts
436
436
  * import { generateHl7Quirk, hl7QuirkRoundTrip } from "@cosyte/synth/hl7";
437
437
  * const rt = hl7QuirkRoundTrip(generateHl7Quirk({ seed: 1, quirk: "unknown-zsegment" }));
438
- * rt.withProfile?.tolerated; // true — the `visage` profile suppresses UNKNOWN_SEGMENT
438
+ * rt.withProfile?.tolerated; // true, the `visage` profile suppresses UNKNOWN_SEGMENT
439
439
  * ```
440
440
  */
441
441
  declare function hl7QuirkRoundTrip(artifact: QuirkArtifact): QuirkRoundTripResult;
@@ -454,8 +454,8 @@ interface Hl7QuirkCorpusOptions {
454
454
  }
455
455
  /**
456
456
  * Build a reproducible {@link Corpus} of HL7 v2 quirk artifacts. Each artifact's `warnings` record the
457
- * parser's verdict — the intended code(s) for its quirk (not empty: a quirk corpus is deliberately
458
- * off-spec) — and the manifest lists the applied quirk names.
457
+ * parser's verdict: the intended code(s) for its quirk (not empty: a quirk corpus is deliberately
458
+ * off-spec), and the manifest lists the applied quirk names.
459
459
  *
460
460
  * @param options - Seed, count, and the quirk selection. See {@link Hl7QuirkCorpusOptions}.
461
461
  * @returns A deep-frozen {@link Corpus}.
@@ -468,7 +468,7 @@ interface Hl7QuirkCorpusOptions {
468
468
  */
469
469
  declare function hl7QuirkCorpus(options: Hl7QuirkCorpusOptions): Corpus;
470
470
  /**
471
- * A ready-made {@link SynthProfile} that requests every built-in HL7 quirk — a convenience for wiring
471
+ * A ready-made {@link SynthProfile} that requests every built-in HL7 quirk: a convenience for wiring
472
472
  * `defineSynthProfile`'s quirk list to the parser's real tolerance.
473
473
  *
474
474
  * @example
@@ -480,20 +480,20 @@ declare function hl7QuirkCorpus(options: Hl7QuirkCorpusOptions): Corpus;
480
480
  declare const hl7QuirkProfile: SynthProfile;
481
481
 
482
482
  /**
483
- * `@cosyte/synth/hl7` — the HL7 v2 generation surface, exposed as its own subpath so importing the
483
+ * `@cosyte/synth/hl7`: the HL7 v2 generation surface, exposed as its own subpath so importing the
484
484
  * package root does **not** pull `@cosyte/hl7`. This is the **lazy, per-format** boundary: a consumer
485
485
  * who only needs HL7 fixtures imports `@cosyte/synth/hl7`; one who needs only the core primitives
486
486
  * never loads a parser.
487
- * `@cosyte/hl7` is an **optional peer dependency** — present only for this subpath.
487
+ * `@cosyte/hl7` is an **optional peer dependency**, present only for this subpath.
488
488
  *
489
489
  * The HL7 v2 message set is complete: `ADT` (A01/A04/A08), `ORU^R01`, `ORM^O01`, `SIU^S12`, and
490
- * `VXU^V04` — each built through `@cosyte/hl7`'s `buildMessage` and round-tripping with zero warnings.
490
+ * `VXU^V04`, each built through `@cosyte/hl7`'s `buildMessage` and round-tripping with zero warnings.
491
491
  *
492
492
  * @module
493
493
  */
494
494
 
495
495
  /**
496
- * Every HL7 v2 message kind this subpath generates — the `MSH-9` label used as the corpus `kind`. `ADT`
496
+ * Every HL7 v2 message kind this subpath generates: the `MSH-9` label used as the corpus `kind`. `ADT`
497
497
  * carries its trigger; the other families have a single generated trigger each.
498
498
  */
499
499
  type Hl7MessageKind = "ADT^A01" | "ADT^A04" | "ADT^A08" | "ORU^R01" | "ORM^O01" | "SIU^S12" | "VXU^V04";
@@ -540,7 +540,7 @@ interface Hl7CorpusOptions {
540
540
  * ```ts
541
541
  * import { hl7Corpus } from "@cosyte/synth/hl7";
542
542
  * const corpus = hl7Corpus({ seed: 42, count: 7 });
543
- * corpus.artifacts.every((a) => a.warnings.length === 0); // true — spec-clean
543
+ * corpus.artifacts.every((a) => a.warnings.length === 0); // true, spec-clean
544
544
  * ```
545
545
  */
546
546
  declare function hl7Corpus(options: Hl7CorpusOptions): Corpus;
@@ -1,15 +1,15 @@
1
1
  import { Hl7Message, RawField } from '@cosyte/hl7';
2
- import { S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress, R as Rng, C as Corpus } from '../providers-OLz3zAc-.js';
3
- import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-C9t9CkPS.js';
2
+ import { S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress, R as Rng, C as Corpus } from '../providers-B9uVinAe.js';
3
+ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-HZdznAkM.js';
4
4
 
5
5
  /**
6
6
  * Spec-clean HL7 v2 `ADT` generation, built **through `@cosyte/hl7`'s `buildMessage`** so MSH
7
- * delimiters, segment layout, and escaping are the parser's own conservative emit — spec-clean *by
7
+ * delimiters, segment layout, and escaping are the parser's own conservative emit: spec-clean *by
8
8
  * construction*. Every PHI-bearing field (name, DOB, SSN, MRN,
9
9
  * address, phone) is drawn from the synthetic-safety providers (`../safe`), so no value can be real.
10
10
  *
11
11
  * `ADT^A01/A04/A08` all require the `PID` (patient) + `PV1` (visit) groups the parser's structure net
12
- * checks for — so a generated message round-trips through `@cosyte/hl7` with **zero warnings**.
12
+ * checks for, so a generated message round-trips through `@cosyte/hl7` with **zero warnings**.
13
13
  *
14
14
  * @module
15
15
  */
@@ -18,7 +18,7 @@ import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as Quirk
18
18
  type AdtTrigger = "A01" | "A04" | "A08";
19
19
  /** Options for {@link generateAdt}. */
20
20
  interface GenerateAdtOptions {
21
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
21
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
22
22
  readonly seed?: number;
23
23
  /** The ADT trigger event. Defaults to `"A01"`. */
24
24
  readonly trigger?: AdtTrigger;
@@ -54,7 +54,7 @@ declare function generateAdt(options?: GenerateAdtOptions): Hl7Message;
54
54
 
55
55
  /** Options for {@link generateOru}. */
56
56
  interface GenerateOruOptions {
57
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
57
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
58
58
  readonly seed?: number;
59
59
  }
60
60
  /**
@@ -87,13 +87,13 @@ declare function generateOru(options?: GenerateOruOptions): Hl7Message;
87
87
 
88
88
  /** Options for {@link generateOrm}. */
89
89
  interface GenerateOrmOptions {
90
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
90
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
91
91
  readonly seed?: number;
92
92
  }
93
93
  /**
94
94
  * Generate a spec-clean `ORM^O01` {@link Hl7Message} through `@cosyte/hl7`. Deterministic in `seed`.
95
95
  *
96
- * Layout: MSH, `PID` (synthetic identity), `ORC` (common order — control `NW`, new order), and a
96
+ * Layout: MSH, `PID` (synthetic identity), `ORC` (common order, control `NW`, new order), and a
97
97
  * matching `OBR` (order detail). The `ORC` satisfies the parser's `ORM^O01` structure net, so the
98
98
  * message re-parses with **zero warnings** (proven by {@link ./round-trip}).
99
99
  *
@@ -119,13 +119,13 @@ declare function generateOrm(options?: GenerateOrmOptions): Hl7Message;
119
119
 
120
120
  /** Options for {@link generateSiu}. */
121
121
  interface GenerateSiuOptions {
122
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
122
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
123
123
  readonly seed?: number;
124
124
  }
125
125
  /**
126
126
  * Generate a spec-clean `SIU^S12` {@link Hl7Message} through `@cosyte/hl7`. Deterministic in `seed`.
127
127
  *
128
- * Layout: MSH, `SCH` (schedule activity — the required group), `PID` (synthetic identity), `RGS`
128
+ * Layout: MSH, `SCH` (schedule activity, the required group), `PID` (synthetic identity), `RGS`
129
129
  * (resource group), `AIL` (location resource). The `SCH` satisfies the parser's `SIU^S12` structure
130
130
  * net, so the message re-parses with **zero warnings** (proven by {@link ./round-trip}).
131
131
  *
@@ -152,13 +152,13 @@ declare function generateSiu(options?: GenerateSiuOptions): Hl7Message;
152
152
 
153
153
  /** Options for {@link generateVxu}. */
154
154
  interface GenerateVxuOptions {
155
- /** The seed — the same seed yields a byte-identical message. Defaults to `0`. */
155
+ /** The seed: the same seed yields a byte-identical message. Defaults to `0`. */
156
156
  readonly seed?: number;
157
157
  }
158
158
  /**
159
159
  * Generate a spec-clean `VXU^V04` {@link Hl7Message} through `@cosyte/hl7`. Deterministic in `seed`.
160
160
  *
161
- * Layout: MSH, `PID` (synthetic identity — the required group), `ORC` (common order), `RXA` (vaccine
161
+ * Layout: MSH, `PID` (synthetic identity, the required group), `ORC` (common order), `RXA` (vaccine
162
162
  * administration, CVX example code), `RXR` (route). The `PID` satisfies the parser's `VXU^V04`
163
163
  * structure net, so the message re-parses with **zero warnings** (proven by {@link ./round-trip}).
164
164
  *
@@ -174,9 +174,9 @@ interface GenerateVxuOptions {
174
174
  declare function generateVxu(options?: GenerateVxuOptions): Hl7Message;
175
175
 
176
176
  /**
177
- * The **round-trip-through-the-parser harness** — the headline gate for the synthetic-fixture
178
- * generator. A generated artifact is "spec-clean" only if `@cosyte/hl7` — not
179
- * `@cosyte/synth`'s own opinion — reads it back cleanly. This harness feeds a generated message
177
+ * The **round-trip-through-the-parser harness**: the headline gate for the synthetic-fixture
178
+ * generator. A generated artifact is "spec-clean" only if `@cosyte/hl7`, not
179
+ * `@cosyte/synth`'s own opinion, reads it back cleanly. This harness feeds a generated message
180
180
  * straight back into the parser and reports what the parser found, so a false "spec-clean" claim
181
181
  * cannot hide.
182
182
  *
@@ -213,7 +213,7 @@ declare function roundTrip(message: Hl7Message): RoundTripResult;
213
213
  * Thin helpers that build `@cosyte/hl7` `RawField` objects with **components** for `addSegment`.
214
214
  *
215
215
  * Why this exists: `Hl7Message.addSegment` accepts a field as either a plain string or a structured
216
- * `RawField`. A plain string is emitted **verbatim** — a literal `^` in it is escaped to `\S\`, not
216
+ * `RawField`. A plain string is emitted **verbatim**: a literal `^` in it is escaped to `\S\`, not
217
217
  * treated as a component separator (the parser re-escapes on serialize, by design). To place true
218
218
  * components (a name's family/given, a CX's id/authority/type) we must hand `addSegment` a `RawField`
219
219
  * with explicit `components`, so the parser's own conservative serializer lays out the separators.
@@ -237,11 +237,11 @@ declare function roundTrip(message: Hl7Message): RoundTripResult;
237
237
  declare function componentsField(components: readonly string[]): RawField;
238
238
 
239
239
  /**
240
- * Shared HL7 v2 building blocks for every message family `@cosyte/synth` generates — the MSH scaffold,
240
+ * Shared HL7 v2 building blocks for every message family `@cosyte/synth` generates: the MSH scaffold,
241
241
  * the seeded timestamp, and the patient-identity bundle + its `PID` segment. Factored out so `ADT`,
242
242
  * `ORU`, `ORM`, `SIU`, and `VXU` all mint identity from the **same** synthetic-safety providers in the
243
243
  * **same** draw order, and all emit through `@cosyte/hl7`'s conservative serializer. Nothing here draws a
244
- * value that is not sourced from `../safe` — the synthetic-by-construction
244
+ * value that is not sourced from `../safe`: the synthetic-by-construction
245
245
  * invariant holds by construction for every family.
246
246
  *
247
247
  * @module
@@ -262,7 +262,7 @@ declare function componentsField(components: readonly string[]): RawField;
262
262
  declare function seededTimestamp(rng: Rng): string;
263
263
  /** The MSH scaffold shared by every generated message: the built message plus its seeded MSH values. */
264
264
  interface MessageScaffold {
265
- /** The `Hl7Message` with a complete MSH — chain `.addSegment(...)` to append the payload. */
265
+ /** The `Hl7Message` with a complete MSH: chain `.addSegment(...)` to append the payload. */
266
266
  readonly message: Hl7Message;
267
267
  /** The seeded `YYYYMMDDHHMMSS` message timestamp (MSH-7), reused for event/observation times. */
268
268
  readonly timestamp: string;
@@ -272,7 +272,7 @@ interface MessageScaffold {
272
272
  /**
273
273
  * Build the MSH scaffold for a message of the given `MSH-9` type through `@cosyte/hl7`'s `buildMessage`,
274
274
  * so the delimiters, control id, and header layout are the parser's own conservative emit. Draws the
275
- * timestamp then the control id from `rng` (a fixed order — the reproducibility contract).
275
+ * timestamp then the control id from `rng` (a fixed order: the reproducibility contract).
276
276
  *
277
277
  * @param rng - The seeded generator.
278
278
  * @param type - The `MSH-9` message type, e.g. `"ORU^R01"`.
@@ -284,7 +284,7 @@ interface MessageScaffold {
284
284
  * ```
285
285
  */
286
286
  declare function mshScaffold(rng: Rng, type: string): MessageScaffold;
287
- /** A complete synthetic patient identity — every field drawn from `../safe`. */
287
+ /** A complete synthetic patient identity: every field drawn from `../safe`. */
288
288
  interface PatientIdentity {
289
289
  /** Name from the shipped fake-name pool. */
290
290
  readonly person: SyntheticName;
@@ -302,8 +302,8 @@ interface PatientIdentity {
302
302
  readonly ssnDigits: string;
303
303
  }
304
304
  /**
305
- * Mint a complete synthetic {@link PatientIdentity}. Every value comes from a synthetic-safety provider
306
- * — no code path here can return a real or plausibly-real identifier. The draw order is
305
+ * Mint a complete synthetic {@link PatientIdentity}. Every value comes from a synthetic-safety provider,
306
+ * so no code path here can return a real or plausibly-real identifier. The draw order is
307
307
  * fixed (name → MRN → DOB → sex → address → phone → SSN) so the same seed yields the same identity.
308
308
  *
309
309
  * @param rng - The seeded generator.
@@ -316,7 +316,7 @@ interface PatientIdentity {
316
316
  */
317
317
  declare function patientIdentity(rng: Rng): PatientIdentity;
318
318
  /**
319
- * Lay out a fully-populated `PID` segment from a {@link PatientIdentity} as `addSegment` fields — the
319
+ * Lay out a fully-populated `PID` segment from a {@link PatientIdentity} as `addSegment` fields: the
320
320
  * PHI-dense segment shared by every family. Components go through {@link componentsField} so the parser
321
321
  * lays out the `^` separators (building *through* the parser).
322
322
  *
@@ -332,12 +332,12 @@ declare function pidSegment(id: PatientIdentity): readonly (string | RawField)[]
332
332
  /**
333
333
  * A tiny, curated, **license-clean** pool of example codes used to fill coded fields in generated HL7
334
334
  * messages (`OBR`/`OBX` observations, `ORC`/`OBR` orders, `RXA` vaccines). These are **public code
335
- * facts** — the spec examples' own values — not copyrighted terminology tables: `@cosyte/synth` bundles
335
+ * facts** (the spec examples' own values), not copyrighted terminology tables: `@cosyte/synth` bundles
336
336
  * **no** SNOMED/CPT/LOINC/RxNorm content. The pool exists only so a generated message is *structurally*
337
337
  * realistic; a consumer who
338
338
  * needs their own codes supplies them.
339
339
  *
340
- * Nothing here is PHI — codes and their display text are not identifiers. The synthetic-safety
340
+ * Nothing here is PHI: codes and their display text are not identifiers. The synthetic-safety
341
341
  * invariant governs identity fields (name/DOB/SSN/MRN/phone/address), which come from `../safe`.
342
342
  *
343
343
  * @module
@@ -372,20 +372,20 @@ declare const EXAMPLE_VACCINES: readonly ExampleCode[];
372
372
  /**
373
373
  * HL7 v2 **vendor-quirk generation**. A quirk deviates the
374
374
  * *structure* of an otherwise spec-clean message so it round-trips through `@cosyte/hl7` to **exactly**
375
- * one intended, stable warning code — the tolerance a `defineProfile` profile encodes. The deviation is
375
+ * one intended, stable warning code: the tolerance a `defineProfile` profile encodes. The deviation is
376
376
  * applied **post-serialize**.
377
377
  *
378
378
  * Two publicly-groundable quirks ship (cited-public, never a private vendor corpus):
379
379
  *
380
380
  * - **`unknown-zsegment`** → `UNKNOWN_SEGMENT`. HL7 v2.x §2.5 permits site-defined `Z`-segments; a
381
381
  * receiver with no profile flags them. `@cosyte/hl7`'s public imaging/PACS profiles (`visage`,
382
- * `philips`, `va` — each grounded in a downloadable vendor/federal interface spec) declare `ZDS`, so a
382
+ * `philips`, `va`: each grounded in a downloadable vendor/federal interface spec) declare `ZDS`, so a
383
383
  * `defineProfile` that claims the segment **suppresses** the warning.
384
- * - **`unknown-escape`** → `UNKNOWN_ESCAPE_SEQUENCE`. HL7 v2.x §2.7 escaping — a locally-defined
384
+ * - **`unknown-escape`** → `UNKNOWN_ESCAPE_SEQUENCE`. HL7 v2.x §2.7 escaping: a locally-defined
385
385
  * `\Z..\` escape is preserved verbatim and flagged. HL7 v2 has no re-badge mechanism, so this is a
386
386
  * `"bare"` quirk (no built-in profile downgrades it).
387
387
  *
388
- * A quirk **never** introduces a real-looking value — it changes the message *shape*, never the
388
+ * A quirk **never** introduces a real-looking value: it changes the message *shape*, never the
389
389
  * *provenance* of the data, so the synthetic-safety gate still runs and stays zero.
390
390
  *
391
391
  * @module
@@ -396,13 +396,13 @@ type Hl7QuirkName = "unknown-zsegment" | "unknown-escape";
396
396
  /** The HL7 v2 message families a quirk can be injected into (the spec-clean base). */
397
397
  type Hl7QuirkKind = "ADT^A01" | "ADT^A04" | "ADT^A08" | "ORU^R01" | "ORM^O01" | "SIU^S12" | "VXU^V04";
398
398
  /**
399
- * The HL7 v2 quirk registry — each recipe bound to the exact `@cosyte/hl7` warning code it targets and
399
+ * The HL7 v2 quirk registry: each recipe bound to the exact `@cosyte/hl7` warning code it targets and
400
400
  * its public grounding.
401
401
  */
402
402
  declare const HL7_QUIRKS: Readonly<Record<Hl7QuirkName, QuirkDescriptor>>;
403
403
  /** Options for {@link generateHl7Quirk}. */
404
404
  interface GenerateHl7QuirkOptions {
405
- /** The seed — the same seed + quirk yields a byte-identical message. Defaults to `0`. */
405
+ /** The seed: the same seed + quirk yields a byte-identical message. Defaults to `0`. */
406
406
  readonly seed?: number;
407
407
  /** The quirk to inject. Required. */
408
408
  readonly quirk: Hl7QuirkName;
@@ -414,20 +414,20 @@ interface GenerateHl7QuirkOptions {
414
414
  * requested vendor deviation injected post-serialize. Deterministic in `seed` + `quirk` + `kind`.
415
415
  *
416
416
  * @param options - Seed, quirk, and base kind. See {@link GenerateHl7QuirkOptions}.
417
- * @returns The {@link QuirkArtifact} — its `content` round-trips to `intendedWarnings` exactly.
417
+ * @returns The {@link QuirkArtifact}: its `content` round-trips to `intendedWarnings` exactly.
418
418
  * @throws SynthError `SYNTH_UNSUPPORTED_QUIRK` if `quirk` is not a supported HL7 quirk.
419
419
  * @example
420
420
  * ```ts
421
421
  * import { generateHl7Quirk, hl7QuirkRoundTrip } from "@cosyte/synth/hl7";
422
422
  * const artifact = generateHl7Quirk({ seed: 1, quirk: "unknown-zsegment" });
423
- * hl7QuirkRoundTrip(artifact).intendedWarningHeld; // true — exactly UNKNOWN_SEGMENT
423
+ * hl7QuirkRoundTrip(artifact).intendedWarningHeld; // true, exactly UNKNOWN_SEGMENT
424
424
  * ```
425
425
  */
426
426
  declare function generateHl7Quirk(options: GenerateHl7QuirkOptions): QuirkArtifact;
427
427
  /**
428
428
  * Round-trip an HL7 v2 quirk artifact through `@cosyte/hl7` and report the intended-warning verdict: a bare
429
- * parse must produce **exactly** the intended code(s), and — when a built-in public
430
- * profile tolerates the quirk — the profiled parse must suppress it.
429
+ * parse must produce **exactly** the intended code(s), and, when a built-in public
430
+ * profile tolerates the quirk, the profiled parse must suppress it.
431
431
  *
432
432
  * @param artifact - The quirk artifact (from {@link generateHl7Quirk}).
433
433
  * @returns The {@link QuirkRoundTripResult}.
@@ -435,7 +435,7 @@ declare function generateHl7Quirk(options: GenerateHl7QuirkOptions): QuirkArtifa
435
435
  * ```ts
436
436
  * import { generateHl7Quirk, hl7QuirkRoundTrip } from "@cosyte/synth/hl7";
437
437
  * const rt = hl7QuirkRoundTrip(generateHl7Quirk({ seed: 1, quirk: "unknown-zsegment" }));
438
- * rt.withProfile?.tolerated; // true — the `visage` profile suppresses UNKNOWN_SEGMENT
438
+ * rt.withProfile?.tolerated; // true, the `visage` profile suppresses UNKNOWN_SEGMENT
439
439
  * ```
440
440
  */
441
441
  declare function hl7QuirkRoundTrip(artifact: QuirkArtifact): QuirkRoundTripResult;
@@ -454,8 +454,8 @@ interface Hl7QuirkCorpusOptions {
454
454
  }
455
455
  /**
456
456
  * Build a reproducible {@link Corpus} of HL7 v2 quirk artifacts. Each artifact's `warnings` record the
457
- * parser's verdict — the intended code(s) for its quirk (not empty: a quirk corpus is deliberately
458
- * off-spec) — and the manifest lists the applied quirk names.
457
+ * parser's verdict: the intended code(s) for its quirk (not empty: a quirk corpus is deliberately
458
+ * off-spec), and the manifest lists the applied quirk names.
459
459
  *
460
460
  * @param options - Seed, count, and the quirk selection. See {@link Hl7QuirkCorpusOptions}.
461
461
  * @returns A deep-frozen {@link Corpus}.
@@ -468,7 +468,7 @@ interface Hl7QuirkCorpusOptions {
468
468
  */
469
469
  declare function hl7QuirkCorpus(options: Hl7QuirkCorpusOptions): Corpus;
470
470
  /**
471
- * A ready-made {@link SynthProfile} that requests every built-in HL7 quirk — a convenience for wiring
471
+ * A ready-made {@link SynthProfile} that requests every built-in HL7 quirk: a convenience for wiring
472
472
  * `defineSynthProfile`'s quirk list to the parser's real tolerance.
473
473
  *
474
474
  * @example
@@ -480,20 +480,20 @@ declare function hl7QuirkCorpus(options: Hl7QuirkCorpusOptions): Corpus;
480
480
  declare const hl7QuirkProfile: SynthProfile;
481
481
 
482
482
  /**
483
- * `@cosyte/synth/hl7` — the HL7 v2 generation surface, exposed as its own subpath so importing the
483
+ * `@cosyte/synth/hl7`: the HL7 v2 generation surface, exposed as its own subpath so importing the
484
484
  * package root does **not** pull `@cosyte/hl7`. This is the **lazy, per-format** boundary: a consumer
485
485
  * who only needs HL7 fixtures imports `@cosyte/synth/hl7`; one who needs only the core primitives
486
486
  * never loads a parser.
487
- * `@cosyte/hl7` is an **optional peer dependency** — present only for this subpath.
487
+ * `@cosyte/hl7` is an **optional peer dependency**, present only for this subpath.
488
488
  *
489
489
  * The HL7 v2 message set is complete: `ADT` (A01/A04/A08), `ORU^R01`, `ORM^O01`, `SIU^S12`, and
490
- * `VXU^V04` — each built through `@cosyte/hl7`'s `buildMessage` and round-tripping with zero warnings.
490
+ * `VXU^V04`, each built through `@cosyte/hl7`'s `buildMessage` and round-tripping with zero warnings.
491
491
  *
492
492
  * @module
493
493
  */
494
494
 
495
495
  /**
496
- * Every HL7 v2 message kind this subpath generates — the `MSH-9` label used as the corpus `kind`. `ADT`
496
+ * Every HL7 v2 message kind this subpath generates: the `MSH-9` label used as the corpus `kind`. `ADT`
497
497
  * carries its trigger; the other families have a single generated trigger each.
498
498
  */
499
499
  type Hl7MessageKind = "ADT^A01" | "ADT^A04" | "ADT^A08" | "ORU^R01" | "ORM^O01" | "SIU^S12" | "VXU^V04";
@@ -540,7 +540,7 @@ interface Hl7CorpusOptions {
540
540
  * ```ts
541
541
  * import { hl7Corpus } from "@cosyte/synth/hl7";
542
542
  * const corpus = hl7Corpus({ seed: 42, count: 7 });
543
- * corpus.artifacts.every((a) => a.warnings.length === 0); // true — spec-clean
543
+ * corpus.artifacts.every((a) => a.warnings.length === 0); // true, spec-clean
544
544
  * ```
545
545
  */
546
546
  declare function hl7Corpus(options: Hl7CorpusOptions): Corpus;