@imranq2/fhirpatientsummary 1.0.24 → 1.0.25
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/dist/index.cjs +32 -10
- package/dist/index.js +32 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1326,6 +1326,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1326
1326
|
*/
|
|
1327
1327
|
generateSummaryNarrative(resources, timezone) {
|
|
1328
1328
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1329
|
+
let isSummaryCreated = false;
|
|
1329
1330
|
let html = `
|
|
1330
1331
|
<div>
|
|
1331
1332
|
<table>
|
|
@@ -1355,6 +1356,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1355
1356
|
break;
|
|
1356
1357
|
}
|
|
1357
1358
|
}
|
|
1359
|
+
isSummaryCreated = true;
|
|
1358
1360
|
html += `
|
|
1359
1361
|
<tr>
|
|
1360
1362
|
<td>${data["allergen"] ?? "-"}</td>
|
|
@@ -1367,7 +1369,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1367
1369
|
</tbody>
|
|
1368
1370
|
</table>
|
|
1369
1371
|
</div>`;
|
|
1370
|
-
return html;
|
|
1372
|
+
return isSummaryCreated ? html : void 0;
|
|
1371
1373
|
}
|
|
1372
1374
|
/**
|
|
1373
1375
|
* Internal static implementation that actually generates the narrative
|
|
@@ -1513,6 +1515,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1513
1515
|
*/
|
|
1514
1516
|
generateSummaryNarrative(resources, timezone) {
|
|
1515
1517
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1518
|
+
let isSummaryCreated = false;
|
|
1516
1519
|
let html = `
|
|
1517
1520
|
<div>
|
|
1518
1521
|
<table>
|
|
@@ -1557,6 +1560,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1557
1560
|
}
|
|
1558
1561
|
}
|
|
1559
1562
|
if (data["status"] === "active") {
|
|
1563
|
+
isSummaryCreated = true;
|
|
1560
1564
|
html += `
|
|
1561
1565
|
<tr>
|
|
1562
1566
|
<td>${data["medication"]}</td>
|
|
@@ -1572,7 +1576,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1572
1576
|
</tbody>
|
|
1573
1577
|
</table>
|
|
1574
1578
|
</div>`;
|
|
1575
|
-
return html;
|
|
1579
|
+
return isSummaryCreated ? html : void 0;
|
|
1576
1580
|
}
|
|
1577
1581
|
/**
|
|
1578
1582
|
* Safely parse a date string and return a valid Date object or null
|
|
@@ -1768,6 +1772,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
1768
1772
|
*/
|
|
1769
1773
|
generateSummaryNarrative(resources, timezone) {
|
|
1770
1774
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1775
|
+
let isSummaryCreated = false;
|
|
1771
1776
|
let html = `
|
|
1772
1777
|
<div>
|
|
1773
1778
|
<table>
|
|
@@ -1798,6 +1803,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
1798
1803
|
}
|
|
1799
1804
|
}
|
|
1800
1805
|
if (data["status"] === "completed") {
|
|
1806
|
+
isSummaryCreated = true;
|
|
1801
1807
|
html += `
|
|
1802
1808
|
<tr>
|
|
1803
1809
|
<td>${data["immunization"] ?? "-"}</td>
|
|
@@ -1811,7 +1817,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
1811
1817
|
</tbody>
|
|
1812
1818
|
</table>
|
|
1813
1819
|
</div>`;
|
|
1814
|
-
return html;
|
|
1820
|
+
return isSummaryCreated ? html : void 0;
|
|
1815
1821
|
}
|
|
1816
1822
|
/**
|
|
1817
1823
|
* Internal static implementation that actually generates the narrative
|
|
@@ -1927,6 +1933,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
1927
1933
|
*/
|
|
1928
1934
|
generateSummaryNarrative(resources, timezone) {
|
|
1929
1935
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1936
|
+
let isSummaryCreated = false;
|
|
1930
1937
|
let html = `
|
|
1931
1938
|
<div>
|
|
1932
1939
|
<table>
|
|
@@ -1966,6 +1973,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
1966
1973
|
data[columnTitle] = columnData.text?.div ?? "";
|
|
1967
1974
|
}
|
|
1968
1975
|
}
|
|
1976
|
+
isSummaryCreated = true;
|
|
1969
1977
|
html += `
|
|
1970
1978
|
<tr>
|
|
1971
1979
|
<td>${data["Vital Name"] ?? "-"}</td>
|
|
@@ -1979,7 +1987,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
1979
1987
|
</tbody>
|
|
1980
1988
|
</table>
|
|
1981
1989
|
</div>`;
|
|
1982
|
-
return html;
|
|
1990
|
+
return isSummaryCreated ? html : void 0;
|
|
1983
1991
|
}
|
|
1984
1992
|
/**
|
|
1985
1993
|
* Internal static implementation that actually generates the narrative
|
|
@@ -2482,7 +2490,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2482
2490
|
}
|
|
2483
2491
|
html += `
|
|
2484
2492
|
</div>`;
|
|
2485
|
-
return html;
|
|
2493
|
+
return observationExists || diagnosticReportExists ? html : void 0;
|
|
2486
2494
|
}
|
|
2487
2495
|
/**
|
|
2488
2496
|
* Internal static implementation that actually generates the narrative
|
|
@@ -2633,6 +2641,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
2633
2641
|
*/
|
|
2634
2642
|
generateSummaryNarrative(resources, timezone) {
|
|
2635
2643
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2644
|
+
let isSummaryCreated = false;
|
|
2636
2645
|
let html = `
|
|
2637
2646
|
<div>
|
|
2638
2647
|
<table>
|
|
@@ -2662,6 +2671,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
2662
2671
|
break;
|
|
2663
2672
|
}
|
|
2664
2673
|
}
|
|
2674
|
+
isSummaryCreated = true;
|
|
2665
2675
|
html += `
|
|
2666
2676
|
<tr>
|
|
2667
2677
|
<td>${data["procedure"] ?? "-"}</td>
|
|
@@ -2674,7 +2684,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
2674
2684
|
</tbody>
|
|
2675
2685
|
</table>
|
|
2676
2686
|
</div>`;
|
|
2677
|
-
return html;
|
|
2687
|
+
return isSummaryCreated ? html : void 0;
|
|
2678
2688
|
}
|
|
2679
2689
|
/**
|
|
2680
2690
|
* Internal static implementation that actually generates the narrative
|
|
@@ -2858,6 +2868,7 @@ var PlanOfCareTemplate = class {
|
|
|
2858
2868
|
*/
|
|
2859
2869
|
generateSummaryNarrative(resources, timezone) {
|
|
2860
2870
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2871
|
+
let isSummaryCreated = false;
|
|
2861
2872
|
let html = `
|
|
2862
2873
|
<div>
|
|
2863
2874
|
<table>
|
|
@@ -2881,6 +2892,7 @@ var PlanOfCareTemplate = class {
|
|
|
2881
2892
|
if (data["status"] !== "active") {
|
|
2882
2893
|
continue;
|
|
2883
2894
|
}
|
|
2895
|
+
isSummaryCreated = true;
|
|
2884
2896
|
html += `
|
|
2885
2897
|
<tr>
|
|
2886
2898
|
<td>${data["CarePlan Name"] ?? "-"}</td>
|
|
@@ -2894,7 +2906,7 @@ var PlanOfCareTemplate = class {
|
|
|
2894
2906
|
</tbody>
|
|
2895
2907
|
</table>
|
|
2896
2908
|
</div>`;
|
|
2897
|
-
return html;
|
|
2909
|
+
return isSummaryCreated ? html : void 0;
|
|
2898
2910
|
}
|
|
2899
2911
|
};
|
|
2900
2912
|
|
|
@@ -3347,11 +3359,13 @@ var ComprehensiveIPSCompositionBuilder = class {
|
|
|
3347
3359
|
timezone,
|
|
3348
3360
|
true
|
|
3349
3361
|
);
|
|
3350
|
-
}
|
|
3362
|
+
}
|
|
3363
|
+
if (!narrative && sectionType in IPSMandatorySections) {
|
|
3351
3364
|
narrative = await NarrativeGenerator.createNarrativeAsync(
|
|
3352
3365
|
IPSMissingMandatorySectionContent[sectionType]
|
|
3353
3366
|
);
|
|
3354
|
-
}
|
|
3367
|
+
}
|
|
3368
|
+
if (!narrative) {
|
|
3355
3369
|
return this;
|
|
3356
3370
|
}
|
|
3357
3371
|
this.addSectionAsync(narrative, sectionType, validResources);
|
|
@@ -3369,13 +3383,21 @@ var ComprehensiveIPSCompositionBuilder = class {
|
|
|
3369
3383
|
}
|
|
3370
3384
|
});
|
|
3371
3385
|
}
|
|
3372
|
-
|
|
3386
|
+
let narrative = await NarrativeGenerator.generateNarrativeAsync(
|
|
3373
3387
|
sectionType,
|
|
3374
3388
|
summaryCompositions,
|
|
3375
3389
|
timezone,
|
|
3376
3390
|
true,
|
|
3377
3391
|
true
|
|
3378
3392
|
);
|
|
3393
|
+
if (!narrative && sectionType in IPSMandatorySections) {
|
|
3394
|
+
narrative = await NarrativeGenerator.createNarrativeAsync(
|
|
3395
|
+
IPSMissingMandatorySectionContent[sectionType]
|
|
3396
|
+
);
|
|
3397
|
+
}
|
|
3398
|
+
if (!narrative) {
|
|
3399
|
+
return this;
|
|
3400
|
+
}
|
|
3379
3401
|
this.addSectionAsync(narrative, sectionType, sectionResources);
|
|
3380
3402
|
return this;
|
|
3381
3403
|
}
|
package/dist/index.js
CHANGED
|
@@ -1298,6 +1298,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1298
1298
|
*/
|
|
1299
1299
|
generateSummaryNarrative(resources, timezone) {
|
|
1300
1300
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1301
|
+
let isSummaryCreated = false;
|
|
1301
1302
|
let html = `
|
|
1302
1303
|
<div>
|
|
1303
1304
|
<table>
|
|
@@ -1327,6 +1328,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1327
1328
|
break;
|
|
1328
1329
|
}
|
|
1329
1330
|
}
|
|
1331
|
+
isSummaryCreated = true;
|
|
1330
1332
|
html += `
|
|
1331
1333
|
<tr>
|
|
1332
1334
|
<td>${data["allergen"] ?? "-"}</td>
|
|
@@ -1339,7 +1341,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1339
1341
|
</tbody>
|
|
1340
1342
|
</table>
|
|
1341
1343
|
</div>`;
|
|
1342
|
-
return html;
|
|
1344
|
+
return isSummaryCreated ? html : void 0;
|
|
1343
1345
|
}
|
|
1344
1346
|
/**
|
|
1345
1347
|
* Internal static implementation that actually generates the narrative
|
|
@@ -1485,6 +1487,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1485
1487
|
*/
|
|
1486
1488
|
generateSummaryNarrative(resources, timezone) {
|
|
1487
1489
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1490
|
+
let isSummaryCreated = false;
|
|
1488
1491
|
let html = `
|
|
1489
1492
|
<div>
|
|
1490
1493
|
<table>
|
|
@@ -1529,6 +1532,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1529
1532
|
}
|
|
1530
1533
|
}
|
|
1531
1534
|
if (data["status"] === "active") {
|
|
1535
|
+
isSummaryCreated = true;
|
|
1532
1536
|
html += `
|
|
1533
1537
|
<tr>
|
|
1534
1538
|
<td>${data["medication"]}</td>
|
|
@@ -1544,7 +1548,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
1544
1548
|
</tbody>
|
|
1545
1549
|
</table>
|
|
1546
1550
|
</div>`;
|
|
1547
|
-
return html;
|
|
1551
|
+
return isSummaryCreated ? html : void 0;
|
|
1548
1552
|
}
|
|
1549
1553
|
/**
|
|
1550
1554
|
* Safely parse a date string and return a valid Date object or null
|
|
@@ -1740,6 +1744,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
1740
1744
|
*/
|
|
1741
1745
|
generateSummaryNarrative(resources, timezone) {
|
|
1742
1746
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1747
|
+
let isSummaryCreated = false;
|
|
1743
1748
|
let html = `
|
|
1744
1749
|
<div>
|
|
1745
1750
|
<table>
|
|
@@ -1770,6 +1775,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
1770
1775
|
}
|
|
1771
1776
|
}
|
|
1772
1777
|
if (data["status"] === "completed") {
|
|
1778
|
+
isSummaryCreated = true;
|
|
1773
1779
|
html += `
|
|
1774
1780
|
<tr>
|
|
1775
1781
|
<td>${data["immunization"] ?? "-"}</td>
|
|
@@ -1783,7 +1789,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
1783
1789
|
</tbody>
|
|
1784
1790
|
</table>
|
|
1785
1791
|
</div>`;
|
|
1786
|
-
return html;
|
|
1792
|
+
return isSummaryCreated ? html : void 0;
|
|
1787
1793
|
}
|
|
1788
1794
|
/**
|
|
1789
1795
|
* Internal static implementation that actually generates the narrative
|
|
@@ -1899,6 +1905,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
1899
1905
|
*/
|
|
1900
1906
|
generateSummaryNarrative(resources, timezone) {
|
|
1901
1907
|
const templateUtilities = new TemplateUtilities(resources);
|
|
1908
|
+
let isSummaryCreated = false;
|
|
1902
1909
|
let html = `
|
|
1903
1910
|
<div>
|
|
1904
1911
|
<table>
|
|
@@ -1938,6 +1945,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
1938
1945
|
data[columnTitle] = columnData.text?.div ?? "";
|
|
1939
1946
|
}
|
|
1940
1947
|
}
|
|
1948
|
+
isSummaryCreated = true;
|
|
1941
1949
|
html += `
|
|
1942
1950
|
<tr>
|
|
1943
1951
|
<td>${data["Vital Name"] ?? "-"}</td>
|
|
@@ -1951,7 +1959,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
1951
1959
|
</tbody>
|
|
1952
1960
|
</table>
|
|
1953
1961
|
</div>`;
|
|
1954
|
-
return html;
|
|
1962
|
+
return isSummaryCreated ? html : void 0;
|
|
1955
1963
|
}
|
|
1956
1964
|
/**
|
|
1957
1965
|
* Internal static implementation that actually generates the narrative
|
|
@@ -2454,7 +2462,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2454
2462
|
}
|
|
2455
2463
|
html += `
|
|
2456
2464
|
</div>`;
|
|
2457
|
-
return html;
|
|
2465
|
+
return observationExists || diagnosticReportExists ? html : void 0;
|
|
2458
2466
|
}
|
|
2459
2467
|
/**
|
|
2460
2468
|
* Internal static implementation that actually generates the narrative
|
|
@@ -2605,6 +2613,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
2605
2613
|
*/
|
|
2606
2614
|
generateSummaryNarrative(resources, timezone) {
|
|
2607
2615
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2616
|
+
let isSummaryCreated = false;
|
|
2608
2617
|
let html = `
|
|
2609
2618
|
<div>
|
|
2610
2619
|
<table>
|
|
@@ -2634,6 +2643,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
2634
2643
|
break;
|
|
2635
2644
|
}
|
|
2636
2645
|
}
|
|
2646
|
+
isSummaryCreated = true;
|
|
2637
2647
|
html += `
|
|
2638
2648
|
<tr>
|
|
2639
2649
|
<td>${data["procedure"] ?? "-"}</td>
|
|
@@ -2646,7 +2656,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
2646
2656
|
</tbody>
|
|
2647
2657
|
</table>
|
|
2648
2658
|
</div>`;
|
|
2649
|
-
return html;
|
|
2659
|
+
return isSummaryCreated ? html : void 0;
|
|
2650
2660
|
}
|
|
2651
2661
|
/**
|
|
2652
2662
|
* Internal static implementation that actually generates the narrative
|
|
@@ -2830,6 +2840,7 @@ var PlanOfCareTemplate = class {
|
|
|
2830
2840
|
*/
|
|
2831
2841
|
generateSummaryNarrative(resources, timezone) {
|
|
2832
2842
|
const templateUtilities = new TemplateUtilities(resources);
|
|
2843
|
+
let isSummaryCreated = false;
|
|
2833
2844
|
let html = `
|
|
2834
2845
|
<div>
|
|
2835
2846
|
<table>
|
|
@@ -2853,6 +2864,7 @@ var PlanOfCareTemplate = class {
|
|
|
2853
2864
|
if (data["status"] !== "active") {
|
|
2854
2865
|
continue;
|
|
2855
2866
|
}
|
|
2867
|
+
isSummaryCreated = true;
|
|
2856
2868
|
html += `
|
|
2857
2869
|
<tr>
|
|
2858
2870
|
<td>${data["CarePlan Name"] ?? "-"}</td>
|
|
@@ -2866,7 +2878,7 @@ var PlanOfCareTemplate = class {
|
|
|
2866
2878
|
</tbody>
|
|
2867
2879
|
</table>
|
|
2868
2880
|
</div>`;
|
|
2869
|
-
return html;
|
|
2881
|
+
return isSummaryCreated ? html : void 0;
|
|
2870
2882
|
}
|
|
2871
2883
|
};
|
|
2872
2884
|
|
|
@@ -3319,11 +3331,13 @@ var ComprehensiveIPSCompositionBuilder = class {
|
|
|
3319
3331
|
timezone,
|
|
3320
3332
|
true
|
|
3321
3333
|
);
|
|
3322
|
-
}
|
|
3334
|
+
}
|
|
3335
|
+
if (!narrative && sectionType in IPSMandatorySections) {
|
|
3323
3336
|
narrative = await NarrativeGenerator.createNarrativeAsync(
|
|
3324
3337
|
IPSMissingMandatorySectionContent[sectionType]
|
|
3325
3338
|
);
|
|
3326
|
-
}
|
|
3339
|
+
}
|
|
3340
|
+
if (!narrative) {
|
|
3327
3341
|
return this;
|
|
3328
3342
|
}
|
|
3329
3343
|
this.addSectionAsync(narrative, sectionType, validResources);
|
|
@@ -3341,13 +3355,21 @@ var ComprehensiveIPSCompositionBuilder = class {
|
|
|
3341
3355
|
}
|
|
3342
3356
|
});
|
|
3343
3357
|
}
|
|
3344
|
-
|
|
3358
|
+
let narrative = await NarrativeGenerator.generateNarrativeAsync(
|
|
3345
3359
|
sectionType,
|
|
3346
3360
|
summaryCompositions,
|
|
3347
3361
|
timezone,
|
|
3348
3362
|
true,
|
|
3349
3363
|
true
|
|
3350
3364
|
);
|
|
3365
|
+
if (!narrative && sectionType in IPSMandatorySections) {
|
|
3366
|
+
narrative = await NarrativeGenerator.createNarrativeAsync(
|
|
3367
|
+
IPSMissingMandatorySectionContent[sectionType]
|
|
3368
|
+
);
|
|
3369
|
+
}
|
|
3370
|
+
if (!narrative) {
|
|
3371
|
+
return this;
|
|
3372
|
+
}
|
|
3351
3373
|
this.addSectionAsync(narrative, sectionType, sectionResources);
|
|
3352
3374
|
return this;
|
|
3353
3375
|
}
|