@cosyte/synth 0.1.4 → 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.
- package/CHANGELOG.md +12 -0
- package/README.md +14 -10
- package/dist/astm/index.cjs +109 -84
- package/dist/astm/index.cjs.map +1 -1
- package/dist/astm/index.mjs +109 -84
- package/dist/astm/index.mjs.map +1 -1
- package/dist/ccda/index.cjs +24 -2
- package/dist/ccda/index.cjs.map +1 -1
- package/dist/ccda/index.mjs +24 -2
- package/dist/ccda/index.mjs.map +1 -1
- package/dist/deid/index.cjs +98 -47
- package/dist/deid/index.cjs.map +1 -1
- package/dist/deid/index.mjs +98 -47
- package/dist/deid/index.mjs.map +1 -1
- package/dist/fhir/index.cjs +33 -2
- package/dist/fhir/index.cjs.map +1 -1
- package/dist/fhir/index.mjs +33 -2
- package/dist/fhir/index.mjs.map +1 -1
- package/dist/hl7/index.cjs +33 -3
- package/dist/hl7/index.cjs.map +1 -1
- package/dist/hl7/index.mjs +33 -3
- package/dist/hl7/index.mjs.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/ncpdp/index.cjs +57 -14
- package/dist/ncpdp/index.cjs.map +1 -1
- package/dist/ncpdp/index.mjs +57 -14
- package/dist/ncpdp/index.mjs.map +1 -1
- package/dist/x12/index.cjs +82 -33
- package/dist/x12/index.cjs.map +1 -1
- package/dist/x12/index.mjs +82 -33
- package/dist/x12/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/astm/index.mjs
CHANGED
|
@@ -30,7 +30,16 @@ 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",
|
|
34
43
|
/**
|
|
35
44
|
* A vendor quirk was requested that the target format's profile system does not support. Fatal,
|
|
36
45
|
* never a silent no-op and never a fabricated quirk.
|
|
@@ -47,6 +56,10 @@ var SYNTH_FATAL_CODES = {
|
|
|
47
56
|
* warning code(s). Fatal, never emit a mislabeled fixture.
|
|
48
57
|
*/
|
|
49
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",
|
|
61
|
+
/** A money value could not be read as an X12 decimal. Fatal: a generator never rounds to a float. */
|
|
62
|
+
SYNTH_INVALID_DECIMAL: "SYNTH_INVALID_DECIMAL",
|
|
50
63
|
/** An integer range was requested with its maximum below its minimum. Fatal. */
|
|
51
64
|
SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE",
|
|
52
65
|
/** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
|
|
@@ -59,7 +72,17 @@ var SYNTH_FATAL_CODES = {
|
|
|
59
72
|
* see `resolveKind`: a selector union is erased at run time, and a selector that falls through
|
|
60
73
|
* either mislabels the fixture or hands the value to a peer builder that quotes it back.
|
|
61
74
|
*/
|
|
62
|
-
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
|
+
});
|
|
63
86
|
var SYNTH_FATAL_MESSAGES = Object.freeze({
|
|
64
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.",
|
|
65
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).",
|
|
@@ -470,88 +493,90 @@ function astmHeaderIdentity(rng) {
|
|
|
470
493
|
}
|
|
471
494
|
|
|
472
495
|
// src/astm/example-codes.ts
|
|
473
|
-
var EXAMPLE_ASTM_TESTS = Object.freeze(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
496
|
+
var EXAMPLE_ASTM_TESTS = Object.freeze(
|
|
497
|
+
[
|
|
498
|
+
{
|
|
499
|
+
localCode: "GLU",
|
|
500
|
+
loinc: "2345-7",
|
|
501
|
+
name: "Glucose",
|
|
502
|
+
units: "mg/dL",
|
|
503
|
+
referenceRange: "70-110",
|
|
504
|
+
valueLow: 55,
|
|
505
|
+
valueHigh: 260,
|
|
506
|
+
decimals: 0
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
localCode: "K",
|
|
510
|
+
loinc: "2823-3",
|
|
511
|
+
name: "Potassium",
|
|
512
|
+
units: "mmol/L",
|
|
513
|
+
referenceRange: "3.5-5.1",
|
|
514
|
+
valueLow: 28,
|
|
515
|
+
valueHigh: 62,
|
|
516
|
+
decimals: 1
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
localCode: "NA",
|
|
520
|
+
loinc: "2951-2",
|
|
521
|
+
name: "Sodium",
|
|
522
|
+
units: "mmol/L",
|
|
523
|
+
referenceRange: "136-145",
|
|
524
|
+
valueLow: 125,
|
|
525
|
+
valueHigh: 155,
|
|
526
|
+
decimals: 0
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
localCode: "CREA",
|
|
530
|
+
loinc: "2160-0",
|
|
531
|
+
name: "Creatinine",
|
|
532
|
+
units: "mg/dL",
|
|
533
|
+
referenceRange: "0.6-1.3",
|
|
534
|
+
valueLow: 4,
|
|
535
|
+
valueHigh: 32,
|
|
536
|
+
decimals: 1
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
localCode: "HGB",
|
|
540
|
+
loinc: "718-7",
|
|
541
|
+
name: "Hemoglobin",
|
|
542
|
+
units: "g/dL",
|
|
543
|
+
referenceRange: "12.0-17.5",
|
|
544
|
+
valueLow: 80,
|
|
545
|
+
valueHigh: 190,
|
|
546
|
+
decimals: 1
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
localCode: "WBC",
|
|
550
|
+
loinc: "6690-2",
|
|
551
|
+
name: "Leukocytes",
|
|
552
|
+
units: "10*3/uL",
|
|
553
|
+
referenceRange: "4.5-11.0",
|
|
554
|
+
valueLow: 30,
|
|
555
|
+
valueHigh: 150,
|
|
556
|
+
decimals: 1
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
localCode: "TSH",
|
|
560
|
+
loinc: "3016-3",
|
|
561
|
+
name: "Thyrotropin",
|
|
562
|
+
units: "mIU/L",
|
|
563
|
+
referenceRange: "0.40-4.50",
|
|
564
|
+
valueLow: 2,
|
|
565
|
+
valueHigh: 90,
|
|
566
|
+
decimals: 2
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
localCode: "ALT",
|
|
570
|
+
loinc: "1742-6",
|
|
571
|
+
name: "Alanine aminotransferase",
|
|
572
|
+
units: "U/L",
|
|
573
|
+
referenceRange: "7-56",
|
|
574
|
+
valueLow: 5,
|
|
575
|
+
valueHigh: 120,
|
|
576
|
+
decimals: 0
|
|
577
|
+
}
|
|
578
|
+
].map((entry) => Object.freeze(entry))
|
|
579
|
+
);
|
|
555
580
|
var ASTM_ABNORMAL_FLAGS = Object.freeze(["N", "L", "H", "A"]);
|
|
556
581
|
var ASTM_RESULT_STATUSES = Object.freeze(["F", "P", "C"]);
|
|
557
582
|
var ASTM_COMMENT_TEXT = Object.freeze([
|