@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,7 +1,7 @@
1
- import { S as SyntheticName, a as SyntheticIdentifier, R as Rng, C as Corpus } from '../providers-DcPrqmp5.cjs';
1
+ import { SyntheticName, SyntheticIdentifier, Rng, Corpus } from '../index.cjs';
2
2
  import { CcdaDocument, BuildCcdaPatient, BuildCode, BuildQuantity } from '@cosyte/ccda';
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-CilFUhwX.cjs';
3
+ import { CodeConcept, QuantConcept } from '../fhir/index.cjs';
4
+ import { QuirkDescriptor, SynthProfile, QuirkArtifact, QuirkRoundTripResult } from '../index.cjs';
5
5
 
6
6
  /**
7
7
  * Synthetic **C-CDA document generation**: a spec-clean Continuity of Care Document
@@ -379,4 +379,5 @@ interface CcdaCorpusOptions {
379
379
  */
380
380
  declare function ccdaCorpus(options: CcdaCorpusOptions): Corpus;
381
381
 
382
- export { ALLERGENS, ALLERGY_REACTIONS, CCDA_QUIRKS, type CcdaCorpusKind, type CcdaCorpusOptions, type CcdaDocumentType, type CcdaPatientIdentity, type CcdaQuirkCorpusOptions, type CcdaQuirkName, type GenerateCcdaOptions, type GenerateCcdaQuirkOptions, LAB_RESULTS, MEDICATIONS, PROBLEMS, PROCEDURES, RESULT_PANELS, ROUTES, type RoundTripResult, SMOKING_STATUSES, VACCINES, VITAL_SIGNS, ccdaCorpus, ccdaPatientIdentity, ccdaQuirkCorpus, ccdaQuirkProfile, ccdaQuirkRoundTrip, generateCcd, generateCcda, generateCcdaQuirk, generateReferralNote, injectCcdaQuirk, quantityFor, roundTrip, toBuildCode };
382
+ export { ALLERGENS, ALLERGY_REACTIONS, CCDA_QUIRKS, LAB_RESULTS, MEDICATIONS, PROBLEMS, PROCEDURES, RESULT_PANELS, ROUTES, SMOKING_STATUSES, VACCINES, VITAL_SIGNS, ccdaCorpus, ccdaPatientIdentity, ccdaQuirkCorpus, ccdaQuirkProfile, ccdaQuirkRoundTrip, generateCcd, generateCcda, generateCcdaQuirk, generateReferralNote, injectCcdaQuirk, quantityFor, roundTrip, toBuildCode };
383
+ export type { CcdaCorpusKind, CcdaCorpusOptions, CcdaDocumentType, CcdaPatientIdentity, CcdaQuirkCorpusOptions, CcdaQuirkName, GenerateCcdaOptions, GenerateCcdaQuirkOptions, RoundTripResult };
@@ -1,7 +1,7 @@
1
- import { S as SyntheticName, a as SyntheticIdentifier, R as Rng, C as Corpus } from '../providers-DcPrqmp5.js';
1
+ import { SyntheticName, SyntheticIdentifier, Rng, Corpus } from '../index.js';
2
2
  import { CcdaDocument, BuildCcdaPatient, BuildCode, BuildQuantity } from '@cosyte/ccda';
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-DmqYw3Vk.js';
3
+ import { CodeConcept, QuantConcept } from '../fhir/index.js';
4
+ import { QuirkDescriptor, SynthProfile, QuirkArtifact, QuirkRoundTripResult } from '../index.js';
5
5
 
6
6
  /**
7
7
  * Synthetic **C-CDA document generation**: a spec-clean Continuity of Care Document
@@ -379,4 +379,5 @@ interface CcdaCorpusOptions {
379
379
  */
380
380
  declare function ccdaCorpus(options: CcdaCorpusOptions): Corpus;
381
381
 
382
- export { ALLERGENS, ALLERGY_REACTIONS, CCDA_QUIRKS, type CcdaCorpusKind, type CcdaCorpusOptions, type CcdaDocumentType, type CcdaPatientIdentity, type CcdaQuirkCorpusOptions, type CcdaQuirkName, type GenerateCcdaOptions, type GenerateCcdaQuirkOptions, LAB_RESULTS, MEDICATIONS, PROBLEMS, PROCEDURES, RESULT_PANELS, ROUTES, type RoundTripResult, SMOKING_STATUSES, VACCINES, VITAL_SIGNS, ccdaCorpus, ccdaPatientIdentity, ccdaQuirkCorpus, ccdaQuirkProfile, ccdaQuirkRoundTrip, generateCcd, generateCcda, generateCcdaQuirk, generateReferralNote, injectCcdaQuirk, quantityFor, roundTrip, toBuildCode };
382
+ export { ALLERGENS, ALLERGY_REACTIONS, CCDA_QUIRKS, LAB_RESULTS, MEDICATIONS, PROBLEMS, PROCEDURES, RESULT_PANELS, ROUTES, SMOKING_STATUSES, VACCINES, VITAL_SIGNS, ccdaCorpus, ccdaPatientIdentity, ccdaQuirkCorpus, ccdaQuirkProfile, ccdaQuirkRoundTrip, generateCcd, generateCcda, generateCcdaQuirk, generateReferralNote, injectCcdaQuirk, quantityFor, roundTrip, toBuildCode };
383
+ export type { CcdaCorpusKind, CcdaCorpusOptions, CcdaDocumentType, CcdaPatientIdentity, CcdaQuirkCorpusOptions, CcdaQuirkName, GenerateCcdaOptions, GenerateCcdaQuirkOptions, RoundTripResult };
@@ -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.
@@ -49,6 +58,8 @@ var SYNTH_FATAL_CODES = {
49
58
  SYNTH_INTENDED_WARNING_MISMATCH: "SYNTH_INTENDED_WARNING_MISMATCH",
50
59
  /** A concept's code-system URI has no OID mapping in the C-CDA example-code table. Fatal. */
51
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",
52
63
  /** An integer range was requested with its maximum below its minimum. Fatal. */
53
64
  SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE",
54
65
  /** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
@@ -61,7 +72,17 @@ var SYNTH_FATAL_CODES = {
61
72
  * see `resolveKind`: a selector union is erased at run time, and a selector that falls through
62
73
  * either mislabels the fixture or hands the value to a peer builder that quotes it back.
63
74
  */
64
- 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
+ });
65
86
  var SYNTH_FATAL_MESSAGES = Object.freeze({
66
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.",
67
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).",
@@ -1073,6 +1094,7 @@ function ccdaQuirkRoundTrip(artifact) {
1073
1094
  intendedWarnings: artifact.intendedWarnings,
1074
1095
  intendedWarningHeld: sameCodeSet(bare, artifact.intendedWarnings),
1075
1096
  withProfile: {
1097
+ /* v8 ignore next -- the `?? profile.name` is unreachable: every descriptor in the frozen CCDA_QUIRKS names its toleratingProfile */
1076
1098
  profileName: descriptor.toleratingProfile ?? profile.name,
1077
1099
  disposition: descriptor.disposition,
1078
1100
  warnings: profiledWarnings,