@imranq2/fhirpatientsummary 1.0.19 → 1.0.21

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 CHANGED
@@ -144,7 +144,9 @@ 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"),
149
+ ["ImmunizationSection" /* IMMUNIZATIONS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "immunization_summary_document")
148
150
  };
149
151
  var IPSSectionResourceHelper = class {
150
152
  static getResourceFilterForSection(section) {
@@ -1679,6 +1681,59 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
1679
1681
  });
1680
1682
  return _ImmunizationsTemplate.generateStaticNarrative(resources, timezone);
1681
1683
  }
1684
+ /**
1685
+ * Generate HTML narrative for Immunization resources using summary
1686
+ * @param resources - FHIR Composition resources
1687
+ * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
1688
+ * @returns HTML string for rendering
1689
+ */
1690
+ generateSummaryNarrative(resources, timezone) {
1691
+ const templateUtilities = new TemplateUtilities(resources);
1692
+ let html = `
1693
+ <div>
1694
+ <table>
1695
+ <thead>
1696
+ <tr>
1697
+ <th>Immunization</th>
1698
+ <th>Status</th>
1699
+ <th>Date</th>
1700
+ </tr>
1701
+ </thead>
1702
+ <tbody>`;
1703
+ for (const resourceItem of resources) {
1704
+ for (const rowData of resourceItem.section ?? []) {
1705
+ const data = {};
1706
+ for (const columnData of rowData.section ?? []) {
1707
+ switch (columnData.title) {
1708
+ case "Immunization Name":
1709
+ data["immunization"] = columnData.text?.div ?? "";
1710
+ break;
1711
+ case "Status":
1712
+ data["status"] = columnData.text?.div ?? "";
1713
+ break;
1714
+ case "occurrenceDateTime":
1715
+ data["occurrenceDateTime"] = columnData.text?.div ?? "";
1716
+ break;
1717
+ default:
1718
+ break;
1719
+ }
1720
+ }
1721
+ if (data["status"] === "completed") {
1722
+ html += `
1723
+ <tr>
1724
+ <td>${data["immunization"] ?? "-"}</td>
1725
+ <td>${data["status"] ?? "-"}</td>
1726
+ <td>${templateUtilities.renderTime(data["occurrenceDateTime"], timezone) ?? "-"}</td>
1727
+ </tr>`;
1728
+ }
1729
+ }
1730
+ }
1731
+ html += `
1732
+ </tbody>
1733
+ </table>
1734
+ </div>`;
1735
+ return html;
1736
+ }
1682
1737
  /**
1683
1738
  * Internal static implementation that actually generates the narrative
1684
1739
  * @param resources - FHIR resources array containing Immunization resources
@@ -2280,6 +2335,52 @@ var PlanOfCareTemplate = class {
2280
2335
  </table>`;
2281
2336
  return html;
2282
2337
  }
2338
+ /**
2339
+ * Generate HTML narrative for CarePlan resources using summary
2340
+ * @param resources - FHIR Composition resources
2341
+ * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
2342
+ * @returns HTML string for rendering
2343
+ */
2344
+ generateSummaryNarrative(resources, timezone) {
2345
+ const templateUtilities = new TemplateUtilities(resources);
2346
+ let html = `
2347
+ <div>
2348
+ <table>
2349
+ <thead>
2350
+ <tr>
2351
+ <th>Description</th>
2352
+ <th>Created</th>
2353
+ <th>Planned Start</th>
2354
+ <th>Planned End</th>
2355
+ </tr>
2356
+ </thead>
2357
+ <tbody>`;
2358
+ for (const resourceItem of resources) {
2359
+ for (const rowData of resourceItem.section ?? []) {
2360
+ const data = {};
2361
+ for (const columnData of rowData.section ?? []) {
2362
+ if (columnData.title) {
2363
+ data[columnData.title] = columnData.text?.div ?? "";
2364
+ }
2365
+ }
2366
+ if (data["status"] !== "active") {
2367
+ continue;
2368
+ }
2369
+ html += `
2370
+ <tr>
2371
+ <td>${data["CarePlan Name"] ?? "-"}</td>
2372
+ <td>${templateUtilities.renderTime(data["created"], timezone) ?? "-"}</td>
2373
+ <td>${templateUtilities.renderTime(data["period.start"], timezone) ?? "-"}</td>
2374
+ <td>${templateUtilities.renderTime(data["period.end"], timezone) ?? "-"}</td>
2375
+ </tr>`;
2376
+ }
2377
+ }
2378
+ html += `
2379
+ </tbody>
2380
+ </table>
2381
+ </div>`;
2382
+ return html;
2383
+ }
2283
2384
  };
2284
2385
 
2285
2386
  // src/narratives/templates/typescript/FunctionalStatusTemplate.ts
package/dist/index.js CHANGED
@@ -116,7 +116,9 @@ 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"),
121
+ ["ImmunizationSection" /* IMMUNIZATIONS */]: (resource) => resource.resourceType === "Composition" && resource.type?.coding?.some((c) => c.system === "https://fhir.icanbwell.com/4_0_0/CodeSystem/composition/" && c.code === "immunization_summary_document")
120
122
  };
121
123
  var IPSSectionResourceHelper = class {
122
124
  static getResourceFilterForSection(section) {
@@ -1651,6 +1653,59 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
1651
1653
  });
1652
1654
  return _ImmunizationsTemplate.generateStaticNarrative(resources, timezone);
1653
1655
  }
1656
+ /**
1657
+ * Generate HTML narrative for Immunization resources using summary
1658
+ * @param resources - FHIR Composition resources
1659
+ * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
1660
+ * @returns HTML string for rendering
1661
+ */
1662
+ generateSummaryNarrative(resources, timezone) {
1663
+ const templateUtilities = new TemplateUtilities(resources);
1664
+ let html = `
1665
+ <div>
1666
+ <table>
1667
+ <thead>
1668
+ <tr>
1669
+ <th>Immunization</th>
1670
+ <th>Status</th>
1671
+ <th>Date</th>
1672
+ </tr>
1673
+ </thead>
1674
+ <tbody>`;
1675
+ for (const resourceItem of resources) {
1676
+ for (const rowData of resourceItem.section ?? []) {
1677
+ const data = {};
1678
+ for (const columnData of rowData.section ?? []) {
1679
+ switch (columnData.title) {
1680
+ case "Immunization Name":
1681
+ data["immunization"] = columnData.text?.div ?? "";
1682
+ break;
1683
+ case "Status":
1684
+ data["status"] = columnData.text?.div ?? "";
1685
+ break;
1686
+ case "occurrenceDateTime":
1687
+ data["occurrenceDateTime"] = columnData.text?.div ?? "";
1688
+ break;
1689
+ default:
1690
+ break;
1691
+ }
1692
+ }
1693
+ if (data["status"] === "completed") {
1694
+ html += `
1695
+ <tr>
1696
+ <td>${data["immunization"] ?? "-"}</td>
1697
+ <td>${data["status"] ?? "-"}</td>
1698
+ <td>${templateUtilities.renderTime(data["occurrenceDateTime"], timezone) ?? "-"}</td>
1699
+ </tr>`;
1700
+ }
1701
+ }
1702
+ }
1703
+ html += `
1704
+ </tbody>
1705
+ </table>
1706
+ </div>`;
1707
+ return html;
1708
+ }
1654
1709
  /**
1655
1710
  * Internal static implementation that actually generates the narrative
1656
1711
  * @param resources - FHIR resources array containing Immunization resources
@@ -2252,6 +2307,52 @@ var PlanOfCareTemplate = class {
2252
2307
  </table>`;
2253
2308
  return html;
2254
2309
  }
2310
+ /**
2311
+ * Generate HTML narrative for CarePlan resources using summary
2312
+ * @param resources - FHIR Composition resources
2313
+ * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
2314
+ * @returns HTML string for rendering
2315
+ */
2316
+ generateSummaryNarrative(resources, timezone) {
2317
+ const templateUtilities = new TemplateUtilities(resources);
2318
+ let html = `
2319
+ <div>
2320
+ <table>
2321
+ <thead>
2322
+ <tr>
2323
+ <th>Description</th>
2324
+ <th>Created</th>
2325
+ <th>Planned Start</th>
2326
+ <th>Planned End</th>
2327
+ </tr>
2328
+ </thead>
2329
+ <tbody>`;
2330
+ for (const resourceItem of resources) {
2331
+ for (const rowData of resourceItem.section ?? []) {
2332
+ const data = {};
2333
+ for (const columnData of rowData.section ?? []) {
2334
+ if (columnData.title) {
2335
+ data[columnData.title] = columnData.text?.div ?? "";
2336
+ }
2337
+ }
2338
+ if (data["status"] !== "active") {
2339
+ continue;
2340
+ }
2341
+ html += `
2342
+ <tr>
2343
+ <td>${data["CarePlan Name"] ?? "-"}</td>
2344
+ <td>${templateUtilities.renderTime(data["created"], timezone) ?? "-"}</td>
2345
+ <td>${templateUtilities.renderTime(data["period.start"], timezone) ?? "-"}</td>
2346
+ <td>${templateUtilities.renderTime(data["period.end"], timezone) ?? "-"}</td>
2347
+ </tr>`;
2348
+ }
2349
+ }
2350
+ html += `
2351
+ </tbody>
2352
+ </table>
2353
+ </div>`;
2354
+ return html;
2355
+ }
2255
2356
  };
2256
2357
 
2257
2358
  // src/narratives/templates/typescript/FunctionalStatusTemplate.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imranq2/fhirpatientsummary",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "A template for creating npm packages using TypeScript and VSCode",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -93,7 +93,7 @@
93
93
  "semantic-release": "^24.2.5",
94
94
  "ts-jest": "^29.4.0",
95
95
  "ts-node": "^10.9.2",
96
- "tsup": "^8.5.0",
96
+ "tsup": "8.5.1",
97
97
  "typescript": "^5.8.3",
98
98
  "typescript-eslint": "^8.34.1"
99
99
  },