@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
@@ -1,4 +1,4 @@
1
- import { b as SyntheticAddress, S as SyntheticName, R as Rng, C as Corpus } from '../providers-DcPrqmp5.cjs';
1
+ import { SyntheticAddress, SyntheticName, Rng, Corpus } from '../index.cjs';
2
2
  import { X12Interchange, X12Decimal } from '@cosyte/x12';
3
3
 
4
4
  /**
@@ -482,4 +482,5 @@ interface X12CorpusOptions {
482
482
  */
483
483
  declare function x12Corpus(options: X12CorpusOptions): Corpus;
484
484
 
485
- export { CARC_CODES, type Claim837Variant, DENTAL_PROCEDURES, DIAGNOSES, type Generate271Options, type Generate835Options, type Generate837Options, INSTITUTIONAL_PROCEDURES, PLACES_OF_SERVICE, PROCEDURE_MODIFIERS, PROFESSIONAL_PROCEDURES, REVENUE_CODES, type RoundTripResult, SERVICE_TYPE_CODES, TOOTH_CODES, TOOTH_SURFACES, type X12CorpusKind, type X12CorpusOptions, type X12EnvelopeTiming, type X12ExampleCode, type X12Organization, type X12Payer, type X12Person, type X12TradingPartners, dec, generate271, generate835, generate837, generate837D, generate837I, generate837P, money, roundTrip, x12Corpus, x12EnvelopeTiming, x12Organization, x12Payer, x12Person, x12ProviderPerson, x12TradingPartners };
485
+ export { CARC_CODES, DENTAL_PROCEDURES, DIAGNOSES, INSTITUTIONAL_PROCEDURES, PLACES_OF_SERVICE, PROCEDURE_MODIFIERS, PROFESSIONAL_PROCEDURES, REVENUE_CODES, SERVICE_TYPE_CODES, TOOTH_CODES, TOOTH_SURFACES, dec, generate271, generate835, generate837, generate837D, generate837I, generate837P, money, roundTrip, x12Corpus, x12EnvelopeTiming, x12Organization, x12Payer, x12Person, x12ProviderPerson, x12TradingPartners };
486
+ export type { Claim837Variant, Generate271Options, Generate835Options, Generate837Options, RoundTripResult, X12CorpusKind, X12CorpusOptions, X12EnvelopeTiming, X12ExampleCode, X12Organization, X12Payer, X12Person, X12TradingPartners };
@@ -1,4 +1,4 @@
1
- import { b as SyntheticAddress, S as SyntheticName, R as Rng, C as Corpus } from '../providers-DcPrqmp5.js';
1
+ import { SyntheticAddress, SyntheticName, Rng, Corpus } from '../index.js';
2
2
  import { X12Interchange, X12Decimal } from '@cosyte/x12';
3
3
 
4
4
  /**
@@ -482,4 +482,5 @@ interface X12CorpusOptions {
482
482
  */
483
483
  declare function x12Corpus(options: X12CorpusOptions): Corpus;
484
484
 
485
- export { CARC_CODES, type Claim837Variant, DENTAL_PROCEDURES, DIAGNOSES, type Generate271Options, type Generate835Options, type Generate837Options, INSTITUTIONAL_PROCEDURES, PLACES_OF_SERVICE, PROCEDURE_MODIFIERS, PROFESSIONAL_PROCEDURES, REVENUE_CODES, type RoundTripResult, SERVICE_TYPE_CODES, TOOTH_CODES, TOOTH_SURFACES, type X12CorpusKind, type X12CorpusOptions, type X12EnvelopeTiming, type X12ExampleCode, type X12Organization, type X12Payer, type X12Person, type X12TradingPartners, dec, generate271, generate835, generate837, generate837D, generate837I, generate837P, money, roundTrip, x12Corpus, x12EnvelopeTiming, x12Organization, x12Payer, x12Person, x12ProviderPerson, x12TradingPartners };
485
+ export { CARC_CODES, DENTAL_PROCEDURES, DIAGNOSES, INSTITUTIONAL_PROCEDURES, PLACES_OF_SERVICE, PROCEDURE_MODIFIERS, PROFESSIONAL_PROCEDURES, REVENUE_CODES, SERVICE_TYPE_CODES, TOOTH_CODES, TOOTH_SURFACES, dec, generate271, generate835, generate837, generate837D, generate837I, generate837P, money, roundTrip, x12Corpus, x12EnvelopeTiming, x12Organization, x12Payer, x12Person, x12ProviderPerson, x12TradingPartners };
486
+ export type { Claim837Variant, Generate271Options, Generate835Options, Generate837Options, RoundTripResult, X12CorpusKind, X12CorpusOptions, X12EnvelopeTiming, X12ExampleCode, X12Organization, X12Payer, X12Person, X12TradingPartners };
@@ -30,20 +30,59 @@ function sfc32Next(s) {
30
30
  }
31
31
 
32
32
  // src/codes.ts
33
- var SYNTH_FATAL_CODES = {
33
+ var SYNTH_FATAL_CODES = Object.freeze({
34
+ /**
35
+ * A format was requested that this build cannot generate through a real parser builder/serializer.
36
+ * Fatal, never a hand-written byte fallback.
37
+ *
38
+ * **No code path in this build raises it.** All six formats generate, so it is reserved for a
39
+ * future format that does not, and is kept because removing a published code is a breaking change.
40
+ * An unsupported *kind* within a format that does generate is `SYNTH_UNSUPPORTED_KIND`.
41
+ */
42
+ SYNTH_UNSUPPORTED_FORMAT: "SYNTH_UNSUPPORTED_FORMAT",
43
+ /**
44
+ * A vendor quirk was requested that the target format's profile system does not support. Fatal,
45
+ * never a silent no-op and never a fabricated quirk.
46
+ */
47
+ SYNTH_UNSUPPORTED_QUIRK: "SYNTH_UNSUPPORTED_QUIRK",
48
+ /**
49
+ * A quirk transform found no structural anchor to mutate, so the fixture would not carry the
50
+ * deviation it is labelled with. Fatal: a golden file that lies about its parser verdict is worse
51
+ * than no golden file.
52
+ */
53
+ SYNTH_QUIRK_ANCHOR_ABSENT: "SYNTH_QUIRK_ANCHOR_ABSENT",
54
+ /**
55
+ * A bare parse of a freshly-generated quirk artifact did not produce exactly the declared intended
56
+ * warning code(s). Fatal, never emit a mislabeled fixture.
57
+ */
58
+ SYNTH_INTENDED_WARNING_MISMATCH: "SYNTH_INTENDED_WARNING_MISMATCH",
59
+ /** A concept's code-system URI has no OID mapping in the C-CDA example-code table. Fatal. */
60
+ SYNTH_UNMAPPED_CODE_SYSTEM: "SYNTH_UNMAPPED_CODE_SYSTEM",
34
61
  /** A money value could not be read as an X12 decimal. Fatal: a generator never rounds to a float. */
35
62
  SYNTH_INVALID_DECIMAL: "SYNTH_INVALID_DECIMAL",
36
63
  /** An integer range was requested with its maximum below its minimum. Fatal. */
37
64
  SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE",
38
65
  /** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
39
66
  SYNTH_EMPTY_POOL: "SYNTH_EMPTY_POOL",
67
+ /** A `defineSynthProfile` spec was not usable (a missing or blank `name`). Fatal. */
68
+ SYNTH_INVALID_PROFILE: "SYNTH_INVALID_PROFILE",
40
69
  /**
41
70
  * A caller-supplied selector (a message kind, a document type, a corpus mix entry, a claim
42
71
  * variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal:
43
72
  * see `resolveKind`: a selector union is erased at run time, and a selector that falls through
44
73
  * either mislabels the fixture or hands the value to a peer builder that quotes it back.
45
74
  */
46
- SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"};
75
+ SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND",
76
+ /**
77
+ * A requested profile IS published by the adopted implementation guide, and this build does not
78
+ * generate it. Deliberately distinct from `SYNTH_UNSUPPORTED_KIND`, which says the name is not in
79
+ * the adopted set at all: "the guide does not publish this" and "we do not generate this yet" are
80
+ * different answers, and a caller building to a regulatory profile set has to be able to tell them
81
+ * apart without matching message text. Fatal, and raised **before** anything is generated: a
82
+ * mislabelled artifact is worse than no artifact.
83
+ */
84
+ SYNTH_PROFILE_NOT_GENERATED: "SYNTH_PROFILE_NOT_GENERATED"
85
+ });
47
86
  var SYNTH_FATAL_MESSAGES = Object.freeze({
48
87
  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.",
49
88
  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).",
@@ -482,39 +521,49 @@ function x12EnvelopeTiming(rng) {
482
521
  }
483
522
 
484
523
  // src/x12/example-codes.ts
485
- var PROFESSIONAL_PROCEDURES = Object.freeze([
486
- { code: "99213", label: "office/outpatient visit, established patient" },
487
- { code: "99214", label: "office/outpatient visit, established patient, moderate" },
488
- { code: "99203", label: "office/outpatient visit, new patient" },
489
- { code: "85025", label: "complete blood count with differential" },
490
- { code: "80053", label: "comprehensive metabolic panel" },
491
- { code: "93000", label: "electrocardiogram, routine" }
492
- ]);
524
+ var PROFESSIONAL_PROCEDURES = Object.freeze(
525
+ [
526
+ { code: "99213", label: "office/outpatient visit, established patient" },
527
+ { code: "99214", label: "office/outpatient visit, established patient, moderate" },
528
+ { code: "99203", label: "office/outpatient visit, new patient" },
529
+ { code: "85025", label: "complete blood count with differential" },
530
+ { code: "80053", label: "comprehensive metabolic panel" },
531
+ { code: "93000", label: "electrocardiogram, routine" }
532
+ ].map((entry) => Object.freeze(entry))
533
+ );
493
534
  var PROCEDURE_MODIFIERS = Object.freeze(["25", "59", "76", "GT"]);
494
535
  var PLACES_OF_SERVICE = Object.freeze(["11", "22", "21", "12", "49"]);
495
- var DIAGNOSES = Object.freeze([
496
- { code: "J20.9", label: "acute bronchitis, unspecified" },
497
- { code: "E11.9", label: "type 2 diabetes mellitus without complications" },
498
- { code: "I10", label: "essential (primary) hypertension" },
499
- { code: "M54.5", label: "low back pain" },
500
- { code: "R07.9", label: "chest pain, unspecified" },
501
- { code: "Z00.00", label: "general adult medical exam without abnormal findings" }
502
- ]);
503
- var REVENUE_CODES = Object.freeze([
504
- { code: "0120", label: "room & board, semi-private" },
505
- { code: "0300", label: "laboratory, general" },
506
- { code: "0450", label: "emergency room, general" },
507
- { code: "0636", label: "drugs requiring detailed coding" }
508
- ]);
509
- var INSTITUTIONAL_PROCEDURES = Object.freeze([
510
- { code: "99221", label: "initial hospital care, per day" },
511
- { code: "99231", label: "subsequent hospital care, per day" }
512
- ]);
513
- var DENTAL_PROCEDURES = Object.freeze([
514
- { code: "D2391", label: "resin-based composite, one surface, posterior" },
515
- { code: "D1110", label: "prophylaxis, adult" },
516
- { code: "D0120", label: "periodic oral evaluation" }
517
- ]);
536
+ var DIAGNOSES = Object.freeze(
537
+ [
538
+ { code: "J20.9", label: "acute bronchitis, unspecified" },
539
+ { code: "E11.9", label: "type 2 diabetes mellitus without complications" },
540
+ { code: "I10", label: "essential (primary) hypertension" },
541
+ { code: "M54.5", label: "low back pain" },
542
+ { code: "R07.9", label: "chest pain, unspecified" },
543
+ { code: "Z00.00", label: "general adult medical exam without abnormal findings" }
544
+ ].map((entry) => Object.freeze(entry))
545
+ );
546
+ var REVENUE_CODES = Object.freeze(
547
+ [
548
+ { code: "0120", label: "room & board, semi-private" },
549
+ { code: "0300", label: "laboratory, general" },
550
+ { code: "0450", label: "emergency room, general" },
551
+ { code: "0636", label: "drugs requiring detailed coding" }
552
+ ].map((entry) => Object.freeze(entry))
553
+ );
554
+ var INSTITUTIONAL_PROCEDURES = Object.freeze(
555
+ [
556
+ { code: "99221", label: "initial hospital care, per day" },
557
+ { code: "99231", label: "subsequent hospital care, per day" }
558
+ ].map((entry) => Object.freeze(entry))
559
+ );
560
+ var DENTAL_PROCEDURES = Object.freeze(
561
+ [
562
+ { code: "D2391", label: "resin-based composite, one surface, posterior" },
563
+ { code: "D1110", label: "prophylaxis, adult" },
564
+ { code: "D0120", label: "periodic oral evaluation" }
565
+ ].map((entry) => Object.freeze(entry))
566
+ );
518
567
  var TOOTH_CODES = Object.freeze(["14", "3", "19", "30"]);
519
568
  var TOOTH_SURFACES = Object.freeze(["M", "O", "D", "B", "L"]);
520
569
  var CARC_CODES = Object.freeze(["1", "2", "3", "45", "96", "197"]);