@cosyte/synth 0.0.9 → 0.1.0
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 +73 -0
- package/README.md +21 -12
- package/dist/astm/index.cjs +18 -6
- package/dist/astm/index.cjs.map +1 -1
- package/dist/astm/index.d.cts +2 -2
- package/dist/astm/index.d.ts +2 -2
- package/dist/astm/index.mjs +18 -6
- package/dist/astm/index.mjs.map +1 -1
- package/dist/ccda/index.cjs +23 -7
- package/dist/ccda/index.cjs.map +1 -1
- package/dist/ccda/index.d.cts +2 -2
- package/dist/ccda/index.d.ts +2 -2
- package/dist/ccda/index.mjs +23 -7
- package/dist/ccda/index.mjs.map +1 -1
- package/dist/deid/index.cjs +26 -8
- package/dist/deid/index.cjs.map +1 -1
- package/dist/deid/index.d.cts +2 -2
- package/dist/deid/index.d.ts +2 -2
- package/dist/deid/index.mjs +26 -8
- package/dist/deid/index.mjs.map +1 -1
- package/dist/fhir/index.cjs +174 -7
- package/dist/fhir/index.cjs.map +1 -1
- package/dist/fhir/index.d.cts +163 -2
- package/dist/fhir/index.d.ts +163 -2
- package/dist/fhir/index.mjs +171 -9
- package/dist/fhir/index.mjs.map +1 -1
- package/dist/hl7/index.cjs +18 -6
- package/dist/hl7/index.cjs.map +1 -1
- package/dist/hl7/index.d.cts +2 -2
- package/dist/hl7/index.d.ts +2 -2
- package/dist/hl7/index.mjs +18 -6
- package/dist/hl7/index.mjs.map +1 -1
- package/dist/index.cjs +37 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -38
- package/dist/index.d.ts +172 -38
- package/dist/index.mjs +36 -7
- package/dist/index.mjs.map +1 -1
- package/dist/ncpdp/index.cjs +18 -6
- package/dist/ncpdp/index.cjs.map +1 -1
- package/dist/ncpdp/index.d.cts +1 -1
- package/dist/ncpdp/index.d.ts +1 -1
- package/dist/ncpdp/index.mjs +18 -6
- package/dist/ncpdp/index.mjs.map +1 -1
- package/dist/{providers-B9uVinAe.d.cts → providers-BQtPk3PN.d.cts} +18 -4
- package/dist/{providers-B9uVinAe.d.ts → providers-BQtPk3PN.d.ts} +18 -4
- package/dist/{quirk-HZdznAkM.d.ts → quirk-Bzx9g8KG.d.ts} +1 -1
- package/dist/{quirk-IaHp4z7N.d.cts → quirk-C_lZrspq.d.cts} +1 -1
- package/dist/x12/index.cjs +18 -6
- package/dist/x12/index.cjs.map +1 -1
- package/dist/x12/index.d.cts +1 -1
- package/dist/x12/index.d.ts +1 -1
- package/dist/x12/index.mjs +18 -6
- package/dist/x12/index.mjs.map +1 -1
- package/package.json +54 -30
package/dist/hl7/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
-
import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-
|
|
2
|
+
import { S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress, R as Rng, C as Corpus } from '../providers-BQtPk3PN.cjs';
|
|
3
|
+
import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-C_lZrspq.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Spec-clean HL7 v2 `ADT` generation, built **through `@cosyte/hl7`'s `buildMessage`** so MSH
|
package/dist/hl7/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
-
import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-
|
|
2
|
+
import { S as SyntheticName, a as SyntheticIdentifier, b as SyntheticAddress, R as Rng, C as Corpus } from '../providers-BQtPk3PN.js';
|
|
3
|
+
import { Q as QuirkDescriptor, S as SynthProfile, a as QuirkArtifact, b as QuirkRoundTripResult } from '../quirk-Bzx9g8KG.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Spec-clean HL7 v2 `ADT` generation, built **through `@cosyte/hl7`'s `buildMessage`** so MSH
|
package/dist/hl7/index.mjs
CHANGED
|
@@ -53,8 +53,7 @@ var SYNTH_FATAL_CODES = {
|
|
|
53
53
|
* see `resolveKind`: a selector union is erased at run time, and a selector that falls through
|
|
54
54
|
* either mislabels the fixture or hands the value to a peer builder that quotes it back.
|
|
55
55
|
*/
|
|
56
|
-
SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"
|
|
57
|
-
};
|
|
56
|
+
SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"};
|
|
58
57
|
var SYNTH_FATAL_MESSAGES = Object.freeze({
|
|
59
58
|
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.",
|
|
60
59
|
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).",
|
|
@@ -65,7 +64,8 @@ var SYNTH_FATAL_MESSAGES = Object.freeze({
|
|
|
65
64
|
SYNTH_INVALID_RANGE: "An integer range was requested with its maximum below its minimum.",
|
|
66
65
|
SYNTH_EMPTY_POOL: "A value was drawn from an empty pool.",
|
|
67
66
|
SYNTH_INVALID_PROFILE: "defineSynthProfile requires a non-empty string name.",
|
|
68
|
-
SYNTH_UNSUPPORTED_KIND: "The requested kind, document type, corpus mix entry, variant or profile is not one this generator supports. The supported set is the exported union for that option."
|
|
67
|
+
SYNTH_UNSUPPORTED_KIND: "The requested kind, document type, corpus mix entry, variant or profile is not one this generator supports. The supported set is the exported union for that option.",
|
|
68
|
+
SYNTH_PROFILE_NOT_GENERATED: "The requested profile is published by the adopted implementation guide, and this build does not generate it. The coverage surface reports, per adopted profile, whether it is generated."
|
|
69
69
|
});
|
|
70
70
|
var SynthError = class extends Error {
|
|
71
71
|
/** The stable fatal code. */
|
|
@@ -151,7 +151,7 @@ function componentsField(components) {
|
|
|
151
151
|
var SYNTHETIC_ASSIGNING_AUTHORITY = Object.freeze({
|
|
152
152
|
/** The human-readable assigning-authority namespace id (HL7 HD.1). */
|
|
153
153
|
namespaceId: "COSYTE-SYNTH",
|
|
154
|
-
/** The universal id, an OID under
|
|
154
|
+
/** The universal id, an OID this package chose under the root `2.16.840.1.113883.19` (HD.2). */
|
|
155
155
|
universalId: "2.16.840.1.113883.19.999",
|
|
156
156
|
/** The universal id type (HD.3). */
|
|
157
157
|
universalIdType: "ISO"
|
|
@@ -170,6 +170,18 @@ var TEST_NET_V4_PREFIXES = Object.freeze([
|
|
|
170
170
|
// TEST-NET-3
|
|
171
171
|
]);
|
|
172
172
|
var DOC_V6_PREFIX = "2001:db8";
|
|
173
|
+
var ITIN_GROUP_RANGES = Object.freeze([
|
|
174
|
+
Object.freeze({ min: 50, max: 65 }),
|
|
175
|
+
Object.freeze({ min: 70, max: 88 }),
|
|
176
|
+
Object.freeze({ min: 90, max: 92 }),
|
|
177
|
+
Object.freeze({ min: 94, max: 99 })
|
|
178
|
+
]);
|
|
179
|
+
var ITIN_EXCLUDED_GROUPS = Object.freeze([89, 93]);
|
|
180
|
+
var SSN_SYNTHETIC_GROUPS = Object.freeze(
|
|
181
|
+
Array.from({ length: 100 }, (_unused, group) => group).filter(
|
|
182
|
+
(group) => !ITIN_GROUP_RANGES.some((range) => group >= range.min && group <= range.max) && !ITIN_EXCLUDED_GROUPS.includes(group)
|
|
183
|
+
).map((group) => String(group).padStart(2, "0"))
|
|
184
|
+
);
|
|
173
185
|
var NPI_LUHN_PREFIX = "80840";
|
|
174
186
|
function luhnMod10(digits) {
|
|
175
187
|
let sum = 0;
|
|
@@ -278,10 +290,10 @@ var SYNTHETIC_CITY_NAMES = Object.freeze([
|
|
|
278
290
|
// src/safe/providers.ts
|
|
279
291
|
function ssn(rng, block = "never-issued") {
|
|
280
292
|
if (block === "advertising") {
|
|
281
|
-
return `987-
|
|
293
|
+
return `987-00-432${String(rng.int(0, 9))}`;
|
|
282
294
|
}
|
|
283
295
|
const area = rng.int(900, 999);
|
|
284
|
-
const group = rng.
|
|
296
|
+
const group = rng.pick(SSN_SYNTHETIC_GROUPS);
|
|
285
297
|
const serial = rng.digits(4);
|
|
286
298
|
return `${String(area)}-${group}-${serial}`;
|
|
287
299
|
}
|