@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.cjs
CHANGED
|
@@ -458,7 +458,12 @@ function isRequireEsmRefusal(error) {
|
|
|
458
458
|
}
|
|
459
459
|
function loadPeer(specifier, host) {
|
|
460
460
|
if (host.resolve === void 0) return host.require(specifier);
|
|
461
|
-
|
|
461
|
+
let entry;
|
|
462
|
+
try {
|
|
463
|
+
entry = url.fileURLToPath(host.resolve(specifier));
|
|
464
|
+
} catch {
|
|
465
|
+
return host.require(specifier);
|
|
466
|
+
}
|
|
462
467
|
try {
|
|
463
468
|
return host.require(entry);
|
|
464
469
|
} catch (error) {
|
|
@@ -504,7 +509,9 @@ function mshScaffold(rng, type) {
|
|
|
504
509
|
controlId,
|
|
505
510
|
timestamp,
|
|
506
511
|
version: "2.5",
|
|
507
|
-
|
|
512
|
+
// MSH-11 processing ID `T` (HL7 table 0103: training), never `P` (production): every message
|
|
513
|
+
// says it is test data in the field the standard gives for it.
|
|
514
|
+
processingId: "T"
|
|
508
515
|
});
|
|
509
516
|
return { message, timestamp, controlId };
|
|
510
517
|
}
|
|
@@ -974,8 +981,18 @@ function narrative(text) {
|
|
|
974
981
|
prop("div", str(`<div xmlns="http://www.w3.org/1999/xhtml"><p>${escaped}</p></div>`))
|
|
975
982
|
]);
|
|
976
983
|
}
|
|
984
|
+
var TEST_DATA_LABEL = Object.freeze({
|
|
985
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActReason",
|
|
986
|
+
code: "HTEST",
|
|
987
|
+
display: "test health data"
|
|
988
|
+
});
|
|
977
989
|
function meta(profiles) {
|
|
978
|
-
|
|
990
|
+
const props = [];
|
|
991
|
+
if (profiles.length > 0) {
|
|
992
|
+
props.push(prop("profile", fhirPeer().list(profiles.map((p) => str(p)))));
|
|
993
|
+
}
|
|
994
|
+
props.push(prop("security", fhirPeer().list([coding(TEST_DATA_LABEL)])));
|
|
995
|
+
return fhirPeer().complex(props);
|
|
979
996
|
}
|
|
980
997
|
function toFhirDate(ymd) {
|
|
981
998
|
return `${ymd.slice(0, 4)}-${ymd.slice(4, 6)}-${ymd.slice(6, 8)}`;
|
|
@@ -1307,7 +1324,7 @@ function generatePatient(options = {}) {
|
|
|
1307
1324
|
prop("resourceType", str("Patient")),
|
|
1308
1325
|
prop("id", str(`syn-patient-${id.id}`))
|
|
1309
1326
|
];
|
|
1310
|
-
|
|
1327
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.PATIENT] : [])));
|
|
1311
1328
|
props.push(
|
|
1312
1329
|
prop(
|
|
1313
1330
|
"text",
|
|
@@ -1389,7 +1406,7 @@ function generateCondition(options = {}) {
|
|
|
1389
1406
|
prop("resourceType", str("Condition")),
|
|
1390
1407
|
prop("id", str(`syn-cond-${rng.digits(8)}`))
|
|
1391
1408
|
];
|
|
1392
|
-
|
|
1409
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.CONDITION] : [])));
|
|
1393
1410
|
props.push(prop("text", narrative(`Synthetic condition: ${code.display}.`)));
|
|
1394
1411
|
props.push(
|
|
1395
1412
|
prop(
|
|
@@ -1445,7 +1462,7 @@ function buildObservation(seed, subject, usCore, profileUrl, category, pool, eff
|
|
|
1445
1462
|
prop("resourceType", str("Observation")),
|
|
1446
1463
|
prop("id", str(`syn-obs-${rng.digits(8)}`))
|
|
1447
1464
|
];
|
|
1448
|
-
|
|
1465
|
+
props.push(prop("meta", meta(usCore ? [profileUrl] : [])));
|
|
1449
1466
|
props.push(
|
|
1450
1467
|
prop("text", narrative(`Synthetic ${category.display.toLowerCase()}: ${concept.display}.`))
|
|
1451
1468
|
);
|
|
@@ -1513,7 +1530,7 @@ function generateMedicationRequest(options = {}) {
|
|
|
1513
1530
|
prop("resourceType", str("MedicationRequest")),
|
|
1514
1531
|
prop("id", str(`syn-medreq-${rng.digits(8)}`))
|
|
1515
1532
|
];
|
|
1516
|
-
|
|
1533
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.MEDICATION_REQUEST] : [])));
|
|
1517
1534
|
props.push(prop("text", narrative(`Synthetic medication order: ${med.display}.`)));
|
|
1518
1535
|
props.push(prop("status", str("active")));
|
|
1519
1536
|
props.push(prop("intent", str("order")));
|
|
@@ -1536,7 +1553,7 @@ function generateEncounter(options = {}) {
|
|
|
1536
1553
|
prop("resourceType", str("Encounter")),
|
|
1537
1554
|
prop("id", str(`syn-enc-${rng.digits(8)}`))
|
|
1538
1555
|
];
|
|
1539
|
-
|
|
1556
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.ENCOUNTER] : [])));
|
|
1540
1557
|
props.push(prop("text", narrative(`Synthetic encounter: ${type.display}.`)));
|
|
1541
1558
|
props.push(
|
|
1542
1559
|
prop(
|
|
@@ -1567,7 +1584,7 @@ function generateImmunization(options = {}) {
|
|
|
1567
1584
|
prop("resourceType", str("Immunization")),
|
|
1568
1585
|
prop("id", str(`syn-imm-${rng.digits(8)}`))
|
|
1569
1586
|
];
|
|
1570
|
-
|
|
1587
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.IMMUNIZATION] : [])));
|
|
1571
1588
|
props.push(prop("text", narrative(`Synthetic immunization: ${vaccine.display}.`)));
|
|
1572
1589
|
props.push(prop("status", str("completed")));
|
|
1573
1590
|
props.push(prop("vaccineCode", codeableConcept(vaccine)));
|
|
@@ -1587,7 +1604,7 @@ function generateAllergyIntolerance(options = {}) {
|
|
|
1587
1604
|
prop("resourceType", str("AllergyIntolerance")),
|
|
1588
1605
|
prop("id", str(`syn-allergy-${rng.digits(8)}`))
|
|
1589
1606
|
];
|
|
1590
|
-
|
|
1607
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.ALLERGY_INTOLERANCE] : [])));
|
|
1591
1608
|
props.push(prop("text", narrative(`Synthetic allergy: ${allergen.display}.`)));
|
|
1592
1609
|
props.push(
|
|
1593
1610
|
prop(
|
|
@@ -1630,7 +1647,7 @@ function generateProcedure(options = {}) {
|
|
|
1630
1647
|
prop("resourceType", str("Procedure")),
|
|
1631
1648
|
prop("id", str(`syn-proc-${rng.digits(8)}`))
|
|
1632
1649
|
];
|
|
1633
|
-
|
|
1650
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.PROCEDURE] : [])));
|
|
1634
1651
|
props.push(prop("text", narrative(`Synthetic procedure: ${code.display}.`)));
|
|
1635
1652
|
props.push(prop("status", str("completed")));
|
|
1636
1653
|
props.push(prop("code", codeableConcept(code)));
|
|
@@ -1649,7 +1666,7 @@ function generateDiagnosticReport(options = {}) {
|
|
|
1649
1666
|
prop("resourceType", str("DiagnosticReport")),
|
|
1650
1667
|
prop("id", str(`syn-dr-${rng.digits(8)}`))
|
|
1651
1668
|
];
|
|
1652
|
-
|
|
1669
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.DIAGNOSTIC_REPORT_LAB] : [])));
|
|
1653
1670
|
props.push(prop("text", narrative(`Synthetic laboratory report: ${code.display}.`)));
|
|
1654
1671
|
props.push(prop("status", str("final")));
|
|
1655
1672
|
props.push(
|
|
@@ -1686,6 +1703,7 @@ function buildComposition(rng, input) {
|
|
|
1686
1703
|
const props = [
|
|
1687
1704
|
prop("resourceType", str("Composition")),
|
|
1688
1705
|
prop("id", str(`syn-comp-${rng.digits(8)}`)),
|
|
1706
|
+
prop("meta", meta([])),
|
|
1689
1707
|
prop("text", narrative("Synthetic continuity-of-care document summary.")),
|
|
1690
1708
|
prop("status", str("final")),
|
|
1691
1709
|
prop(
|
|
@@ -1721,6 +1739,7 @@ function buildOrganization(rng) {
|
|
|
1721
1739
|
return fhirPeer().complex([
|
|
1722
1740
|
prop("resourceType", str("Organization")),
|
|
1723
1741
|
prop("id", str(`syn-org-${rng.digits(8)}`)),
|
|
1742
|
+
prop("meta", meta([])),
|
|
1724
1743
|
prop("text", narrative("Synthetic health organization.")),
|
|
1725
1744
|
prop(
|
|
1726
1745
|
"identifier",
|
|
@@ -1849,7 +1868,8 @@ function generateBundle(options = {}) {
|
|
|
1849
1868
|
});
|
|
1850
1869
|
const props = [
|
|
1851
1870
|
prop("resourceType", str("Bundle")),
|
|
1852
|
-
prop("id", str(`syn-bundle-${rng.digits(8)}`))
|
|
1871
|
+
prop("id", str(`syn-bundle-${rng.digits(8)}`)),
|
|
1872
|
+
prop("meta", meta([]))
|
|
1853
1873
|
];
|
|
1854
1874
|
if (type === "document") {
|
|
1855
1875
|
const id = safe.identifier(rng, "AN");
|