@imranq2/fhirpatientsummary 1.0.18 → 1.0.20
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 +50 -3
- package/dist/index.js +50 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -144,7 +144,8 @@ var IPSSectionResourceFilters = {
|
|
|
144
144
|
};
|
|
145
145
|
var IPSSectionSummaryCompositionFilter = {
|
|
146
146
|
["AllergyIntoleranceSection" /* ALLERGIES */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "allergy_summary_document"),
|
|
147
|
-
["VitalSignsSection" /* VITAL_SIGNS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "vital_summary_document")
|
|
147
|
+
["VitalSignsSection" /* VITAL_SIGNS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "vital_summary_document"),
|
|
148
|
+
["PlanOfCareSection" /* CARE_PLAN */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "careplan_summary_document")
|
|
148
149
|
};
|
|
149
150
|
var IPSSectionResourceHelper = class {
|
|
150
151
|
static getResourceFilterForSection(section) {
|
|
@@ -2280,6 +2281,52 @@ var PlanOfCareTemplate = class {
|
|
|
2280
2281
|
</table>`;
|
|
2281
2282
|
return html;
|
|
2282
2283
|
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Generate HTML narrative for CarePlan resources using summary
|
|
2286
|
+
* @param resources - FHIR Composition resources
|
|
2287
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
2288
|
+
* @returns HTML string for rendering
|
|
2289
|
+
*/
|
|
2290
|
+
generateSummaryNarrative(resources, timezone) {
|
|
2291
|
+
const templateUtilities = new TemplateUtilities(resources);
|
|
2292
|
+
let html = `
|
|
2293
|
+
<div>
|
|
2294
|
+
<table>
|
|
2295
|
+
<thead>
|
|
2296
|
+
<tr>
|
|
2297
|
+
<th>Description</th>
|
|
2298
|
+
<th>Created</th>
|
|
2299
|
+
<th>Planned Start</th>
|
|
2300
|
+
<th>Planned End</th>
|
|
2301
|
+
</tr>
|
|
2302
|
+
</thead>
|
|
2303
|
+
<tbody>`;
|
|
2304
|
+
for (const resourceItem of resources) {
|
|
2305
|
+
for (const rowData of resourceItem.section ?? []) {
|
|
2306
|
+
const data = {};
|
|
2307
|
+
for (const columnData of rowData.section ?? []) {
|
|
2308
|
+
if (columnData.title) {
|
|
2309
|
+
data[columnData.title] = columnData.text?.div ?? "";
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
if (data["status"] !== "active") {
|
|
2313
|
+
continue;
|
|
2314
|
+
}
|
|
2315
|
+
html += `
|
|
2316
|
+
<tr>
|
|
2317
|
+
<td>${data["CarePlan Name"] ?? "-"}</td>
|
|
2318
|
+
<td>${templateUtilities.renderTime(data["created"], timezone) ?? "-"}</td>
|
|
2319
|
+
<td>${templateUtilities.renderTime(data["period.start"], timezone) ?? "-"}</td>
|
|
2320
|
+
<td>${templateUtilities.renderTime(data["period.end"], timezone) ?? "-"}</td>
|
|
2321
|
+
</tr>`;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
html += `
|
|
2325
|
+
</tbody>
|
|
2326
|
+
</table>
|
|
2327
|
+
</div>`;
|
|
2328
|
+
return html;
|
|
2329
|
+
}
|
|
2283
2330
|
};
|
|
2284
2331
|
|
|
2285
2332
|
// src/narratives/templates/typescript/FunctionalStatusTemplate.ts
|
|
@@ -2797,8 +2844,8 @@ var ComprehensiveIPSCompositionBuilder = class {
|
|
|
2797
2844
|
continue;
|
|
2798
2845
|
}
|
|
2799
2846
|
const summaryCompositionFilter = useSummaryCompositions ? IPSSectionResourceHelper.getSummaryCompositionFilterForSection(sectionType) : void 0;
|
|
2800
|
-
const sectionSummary = summaryCompositionFilter ? resources.filter((resource) => summaryCompositionFilter(resource)) :
|
|
2801
|
-
if (sectionSummary) {
|
|
2847
|
+
const sectionSummary = summaryCompositionFilter ? resources.filter((resource) => summaryCompositionFilter(resource)) : [];
|
|
2848
|
+
if (sectionSummary.length > 0) {
|
|
2802
2849
|
await this.makeSectionFromSummaryAsync(sectionType, sectionSummary, resources, timezone);
|
|
2803
2850
|
} else {
|
|
2804
2851
|
const sectionFilter = IPSSectionResourceHelper.getResourceFilterForSection(sectionType);
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,8 @@ var IPSSectionResourceFilters = {
|
|
|
116
116
|
};
|
|
117
117
|
var IPSSectionSummaryCompositionFilter = {
|
|
118
118
|
["AllergyIntoleranceSection" /* ALLERGIES */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "allergy_summary_document"),
|
|
119
|
-
["VitalSignsSection" /* VITAL_SIGNS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "vital_summary_document")
|
|
119
|
+
["VitalSignsSection" /* VITAL_SIGNS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "vital_summary_document"),
|
|
120
|
+
["PlanOfCareSection" /* CARE_PLAN */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "careplan_summary_document")
|
|
120
121
|
};
|
|
121
122
|
var IPSSectionResourceHelper = class {
|
|
122
123
|
static getResourceFilterForSection(section) {
|
|
@@ -2252,6 +2253,52 @@ var PlanOfCareTemplate = class {
|
|
|
2252
2253
|
</table>`;
|
|
2253
2254
|
return html;
|
|
2254
2255
|
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Generate HTML narrative for CarePlan resources using summary
|
|
2258
|
+
* @param resources - FHIR Composition resources
|
|
2259
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
2260
|
+
* @returns HTML string for rendering
|
|
2261
|
+
*/
|
|
2262
|
+
generateSummaryNarrative(resources, timezone) {
|
|
2263
|
+
const templateUtilities = new TemplateUtilities(resources);
|
|
2264
|
+
let html = `
|
|
2265
|
+
<div>
|
|
2266
|
+
<table>
|
|
2267
|
+
<thead>
|
|
2268
|
+
<tr>
|
|
2269
|
+
<th>Description</th>
|
|
2270
|
+
<th>Created</th>
|
|
2271
|
+
<th>Planned Start</th>
|
|
2272
|
+
<th>Planned End</th>
|
|
2273
|
+
</tr>
|
|
2274
|
+
</thead>
|
|
2275
|
+
<tbody>`;
|
|
2276
|
+
for (const resourceItem of resources) {
|
|
2277
|
+
for (const rowData of resourceItem.section ?? []) {
|
|
2278
|
+
const data = {};
|
|
2279
|
+
for (const columnData of rowData.section ?? []) {
|
|
2280
|
+
if (columnData.title) {
|
|
2281
|
+
data[columnData.title] = columnData.text?.div ?? "";
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
if (data["status"] !== "active") {
|
|
2285
|
+
continue;
|
|
2286
|
+
}
|
|
2287
|
+
html += `
|
|
2288
|
+
<tr>
|
|
2289
|
+
<td>${data["CarePlan Name"] ?? "-"}</td>
|
|
2290
|
+
<td>${templateUtilities.renderTime(data["created"], timezone) ?? "-"}</td>
|
|
2291
|
+
<td>${templateUtilities.renderTime(data["period.start"], timezone) ?? "-"}</td>
|
|
2292
|
+
<td>${templateUtilities.renderTime(data["period.end"], timezone) ?? "-"}</td>
|
|
2293
|
+
</tr>`;
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
html += `
|
|
2297
|
+
</tbody>
|
|
2298
|
+
</table>
|
|
2299
|
+
</div>`;
|
|
2300
|
+
return html;
|
|
2301
|
+
}
|
|
2255
2302
|
};
|
|
2256
2303
|
|
|
2257
2304
|
// src/narratives/templates/typescript/FunctionalStatusTemplate.ts
|
|
@@ -2769,8 +2816,8 @@ var ComprehensiveIPSCompositionBuilder = class {
|
|
|
2769
2816
|
continue;
|
|
2770
2817
|
}
|
|
2771
2818
|
const summaryCompositionFilter = useSummaryCompositions ? IPSSectionResourceHelper.getSummaryCompositionFilterForSection(sectionType) : void 0;
|
|
2772
|
-
const sectionSummary = summaryCompositionFilter ? resources.filter((resource) => summaryCompositionFilter(resource)) :
|
|
2773
|
-
if (sectionSummary) {
|
|
2819
|
+
const sectionSummary = summaryCompositionFilter ? resources.filter((resource) => summaryCompositionFilter(resource)) : [];
|
|
2820
|
+
if (sectionSummary.length > 0) {
|
|
2774
2821
|
await this.makeSectionFromSummaryAsync(sectionType, sectionSummary, resources, timezone);
|
|
2775
2822
|
} else {
|
|
2776
2823
|
const sectionFilter = IPSSectionResourceHelper.getResourceFilterForSection(sectionType);
|