@imranq2/fhirpatientsummary 1.0.14 → 1.0.15
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/README.md +2 -0
- package/dist/index.cjs +7 -9
- package/dist/index.js +7 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This project provides utilities to generate patient summaries from FHIR Bundles, including narrative generation and section extraction, following the International Patient Summary (IPS) specification.
|
|
4
4
|
|
|
5
|
+
Detailed explanation of content of each section of IPS is [here](./sections.md)
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
Clone the repository and install dependencies:
|
package/dist/index.cjs
CHANGED
|
@@ -126,9 +126,7 @@ var IPSSectionResourceMap = {
|
|
|
126
126
|
["AdvanceDirectivesSection" /* ADVANCE_DIRECTIVES */]: ["Consent"]
|
|
127
127
|
};
|
|
128
128
|
var IPSSectionResourceFilters = {
|
|
129
|
-
// Only include active
|
|
130
|
-
["AllergyIntoleranceSection" /* ALLERGIES */]: (resource) => resource.resourceType === "AllergyIntolerance" && resource.clinicalStatus?.coding?.some((c) => typeof c.code === "string"),
|
|
131
|
-
// Only include active problems/conditions
|
|
129
|
+
// Only include active conditions
|
|
132
130
|
["ProblemSection" /* PROBLEMS */]: (resource) => resource.resourceType === "Condition" && resource.clinicalStatus?.coding?.some((c) => !["inactive", "resolved"].includes(c.code)),
|
|
133
131
|
// Only include completed immunizations
|
|
134
132
|
["ImmunizationSection" /* IMMUNIZATIONS */]: (resource) => resource.resourceType === "Immunization" && resource.status === "completed" || resource.resourceType === "Organization",
|
|
@@ -138,12 +136,12 @@ var IPSSectionResourceFilters = {
|
|
|
138
136
|
["ResultsSection" /* DIAGNOSTIC_REPORTS */]: (resource) => ["DiagnosticReport", "Observation"].includes(resource.resourceType) && resource.status === "final",
|
|
139
137
|
// Only include completed procedures
|
|
140
138
|
["HistoryOfProceduresSection" /* PROCEDURES */]: (resource) => resource.resourceType === "Procedure" && resource.status === "completed",
|
|
141
|
-
// Only include social history Observations
|
|
139
|
+
// Only include social history Observations
|
|
142
140
|
["SocialHistorySection" /* SOCIAL_HISTORY */]: (resource) => resource.resourceType === "Observation" && resource.code?.coding?.some((c) => Object.keys(SOCIAL_HISTORY_LOINC_CODES).includes(c.code)),
|
|
143
|
-
// Only include pregnancy history Observations
|
|
141
|
+
// Only include pregnancy history Observations
|
|
144
142
|
["HistoryOfPregnancySection" /* PREGNANCY_HISTORY */]: (resource) => resource.resourceType === "Observation" && (resource.code?.coding?.some((c) => Object.keys(PREGNANCY_LOINC_CODES.PREGNANCY_STATUS).includes(c.code)) || resource.valueCodeableConcept?.coding?.some((c) => Object.keys(PREGNANCY_LOINC_CODES.PREGNANCY_OUTCOME).includes(c.code))),
|
|
145
|
-
// Only include
|
|
146
|
-
["FunctionalStatusSection" /* FUNCTIONAL_STATUS */]: (resource) => resource.resourceType === "Condition"
|
|
143
|
+
// Only include Conditions or completed ClinicalImpressions
|
|
144
|
+
["FunctionalStatusSection" /* FUNCTIONAL_STATUS */]: (resource) => resource.resourceType === "Condition" || resource.resourceType === "ClinicalImpression" && resource.status === "completed",
|
|
147
145
|
// Only include resolved medical history Conditions
|
|
148
146
|
["HistoryOfPastIllnessSection" /* MEDICAL_HISTORY */]: (resource) => resource.resourceType === "Condition" && resource.clinicalStatus?.coding?.some((c) => ["inactive", "resolved"].includes(c.code)),
|
|
149
147
|
// Only include active care plans
|
|
@@ -993,8 +991,8 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
993
991
|
if (resource.entry && Array.isArray(resource.entry)) {
|
|
994
992
|
for (const entry of resource.entry) {
|
|
995
993
|
const allergy = entry.resource;
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
994
|
+
const isResolved = allergy.clinicalStatus?.coding?.some((c) => ["inactive", "resolved"].includes(c.code));
|
|
995
|
+
if (isResolved) {
|
|
998
996
|
resolvedAllergies.push(allergy);
|
|
999
997
|
} else {
|
|
1000
998
|
activeAllergies.push(allergy);
|
package/dist/index.js
CHANGED
|
@@ -98,9 +98,7 @@ var IPSSectionResourceMap = {
|
|
|
98
98
|
["AdvanceDirectivesSection" /* ADVANCE_DIRECTIVES */]: ["Consent"]
|
|
99
99
|
};
|
|
100
100
|
var IPSSectionResourceFilters = {
|
|
101
|
-
// Only include active
|
|
102
|
-
["AllergyIntoleranceSection" /* ALLERGIES */]: (resource) => resource.resourceType === "AllergyIntolerance" && resource.clinicalStatus?.coding?.some((c) => typeof c.code === "string"),
|
|
103
|
-
// Only include active problems/conditions
|
|
101
|
+
// Only include active conditions
|
|
104
102
|
["ProblemSection" /* PROBLEMS */]: (resource) => resource.resourceType === "Condition" && resource.clinicalStatus?.coding?.some((c) => !["inactive", "resolved"].includes(c.code)),
|
|
105
103
|
// Only include completed immunizations
|
|
106
104
|
["ImmunizationSection" /* IMMUNIZATIONS */]: (resource) => resource.resourceType === "Immunization" && resource.status === "completed" || resource.resourceType === "Organization",
|
|
@@ -110,12 +108,12 @@ var IPSSectionResourceFilters = {
|
|
|
110
108
|
["ResultsSection" /* DIAGNOSTIC_REPORTS */]: (resource) => ["DiagnosticReport", "Observation"].includes(resource.resourceType) && resource.status === "final",
|
|
111
109
|
// Only include completed procedures
|
|
112
110
|
["HistoryOfProceduresSection" /* PROCEDURES */]: (resource) => resource.resourceType === "Procedure" && resource.status === "completed",
|
|
113
|
-
// Only include social history Observations
|
|
111
|
+
// Only include social history Observations
|
|
114
112
|
["SocialHistorySection" /* SOCIAL_HISTORY */]: (resource) => resource.resourceType === "Observation" && resource.code?.coding?.some((c) => Object.keys(SOCIAL_HISTORY_LOINC_CODES).includes(c.code)),
|
|
115
|
-
// Only include pregnancy history Observations
|
|
113
|
+
// Only include pregnancy history Observations
|
|
116
114
|
["HistoryOfPregnancySection" /* PREGNANCY_HISTORY */]: (resource) => resource.resourceType === "Observation" && (resource.code?.coding?.some((c) => Object.keys(PREGNANCY_LOINC_CODES.PREGNANCY_STATUS).includes(c.code)) || resource.valueCodeableConcept?.coding?.some((c) => Object.keys(PREGNANCY_LOINC_CODES.PREGNANCY_OUTCOME).includes(c.code))),
|
|
117
|
-
// Only include
|
|
118
|
-
["FunctionalStatusSection" /* FUNCTIONAL_STATUS */]: (resource) => resource.resourceType === "Condition"
|
|
115
|
+
// Only include Conditions or completed ClinicalImpressions
|
|
116
|
+
["FunctionalStatusSection" /* FUNCTIONAL_STATUS */]: (resource) => resource.resourceType === "Condition" || resource.resourceType === "ClinicalImpression" && resource.status === "completed",
|
|
119
117
|
// Only include resolved medical history Conditions
|
|
120
118
|
["HistoryOfPastIllnessSection" /* MEDICAL_HISTORY */]: (resource) => resource.resourceType === "Condition" && resource.clinicalStatus?.coding?.some((c) => ["inactive", "resolved"].includes(c.code)),
|
|
121
119
|
// Only include active care plans
|
|
@@ -965,8 +963,8 @@ var AllergyIntoleranceTemplate = class _AllergyIntoleranceTemplate {
|
|
|
965
963
|
if (resource.entry && Array.isArray(resource.entry)) {
|
|
966
964
|
for (const entry of resource.entry) {
|
|
967
965
|
const allergy = entry.resource;
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
966
|
+
const isResolved = allergy.clinicalStatus?.coding?.some((c) => ["inactive", "resolved"].includes(c.code));
|
|
967
|
+
if (isResolved) {
|
|
970
968
|
resolvedAllergies.push(allergy);
|
|
971
969
|
} else {
|
|
972
970
|
activeAllergies.push(allergy);
|