@cosyte/synth 0.1.3 → 0.1.5

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 +22 -0
  2. package/README.md +28 -24
  3. package/dist/astm/index.cjs +109 -84
  4. package/dist/astm/index.cjs.map +1 -1
  5. package/dist/astm/index.d.cts +4 -3
  6. package/dist/astm/index.d.ts +4 -3
  7. package/dist/astm/index.mjs +109 -84
  8. package/dist/astm/index.mjs.map +1 -1
  9. package/dist/ccda/index.cjs +24 -2
  10. package/dist/ccda/index.cjs.map +1 -1
  11. package/dist/ccda/index.d.cts +5 -4
  12. package/dist/ccda/index.d.ts +5 -4
  13. package/dist/ccda/index.mjs +24 -2
  14. package/dist/ccda/index.mjs.map +1 -1
  15. package/dist/deid/index.cjs +98 -47
  16. package/dist/deid/index.cjs.map +1 -1
  17. package/dist/deid/index.d.cts +4 -3
  18. package/dist/deid/index.d.ts +4 -3
  19. package/dist/deid/index.mjs +98 -47
  20. package/dist/deid/index.mjs.map +1 -1
  21. package/dist/{example-codes-88f3_bQZ.d.cts → example-codes-4RnyF7bV.d.cts} +2 -1
  22. package/dist/{example-codes-88f3_bQZ.d.ts → example-codes-4RnyF7bV.d.ts} +2 -1
  23. package/dist/fhir/index.cjs +33 -2
  24. package/dist/fhir/index.cjs.map +1 -1
  25. package/dist/fhir/index.d.cts +4 -3
  26. package/dist/fhir/index.d.ts +4 -3
  27. package/dist/fhir/index.mjs +33 -2
  28. package/dist/fhir/index.mjs.map +1 -1
  29. package/dist/hl7/index.cjs +33 -3
  30. package/dist/hl7/index.cjs.map +1 -1
  31. package/dist/hl7/index.d.cts +4 -3
  32. package/dist/hl7/index.d.ts +4 -3
  33. package/dist/hl7/index.mjs +33 -3
  34. package/dist/hl7/index.mjs.map +1 -1
  35. package/dist/index.cjs +3 -3
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +13 -8
  38. package/dist/index.d.ts +13 -8
  39. package/dist/index.mjs +3 -3
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/ncpdp/index.cjs +57 -14
  42. package/dist/ncpdp/index.cjs.map +1 -1
  43. package/dist/ncpdp/index.d.cts +3 -2
  44. package/dist/ncpdp/index.d.ts +3 -2
  45. package/dist/ncpdp/index.mjs +57 -14
  46. package/dist/ncpdp/index.mjs.map +1 -1
  47. package/dist/{providers-DcPrqmp5.d.cts → providers-B48qUwHU.d.cts} +2 -1
  48. package/dist/{providers-DcPrqmp5.d.ts → providers-B48qUwHU.d.ts} +2 -1
  49. package/dist/{quirk-DmqYw3Vk.d.ts → quirk-BCSs1jPt.d.cts} +3 -2
  50. package/dist/{quirk-CilFUhwX.d.cts → quirk-BfObsiWV.d.ts} +3 -2
  51. package/dist/x12/index.cjs +82 -33
  52. package/dist/x12/index.cjs.map +1 -1
  53. package/dist/x12/index.d.cts +3 -2
  54. package/dist/x12/index.d.ts +3 -2
  55. package/dist/x12/index.mjs +82 -33
  56. package/dist/x12/index.mjs.map +1 -1
  57. package/package.json +29 -31
@@ -354,4 +354,5 @@ declare function address(rng: Rng): SyntheticAddress;
354
354
  */
355
355
  declare function dateYmd(rng: Rng, minYear?: number, maxYear?: number): string;
356
356
 
357
- export { type Artifact as A, type Corpus as C, type Rng as R, type SyntheticName as S, type SyntheticIdentifier as a, type SyntheticAddress as b, ipv6 as c, identifier as d, email as e, address as f, dateYmd as g, npi as h, ipv4 as i, dea as j, type CorpusManifest as k, type SsnBlock as l, type SynthFormat as m, name as n, createRng as o, phone as p, makeCorpus as q, ssn as s, uuid as u };
357
+ export { ipv6 as c, identifier as d, email as e, address as f, dateYmd as g, npi as h, ipv4 as i, dea as j, name as n, createRng as o, phone as p, makeCorpus as q, ssn as s, uuid as u };
358
+ export type { Artifact as A, Corpus as C, Rng as R, SyntheticName as S, SyntheticIdentifier as a, SyntheticAddress as b, CorpusManifest as k, SsnBlock as l, SynthFormat as m };
@@ -354,4 +354,5 @@ declare function address(rng: Rng): SyntheticAddress;
354
354
  */
355
355
  declare function dateYmd(rng: Rng, minYear?: number, maxYear?: number): string;
356
356
 
357
- export { type Artifact as A, type Corpus as C, type Rng as R, type SyntheticName as S, type SyntheticIdentifier as a, type SyntheticAddress as b, ipv6 as c, identifier as d, email as e, address as f, dateYmd as g, npi as h, ipv4 as i, dea as j, type CorpusManifest as k, type SsnBlock as l, type SynthFormat as m, name as n, createRng as o, phone as p, makeCorpus as q, ssn as s, uuid as u };
357
+ export { ipv6 as c, identifier as d, email as e, address as f, dateYmd as g, npi as h, ipv4 as i, dea as j, name as n, createRng as o, phone as p, makeCorpus as q, ssn as s, uuid as u };
358
+ export type { Artifact as A, Corpus as C, Rng as R, SyntheticName as S, SyntheticIdentifier as a, SyntheticAddress as b, CorpusManifest as k, SsnBlock as l, SynthFormat as m };
@@ -1,4 +1,4 @@
1
- import { m as SynthFormat } from './providers-DcPrqmp5.js';
1
+ import { m as SynthFormat } from './providers-B48qUwHU.cjs';
2
2
 
3
3
  /**
4
4
  * `defineSynthProfile`: the growth-loop hook for site/vendor fixture recipes. A profile bundles the
@@ -247,4 +247,5 @@ declare function assertIntendedWarnings(intendedWarnings: readonly string[], bar
247
247
  */
248
248
  declare function validateProfileQuirks(profile: SynthProfile, registry: Readonly<Record<string, QuirkDescriptor>>, format: SynthFormat): readonly string[];
249
249
 
250
- export { PROFILE_QUIRK_APPLIED as P, type QuirkDescriptor as Q, type SynthProfile as S, type QuirkArtifact as a, type QuirkRoundTripResult as b, type QuirkProfileDisposition as c, type QuirkProfiledVerdict as d, type SynthProfileSpec as e, assertIntendedWarnings as f, defineSynthProfile as g, profileTolerated as p, resolveQuirk as r, sameCodeSet as s, validateProfileQuirks as v };
250
+ export { PROFILE_QUIRK_APPLIED as P, assertIntendedWarnings as f, defineSynthProfile as g, profileTolerated as p, resolveQuirk as r, sameCodeSet as s, validateProfileQuirks as v };
251
+ export type { QuirkDescriptor as Q, SynthProfile as S, QuirkArtifact as a, QuirkRoundTripResult as b, QuirkProfileDisposition as c, QuirkProfiledVerdict as d, SynthProfileSpec as e };
@@ -1,4 +1,4 @@
1
- import { m as SynthFormat } from './providers-DcPrqmp5.cjs';
1
+ import { m as SynthFormat } from './providers-B48qUwHU.js';
2
2
 
3
3
  /**
4
4
  * `defineSynthProfile`: the growth-loop hook for site/vendor fixture recipes. A profile bundles the
@@ -247,4 +247,5 @@ declare function assertIntendedWarnings(intendedWarnings: readonly string[], bar
247
247
  */
248
248
  declare function validateProfileQuirks(profile: SynthProfile, registry: Readonly<Record<string, QuirkDescriptor>>, format: SynthFormat): readonly string[];
249
249
 
250
- export { PROFILE_QUIRK_APPLIED as P, type QuirkDescriptor as Q, type SynthProfile as S, type QuirkArtifact as a, type QuirkRoundTripResult as b, type QuirkProfileDisposition as c, type QuirkProfiledVerdict as d, type SynthProfileSpec as e, assertIntendedWarnings as f, defineSynthProfile as g, profileTolerated as p, resolveQuirk as r, sameCodeSet as s, validateProfileQuirks as v };
250
+ export { PROFILE_QUIRK_APPLIED as P, assertIntendedWarnings as f, defineSynthProfile as g, profileTolerated as p, resolveQuirk as r, sameCodeSet as s, validateProfileQuirks as v };
251
+ export type { QuirkDescriptor as Q, SynthProfile as S, QuirkArtifact as a, QuirkRoundTripResult as b, QuirkProfileDisposition as c, QuirkProfiledVerdict as d, SynthProfileSpec as e };
@@ -32,20 +32,59 @@ function sfc32Next(s) {
32
32
  }
33
33
 
34
34
  // src/codes.ts
35
- var SYNTH_FATAL_CODES = {
35
+ var SYNTH_FATAL_CODES = Object.freeze({
36
+ /**
37
+ * A format was requested that this build cannot generate through a real parser builder/serializer.
38
+ * Fatal, never a hand-written byte fallback.
39
+ *
40
+ * **No code path in this build raises it.** All six formats generate, so it is reserved for a
41
+ * future format that does not, and is kept because removing a published code is a breaking change.
42
+ * An unsupported *kind* within a format that does generate is `SYNTH_UNSUPPORTED_KIND`.
43
+ */
44
+ SYNTH_UNSUPPORTED_FORMAT: "SYNTH_UNSUPPORTED_FORMAT",
45
+ /**
46
+ * A vendor quirk was requested that the target format's profile system does not support. Fatal,
47
+ * never a silent no-op and never a fabricated quirk.
48
+ */
49
+ SYNTH_UNSUPPORTED_QUIRK: "SYNTH_UNSUPPORTED_QUIRK",
50
+ /**
51
+ * A quirk transform found no structural anchor to mutate, so the fixture would not carry the
52
+ * deviation it is labelled with. Fatal: a golden file that lies about its parser verdict is worse
53
+ * than no golden file.
54
+ */
55
+ SYNTH_QUIRK_ANCHOR_ABSENT: "SYNTH_QUIRK_ANCHOR_ABSENT",
56
+ /**
57
+ * A bare parse of a freshly-generated quirk artifact did not produce exactly the declared intended
58
+ * warning code(s). Fatal, never emit a mislabeled fixture.
59
+ */
60
+ SYNTH_INTENDED_WARNING_MISMATCH: "SYNTH_INTENDED_WARNING_MISMATCH",
61
+ /** A concept's code-system URI has no OID mapping in the C-CDA example-code table. Fatal. */
62
+ SYNTH_UNMAPPED_CODE_SYSTEM: "SYNTH_UNMAPPED_CODE_SYSTEM",
36
63
  /** A money value could not be read as an X12 decimal. Fatal: a generator never rounds to a float. */
37
64
  SYNTH_INVALID_DECIMAL: "SYNTH_INVALID_DECIMAL",
38
65
  /** An integer range was requested with its maximum below its minimum. Fatal. */
39
66
  SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE",
40
67
  /** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
41
68
  SYNTH_EMPTY_POOL: "SYNTH_EMPTY_POOL",
69
+ /** A `defineSynthProfile` spec was not usable (a missing or blank `name`). Fatal. */
70
+ SYNTH_INVALID_PROFILE: "SYNTH_INVALID_PROFILE",
42
71
  /**
43
72
  * A caller-supplied selector (a message kind, a document type, a corpus mix entry, a claim
44
73
  * variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal:
45
74
  * see `resolveKind`: a selector union is erased at run time, and a selector that falls through
46
75
  * either mislabels the fixture or hands the value to a peer builder that quotes it back.
47
76
  */
48
- SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"};
77
+ SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND",
78
+ /**
79
+ * A requested profile IS published by the adopted implementation guide, and this build does not
80
+ * generate it. Deliberately distinct from `SYNTH_UNSUPPORTED_KIND`, which says the name is not in
81
+ * the adopted set at all: "the guide does not publish this" and "we do not generate this yet" are
82
+ * different answers, and a caller building to a regulatory profile set has to be able to tell them
83
+ * apart without matching message text. Fatal, and raised **before** anything is generated: a
84
+ * mislabelled artifact is worse than no artifact.
85
+ */
86
+ SYNTH_PROFILE_NOT_GENERATED: "SYNTH_PROFILE_NOT_GENERATED"
87
+ });
49
88
  var SYNTH_FATAL_MESSAGES = Object.freeze({
50
89
  SYNTH_UNSUPPORTED_FORMAT: "The requested format is not generable by this build. A generator has no byte fallback: it builds through a parser's own serializer or it refuses.",
51
90
  SYNTH_UNSUPPORTED_QUIRK: "The requested vendor quirk is not in the target format's quirk registry. Compare the request against that format's exported registry (HL7_QUIRKS, CCDA_QUIRKS, ASTM_QUIRKS).",
@@ -484,39 +523,49 @@ function x12EnvelopeTiming(rng) {
484
523
  }
485
524
 
486
525
  // src/x12/example-codes.ts
487
- var PROFESSIONAL_PROCEDURES = Object.freeze([
488
- { code: "99213", label: "office/outpatient visit, established patient" },
489
- { code: "99214", label: "office/outpatient visit, established patient, moderate" },
490
- { code: "99203", label: "office/outpatient visit, new patient" },
491
- { code: "85025", label: "complete blood count with differential" },
492
- { code: "80053", label: "comprehensive metabolic panel" },
493
- { code: "93000", label: "electrocardiogram, routine" }
494
- ]);
526
+ var PROFESSIONAL_PROCEDURES = Object.freeze(
527
+ [
528
+ { code: "99213", label: "office/outpatient visit, established patient" },
529
+ { code: "99214", label: "office/outpatient visit, established patient, moderate" },
530
+ { code: "99203", label: "office/outpatient visit, new patient" },
531
+ { code: "85025", label: "complete blood count with differential" },
532
+ { code: "80053", label: "comprehensive metabolic panel" },
533
+ { code: "93000", label: "electrocardiogram, routine" }
534
+ ].map((entry) => Object.freeze(entry))
535
+ );
495
536
  var PROCEDURE_MODIFIERS = Object.freeze(["25", "59", "76", "GT"]);
496
537
  var PLACES_OF_SERVICE = Object.freeze(["11", "22", "21", "12", "49"]);
497
- var DIAGNOSES = Object.freeze([
498
- { code: "J20.9", label: "acute bronchitis, unspecified" },
499
- { code: "E11.9", label: "type 2 diabetes mellitus without complications" },
500
- { code: "I10", label: "essential (primary) hypertension" },
501
- { code: "M54.5", label: "low back pain" },
502
- { code: "R07.9", label: "chest pain, unspecified" },
503
- { code: "Z00.00", label: "general adult medical exam without abnormal findings" }
504
- ]);
505
- var REVENUE_CODES = Object.freeze([
506
- { code: "0120", label: "room & board, semi-private" },
507
- { code: "0300", label: "laboratory, general" },
508
- { code: "0450", label: "emergency room, general" },
509
- { code: "0636", label: "drugs requiring detailed coding" }
510
- ]);
511
- var INSTITUTIONAL_PROCEDURES = Object.freeze([
512
- { code: "99221", label: "initial hospital care, per day" },
513
- { code: "99231", label: "subsequent hospital care, per day" }
514
- ]);
515
- var DENTAL_PROCEDURES = Object.freeze([
516
- { code: "D2391", label: "resin-based composite, one surface, posterior" },
517
- { code: "D1110", label: "prophylaxis, adult" },
518
- { code: "D0120", label: "periodic oral evaluation" }
519
- ]);
538
+ var DIAGNOSES = Object.freeze(
539
+ [
540
+ { code: "J20.9", label: "acute bronchitis, unspecified" },
541
+ { code: "E11.9", label: "type 2 diabetes mellitus without complications" },
542
+ { code: "I10", label: "essential (primary) hypertension" },
543
+ { code: "M54.5", label: "low back pain" },
544
+ { code: "R07.9", label: "chest pain, unspecified" },
545
+ { code: "Z00.00", label: "general adult medical exam without abnormal findings" }
546
+ ].map((entry) => Object.freeze(entry))
547
+ );
548
+ var REVENUE_CODES = Object.freeze(
549
+ [
550
+ { code: "0120", label: "room & board, semi-private" },
551
+ { code: "0300", label: "laboratory, general" },
552
+ { code: "0450", label: "emergency room, general" },
553
+ { code: "0636", label: "drugs requiring detailed coding" }
554
+ ].map((entry) => Object.freeze(entry))
555
+ );
556
+ var INSTITUTIONAL_PROCEDURES = Object.freeze(
557
+ [
558
+ { code: "99221", label: "initial hospital care, per day" },
559
+ { code: "99231", label: "subsequent hospital care, per day" }
560
+ ].map((entry) => Object.freeze(entry))
561
+ );
562
+ var DENTAL_PROCEDURES = Object.freeze(
563
+ [
564
+ { code: "D2391", label: "resin-based composite, one surface, posterior" },
565
+ { code: "D1110", label: "prophylaxis, adult" },
566
+ { code: "D0120", label: "periodic oral evaluation" }
567
+ ].map((entry) => Object.freeze(entry))
568
+ );
520
569
  var TOOTH_CODES = Object.freeze(["14", "3", "19", "30"]);
521
570
  var TOOTH_SURFACES = Object.freeze(["M", "O", "D", "B", "L"]);
522
571
  var CARC_CODES = Object.freeze(["1", "2", "3", "45", "96", "197"]);