@imranq2/fhirpatientsummary 1.0.35 → 1.0.37
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 +217 -6
- package/dist/index.js +217 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -201,7 +201,8 @@ var IPSSectionSummaryCompositionFilter = {
|
|
|
201
201
|
var IPSSectionSummaryIPSCompositionFilter = {
|
|
202
202
|
["Patient" /* PATIENT */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_patient_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM)),
|
|
203
203
|
["VitalSignsSection" /* VITAL_SIGNS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_vital_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM)),
|
|
204
|
-
["SocialHistorySection" /* SOCIAL_HISTORY */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_social_history_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM))
|
|
204
|
+
["SocialHistorySection" /* SOCIAL_HISTORY */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_social_history_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM)),
|
|
205
|
+
["FunctionalStatusSection" /* FUNCTIONAL_STATUS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, ["ips_functional_status_condition_summary_document", "ips_functional_status_clinical_impression_summary_document"], IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM))
|
|
205
206
|
};
|
|
206
207
|
var IPSSectionResourceHelper = class {
|
|
207
208
|
static getResourceFilterForSection(section) {
|
|
@@ -922,6 +923,18 @@ var TemplateUtilities = class {
|
|
|
922
923
|
}
|
|
923
924
|
return "";
|
|
924
925
|
}
|
|
926
|
+
/**
|
|
927
|
+
* Returns the owner tag from the resource meta.security array.
|
|
928
|
+
* @param resource - FHIR resource with meta tag
|
|
929
|
+
* @returns The owner display or code if found, otherwise undefined
|
|
930
|
+
*/
|
|
931
|
+
getOwnerTag(resource) {
|
|
932
|
+
if (!resource?.meta?.security) return "";
|
|
933
|
+
const ownerEntry = resource.meta.security.find(
|
|
934
|
+
(sec) => sec.system === "https://www.icanbwell.com/owner" && !!sec.code
|
|
935
|
+
);
|
|
936
|
+
return ownerEntry?.display || ownerEntry?.code;
|
|
937
|
+
}
|
|
925
938
|
/**
|
|
926
939
|
* Public method to render plain text as HTML, escaping special characters and replacing newlines with <br />.
|
|
927
940
|
* This method should be used whenever displaying user-supplied or FHIR resource text in HTML to prevent XSS vulnerabilities
|
|
@@ -1857,6 +1870,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1857
1870
|
<th>Code (System)</th>
|
|
1858
1871
|
<th>Criticality</th>
|
|
1859
1872
|
<th>Recorded Date</th>
|
|
1873
|
+
<th>Source</th>
|
|
1860
1874
|
</tr>
|
|
1861
1875
|
</thead>
|
|
1862
1876
|
<tbody>`;
|
|
@@ -1876,6 +1890,9 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1876
1890
|
case "Recorded Date":
|
|
1877
1891
|
data["recordedDate"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
1878
1892
|
break;
|
|
1893
|
+
case "Source":
|
|
1894
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
1895
|
+
break;
|
|
1879
1896
|
default:
|
|
1880
1897
|
break;
|
|
1881
1898
|
}
|
|
@@ -1890,6 +1907,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1890
1907
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
1891
1908
|
<td>${data["criticality"] ?? ""}</td>
|
|
1892
1909
|
<td>${templateUtilities.renderTime(data["recordedDate"], timezone) ?? ""}</td>
|
|
1910
|
+
<td>${data["source"] ?? ""}</td>
|
|
1893
1911
|
</tr>`;
|
|
1894
1912
|
}
|
|
1895
1913
|
}
|
|
@@ -1943,6 +1961,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1943
1961
|
<th>Reaction</th>
|
|
1944
1962
|
<th>Onset Date</th>
|
|
1945
1963
|
<th>Comments</th>
|
|
1964
|
+
<th>Source</th>
|
|
1946
1965
|
</tr>
|
|
1947
1966
|
</thead>
|
|
1948
1967
|
<tbody>`;
|
|
@@ -1972,6 +1991,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1972
1991
|
<th>Onset Date</th>
|
|
1973
1992
|
<th>Comments</th>
|
|
1974
1993
|
<th>Resolved Date</th>
|
|
1994
|
+
<th>Source</th>
|
|
1975
1995
|
</tr>
|
|
1976
1996
|
</thead>
|
|
1977
1997
|
<tbody>`;
|
|
@@ -2012,7 +2032,8 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
2012
2032
|
<td class="Category">${templateUtilities.renderTextAsHtml(templateUtilities.safeConcat(allergy.category)) || ""}</td>
|
|
2013
2033
|
<td class="Reaction">${templateUtilities.renderTextAsHtml(templateUtilities.concatReactionManifestation(allergy.reaction)) || ""}</td>
|
|
2014
2034
|
<td class="OnsetDate">${templateUtilities.renderTextAsHtml(templateUtilities.renderTime(allergy.onsetDateTime, timezone)) || ""}</td>
|
|
2015
|
-
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td
|
|
2035
|
+
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td>
|
|
2036
|
+
<td class="Source">${templateUtilities.getOwnerTag(allergy)}</td>`;
|
|
2016
2037
|
if (includeResolved) {
|
|
2017
2038
|
let endDate = "";
|
|
2018
2039
|
if (allergy.extension && Array.isArray(allergy.extension)) {
|
|
@@ -2068,6 +2089,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2068
2089
|
<th>Sig</th>
|
|
2069
2090
|
<th>Days of Supply</th>
|
|
2070
2091
|
<th>Start Date</th>
|
|
2092
|
+
<th>Source</th>
|
|
2071
2093
|
</tr>
|
|
2072
2094
|
</thead>
|
|
2073
2095
|
<tbody>`;
|
|
@@ -2096,6 +2118,9 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2096
2118
|
case "Authored On Date":
|
|
2097
2119
|
data["startDate"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2098
2120
|
break;
|
|
2121
|
+
case "Source":
|
|
2122
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2123
|
+
break;
|
|
2099
2124
|
default:
|
|
2100
2125
|
break;
|
|
2101
2126
|
}
|
|
@@ -2123,6 +2148,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2123
2148
|
<td>${templateUtilities.renderTextAsHtml(data["sig-prescriber"] || data["sig-pharmacy"])}</td>
|
|
2124
2149
|
<td>${templateUtilities.renderTextAsHtml(data["daysOfSupply"])}</td>
|
|
2125
2150
|
<td>${templateUtilities.renderTime(data["startDate"], timezone)}</td>
|
|
2151
|
+
<td>${data["source"] ?? ""}</td>
|
|
2126
2152
|
</tr>`;
|
|
2127
2153
|
}
|
|
2128
2154
|
}
|
|
@@ -2248,6 +2274,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2248
2274
|
<th>Sig</th>
|
|
2249
2275
|
<th>Dispense Quantity</th>
|
|
2250
2276
|
<th>Start Date</th>
|
|
2277
|
+
<th>Source</th>
|
|
2251
2278
|
</tr>
|
|
2252
2279
|
</thead>
|
|
2253
2280
|
<tbody>`;
|
|
@@ -2306,6 +2333,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2306
2333
|
<td>${sig}</td>
|
|
2307
2334
|
<td>${dispenseQuantity}</td>
|
|
2308
2335
|
<td>${startDate}</td>
|
|
2336
|
+
<td>${templateUtilities.getOwnerTag(medication.resource)}</td>
|
|
2309
2337
|
</tr>`;
|
|
2310
2338
|
}
|
|
2311
2339
|
html += `
|
|
@@ -2350,6 +2378,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2350
2378
|
<th>Code (System)</th>
|
|
2351
2379
|
<th>Status</th>
|
|
2352
2380
|
<th>Date</th>
|
|
2381
|
+
<th>Source</th>
|
|
2353
2382
|
</tr>
|
|
2354
2383
|
</thead>
|
|
2355
2384
|
<tbody>`;
|
|
@@ -2369,6 +2398,9 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2369
2398
|
case "occurrenceDateTime":
|
|
2370
2399
|
data["occurrenceDateTime"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2371
2400
|
break;
|
|
2401
|
+
case "Source":
|
|
2402
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2403
|
+
break;
|
|
2372
2404
|
default:
|
|
2373
2405
|
break;
|
|
2374
2406
|
}
|
|
@@ -2384,6 +2416,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2384
2416
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
2385
2417
|
<td>${data["status"] ?? ""}</td>
|
|
2386
2418
|
<td>${templateUtilities.renderTime(data["occurrenceDateTime"], timezone) ?? ""}</td>
|
|
2419
|
+
<td>${data["source"] ?? ""}</td>
|
|
2387
2420
|
</tr>`;
|
|
2388
2421
|
}
|
|
2389
2422
|
}
|
|
@@ -2414,6 +2447,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2414
2447
|
<th>Lot Number</th>
|
|
2415
2448
|
<th>Comments</th>
|
|
2416
2449
|
<th>Date</th>
|
|
2450
|
+
<th>Source</th>
|
|
2417
2451
|
</tr>
|
|
2418
2452
|
</thead>
|
|
2419
2453
|
<tbody>`;
|
|
@@ -2435,6 +2469,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2435
2469
|
<td>${imm.lotNumber || ""}</td>
|
|
2436
2470
|
<td>${templateUtilities.renderNotes(imm.note, timezone)}</td>
|
|
2437
2471
|
<td>${templateUtilities.renderTime(imm.occurrenceDateTime, timezone)}</td>
|
|
2472
|
+
<td>${templateUtilities.getOwnerTag(imm)}</td>
|
|
2438
2473
|
</tr>`;
|
|
2439
2474
|
}
|
|
2440
2475
|
}
|
|
@@ -2475,6 +2510,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2475
2510
|
<th>Is Chronic</th>
|
|
2476
2511
|
<th>Onset Date</th>
|
|
2477
2512
|
<th>Last Confirmed Date</th>
|
|
2513
|
+
<th>Source</th>
|
|
2478
2514
|
</tr>
|
|
2479
2515
|
</thead>
|
|
2480
2516
|
<tbody>`;
|
|
@@ -2499,6 +2535,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2499
2535
|
<td>${data["Is Chronic"] ?? ""}</td>
|
|
2500
2536
|
<td>${templateUtilities.renderTime(data["Onset Date"], timezone) ?? ""}</td>
|
|
2501
2537
|
<td>${templateUtilities.renderTime(data["Last Confirmed Date"], timezone) ?? ""}</td>
|
|
2538
|
+
<td>${data["Source"] ?? ""}</td>
|
|
2502
2539
|
</tr>`;
|
|
2503
2540
|
}
|
|
2504
2541
|
}
|
|
@@ -2537,6 +2574,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2537
2574
|
<th>Code (System)</th>
|
|
2538
2575
|
<th>Onset Date</th>
|
|
2539
2576
|
<th>Recorded Date</th>
|
|
2577
|
+
<th>Source</th>
|
|
2540
2578
|
</tr>
|
|
2541
2579
|
</thead>
|
|
2542
2580
|
<tbody>`;
|
|
@@ -2556,6 +2594,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2556
2594
|
<td class="CodeSystem">${codeAndSystem}</td>
|
|
2557
2595
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
2558
2596
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
2597
|
+
<td class="Source">${templateUtilities.getOwnerTag(cond)}</td>
|
|
2559
2598
|
</tr>`;
|
|
2560
2599
|
}
|
|
2561
2600
|
html += `</tbody>
|
|
@@ -2595,6 +2634,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2595
2634
|
<th>Code (System)</th>
|
|
2596
2635
|
<th>Result</th>
|
|
2597
2636
|
<th>Date</th>
|
|
2637
|
+
<th>Source</th>
|
|
2598
2638
|
</tr>
|
|
2599
2639
|
</thead>
|
|
2600
2640
|
<tbody>`;
|
|
@@ -2637,6 +2677,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2637
2677
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
2638
2678
|
<td>${templateUtilities.extractObservationSummaryValue(data, timezone) ?? ""}</td>
|
|
2639
2679
|
<td>${templateUtilities.extractObservationSummaryEffectiveTime(data, timezone) ?? ""}</td>
|
|
2680
|
+
<td>${data["Source"] ?? ""}</td>
|
|
2640
2681
|
</tr>`;
|
|
2641
2682
|
}
|
|
2642
2683
|
}
|
|
@@ -2674,6 +2715,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2674
2715
|
<th>Component(s)</th>
|
|
2675
2716
|
<th>Comments</th>
|
|
2676
2717
|
<th>Date</th>
|
|
2718
|
+
<th>Source</th>
|
|
2677
2719
|
</tr>
|
|
2678
2720
|
</thead>
|
|
2679
2721
|
<tbody>`;
|
|
@@ -2692,6 +2734,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2692
2734
|
<td>${templateUtilities.renderComponent(obs.component)}</td>
|
|
2693
2735
|
<td>${templateUtilities.renderNotes(obs.note, timezone)}</td>
|
|
2694
2736
|
<td>${obs.effectiveDateTime ? templateUtilities.renderTime(obs.effectiveDateTime, timezone) : obs.effectivePeriod ? templateUtilities.renderPeriod(obs.effectivePeriod, timezone) : ""}</td>
|
|
2737
|
+
<td>${templateUtilities.getOwnerTag(obs)}</td>
|
|
2695
2738
|
</tr>`;
|
|
2696
2739
|
}
|
|
2697
2740
|
html += `
|
|
@@ -2728,6 +2771,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2728
2771
|
<th>Status</th>
|
|
2729
2772
|
<th>Comments</th>
|
|
2730
2773
|
<th>Date Recorded</th>
|
|
2774
|
+
<th>Source</th>
|
|
2731
2775
|
</tr>
|
|
2732
2776
|
</thead>
|
|
2733
2777
|
<tbody>`;
|
|
@@ -2749,6 +2793,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2749
2793
|
<td>${templateUtilities.renderTextAsHtml(dus.status || "")}</td>
|
|
2750
2794
|
<td>${templateUtilities.renderNotes(dus.note, timezone)}</td>
|
|
2751
2795
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.renderRecorded(dus.recordedOn, timezone))}</td>
|
|
2796
|
+
<td>${templateUtilities.getOwnerTag(dus)}</td>
|
|
2752
2797
|
</tr>`;
|
|
2753
2798
|
}
|
|
2754
2799
|
html += `
|
|
@@ -2901,6 +2946,9 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2901
2946
|
case "effectivePeriod.end":
|
|
2902
2947
|
targetData["effectivePeriodEnd"] = templateUtilities.renderTextAsHtml(column.text?.div ?? "");
|
|
2903
2948
|
break;
|
|
2949
|
+
case "Source":
|
|
2950
|
+
targetData["source"] = templateUtilities.renderTextAsHtml(column.text?.div ?? "");
|
|
2951
|
+
break;
|
|
2904
2952
|
// valueQuantity
|
|
2905
2953
|
case "valueQuantity.value":
|
|
2906
2954
|
targetData["value"] = templateUtilities.renderTextAsHtml(column.text?.div ?? "");
|
|
@@ -3119,6 +3167,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3119
3167
|
<th>Result</th>
|
|
3120
3168
|
<th>Reference Range</th>
|
|
3121
3169
|
<th>Date</th>
|
|
3170
|
+
<th>Source</th>
|
|
3122
3171
|
</tr>
|
|
3123
3172
|
</thead>
|
|
3124
3173
|
<tbody>`;
|
|
@@ -3132,6 +3181,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3132
3181
|
<th>Report</th>
|
|
3133
3182
|
<th>Performer</th>
|
|
3134
3183
|
<th>Issued</th>
|
|
3184
|
+
<th>Source</th>
|
|
3135
3185
|
</tr>
|
|
3136
3186
|
</thead>
|
|
3137
3187
|
<tbody>`;
|
|
@@ -3178,6 +3228,8 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3178
3228
|
case "Status":
|
|
3179
3229
|
data["status"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
3180
3230
|
break;
|
|
3231
|
+
case "Source":
|
|
3232
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
3181
3233
|
break;
|
|
3182
3234
|
default:
|
|
3183
3235
|
break;
|
|
@@ -3215,6 +3267,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3215
3267
|
<td>${templateUtilities.renderTextAsHtml(component["formattedValue"]) ?? ""}</td>
|
|
3216
3268
|
<td>${templateUtilities.renderTextAsHtml(component["referenceRange"])?.trim() ?? ""}</td>
|
|
3217
3269
|
<td>${date ?? ""}</td>
|
|
3270
|
+
<td>${data["source"] ?? ""}</td>
|
|
3218
3271
|
</tr>`;
|
|
3219
3272
|
}
|
|
3220
3273
|
}
|
|
@@ -3234,6 +3287,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3234
3287
|
<td>${templateUtilities.renderTextAsHtml(data["formattedValue"]) ?? ""}</td>
|
|
3235
3288
|
<td>${templateUtilities.renderTextAsHtml(data["referenceRange"])?.trim() ?? ""}</td>
|
|
3236
3289
|
<td>${date ?? ""}</td>
|
|
3290
|
+
<td>${data["source"] ?? ""}</td>
|
|
3237
3291
|
</tr>`;
|
|
3238
3292
|
}
|
|
3239
3293
|
}
|
|
@@ -3255,6 +3309,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3255
3309
|
<td>${templateUtilities.capitalizeFirstLetter(data["report"] ?? "")}</td>
|
|
3256
3310
|
<td>${data["performer"] ?? ""}</td>
|
|
3257
3311
|
<td>${templateUtilities.renderTime(data["issued"], timezone) ?? ""}</td>
|
|
3312
|
+
<td>${data["source"] ?? ""}</td>
|
|
3258
3313
|
</tr>`;
|
|
3259
3314
|
}
|
|
3260
3315
|
}
|
|
@@ -3439,6 +3494,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3439
3494
|
<th>Result</th>
|
|
3440
3495
|
<th>Reference Range</th>
|
|
3441
3496
|
<th>Date</th>
|
|
3497
|
+
<th>Source</th>
|
|
3442
3498
|
</tr>
|
|
3443
3499
|
</thead>
|
|
3444
3500
|
<tbody>`;
|
|
@@ -3459,6 +3515,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3459
3515
|
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
3460
3516
|
<td>${templateUtilities.concatReferenceRange(obs.referenceRange)}</td>
|
|
3461
3517
|
<td>${obs.effectiveDateTime ? templateUtilities.renderTime(obs.effectiveDateTime, timezone) : obs.effectivePeriod ? templateUtilities.renderPeriod(obs.effectivePeriod, timezone) : ""}</td>
|
|
3518
|
+
<td>${templateUtilities.getOwnerTag(obs)}</td>
|
|
3462
3519
|
</tr>`;
|
|
3463
3520
|
}
|
|
3464
3521
|
}
|
|
@@ -3485,6 +3542,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3485
3542
|
<th>Category</th>
|
|
3486
3543
|
<th>Result</th>
|
|
3487
3544
|
<th>Issued</th>
|
|
3545
|
+
<th>Source</th>
|
|
3488
3546
|
</tr>
|
|
3489
3547
|
</thead>
|
|
3490
3548
|
<tbody>`;
|
|
@@ -3509,6 +3567,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3509
3567
|
<td>${templateUtilities.firstFromCodeableConceptList(report.category)}</td>
|
|
3510
3568
|
<td>${resultCount}</td>
|
|
3511
3569
|
<td>${report.issued ? templateUtilities.renderTime(report.issued, timezone) : ""}</td>
|
|
3570
|
+
<td>${templateUtilities.getOwnerTag(report)}</td>
|
|
3512
3571
|
</tr>`;
|
|
3513
3572
|
}
|
|
3514
3573
|
}
|
|
@@ -3575,6 +3634,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3575
3634
|
<th>Code (System)</th>
|
|
3576
3635
|
<th>Performer</th>
|
|
3577
3636
|
<th>Date</th>
|
|
3637
|
+
<th>Source</th>
|
|
3578
3638
|
</tr>
|
|
3579
3639
|
</thead>
|
|
3580
3640
|
<tbody>`;
|
|
@@ -3594,6 +3654,8 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3594
3654
|
case "Performed Date":
|
|
3595
3655
|
data["date"] = columnData.text?.div ?? "";
|
|
3596
3656
|
break;
|
|
3657
|
+
case "Source":
|
|
3658
|
+
data["source"] = columnData.text?.div ?? "";
|
|
3597
3659
|
break;
|
|
3598
3660
|
default:
|
|
3599
3661
|
break;
|
|
@@ -3609,6 +3671,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3609
3671
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
3610
3672
|
<td>${data["performer"] ?? ""}</td>
|
|
3611
3673
|
<td>${templateUtilities.renderTime(data["date"], timezone) ?? ""}</td>
|
|
3674
|
+
<td>${data["source"] ?? ""}</td>
|
|
3612
3675
|
</tr>`;
|
|
3613
3676
|
}
|
|
3614
3677
|
}
|
|
@@ -3636,6 +3699,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3636
3699
|
<th>Code (System)</th>
|
|
3637
3700
|
<th>Comments</th>
|
|
3638
3701
|
<th>Date</th>
|
|
3702
|
+
<th>Source</th>
|
|
3639
3703
|
</tr>
|
|
3640
3704
|
</thead>
|
|
3641
3705
|
<tbody>`;
|
|
@@ -3651,6 +3715,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3651
3715
|
<td>${templateUtilities.codeableConceptCoding(proc.code)}</td>
|
|
3652
3716
|
<td>${templateUtilities.renderNotes(proc.note, timezone)}</td>
|
|
3653
3717
|
<td>${templateUtilities.renderTime(proc.performedDateTime || proc.performedPeriod?.start, timezone)}</td>
|
|
3718
|
+
<td>${templateUtilities.getOwnerTag(proc)}</td>
|
|
3654
3719
|
</tr>`;
|
|
3655
3720
|
}
|
|
3656
3721
|
html += `
|
|
@@ -3692,6 +3757,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3692
3757
|
<th>Result</th>
|
|
3693
3758
|
<th>Date</th>
|
|
3694
3759
|
<th>Comments</th>
|
|
3760
|
+
<th>Source</th>
|
|
3695
3761
|
</tr>
|
|
3696
3762
|
</thead>
|
|
3697
3763
|
<tbody>`;
|
|
@@ -3717,6 +3783,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3717
3783
|
<td>${templateUtilities.extractObservationSummaryValue(data, timezone) ?? ""}</td>
|
|
3718
3784
|
<td>${templateUtilities.extractObservationSummaryEffectiveTime(data, timezone) ?? ""}</td>
|
|
3719
3785
|
<td>${data["Notes"] ?? ""}</td>
|
|
3786
|
+
<td>${data["Source"] ?? ""}</td>
|
|
3720
3787
|
</tr>`;
|
|
3721
3788
|
}
|
|
3722
3789
|
}
|
|
@@ -3752,6 +3819,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3752
3819
|
<th>Unit</th>
|
|
3753
3820
|
<th>Comments</th>
|
|
3754
3821
|
<th>Date</th>
|
|
3822
|
+
<th>Source</th>
|
|
3755
3823
|
</tr>
|
|
3756
3824
|
</thead>
|
|
3757
3825
|
<tbody>`;
|
|
@@ -3771,6 +3839,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3771
3839
|
<td>${templateUtilities.extractObservationValueUnit(obs)}</td>
|
|
3772
3840
|
<td>${templateUtilities.renderNotes(obs.note, timezone)}</td>
|
|
3773
3841
|
<td>${obs.effectiveDateTime ? templateUtilities.renderTime(obs.effectiveDateTime, timezone) : obs.effectivePeriod ? templateUtilities.renderPeriod(obs.effectivePeriod, timezone) : ""}</td>
|
|
3842
|
+
<td>${templateUtilities.getOwnerTag(obs)}</td>
|
|
3774
3843
|
</tr>`;
|
|
3775
3844
|
}
|
|
3776
3845
|
}
|
|
@@ -3821,6 +3890,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3821
3890
|
<th>Onset Date</th>
|
|
3822
3891
|
<th>Recorded Date</th>
|
|
3823
3892
|
<th>Resolved Date</th>
|
|
3893
|
+
<th>Source</th>
|
|
3824
3894
|
</tr>
|
|
3825
3895
|
</thead>
|
|
3826
3896
|
<tbody>`;
|
|
@@ -3838,6 +3908,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3838
3908
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
3839
3909
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
3840
3910
|
<td class="ResolvedDate">${templateUtilities.renderDate(cond.abatementDateTime)}</td>
|
|
3911
|
+
<td class="Source">${templateUtilities.getOwnerTag(cond)}</td>
|
|
3841
3912
|
</tr>`;
|
|
3842
3913
|
}
|
|
3843
3914
|
}
|
|
@@ -3873,6 +3944,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3873
3944
|
<th>Onset Date</th>
|
|
3874
3945
|
<th>Last Confirmed Date</th>
|
|
3875
3946
|
<th>Resolved Date</th>
|
|
3947
|
+
<th>Source</th>
|
|
3876
3948
|
</tr>
|
|
3877
3949
|
</thead>
|
|
3878
3950
|
<tbody>`;
|
|
@@ -3902,6 +3974,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3902
3974
|
<td>${templateUtilities.renderTime(data["Onset Date"], timezone) ?? ""}</td>
|
|
3903
3975
|
<td>${templateUtilities.renderTime(data["Last Confirmed Date"], timezone) ?? ""}</td>
|
|
3904
3976
|
<td>${templateUtilities.renderTime(data["Resolved Date"], timezone) ?? ""}</td>
|
|
3977
|
+
<td>${data["Source"] ?? ""}</td>
|
|
3905
3978
|
</tr>`;
|
|
3906
3979
|
}
|
|
3907
3980
|
}
|
|
@@ -3945,6 +4018,7 @@ var PlanOfCareTemplate = class {
|
|
|
3945
4018
|
<th>Comments</th>
|
|
3946
4019
|
<th>Planned Start</th>
|
|
3947
4020
|
<th>Planned End</th>
|
|
4021
|
+
<th>Source</th>
|
|
3948
4022
|
</tr>
|
|
3949
4023
|
</thead>
|
|
3950
4024
|
<tbody>`;
|
|
@@ -3960,6 +4034,7 @@ var PlanOfCareTemplate = class {
|
|
|
3960
4034
|
<td>${templateUtilities.concat(cp.note, "text")}</td>
|
|
3961
4035
|
<td>${cp.period?.start ? templateUtilities.renderTime(cp.period?.start, timezone) : ""}</td>
|
|
3962
4036
|
<td>${cp.period?.end ? templateUtilities.renderTime(cp.period?.end, timezone) : ""}</td>
|
|
4037
|
+
<td>${templateUtilities.getOwnerTag(cp)}</td>
|
|
3963
4038
|
</tr>`;
|
|
3964
4039
|
}
|
|
3965
4040
|
html += `
|
|
@@ -3987,6 +4062,7 @@ var PlanOfCareTemplate = class {
|
|
|
3987
4062
|
<th>Created</th>
|
|
3988
4063
|
<th>Planned Start</th>
|
|
3989
4064
|
<th>Planned End</th>
|
|
4065
|
+
<th>Source</th>
|
|
3990
4066
|
</tr>
|
|
3991
4067
|
</thead>
|
|
3992
4068
|
<tbody>`;
|
|
@@ -4011,6 +4087,7 @@ var PlanOfCareTemplate = class {
|
|
|
4011
4087
|
<td>${templateUtilities.renderTime(data["created"], timezone) ?? ""}</td>
|
|
4012
4088
|
<td>${templateUtilities.renderTime(data["period.start"], timezone) ?? ""}</td>
|
|
4013
4089
|
<td>${templateUtilities.renderTime(data["period.end"], timezone) ?? ""}</td>
|
|
4090
|
+
<td>${data["Source"] ?? ""}</td>
|
|
4014
4091
|
</tr>`;
|
|
4015
4092
|
}
|
|
4016
4093
|
}
|
|
@@ -4033,6 +4110,134 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4033
4110
|
generateNarrative(resources, timezone) {
|
|
4034
4111
|
return _FunctionalStatusTemplate.generateStaticNarrative(resources, timezone);
|
|
4035
4112
|
}
|
|
4113
|
+
/**
|
|
4114
|
+
* Generate HTML narrative for Functional Status Condition & ClinicalImpression resources using summary
|
|
4115
|
+
* @param resources - FHIR Composition resources
|
|
4116
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
4117
|
+
* @param now - Optional current date for filtering
|
|
4118
|
+
* @returns HTML string for rendering
|
|
4119
|
+
*/
|
|
4120
|
+
generateSummaryNarrative(resources, timezone) {
|
|
4121
|
+
const templateUtilities = new TemplateUtilities(resources);
|
|
4122
|
+
let html = `
|
|
4123
|
+
<div>
|
|
4124
|
+
<p>This section summarizes key conditions and assessments related to the person's functional status and ability to perform daily activities.</p>`;
|
|
4125
|
+
let conditionHtml = `
|
|
4126
|
+
<div>
|
|
4127
|
+
<h3>Conditions</h3>
|
|
4128
|
+
<table>
|
|
4129
|
+
<thead>
|
|
4130
|
+
<tr>
|
|
4131
|
+
<th>Problem</th>
|
|
4132
|
+
<th>Code (System)</th>
|
|
4133
|
+
<th>Onset Date</th>
|
|
4134
|
+
<th>Recorded Date</th>
|
|
4135
|
+
<th>Source</th>
|
|
4136
|
+
</tr>
|
|
4137
|
+
</thead>
|
|
4138
|
+
<tbody>`;
|
|
4139
|
+
let clinicalImpressionsHtml = `
|
|
4140
|
+
<div>
|
|
4141
|
+
<h3>Clinical Impressions</h3>
|
|
4142
|
+
<table>
|
|
4143
|
+
<thead>
|
|
4144
|
+
<tr>
|
|
4145
|
+
<th>Name</th>
|
|
4146
|
+
<th>Date</th>
|
|
4147
|
+
<th>Code (System)</th>
|
|
4148
|
+
<th>Description</th>
|
|
4149
|
+
<th>Summary</th>
|
|
4150
|
+
<th>Source</th>
|
|
4151
|
+
</tr>
|
|
4152
|
+
</thead>
|
|
4153
|
+
<tbody>`;
|
|
4154
|
+
const conditionsAdded = /* @__PURE__ */ new Set();
|
|
4155
|
+
const clinicalImpressionsAdded = /* @__PURE__ */ new Set();
|
|
4156
|
+
for (const resourceItem of resources) {
|
|
4157
|
+
for (const rowData of resourceItem.section ?? []) {
|
|
4158
|
+
const sectionCodeableConcept = rowData.code;
|
|
4159
|
+
const data = {};
|
|
4160
|
+
for (const columnData of rowData.section ?? []) {
|
|
4161
|
+
if (columnData.title) {
|
|
4162
|
+
data[columnData.title] = templateUtilities.renderTextAsHtml(
|
|
4163
|
+
columnData.text?.div ?? ""
|
|
4164
|
+
);
|
|
4165
|
+
}
|
|
4166
|
+
}
|
|
4167
|
+
if (resourceItem.title === "Condition|Condition Summary Grouped by Functional Status Code") {
|
|
4168
|
+
let date = data["onsetDateTime"] ? templateUtilities.renderTime(data["onsetDateTime"], timezone) : "";
|
|
4169
|
+
if (!date && data["onsetPeriod.start"]) {
|
|
4170
|
+
date = templateUtilities.renderTime(
|
|
4171
|
+
data["onsetPeriod.start"],
|
|
4172
|
+
timezone
|
|
4173
|
+
);
|
|
4174
|
+
if (data["onsetPeriod.end"]) {
|
|
4175
|
+
date += " - " + templateUtilities.renderTime(data["onsetPeriod.end"], timezone);
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4178
|
+
const problem = data["Condition Name"];
|
|
4179
|
+
if (problem && !conditionsAdded.has(problem)) {
|
|
4180
|
+
if (problem.toLowerCase() === "unknown") {
|
|
4181
|
+
continue;
|
|
4182
|
+
}
|
|
4183
|
+
conditionsAdded.add(problem);
|
|
4184
|
+
conditionHtml += `
|
|
4185
|
+
<tr>
|
|
4186
|
+
<td>${templateUtilities.capitalizeFirstLetter(problem)}</td>
|
|
4187
|
+
<td>${templateUtilities.codeableConceptCoding(sectionCodeableConcept)}</td>
|
|
4188
|
+
<td>${date}</td>
|
|
4189
|
+
<td>${templateUtilities.renderTime(data["recordedDate"], timezone) ?? ""}</td>
|
|
4190
|
+
<td>${data["Source"] ?? ""}</td>
|
|
4191
|
+
</tr>`;
|
|
4192
|
+
}
|
|
4193
|
+
} else if (resourceItem.title === "Clinical Impression|Clinical Impression Summary") {
|
|
4194
|
+
let date = data["effectiveDateTime"] ? templateUtilities.renderTime(data["effectiveDateTime"], timezone) : "";
|
|
4195
|
+
if (!date && data["effectivePeriod.start"]) {
|
|
4196
|
+
date = templateUtilities.renderTime(
|
|
4197
|
+
data["effectivePeriod.start"],
|
|
4198
|
+
timezone
|
|
4199
|
+
);
|
|
4200
|
+
if (data["effectivePeriod.end"]) {
|
|
4201
|
+
date += " - " + templateUtilities.renderTime(data["effectivePeriod.end"], timezone);
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
const name = data["Clinical Impression Name"];
|
|
4205
|
+
if (name && !clinicalImpressionsAdded.has(name)) {
|
|
4206
|
+
if (name?.toLowerCase() === "unknown") {
|
|
4207
|
+
continue;
|
|
4208
|
+
}
|
|
4209
|
+
clinicalImpressionsAdded.add(name);
|
|
4210
|
+
clinicalImpressionsHtml += `
|
|
4211
|
+
<tr>
|
|
4212
|
+
<td>${templateUtilities.capitalizeFirstLetter(name)}</td>
|
|
4213
|
+
<td>${date ?? ""}</td>
|
|
4214
|
+
<td>${templateUtilities.codeableConceptCoding(sectionCodeableConcept)}</td>
|
|
4215
|
+
<td>${data["Description"] ?? ""}</td>
|
|
4216
|
+
<td>${data["Summary"] ?? ""}</td>
|
|
4217
|
+
<td>${data["Source"] ?? ""}</td>
|
|
4218
|
+
</tr>`;
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
}
|
|
4223
|
+
if (conditionsAdded.size > 0) {
|
|
4224
|
+
html += conditionHtml;
|
|
4225
|
+
html += `
|
|
4226
|
+
</tbody>
|
|
4227
|
+
</table>
|
|
4228
|
+
</div>`;
|
|
4229
|
+
}
|
|
4230
|
+
if (clinicalImpressionsAdded.size > 0) {
|
|
4231
|
+
html += clinicalImpressionsHtml;
|
|
4232
|
+
html += `
|
|
4233
|
+
</tbody>
|
|
4234
|
+
</table>
|
|
4235
|
+
</div>`;
|
|
4236
|
+
}
|
|
4237
|
+
html += `
|
|
4238
|
+
</div>`;
|
|
4239
|
+
return conditionsAdded.size > 0 || clinicalImpressionsAdded.size > 0 ? html : void 0;
|
|
4240
|
+
}
|
|
4036
4241
|
/**
|
|
4037
4242
|
* Internal static implementation that actually generates the narrative
|
|
4038
4243
|
* @param resources - FHIR resources array containing Observation resources
|
|
@@ -4063,7 +4268,7 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4063
4268
|
return getImpressionDate(b) - getImpressionDate(a);
|
|
4064
4269
|
});
|
|
4065
4270
|
if (functionalObservations.length > 0) {
|
|
4066
|
-
html += `<table><thead><tr><th>Observation</th><th>Value</th><th>Date</th><th>Interpretation</th><th>Comments</th></tr></thead><tbody>`;
|
|
4271
|
+
html += `<table><thead><tr><th>Observation</th><th>Value</th><th>Date</th><th>Interpretation</th><th>Comments</th><th>Source</th></tr></thead><tbody>`;
|
|
4067
4272
|
for (const obs of functionalObservations) {
|
|
4068
4273
|
const observation = obs;
|
|
4069
4274
|
const obsName = templateUtilities.codeableConceptDisplay(observation.code);
|
|
@@ -4080,12 +4285,13 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4080
4285
|
<td>${date}</td>
|
|
4081
4286
|
<td>${interpretation}</td>
|
|
4082
4287
|
<td>${comments}</td>
|
|
4288
|
+
<td>${templateUtilities.getOwnerTag(observation)}</td>
|
|
4083
4289
|
</tr>`;
|
|
4084
4290
|
}
|
|
4085
4291
|
html += `</tbody></table>`;
|
|
4086
4292
|
}
|
|
4087
4293
|
if (clinicalImpressions.length > 0) {
|
|
4088
|
-
html += `<table><thead><tr><th>Date</th><th>Status</th><th>Description</th><th>Summary</th><th>Findings</th></tr></thead><tbody>`;
|
|
4294
|
+
html += `<table><thead><tr><th>Date</th><th>Status</th><th>Description</th><th>Summary</th><th>Findings</th><th>Source</th></tr></thead><tbody>`;
|
|
4089
4295
|
for (const impression of clinicalImpressions) {
|
|
4090
4296
|
let formattedDate = "";
|
|
4091
4297
|
if (impression.effectiveDateTime) {
|
|
@@ -4111,6 +4317,7 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4111
4317
|
<td>${impression.description || ""}</td>
|
|
4112
4318
|
<td>${impression.summary || ""}</td>
|
|
4113
4319
|
<td>${findingsHtml}</td>
|
|
4320
|
+
<td>${templateUtilities.getOwnerTag(impression)}</td>
|
|
4114
4321
|
</tr>`;
|
|
4115
4322
|
}
|
|
4116
4323
|
html += `</tbody></table>`;
|
|
@@ -4177,10 +4384,11 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
4177
4384
|
<th>Code (System)</th>
|
|
4178
4385
|
<th>Comments</th>
|
|
4179
4386
|
<th>Date</th>
|
|
4387
|
+
<th>Source</th>
|
|
4180
4388
|
</tr>
|
|
4181
4389
|
</thead>
|
|
4182
4390
|
<tbody>`;
|
|
4183
|
-
function renderRow({ result, comments, date, codeSystem }) {
|
|
4391
|
+
function renderRow({ result, comments, date, codeSystem, resource }) {
|
|
4184
4392
|
if (result?.toLowerCase() === "unknown") {
|
|
4185
4393
|
return;
|
|
4186
4394
|
}
|
|
@@ -4190,6 +4398,7 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
4190
4398
|
<td class="CodeSystem">${codeSystem}</td>
|
|
4191
4399
|
<td class="Comments">${comments}</td>
|
|
4192
4400
|
<td class="Date">${date}</td>
|
|
4401
|
+
<td class="Source">${templateUtilities.getOwnerTag(resource)}</td>
|
|
4193
4402
|
</tr>`;
|
|
4194
4403
|
}
|
|
4195
4404
|
const rowResources = [];
|
|
@@ -4243,7 +4452,7 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
4243
4452
|
const rowKey = `${result}|${codeSystem}`;
|
|
4244
4453
|
if (!addedRows.has(rowKey)) {
|
|
4245
4454
|
addedRows.add(rowKey);
|
|
4246
|
-
renderRow({ result, comments, date: dateStr, codeSystem });
|
|
4455
|
+
renderRow({ result, comments, date: dateStr, codeSystem, resource });
|
|
4247
4456
|
}
|
|
4248
4457
|
}
|
|
4249
4458
|
html += `
|
|
@@ -4287,6 +4496,7 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
4287
4496
|
<th>Status</th>
|
|
4288
4497
|
<th>Action Controlled</th>
|
|
4289
4498
|
<th>Date</th>
|
|
4499
|
+
<th>Source</th>
|
|
4290
4500
|
</tr>
|
|
4291
4501
|
</thead>
|
|
4292
4502
|
<tbody>`;
|
|
@@ -4304,6 +4514,7 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
4304
4514
|
<td>${consent.status || ""}</td>
|
|
4305
4515
|
<td>${consent.provision?.action ? templateUtilities.concatCodeableConcept(consent.provision.action) : ""}</td>
|
|
4306
4516
|
<td>${consent.dateTime || ""}</td>
|
|
4517
|
+
<td>${templateUtilities.getOwnerTag(consent)}</td>
|
|
4307
4518
|
</tr>`;
|
|
4308
4519
|
}
|
|
4309
4520
|
html += `
|
package/dist/index.js
CHANGED
|
@@ -173,7 +173,8 @@ var IPSSectionSummaryCompositionFilter = {
|
|
|
173
173
|
var IPSSectionSummaryIPSCompositionFilter = {
|
|
174
174
|
["Patient" /* PATIENT */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_patient_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM)),
|
|
175
175
|
["VitalSignsSection" /* VITAL_SIGNS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_vital_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM)),
|
|
176
|
-
["SocialHistorySection" /* SOCIAL_HISTORY */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_social_history_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM))
|
|
176
|
+
["SocialHistorySection" /* SOCIAL_HISTORY */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, "ips_social_history_summary_document", IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM)),
|
|
177
|
+
["FunctionalStatusSection" /* FUNCTIONAL_STATUS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => codingMatches(c, ["ips_functional_status_condition_summary_document", "ips_functional_status_clinical_impression_summary_document"], IPS_SUMMARY_COMPOSITION_TYPE_SYSTEM))
|
|
177
178
|
};
|
|
178
179
|
var IPSSectionResourceHelper = class {
|
|
179
180
|
static getResourceFilterForSection(section) {
|
|
@@ -894,6 +895,18 @@ var TemplateUtilities = class {
|
|
|
894
895
|
}
|
|
895
896
|
return "";
|
|
896
897
|
}
|
|
898
|
+
/**
|
|
899
|
+
* Returns the owner tag from the resource meta.security array.
|
|
900
|
+
* @param resource - FHIR resource with meta tag
|
|
901
|
+
* @returns The owner display or code if found, otherwise undefined
|
|
902
|
+
*/
|
|
903
|
+
getOwnerTag(resource) {
|
|
904
|
+
if (!resource?.meta?.security) return "";
|
|
905
|
+
const ownerEntry = resource.meta.security.find(
|
|
906
|
+
(sec) => sec.system === "https://www.icanbwell.com/owner" && !!sec.code
|
|
907
|
+
);
|
|
908
|
+
return ownerEntry?.display || ownerEntry?.code;
|
|
909
|
+
}
|
|
897
910
|
/**
|
|
898
911
|
* Public method to render plain text as HTML, escaping special characters and replacing newlines with <br />.
|
|
899
912
|
* This method should be used whenever displaying user-supplied or FHIR resource text in HTML to prevent XSS vulnerabilities
|
|
@@ -1829,6 +1842,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1829
1842
|
<th>Code (System)</th>
|
|
1830
1843
|
<th>Criticality</th>
|
|
1831
1844
|
<th>Recorded Date</th>
|
|
1845
|
+
<th>Source</th>
|
|
1832
1846
|
</tr>
|
|
1833
1847
|
</thead>
|
|
1834
1848
|
<tbody>`;
|
|
@@ -1848,6 +1862,9 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1848
1862
|
case "Recorded Date":
|
|
1849
1863
|
data["recordedDate"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
1850
1864
|
break;
|
|
1865
|
+
case "Source":
|
|
1866
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
1867
|
+
break;
|
|
1851
1868
|
default:
|
|
1852
1869
|
break;
|
|
1853
1870
|
}
|
|
@@ -1862,6 +1879,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1862
1879
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
1863
1880
|
<td>${data["criticality"] ?? ""}</td>
|
|
1864
1881
|
<td>${templateUtilities.renderTime(data["recordedDate"], timezone) ?? ""}</td>
|
|
1882
|
+
<td>${data["source"] ?? ""}</td>
|
|
1865
1883
|
</tr>`;
|
|
1866
1884
|
}
|
|
1867
1885
|
}
|
|
@@ -1915,6 +1933,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1915
1933
|
<th>Reaction</th>
|
|
1916
1934
|
<th>Onset Date</th>
|
|
1917
1935
|
<th>Comments</th>
|
|
1936
|
+
<th>Source</th>
|
|
1918
1937
|
</tr>
|
|
1919
1938
|
</thead>
|
|
1920
1939
|
<tbody>`;
|
|
@@ -1944,6 +1963,7 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1944
1963
|
<th>Onset Date</th>
|
|
1945
1964
|
<th>Comments</th>
|
|
1946
1965
|
<th>Resolved Date</th>
|
|
1966
|
+
<th>Source</th>
|
|
1947
1967
|
</tr>
|
|
1948
1968
|
</thead>
|
|
1949
1969
|
<tbody>`;
|
|
@@ -1984,7 +2004,8 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
1984
2004
|
<td class="Category">${templateUtilities.renderTextAsHtml(templateUtilities.safeConcat(allergy.category)) || ""}</td>
|
|
1985
2005
|
<td class="Reaction">${templateUtilities.renderTextAsHtml(templateUtilities.concatReactionManifestation(allergy.reaction)) || ""}</td>
|
|
1986
2006
|
<td class="OnsetDate">${templateUtilities.renderTextAsHtml(templateUtilities.renderTime(allergy.onsetDateTime, timezone)) || ""}</td>
|
|
1987
|
-
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td
|
|
2007
|
+
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td>
|
|
2008
|
+
<td class="Source">${templateUtilities.getOwnerTag(allergy)}</td>`;
|
|
1988
2009
|
if (includeResolved) {
|
|
1989
2010
|
let endDate = "";
|
|
1990
2011
|
if (allergy.extension && Array.isArray(allergy.extension)) {
|
|
@@ -2040,6 +2061,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2040
2061
|
<th>Sig</th>
|
|
2041
2062
|
<th>Days of Supply</th>
|
|
2042
2063
|
<th>Start Date</th>
|
|
2064
|
+
<th>Source</th>
|
|
2043
2065
|
</tr>
|
|
2044
2066
|
</thead>
|
|
2045
2067
|
<tbody>`;
|
|
@@ -2068,6 +2090,9 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2068
2090
|
case "Authored On Date":
|
|
2069
2091
|
data["startDate"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2070
2092
|
break;
|
|
2093
|
+
case "Source":
|
|
2094
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2095
|
+
break;
|
|
2071
2096
|
default:
|
|
2072
2097
|
break;
|
|
2073
2098
|
}
|
|
@@ -2095,6 +2120,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2095
2120
|
<td>${templateUtilities.renderTextAsHtml(data["sig-prescriber"] || data["sig-pharmacy"])}</td>
|
|
2096
2121
|
<td>${templateUtilities.renderTextAsHtml(data["daysOfSupply"])}</td>
|
|
2097
2122
|
<td>${templateUtilities.renderTime(data["startDate"], timezone)}</td>
|
|
2123
|
+
<td>${data["source"] ?? ""}</td>
|
|
2098
2124
|
</tr>`;
|
|
2099
2125
|
}
|
|
2100
2126
|
}
|
|
@@ -2220,6 +2246,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2220
2246
|
<th>Sig</th>
|
|
2221
2247
|
<th>Dispense Quantity</th>
|
|
2222
2248
|
<th>Start Date</th>
|
|
2249
|
+
<th>Source</th>
|
|
2223
2250
|
</tr>
|
|
2224
2251
|
</thead>
|
|
2225
2252
|
<tbody>`;
|
|
@@ -2278,6 +2305,7 @@ var MedicationSummaryTemplate = class _MedicationSummaryTemplate {
|
|
|
2278
2305
|
<td>${sig}</td>
|
|
2279
2306
|
<td>${dispenseQuantity}</td>
|
|
2280
2307
|
<td>${startDate}</td>
|
|
2308
|
+
<td>${templateUtilities.getOwnerTag(medication.resource)}</td>
|
|
2281
2309
|
</tr>`;
|
|
2282
2310
|
}
|
|
2283
2311
|
html += `
|
|
@@ -2322,6 +2350,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2322
2350
|
<th>Code (System)</th>
|
|
2323
2351
|
<th>Status</th>
|
|
2324
2352
|
<th>Date</th>
|
|
2353
|
+
<th>Source</th>
|
|
2325
2354
|
</tr>
|
|
2326
2355
|
</thead>
|
|
2327
2356
|
<tbody>`;
|
|
@@ -2341,6 +2370,9 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2341
2370
|
case "occurrenceDateTime":
|
|
2342
2371
|
data["occurrenceDateTime"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2343
2372
|
break;
|
|
2373
|
+
case "Source":
|
|
2374
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
2375
|
+
break;
|
|
2344
2376
|
default:
|
|
2345
2377
|
break;
|
|
2346
2378
|
}
|
|
@@ -2356,6 +2388,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2356
2388
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
2357
2389
|
<td>${data["status"] ?? ""}</td>
|
|
2358
2390
|
<td>${templateUtilities.renderTime(data["occurrenceDateTime"], timezone) ?? ""}</td>
|
|
2391
|
+
<td>${data["source"] ?? ""}</td>
|
|
2359
2392
|
</tr>`;
|
|
2360
2393
|
}
|
|
2361
2394
|
}
|
|
@@ -2386,6 +2419,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2386
2419
|
<th>Lot Number</th>
|
|
2387
2420
|
<th>Comments</th>
|
|
2388
2421
|
<th>Date</th>
|
|
2422
|
+
<th>Source</th>
|
|
2389
2423
|
</tr>
|
|
2390
2424
|
</thead>
|
|
2391
2425
|
<tbody>`;
|
|
@@ -2407,6 +2441,7 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
|
|
|
2407
2441
|
<td>${imm.lotNumber || ""}</td>
|
|
2408
2442
|
<td>${templateUtilities.renderNotes(imm.note, timezone)}</td>
|
|
2409
2443
|
<td>${templateUtilities.renderTime(imm.occurrenceDateTime, timezone)}</td>
|
|
2444
|
+
<td>${templateUtilities.getOwnerTag(imm)}</td>
|
|
2410
2445
|
</tr>`;
|
|
2411
2446
|
}
|
|
2412
2447
|
}
|
|
@@ -2447,6 +2482,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2447
2482
|
<th>Is Chronic</th>
|
|
2448
2483
|
<th>Onset Date</th>
|
|
2449
2484
|
<th>Last Confirmed Date</th>
|
|
2485
|
+
<th>Source</th>
|
|
2450
2486
|
</tr>
|
|
2451
2487
|
</thead>
|
|
2452
2488
|
<tbody>`;
|
|
@@ -2471,6 +2507,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2471
2507
|
<td>${data["Is Chronic"] ?? ""}</td>
|
|
2472
2508
|
<td>${templateUtilities.renderTime(data["Onset Date"], timezone) ?? ""}</td>
|
|
2473
2509
|
<td>${templateUtilities.renderTime(data["Last Confirmed Date"], timezone) ?? ""}</td>
|
|
2510
|
+
<td>${data["Source"] ?? ""}</td>
|
|
2474
2511
|
</tr>`;
|
|
2475
2512
|
}
|
|
2476
2513
|
}
|
|
@@ -2509,6 +2546,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2509
2546
|
<th>Code (System)</th>
|
|
2510
2547
|
<th>Onset Date</th>
|
|
2511
2548
|
<th>Recorded Date</th>
|
|
2549
|
+
<th>Source</th>
|
|
2512
2550
|
</tr>
|
|
2513
2551
|
</thead>
|
|
2514
2552
|
<tbody>`;
|
|
@@ -2528,6 +2566,7 @@ var ProblemListTemplate = class _ProblemListTemplate {
|
|
|
2528
2566
|
<td class="CodeSystem">${codeAndSystem}</td>
|
|
2529
2567
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
2530
2568
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
2569
|
+
<td class="Source">${templateUtilities.getOwnerTag(cond)}</td>
|
|
2531
2570
|
</tr>`;
|
|
2532
2571
|
}
|
|
2533
2572
|
html += `</tbody>
|
|
@@ -2567,6 +2606,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2567
2606
|
<th>Code (System)</th>
|
|
2568
2607
|
<th>Result</th>
|
|
2569
2608
|
<th>Date</th>
|
|
2609
|
+
<th>Source</th>
|
|
2570
2610
|
</tr>
|
|
2571
2611
|
</thead>
|
|
2572
2612
|
<tbody>`;
|
|
@@ -2609,6 +2649,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2609
2649
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
2610
2650
|
<td>${templateUtilities.extractObservationSummaryValue(data, timezone) ?? ""}</td>
|
|
2611
2651
|
<td>${templateUtilities.extractObservationSummaryEffectiveTime(data, timezone) ?? ""}</td>
|
|
2652
|
+
<td>${data["Source"] ?? ""}</td>
|
|
2612
2653
|
</tr>`;
|
|
2613
2654
|
}
|
|
2614
2655
|
}
|
|
@@ -2646,6 +2687,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2646
2687
|
<th>Component(s)</th>
|
|
2647
2688
|
<th>Comments</th>
|
|
2648
2689
|
<th>Date</th>
|
|
2690
|
+
<th>Source</th>
|
|
2649
2691
|
</tr>
|
|
2650
2692
|
</thead>
|
|
2651
2693
|
<tbody>`;
|
|
@@ -2664,6 +2706,7 @@ var VitalSignsTemplate = class _VitalSignsTemplate {
|
|
|
2664
2706
|
<td>${templateUtilities.renderComponent(obs.component)}</td>
|
|
2665
2707
|
<td>${templateUtilities.renderNotes(obs.note, timezone)}</td>
|
|
2666
2708
|
<td>${obs.effectiveDateTime ? templateUtilities.renderTime(obs.effectiveDateTime, timezone) : obs.effectivePeriod ? templateUtilities.renderPeriod(obs.effectivePeriod, timezone) : ""}</td>
|
|
2709
|
+
<td>${templateUtilities.getOwnerTag(obs)}</td>
|
|
2667
2710
|
</tr>`;
|
|
2668
2711
|
}
|
|
2669
2712
|
html += `
|
|
@@ -2700,6 +2743,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2700
2743
|
<th>Status</th>
|
|
2701
2744
|
<th>Comments</th>
|
|
2702
2745
|
<th>Date Recorded</th>
|
|
2746
|
+
<th>Source</th>
|
|
2703
2747
|
</tr>
|
|
2704
2748
|
</thead>
|
|
2705
2749
|
<tbody>`;
|
|
@@ -2721,6 +2765,7 @@ var MedicalDevicesTemplate = class _MedicalDevicesTemplate {
|
|
|
2721
2765
|
<td>${templateUtilities.renderTextAsHtml(dus.status || "")}</td>
|
|
2722
2766
|
<td>${templateUtilities.renderNotes(dus.note, timezone)}</td>
|
|
2723
2767
|
<td>${templateUtilities.renderTextAsHtml(templateUtilities.renderRecorded(dus.recordedOn, timezone))}</td>
|
|
2768
|
+
<td>${templateUtilities.getOwnerTag(dus)}</td>
|
|
2724
2769
|
</tr>`;
|
|
2725
2770
|
}
|
|
2726
2771
|
html += `
|
|
@@ -2873,6 +2918,9 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
2873
2918
|
case "effectivePeriod.end":
|
|
2874
2919
|
targetData["effectivePeriodEnd"] = templateUtilities.renderTextAsHtml(column.text?.div ?? "");
|
|
2875
2920
|
break;
|
|
2921
|
+
case "Source":
|
|
2922
|
+
targetData["source"] = templateUtilities.renderTextAsHtml(column.text?.div ?? "");
|
|
2923
|
+
break;
|
|
2876
2924
|
// valueQuantity
|
|
2877
2925
|
case "valueQuantity.value":
|
|
2878
2926
|
targetData["value"] = templateUtilities.renderTextAsHtml(column.text?.div ?? "");
|
|
@@ -3091,6 +3139,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3091
3139
|
<th>Result</th>
|
|
3092
3140
|
<th>Reference Range</th>
|
|
3093
3141
|
<th>Date</th>
|
|
3142
|
+
<th>Source</th>
|
|
3094
3143
|
</tr>
|
|
3095
3144
|
</thead>
|
|
3096
3145
|
<tbody>`;
|
|
@@ -3104,6 +3153,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3104
3153
|
<th>Report</th>
|
|
3105
3154
|
<th>Performer</th>
|
|
3106
3155
|
<th>Issued</th>
|
|
3156
|
+
<th>Source</th>
|
|
3107
3157
|
</tr>
|
|
3108
3158
|
</thead>
|
|
3109
3159
|
<tbody>`;
|
|
@@ -3150,6 +3200,8 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3150
3200
|
case "Status":
|
|
3151
3201
|
data["status"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
3152
3202
|
break;
|
|
3203
|
+
case "Source":
|
|
3204
|
+
data["source"] = templateUtilities.renderTextAsHtml(columnData.text?.div ?? "");
|
|
3153
3205
|
break;
|
|
3154
3206
|
default:
|
|
3155
3207
|
break;
|
|
@@ -3187,6 +3239,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3187
3239
|
<td>${templateUtilities.renderTextAsHtml(component["formattedValue"]) ?? ""}</td>
|
|
3188
3240
|
<td>${templateUtilities.renderTextAsHtml(component["referenceRange"])?.trim() ?? ""}</td>
|
|
3189
3241
|
<td>${date ?? ""}</td>
|
|
3242
|
+
<td>${data["source"] ?? ""}</td>
|
|
3190
3243
|
</tr>`;
|
|
3191
3244
|
}
|
|
3192
3245
|
}
|
|
@@ -3206,6 +3259,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3206
3259
|
<td>${templateUtilities.renderTextAsHtml(data["formattedValue"]) ?? ""}</td>
|
|
3207
3260
|
<td>${templateUtilities.renderTextAsHtml(data["referenceRange"])?.trim() ?? ""}</td>
|
|
3208
3261
|
<td>${date ?? ""}</td>
|
|
3262
|
+
<td>${data["source"] ?? ""}</td>
|
|
3209
3263
|
</tr>`;
|
|
3210
3264
|
}
|
|
3211
3265
|
}
|
|
@@ -3227,6 +3281,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3227
3281
|
<td>${templateUtilities.capitalizeFirstLetter(data["report"] ?? "")}</td>
|
|
3228
3282
|
<td>${data["performer"] ?? ""}</td>
|
|
3229
3283
|
<td>${templateUtilities.renderTime(data["issued"], timezone) ?? ""}</td>
|
|
3284
|
+
<td>${data["source"] ?? ""}</td>
|
|
3230
3285
|
</tr>`;
|
|
3231
3286
|
}
|
|
3232
3287
|
}
|
|
@@ -3411,6 +3466,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3411
3466
|
<th>Result</th>
|
|
3412
3467
|
<th>Reference Range</th>
|
|
3413
3468
|
<th>Date</th>
|
|
3469
|
+
<th>Source</th>
|
|
3414
3470
|
</tr>
|
|
3415
3471
|
</thead>
|
|
3416
3472
|
<tbody>`;
|
|
@@ -3431,6 +3487,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3431
3487
|
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
3432
3488
|
<td>${templateUtilities.concatReferenceRange(obs.referenceRange)}</td>
|
|
3433
3489
|
<td>${obs.effectiveDateTime ? templateUtilities.renderTime(obs.effectiveDateTime, timezone) : obs.effectivePeriod ? templateUtilities.renderPeriod(obs.effectivePeriod, timezone) : ""}</td>
|
|
3490
|
+
<td>${templateUtilities.getOwnerTag(obs)}</td>
|
|
3434
3491
|
</tr>`;
|
|
3435
3492
|
}
|
|
3436
3493
|
}
|
|
@@ -3457,6 +3514,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3457
3514
|
<th>Category</th>
|
|
3458
3515
|
<th>Result</th>
|
|
3459
3516
|
<th>Issued</th>
|
|
3517
|
+
<th>Source</th>
|
|
3460
3518
|
</tr>
|
|
3461
3519
|
</thead>
|
|
3462
3520
|
<tbody>`;
|
|
@@ -3481,6 +3539,7 @@ var DiagnosticResultsTemplate = class _DiagnosticResultsTemplate {
|
|
|
3481
3539
|
<td>${templateUtilities.firstFromCodeableConceptList(report.category)}</td>
|
|
3482
3540
|
<td>${resultCount}</td>
|
|
3483
3541
|
<td>${report.issued ? templateUtilities.renderTime(report.issued, timezone) : ""}</td>
|
|
3542
|
+
<td>${templateUtilities.getOwnerTag(report)}</td>
|
|
3484
3543
|
</tr>`;
|
|
3485
3544
|
}
|
|
3486
3545
|
}
|
|
@@ -3547,6 +3606,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3547
3606
|
<th>Code (System)</th>
|
|
3548
3607
|
<th>Performer</th>
|
|
3549
3608
|
<th>Date</th>
|
|
3609
|
+
<th>Source</th>
|
|
3550
3610
|
</tr>
|
|
3551
3611
|
</thead>
|
|
3552
3612
|
<tbody>`;
|
|
@@ -3566,6 +3626,8 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3566
3626
|
case "Performed Date":
|
|
3567
3627
|
data["date"] = columnData.text?.div ?? "";
|
|
3568
3628
|
break;
|
|
3629
|
+
case "Source":
|
|
3630
|
+
data["source"] = columnData.text?.div ?? "";
|
|
3569
3631
|
break;
|
|
3570
3632
|
default:
|
|
3571
3633
|
break;
|
|
@@ -3581,6 +3643,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3581
3643
|
<td>${data["codeSystem"] ?? ""}</td>
|
|
3582
3644
|
<td>${data["performer"] ?? ""}</td>
|
|
3583
3645
|
<td>${templateUtilities.renderTime(data["date"], timezone) ?? ""}</td>
|
|
3646
|
+
<td>${data["source"] ?? ""}</td>
|
|
3584
3647
|
</tr>`;
|
|
3585
3648
|
}
|
|
3586
3649
|
}
|
|
@@ -3608,6 +3671,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3608
3671
|
<th>Code (System)</th>
|
|
3609
3672
|
<th>Comments</th>
|
|
3610
3673
|
<th>Date</th>
|
|
3674
|
+
<th>Source</th>
|
|
3611
3675
|
</tr>
|
|
3612
3676
|
</thead>
|
|
3613
3677
|
<tbody>`;
|
|
@@ -3623,6 +3687,7 @@ var HistoryOfProceduresTemplate = class _HistoryOfProceduresTemplate {
|
|
|
3623
3687
|
<td>${templateUtilities.codeableConceptCoding(proc.code)}</td>
|
|
3624
3688
|
<td>${templateUtilities.renderNotes(proc.note, timezone)}</td>
|
|
3625
3689
|
<td>${templateUtilities.renderTime(proc.performedDateTime || proc.performedPeriod?.start, timezone)}</td>
|
|
3690
|
+
<td>${templateUtilities.getOwnerTag(proc)}</td>
|
|
3626
3691
|
</tr>`;
|
|
3627
3692
|
}
|
|
3628
3693
|
html += `
|
|
@@ -3664,6 +3729,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3664
3729
|
<th>Result</th>
|
|
3665
3730
|
<th>Date</th>
|
|
3666
3731
|
<th>Comments</th>
|
|
3732
|
+
<th>Source</th>
|
|
3667
3733
|
</tr>
|
|
3668
3734
|
</thead>
|
|
3669
3735
|
<tbody>`;
|
|
@@ -3689,6 +3755,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3689
3755
|
<td>${templateUtilities.extractObservationSummaryValue(data, timezone) ?? ""}</td>
|
|
3690
3756
|
<td>${templateUtilities.extractObservationSummaryEffectiveTime(data, timezone) ?? ""}</td>
|
|
3691
3757
|
<td>${data["Notes"] ?? ""}</td>
|
|
3758
|
+
<td>${data["Source"] ?? ""}</td>
|
|
3692
3759
|
</tr>`;
|
|
3693
3760
|
}
|
|
3694
3761
|
}
|
|
@@ -3724,6 +3791,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3724
3791
|
<th>Unit</th>
|
|
3725
3792
|
<th>Comments</th>
|
|
3726
3793
|
<th>Date</th>
|
|
3794
|
+
<th>Source</th>
|
|
3727
3795
|
</tr>
|
|
3728
3796
|
</thead>
|
|
3729
3797
|
<tbody>`;
|
|
@@ -3743,6 +3811,7 @@ var SocialHistoryTemplate = class _SocialHistoryTemplate {
|
|
|
3743
3811
|
<td>${templateUtilities.extractObservationValueUnit(obs)}</td>
|
|
3744
3812
|
<td>${templateUtilities.renderNotes(obs.note, timezone)}</td>
|
|
3745
3813
|
<td>${obs.effectiveDateTime ? templateUtilities.renderTime(obs.effectiveDateTime, timezone) : obs.effectivePeriod ? templateUtilities.renderPeriod(obs.effectivePeriod, timezone) : ""}</td>
|
|
3814
|
+
<td>${templateUtilities.getOwnerTag(obs)}</td>
|
|
3746
3815
|
</tr>`;
|
|
3747
3816
|
}
|
|
3748
3817
|
}
|
|
@@ -3793,6 +3862,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3793
3862
|
<th>Onset Date</th>
|
|
3794
3863
|
<th>Recorded Date</th>
|
|
3795
3864
|
<th>Resolved Date</th>
|
|
3865
|
+
<th>Source</th>
|
|
3796
3866
|
</tr>
|
|
3797
3867
|
</thead>
|
|
3798
3868
|
<tbody>`;
|
|
@@ -3810,6 +3880,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3810
3880
|
<td class="OnsetDate">${templateUtilities.renderDate(cond.onsetDateTime)}</td>
|
|
3811
3881
|
<td class="RecordedDate">${templateUtilities.renderDate(cond.recordedDate)}</td>
|
|
3812
3882
|
<td class="ResolvedDate">${templateUtilities.renderDate(cond.abatementDateTime)}</td>
|
|
3883
|
+
<td class="Source">${templateUtilities.getOwnerTag(cond)}</td>
|
|
3813
3884
|
</tr>`;
|
|
3814
3885
|
}
|
|
3815
3886
|
}
|
|
@@ -3845,6 +3916,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3845
3916
|
<th>Onset Date</th>
|
|
3846
3917
|
<th>Last Confirmed Date</th>
|
|
3847
3918
|
<th>Resolved Date</th>
|
|
3919
|
+
<th>Source</th>
|
|
3848
3920
|
</tr>
|
|
3849
3921
|
</thead>
|
|
3850
3922
|
<tbody>`;
|
|
@@ -3874,6 +3946,7 @@ var PastHistoryOfIllnessTemplate = class {
|
|
|
3874
3946
|
<td>${templateUtilities.renderTime(data["Onset Date"], timezone) ?? ""}</td>
|
|
3875
3947
|
<td>${templateUtilities.renderTime(data["Last Confirmed Date"], timezone) ?? ""}</td>
|
|
3876
3948
|
<td>${templateUtilities.renderTime(data["Resolved Date"], timezone) ?? ""}</td>
|
|
3949
|
+
<td>${data["Source"] ?? ""}</td>
|
|
3877
3950
|
</tr>`;
|
|
3878
3951
|
}
|
|
3879
3952
|
}
|
|
@@ -3917,6 +3990,7 @@ var PlanOfCareTemplate = class {
|
|
|
3917
3990
|
<th>Comments</th>
|
|
3918
3991
|
<th>Planned Start</th>
|
|
3919
3992
|
<th>Planned End</th>
|
|
3993
|
+
<th>Source</th>
|
|
3920
3994
|
</tr>
|
|
3921
3995
|
</thead>
|
|
3922
3996
|
<tbody>`;
|
|
@@ -3932,6 +4006,7 @@ var PlanOfCareTemplate = class {
|
|
|
3932
4006
|
<td>${templateUtilities.concat(cp.note, "text")}</td>
|
|
3933
4007
|
<td>${cp.period?.start ? templateUtilities.renderTime(cp.period?.start, timezone) : ""}</td>
|
|
3934
4008
|
<td>${cp.period?.end ? templateUtilities.renderTime(cp.period?.end, timezone) : ""}</td>
|
|
4009
|
+
<td>${templateUtilities.getOwnerTag(cp)}</td>
|
|
3935
4010
|
</tr>`;
|
|
3936
4011
|
}
|
|
3937
4012
|
html += `
|
|
@@ -3959,6 +4034,7 @@ var PlanOfCareTemplate = class {
|
|
|
3959
4034
|
<th>Created</th>
|
|
3960
4035
|
<th>Planned Start</th>
|
|
3961
4036
|
<th>Planned End</th>
|
|
4037
|
+
<th>Source</th>
|
|
3962
4038
|
</tr>
|
|
3963
4039
|
</thead>
|
|
3964
4040
|
<tbody>`;
|
|
@@ -3983,6 +4059,7 @@ var PlanOfCareTemplate = class {
|
|
|
3983
4059
|
<td>${templateUtilities.renderTime(data["created"], timezone) ?? ""}</td>
|
|
3984
4060
|
<td>${templateUtilities.renderTime(data["period.start"], timezone) ?? ""}</td>
|
|
3985
4061
|
<td>${templateUtilities.renderTime(data["period.end"], timezone) ?? ""}</td>
|
|
4062
|
+
<td>${data["Source"] ?? ""}</td>
|
|
3986
4063
|
</tr>`;
|
|
3987
4064
|
}
|
|
3988
4065
|
}
|
|
@@ -4005,6 +4082,134 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4005
4082
|
generateNarrative(resources, timezone) {
|
|
4006
4083
|
return _FunctionalStatusTemplate.generateStaticNarrative(resources, timezone);
|
|
4007
4084
|
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Generate HTML narrative for Functional Status Condition & ClinicalImpression resources using summary
|
|
4087
|
+
* @param resources - FHIR Composition resources
|
|
4088
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
4089
|
+
* @param now - Optional current date for filtering
|
|
4090
|
+
* @returns HTML string for rendering
|
|
4091
|
+
*/
|
|
4092
|
+
generateSummaryNarrative(resources, timezone) {
|
|
4093
|
+
const templateUtilities = new TemplateUtilities(resources);
|
|
4094
|
+
let html = `
|
|
4095
|
+
<div>
|
|
4096
|
+
<p>This section summarizes key conditions and assessments related to the person's functional status and ability to perform daily activities.</p>`;
|
|
4097
|
+
let conditionHtml = `
|
|
4098
|
+
<div>
|
|
4099
|
+
<h3>Conditions</h3>
|
|
4100
|
+
<table>
|
|
4101
|
+
<thead>
|
|
4102
|
+
<tr>
|
|
4103
|
+
<th>Problem</th>
|
|
4104
|
+
<th>Code (System)</th>
|
|
4105
|
+
<th>Onset Date</th>
|
|
4106
|
+
<th>Recorded Date</th>
|
|
4107
|
+
<th>Source</th>
|
|
4108
|
+
</tr>
|
|
4109
|
+
</thead>
|
|
4110
|
+
<tbody>`;
|
|
4111
|
+
let clinicalImpressionsHtml = `
|
|
4112
|
+
<div>
|
|
4113
|
+
<h3>Clinical Impressions</h3>
|
|
4114
|
+
<table>
|
|
4115
|
+
<thead>
|
|
4116
|
+
<tr>
|
|
4117
|
+
<th>Name</th>
|
|
4118
|
+
<th>Date</th>
|
|
4119
|
+
<th>Code (System)</th>
|
|
4120
|
+
<th>Description</th>
|
|
4121
|
+
<th>Summary</th>
|
|
4122
|
+
<th>Source</th>
|
|
4123
|
+
</tr>
|
|
4124
|
+
</thead>
|
|
4125
|
+
<tbody>`;
|
|
4126
|
+
const conditionsAdded = /* @__PURE__ */ new Set();
|
|
4127
|
+
const clinicalImpressionsAdded = /* @__PURE__ */ new Set();
|
|
4128
|
+
for (const resourceItem of resources) {
|
|
4129
|
+
for (const rowData of resourceItem.section ?? []) {
|
|
4130
|
+
const sectionCodeableConcept = rowData.code;
|
|
4131
|
+
const data = {};
|
|
4132
|
+
for (const columnData of rowData.section ?? []) {
|
|
4133
|
+
if (columnData.title) {
|
|
4134
|
+
data[columnData.title] = templateUtilities.renderTextAsHtml(
|
|
4135
|
+
columnData.text?.div ?? ""
|
|
4136
|
+
);
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
if (resourceItem.title === "Condition|Condition Summary Grouped by Functional Status Code") {
|
|
4140
|
+
let date = data["onsetDateTime"] ? templateUtilities.renderTime(data["onsetDateTime"], timezone) : "";
|
|
4141
|
+
if (!date && data["onsetPeriod.start"]) {
|
|
4142
|
+
date = templateUtilities.renderTime(
|
|
4143
|
+
data["onsetPeriod.start"],
|
|
4144
|
+
timezone
|
|
4145
|
+
);
|
|
4146
|
+
if (data["onsetPeriod.end"]) {
|
|
4147
|
+
date += " - " + templateUtilities.renderTime(data["onsetPeriod.end"], timezone);
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
const problem = data["Condition Name"];
|
|
4151
|
+
if (problem && !conditionsAdded.has(problem)) {
|
|
4152
|
+
if (problem.toLowerCase() === "unknown") {
|
|
4153
|
+
continue;
|
|
4154
|
+
}
|
|
4155
|
+
conditionsAdded.add(problem);
|
|
4156
|
+
conditionHtml += `
|
|
4157
|
+
<tr>
|
|
4158
|
+
<td>${templateUtilities.capitalizeFirstLetter(problem)}</td>
|
|
4159
|
+
<td>${templateUtilities.codeableConceptCoding(sectionCodeableConcept)}</td>
|
|
4160
|
+
<td>${date}</td>
|
|
4161
|
+
<td>${templateUtilities.renderTime(data["recordedDate"], timezone) ?? ""}</td>
|
|
4162
|
+
<td>${data["Source"] ?? ""}</td>
|
|
4163
|
+
</tr>`;
|
|
4164
|
+
}
|
|
4165
|
+
} else if (resourceItem.title === "Clinical Impression|Clinical Impression Summary") {
|
|
4166
|
+
let date = data["effectiveDateTime"] ? templateUtilities.renderTime(data["effectiveDateTime"], timezone) : "";
|
|
4167
|
+
if (!date && data["effectivePeriod.start"]) {
|
|
4168
|
+
date = templateUtilities.renderTime(
|
|
4169
|
+
data["effectivePeriod.start"],
|
|
4170
|
+
timezone
|
|
4171
|
+
);
|
|
4172
|
+
if (data["effectivePeriod.end"]) {
|
|
4173
|
+
date += " - " + templateUtilities.renderTime(data["effectivePeriod.end"], timezone);
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
const name = data["Clinical Impression Name"];
|
|
4177
|
+
if (name && !clinicalImpressionsAdded.has(name)) {
|
|
4178
|
+
if (name?.toLowerCase() === "unknown") {
|
|
4179
|
+
continue;
|
|
4180
|
+
}
|
|
4181
|
+
clinicalImpressionsAdded.add(name);
|
|
4182
|
+
clinicalImpressionsHtml += `
|
|
4183
|
+
<tr>
|
|
4184
|
+
<td>${templateUtilities.capitalizeFirstLetter(name)}</td>
|
|
4185
|
+
<td>${date ?? ""}</td>
|
|
4186
|
+
<td>${templateUtilities.codeableConceptCoding(sectionCodeableConcept)}</td>
|
|
4187
|
+
<td>${data["Description"] ?? ""}</td>
|
|
4188
|
+
<td>${data["Summary"] ?? ""}</td>
|
|
4189
|
+
<td>${data["Source"] ?? ""}</td>
|
|
4190
|
+
</tr>`;
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
if (conditionsAdded.size > 0) {
|
|
4196
|
+
html += conditionHtml;
|
|
4197
|
+
html += `
|
|
4198
|
+
</tbody>
|
|
4199
|
+
</table>
|
|
4200
|
+
</div>`;
|
|
4201
|
+
}
|
|
4202
|
+
if (clinicalImpressionsAdded.size > 0) {
|
|
4203
|
+
html += clinicalImpressionsHtml;
|
|
4204
|
+
html += `
|
|
4205
|
+
</tbody>
|
|
4206
|
+
</table>
|
|
4207
|
+
</div>`;
|
|
4208
|
+
}
|
|
4209
|
+
html += `
|
|
4210
|
+
</div>`;
|
|
4211
|
+
return conditionsAdded.size > 0 || clinicalImpressionsAdded.size > 0 ? html : void 0;
|
|
4212
|
+
}
|
|
4008
4213
|
/**
|
|
4009
4214
|
* Internal static implementation that actually generates the narrative
|
|
4010
4215
|
* @param resources - FHIR resources array containing Observation resources
|
|
@@ -4035,7 +4240,7 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4035
4240
|
return getImpressionDate(b) - getImpressionDate(a);
|
|
4036
4241
|
});
|
|
4037
4242
|
if (functionalObservations.length > 0) {
|
|
4038
|
-
html += `<table><thead><tr><th>Observation</th><th>Value</th><th>Date</th><th>Interpretation</th><th>Comments</th></tr></thead><tbody>`;
|
|
4243
|
+
html += `<table><thead><tr><th>Observation</th><th>Value</th><th>Date</th><th>Interpretation</th><th>Comments</th><th>Source</th></tr></thead><tbody>`;
|
|
4039
4244
|
for (const obs of functionalObservations) {
|
|
4040
4245
|
const observation = obs;
|
|
4041
4246
|
const obsName = templateUtilities.codeableConceptDisplay(observation.code);
|
|
@@ -4052,12 +4257,13 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4052
4257
|
<td>${date}</td>
|
|
4053
4258
|
<td>${interpretation}</td>
|
|
4054
4259
|
<td>${comments}</td>
|
|
4260
|
+
<td>${templateUtilities.getOwnerTag(observation)}</td>
|
|
4055
4261
|
</tr>`;
|
|
4056
4262
|
}
|
|
4057
4263
|
html += `</tbody></table>`;
|
|
4058
4264
|
}
|
|
4059
4265
|
if (clinicalImpressions.length > 0) {
|
|
4060
|
-
html += `<table><thead><tr><th>Date</th><th>Status</th><th>Description</th><th>Summary</th><th>Findings</th></tr></thead><tbody>`;
|
|
4266
|
+
html += `<table><thead><tr><th>Date</th><th>Status</th><th>Description</th><th>Summary</th><th>Findings</th><th>Source</th></tr></thead><tbody>`;
|
|
4061
4267
|
for (const impression of clinicalImpressions) {
|
|
4062
4268
|
let formattedDate = "";
|
|
4063
4269
|
if (impression.effectiveDateTime) {
|
|
@@ -4083,6 +4289,7 @@ var FunctionalStatusTemplate = class _FunctionalStatusTemplate {
|
|
|
4083
4289
|
<td>${impression.description || ""}</td>
|
|
4084
4290
|
<td>${impression.summary || ""}</td>
|
|
4085
4291
|
<td>${findingsHtml}</td>
|
|
4292
|
+
<td>${templateUtilities.getOwnerTag(impression)}</td>
|
|
4086
4293
|
</tr>`;
|
|
4087
4294
|
}
|
|
4088
4295
|
html += `</tbody></table>`;
|
|
@@ -4149,10 +4356,11 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
4149
4356
|
<th>Code (System)</th>
|
|
4150
4357
|
<th>Comments</th>
|
|
4151
4358
|
<th>Date</th>
|
|
4359
|
+
<th>Source</th>
|
|
4152
4360
|
</tr>
|
|
4153
4361
|
</thead>
|
|
4154
4362
|
<tbody>`;
|
|
4155
|
-
function renderRow({ result, comments, date, codeSystem }) {
|
|
4363
|
+
function renderRow({ result, comments, date, codeSystem, resource }) {
|
|
4156
4364
|
if (result?.toLowerCase() === "unknown") {
|
|
4157
4365
|
return;
|
|
4158
4366
|
}
|
|
@@ -4162,6 +4370,7 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
4162
4370
|
<td class="CodeSystem">${codeSystem}</td>
|
|
4163
4371
|
<td class="Comments">${comments}</td>
|
|
4164
4372
|
<td class="Date">${date}</td>
|
|
4373
|
+
<td class="Source">${templateUtilities.getOwnerTag(resource)}</td>
|
|
4165
4374
|
</tr>`;
|
|
4166
4375
|
}
|
|
4167
4376
|
const rowResources = [];
|
|
@@ -4215,7 +4424,7 @@ var PregnancyTemplate = class _PregnancyTemplate {
|
|
|
4215
4424
|
const rowKey = `${result}|${codeSystem}`;
|
|
4216
4425
|
if (!addedRows.has(rowKey)) {
|
|
4217
4426
|
addedRows.add(rowKey);
|
|
4218
|
-
renderRow({ result, comments, date: dateStr, codeSystem });
|
|
4427
|
+
renderRow({ result, comments, date: dateStr, codeSystem, resource });
|
|
4219
4428
|
}
|
|
4220
4429
|
}
|
|
4221
4430
|
html += `
|
|
@@ -4259,6 +4468,7 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
4259
4468
|
<th>Status</th>
|
|
4260
4469
|
<th>Action Controlled</th>
|
|
4261
4470
|
<th>Date</th>
|
|
4471
|
+
<th>Source</th>
|
|
4262
4472
|
</tr>
|
|
4263
4473
|
</thead>
|
|
4264
4474
|
<tbody>`;
|
|
@@ -4276,6 +4486,7 @@ var AdvanceDirectivesTemplate = class _AdvanceDirectivesTemplate {
|
|
|
4276
4486
|
<td>${consent.status || ""}</td>
|
|
4277
4487
|
<td>${consent.provision?.action ? templateUtilities.concatCodeableConcept(consent.provision.action) : ""}</td>
|
|
4278
4488
|
<td>${consent.dateTime || ""}</td>
|
|
4489
|
+
<td>${templateUtilities.getOwnerTag(consent)}</td>
|
|
4279
4490
|
</tr>`;
|
|
4280
4491
|
}
|
|
4281
4492
|
html += `
|