@cosyte/synth 0.1.7 → 0.1.8
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 +16 -0
- package/README.md +8 -2
- package/dist/astm/index.cjs +4 -2
- package/dist/astm/index.cjs.map +1 -1
- package/dist/astm/index.mjs +4 -2
- package/dist/astm/index.mjs.map +1 -1
- package/dist/ccda/index.cjs.map +1 -1
- package/dist/ccda/index.mjs.map +1 -1
- package/dist/deid/index.cjs +27 -12
- package/dist/deid/index.cjs.map +1 -1
- package/dist/deid/index.mjs +27 -12
- package/dist/deid/index.mjs.map +1 -1
- package/dist/fhir/index.cjs +25 -12
- 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 +25 -12
- package/dist/fhir/index.mjs.map +1 -1
- package/dist/hl7/index.cjs +3 -1
- package/dist/hl7/index.cjs.map +1 -1
- package/dist/hl7/index.mjs +3 -1
- 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.map +1 -1
- package/dist/ncpdp/index.mjs.map +1 -1
- package/dist/x12/index.cjs.map +1 -1
- package/dist/x12/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/deid/index.cjs
CHANGED
|
@@ -504,7 +504,9 @@ function mshScaffold(rng, type) {
|
|
|
504
504
|
controlId,
|
|
505
505
|
timestamp,
|
|
506
506
|
version: "2.5",
|
|
507
|
-
|
|
507
|
+
// MSH-11 processing ID `T` (HL7 table 0103: training), never `P` (production): every message
|
|
508
|
+
// says it is test data in the field the standard gives for it.
|
|
509
|
+
processingId: "T"
|
|
508
510
|
});
|
|
509
511
|
return { message, timestamp, controlId };
|
|
510
512
|
}
|
|
@@ -974,8 +976,18 @@ function narrative(text) {
|
|
|
974
976
|
prop("div", str(`<div xmlns="http://www.w3.org/1999/xhtml"><p>${escaped}</p></div>`))
|
|
975
977
|
]);
|
|
976
978
|
}
|
|
979
|
+
var TEST_DATA_LABEL = Object.freeze({
|
|
980
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActReason",
|
|
981
|
+
code: "HTEST",
|
|
982
|
+
display: "test health data"
|
|
983
|
+
});
|
|
977
984
|
function meta(profiles) {
|
|
978
|
-
|
|
985
|
+
const props = [];
|
|
986
|
+
if (profiles.length > 0) {
|
|
987
|
+
props.push(prop("profile", fhirPeer().list(profiles.map((p) => str(p)))));
|
|
988
|
+
}
|
|
989
|
+
props.push(prop("security", fhirPeer().list([coding(TEST_DATA_LABEL)])));
|
|
990
|
+
return fhirPeer().complex(props);
|
|
979
991
|
}
|
|
980
992
|
function toFhirDate(ymd) {
|
|
981
993
|
return `${ymd.slice(0, 4)}-${ymd.slice(4, 6)}-${ymd.slice(6, 8)}`;
|
|
@@ -1307,7 +1319,7 @@ function generatePatient(options = {}) {
|
|
|
1307
1319
|
prop("resourceType", str("Patient")),
|
|
1308
1320
|
prop("id", str(`syn-patient-${id.id}`))
|
|
1309
1321
|
];
|
|
1310
|
-
|
|
1322
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.PATIENT] : [])));
|
|
1311
1323
|
props.push(
|
|
1312
1324
|
prop(
|
|
1313
1325
|
"text",
|
|
@@ -1389,7 +1401,7 @@ function generateCondition(options = {}) {
|
|
|
1389
1401
|
prop("resourceType", str("Condition")),
|
|
1390
1402
|
prop("id", str(`syn-cond-${rng.digits(8)}`))
|
|
1391
1403
|
];
|
|
1392
|
-
|
|
1404
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.CONDITION] : [])));
|
|
1393
1405
|
props.push(prop("text", narrative(`Synthetic condition: ${code.display}.`)));
|
|
1394
1406
|
props.push(
|
|
1395
1407
|
prop(
|
|
@@ -1445,7 +1457,7 @@ function buildObservation(seed, subject, usCore, profileUrl, category, pool, eff
|
|
|
1445
1457
|
prop("resourceType", str("Observation")),
|
|
1446
1458
|
prop("id", str(`syn-obs-${rng.digits(8)}`))
|
|
1447
1459
|
];
|
|
1448
|
-
|
|
1460
|
+
props.push(prop("meta", meta(usCore ? [profileUrl] : [])));
|
|
1449
1461
|
props.push(
|
|
1450
1462
|
prop("text", narrative(`Synthetic ${category.display.toLowerCase()}: ${concept.display}.`))
|
|
1451
1463
|
);
|
|
@@ -1513,7 +1525,7 @@ function generateMedicationRequest(options = {}) {
|
|
|
1513
1525
|
prop("resourceType", str("MedicationRequest")),
|
|
1514
1526
|
prop("id", str(`syn-medreq-${rng.digits(8)}`))
|
|
1515
1527
|
];
|
|
1516
|
-
|
|
1528
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.MEDICATION_REQUEST] : [])));
|
|
1517
1529
|
props.push(prop("text", narrative(`Synthetic medication order: ${med.display}.`)));
|
|
1518
1530
|
props.push(prop("status", str("active")));
|
|
1519
1531
|
props.push(prop("intent", str("order")));
|
|
@@ -1536,7 +1548,7 @@ function generateEncounter(options = {}) {
|
|
|
1536
1548
|
prop("resourceType", str("Encounter")),
|
|
1537
1549
|
prop("id", str(`syn-enc-${rng.digits(8)}`))
|
|
1538
1550
|
];
|
|
1539
|
-
|
|
1551
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.ENCOUNTER] : [])));
|
|
1540
1552
|
props.push(prop("text", narrative(`Synthetic encounter: ${type.display}.`)));
|
|
1541
1553
|
props.push(
|
|
1542
1554
|
prop(
|
|
@@ -1567,7 +1579,7 @@ function generateImmunization(options = {}) {
|
|
|
1567
1579
|
prop("resourceType", str("Immunization")),
|
|
1568
1580
|
prop("id", str(`syn-imm-${rng.digits(8)}`))
|
|
1569
1581
|
];
|
|
1570
|
-
|
|
1582
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.IMMUNIZATION] : [])));
|
|
1571
1583
|
props.push(prop("text", narrative(`Synthetic immunization: ${vaccine.display}.`)));
|
|
1572
1584
|
props.push(prop("status", str("completed")));
|
|
1573
1585
|
props.push(prop("vaccineCode", codeableConcept(vaccine)));
|
|
@@ -1587,7 +1599,7 @@ function generateAllergyIntolerance(options = {}) {
|
|
|
1587
1599
|
prop("resourceType", str("AllergyIntolerance")),
|
|
1588
1600
|
prop("id", str(`syn-allergy-${rng.digits(8)}`))
|
|
1589
1601
|
];
|
|
1590
|
-
|
|
1602
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.ALLERGY_INTOLERANCE] : [])));
|
|
1591
1603
|
props.push(prop("text", narrative(`Synthetic allergy: ${allergen.display}.`)));
|
|
1592
1604
|
props.push(
|
|
1593
1605
|
prop(
|
|
@@ -1630,7 +1642,7 @@ function generateProcedure(options = {}) {
|
|
|
1630
1642
|
prop("resourceType", str("Procedure")),
|
|
1631
1643
|
prop("id", str(`syn-proc-${rng.digits(8)}`))
|
|
1632
1644
|
];
|
|
1633
|
-
|
|
1645
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.PROCEDURE] : [])));
|
|
1634
1646
|
props.push(prop("text", narrative(`Synthetic procedure: ${code.display}.`)));
|
|
1635
1647
|
props.push(prop("status", str("completed")));
|
|
1636
1648
|
props.push(prop("code", codeableConcept(code)));
|
|
@@ -1649,7 +1661,7 @@ function generateDiagnosticReport(options = {}) {
|
|
|
1649
1661
|
prop("resourceType", str("DiagnosticReport")),
|
|
1650
1662
|
prop("id", str(`syn-dr-${rng.digits(8)}`))
|
|
1651
1663
|
];
|
|
1652
|
-
|
|
1664
|
+
props.push(prop("meta", meta(usCore ? [US_CORE_PROFILE.DIAGNOSTIC_REPORT_LAB] : [])));
|
|
1653
1665
|
props.push(prop("text", narrative(`Synthetic laboratory report: ${code.display}.`)));
|
|
1654
1666
|
props.push(prop("status", str("final")));
|
|
1655
1667
|
props.push(
|
|
@@ -1686,6 +1698,7 @@ function buildComposition(rng, input) {
|
|
|
1686
1698
|
const props = [
|
|
1687
1699
|
prop("resourceType", str("Composition")),
|
|
1688
1700
|
prop("id", str(`syn-comp-${rng.digits(8)}`)),
|
|
1701
|
+
prop("meta", meta([])),
|
|
1689
1702
|
prop("text", narrative("Synthetic continuity-of-care document summary.")),
|
|
1690
1703
|
prop("status", str("final")),
|
|
1691
1704
|
prop(
|
|
@@ -1721,6 +1734,7 @@ function buildOrganization(rng) {
|
|
|
1721
1734
|
return fhirPeer().complex([
|
|
1722
1735
|
prop("resourceType", str("Organization")),
|
|
1723
1736
|
prop("id", str(`syn-org-${rng.digits(8)}`)),
|
|
1737
|
+
prop("meta", meta([])),
|
|
1724
1738
|
prop("text", narrative("Synthetic health organization.")),
|
|
1725
1739
|
prop(
|
|
1726
1740
|
"identifier",
|
|
@@ -1849,7 +1863,8 @@ function generateBundle(options = {}) {
|
|
|
1849
1863
|
});
|
|
1850
1864
|
const props = [
|
|
1851
1865
|
prop("resourceType", str("Bundle")),
|
|
1852
|
-
prop("id", str(`syn-bundle-${rng.digits(8)}`))
|
|
1866
|
+
prop("id", str(`syn-bundle-${rng.digits(8)}`)),
|
|
1867
|
+
prop("meta", meta([]))
|
|
1853
1868
|
];
|
|
1854
1869
|
if (type === "document") {
|
|
1855
1870
|
const id = safe.identifier(rng, "AN");
|