@imranq2/fhirpatientsummary 1.0.20 → 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
@@ -145,7 +145,8 @@ var IPSSectionResourceFilters = {
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
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
+ ["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")
149
150
  };
150
151
  var IPSSectionResourceHelper = class {
151
152
  static getResourceFilterForSection(section) {
@@ -1680,6 +1681,59 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
1680
1681
  });
1681
1682
  return _ImmunizationsTemplate.generateStaticNarrative(resources, timezone);
1682
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
+ }
1683
1737
  /**
1684
1738
  * Internal static implementation that actually generates the narrative
1685
1739
  * @param resources - FHIR resources array containing Immunization resources
package/dist/index.js CHANGED
@@ -117,7 +117,8 @@ var IPSSectionResourceFilters = {
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
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
+ ["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")
121
122
  };
122
123
  var IPSSectionResourceHelper = class {
123
124
  static getResourceFilterForSection(section) {
@@ -1652,6 +1653,59 @@ var ImmunizationsTemplate = class _ImmunizationsTemplate {
1652
1653
  });
1653
1654
  return _ImmunizationsTemplate.generateStaticNarrative(resources, timezone);
1654
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
+ }
1655
1709
  /**
1656
1710
  * Internal static implementation that actually generates the narrative
1657
1711
  * @param resources - FHIR resources array containing Immunization resources
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imranq2/fhirpatientsummary",
3
- "version": "1.0.20",
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
  },