@cosyte/synth 0.1.7 → 0.1.9
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 +24 -0
- package/README.md +8 -2
- package/dist/astm/index.cjs +10 -3
- package/dist/astm/index.cjs.map +1 -1
- package/dist/astm/index.mjs +10 -3
- package/dist/astm/index.mjs.map +1 -1
- package/dist/ccda/index.cjs +6 -1
- package/dist/ccda/index.cjs.map +1 -1
- package/dist/ccda/index.mjs +6 -1
- package/dist/ccda/index.mjs.map +1 -1
- package/dist/deid/index.cjs +33 -13
- package/dist/deid/index.cjs.map +1 -1
- package/dist/deid/index.mjs +33 -13
- package/dist/deid/index.mjs.map +1 -1
- package/dist/fhir/index.cjs +31 -13
- package/dist/fhir/index.cjs.map +1 -1
- package/dist/fhir/index.d.cts +8 -5
- package/dist/fhir/index.d.ts +8 -5
- package/dist/fhir/index.mjs +31 -13
- package/dist/fhir/index.mjs.map +1 -1
- package/dist/hl7/index.cjs +9 -2
- package/dist/hl7/index.cjs.map +1 -1
- package/dist/hl7/index.mjs +9 -2
- package/dist/hl7/index.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/ncpdp/index.cjs +6 -1
- package/dist/ncpdp/index.cjs.map +1 -1
- package/dist/ncpdp/index.mjs +6 -1
- package/dist/ncpdp/index.mjs.map +1 -1
- package/dist/x12/index.cjs +6 -1
- package/dist/x12/index.cjs.map +1 -1
- package/dist/x12/index.mjs +6 -1
- package/dist/x12/index.mjs.map +1 -1
- package/package.json +13 -5
package/dist/deid/index.mjs
CHANGED
|
@@ -455,7 +455,12 @@ function isRequireEsmRefusal(error) {
|
|
|
455
455
|
}
|
|
456
456
|
function loadPeer(specifier, host) {
|
|
457
457
|
if (host.resolve === void 0) return host.require(specifier);
|
|
458
|
-
|
|
458
|
+
let entry;
|
|
459
|
+
try {
|
|
460
|
+
entry = fileURLToPath(host.resolve(specifier));
|
|
461
|
+
} catch {
|
|
462
|
+
return host.require(specifier);
|
|
463
|
+
}
|
|
459
464
|
try {
|
|
460
465
|
return host.require(entry);
|
|
461
466
|
} catch (error) {
|
|
@@ -501,7 +506,9 @@ function mshScaffold(rng, type) {
|
|
|
501
506
|
controlId,
|
|
502
507
|
timestamp,
|
|
503
508
|
version: "2.5",
|
|
504
|
-
|
|
509
|
+
// MSH-11 processing ID `T` (HL7 table 0103: training), never `P` (production): every message
|
|
510
|
+
// says it is test data in the field the standard gives for it.
|
|
511
|
+
processingId: "T"
|
|
505
512
|
});
|
|
506
513
|
return { message, timestamp, controlId };
|
|
507
514
|
}
|
|
@@ -971,8 +978,18 @@ function narrative(text) {
|
|
|
971
978
|
prop("div", str(`<div xmlns="http://www.w3.org/1999/xhtml"><p>${escaped}</p></div>`))
|
|
972
979
|
]);
|
|
973
980
|
}
|
|
981
|
+
var TEST_DATA_LABEL = Object.freeze({
|
|
982
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActReason",
|
|
983
|
+
code: "HTEST",
|
|
984
|
+
display: "test health data"
|
|
985
|
+
});
|
|
974
986
|
function meta(profiles) {
|
|
975
|
-
|
|
987
|
+
const props = [];
|
|
988
|
+
if (profiles.length > 0) {
|
|
989
|
+
props.push(prop("profile", fhirPeer().list(profiles.map((p) => str(p)))));
|
|
990
|
+
}
|
|
991
|
+
props.push(prop("security", fhirPeer().list([coding(TEST_DATA_LABEL)])));
|
|
992
|
+
return fhirPeer().complex(props);
|
|
976
993
|
}
|
|
977
994
|
function toFhirDate(ymd) {
|
|
978
995
|
return `${ymd.slice(0, 4)}-${ymd.slice(4, 6)}-${ymd.slice(6, 8)}`;
|
|
@@ -1304,7 +1321,7 @@ function generatePatient(options = {}) {
|
|
|
1304
1321
|
prop("resourceType", str("Patient")),
|
|
1305
1322
|
prop("id", str(`syn-patient-${id.id}`))
|
|
1306
1323
|
];
|
|
1307
|
-
|
|
1324
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.PATIENT] : [])));
|
|
1308
1325
|
props.push(
|
|
1309
1326
|
prop(
|
|
1310
1327
|
"text",
|
|
@@ -1386,7 +1403,7 @@ function generateCondition(options = {}) {
|
|
|
1386
1403
|
prop("resourceType", str("Condition")),
|
|
1387
1404
|
prop("id", str(`syn-cond-${rng.digits(8)}`))
|
|
1388
1405
|
];
|
|
1389
|
-
|
|
1406
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.CONDITION] : [])));
|
|
1390
1407
|
props.push(prop("text", narrative(`Synthetic condition: ${code.display}.`)));
|
|
1391
1408
|
props.push(
|
|
1392
1409
|
prop(
|
|
@@ -1442,7 +1459,7 @@ function buildObservation(seed, subject, usCore, profileUrl, category, pool, eff
|
|
|
1442
1459
|
prop("resourceType", str("Observation")),
|
|
1443
1460
|
prop("id", str(`syn-obs-${rng.digits(8)}`))
|
|
1444
1461
|
];
|
|
1445
|
-
|
|
1462
|
+
props.push(prop("meta", meta(usCore ? [profileUrl] : [])));
|
|
1446
1463
|
props.push(
|
|
1447
1464
|
prop("text", narrative(`Synthetic ${category.display.toLowerCase()}: ${concept.display}.`))
|
|
1448
1465
|
);
|
|
@@ -1510,7 +1527,7 @@ function generateMedicationRequest(options = {}) {
|
|
|
1510
1527
|
prop("resourceType", str("MedicationRequest")),
|
|
1511
1528
|
prop("id", str(`syn-medreq-${rng.digits(8)}`))
|
|
1512
1529
|
];
|
|
1513
|
-
|
|
1530
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.MEDICATION_REQUEST] : [])));
|
|
1514
1531
|
props.push(prop("text", narrative(`Synthetic medication order: ${med.display}.`)));
|
|
1515
1532
|
props.push(prop("status", str("active")));
|
|
1516
1533
|
props.push(prop("intent", str("order")));
|
|
@@ -1533,7 +1550,7 @@ function generateEncounter(options = {}) {
|
|
|
1533
1550
|
prop("resourceType", str("Encounter")),
|
|
1534
1551
|
prop("id", str(`syn-enc-${rng.digits(8)}`))
|
|
1535
1552
|
];
|
|
1536
|
-
|
|
1553
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.ENCOUNTER] : [])));
|
|
1537
1554
|
props.push(prop("text", narrative(`Synthetic encounter: ${type.display}.`)));
|
|
1538
1555
|
props.push(
|
|
1539
1556
|
prop(
|
|
@@ -1564,7 +1581,7 @@ function generateImmunization(options = {}) {
|
|
|
1564
1581
|
prop("resourceType", str("Immunization")),
|
|
1565
1582
|
prop("id", str(`syn-imm-${rng.digits(8)}`))
|
|
1566
1583
|
];
|
|
1567
|
-
|
|
1584
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.IMMUNIZATION] : [])));
|
|
1568
1585
|
props.push(prop("text", narrative(`Synthetic immunization: ${vaccine.display}.`)));
|
|
1569
1586
|
props.push(prop("status", str("completed")));
|
|
1570
1587
|
props.push(prop("vaccineCode", codeableConcept(vaccine)));
|
|
@@ -1584,7 +1601,7 @@ function generateAllergyIntolerance(options = {}) {
|
|
|
1584
1601
|
prop("resourceType", str("AllergyIntolerance")),
|
|
1585
1602
|
prop("id", str(`syn-allergy-${rng.digits(8)}`))
|
|
1586
1603
|
];
|
|
1587
|
-
|
|
1604
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.ALLERGY_INTOLERANCE] : [])));
|
|
1588
1605
|
props.push(prop("text", narrative(`Synthetic allergy: ${allergen.display}.`)));
|
|
1589
1606
|
props.push(
|
|
1590
1607
|
prop(
|
|
@@ -1627,7 +1644,7 @@ function generateProcedure(options = {}) {
|
|
|
1627
1644
|
prop("resourceType", str("Procedure")),
|
|
1628
1645
|
prop("id", str(`syn-proc-${rng.digits(8)}`))
|
|
1629
1646
|
];
|
|
1630
|
-
|
|
1647
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.PROCEDURE] : [])));
|
|
1631
1648
|
props.push(prop("text", narrative(`Synthetic procedure: ${code.display}.`)));
|
|
1632
1649
|
props.push(prop("status", str("completed")));
|
|
1633
1650
|
props.push(prop("code", codeableConcept(code)));
|
|
@@ -1646,7 +1663,7 @@ function generateDiagnosticReport(options = {}) {
|
|
|
1646
1663
|
prop("resourceType", str("DiagnosticReport")),
|
|
1647
1664
|
prop("id", str(`syn-dr-${rng.digits(8)}`))
|
|
1648
1665
|
];
|
|
1649
|
-
|
|
1666
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.DIAGNOSTIC_REPORT_LAB] : [])));
|
|
1650
1667
|
props.push(prop("text", narrative(`Synthetic laboratory report: ${code.display}.`)));
|
|
1651
1668
|
props.push(prop("status", str("final")));
|
|
1652
1669
|
props.push(
|
|
@@ -1683,6 +1700,7 @@ function buildComposition(rng, input) {
|
|
|
1683
1700
|
const props = [
|
|
1684
1701
|
prop("resourceType", str("Composition")),
|
|
1685
1702
|
prop("id", str(`syn-comp-${rng.digits(8)}`)),
|
|
1703
|
+
prop("meta", meta([])),
|
|
1686
1704
|
prop("text", narrative("Synthetic continuity-of-care document summary.")),
|
|
1687
1705
|
prop("status", str("final")),
|
|
1688
1706
|
prop(
|
|
@@ -1718,6 +1736,7 @@ function buildOrganization(rng) {
|
|
|
1718
1736
|
return fhirPeer().complex([
|
|
1719
1737
|
prop("resourceType", str("Organization")),
|
|
1720
1738
|
prop("id", str(`syn-org-${rng.digits(8)}`)),
|
|
1739
|
+
prop("meta", meta([])),
|
|
1721
1740
|
prop("text", narrative("Synthetic health organization.")),
|
|
1722
1741
|
prop(
|
|
1723
1742
|
"identifier",
|
|
@@ -1846,7 +1865,8 @@ function generateBundle(options = {}) {
|
|
|
1846
1865
|
});
|
|
1847
1866
|
const props = [
|
|
1848
1867
|
prop("resourceType", str("Bundle")),
|
|
1849
|
-
prop("id", str(`syn-bundle-${rng.digits(8)}`))
|
|
1868
|
+
prop("id", str(`syn-bundle-${rng.digits(8)}`)),
|
|
1869
|
+
prop("meta", meta([]))
|
|
1850
1870
|
];
|
|
1851
1871
|
if (type === "document") {
|
|
1852
1872
|
const id = safe.identifier(rng, "AN");
|