@imranq2/fhirpatientsummary 1.0.0 → 1.0.2
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/lib/esm/src/generators/fhir_summary_generator.d.ts +46 -0
- package/lib/esm/src/generators/fhir_summary_generator.js +224 -0
- package/lib/esm/src/generators/narrative_generator.d.ts +40 -0
- package/lib/esm/src/generators/narrative_generator.js +76 -0
- package/lib/esm/src/narratives/templates/typescript/AdvanceDirectivesTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/AdvanceDirectivesTemplate.js +66 -0
- package/lib/esm/src/narratives/templates/typescript/AllergyIntoleranceTemplate.d.ts +31 -0
- package/lib/esm/src/narratives/templates/typescript/AllergyIntoleranceTemplate.js +151 -0
- package/lib/esm/src/narratives/templates/typescript/ClinicalImpressionTemplate.d.ts +15 -0
- package/lib/esm/src/narratives/templates/typescript/ClinicalImpressionTemplate.js +107 -0
- package/lib/esm/src/narratives/templates/typescript/DiagnosticResultsTemplate.d.ts +50 -0
- package/lib/esm/src/narratives/templates/typescript/DiagnosticResultsTemplate.js +149 -0
- package/lib/esm/src/narratives/templates/typescript/FamilyHistoryTemplate.d.ts +15 -0
- package/lib/esm/src/narratives/templates/typescript/FamilyHistoryTemplate.js +99 -0
- package/lib/esm/src/narratives/templates/typescript/FunctionalStatusTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/FunctionalStatusTemplate.js +66 -0
- package/lib/esm/src/narratives/templates/typescript/HistoryOfProceduresTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/HistoryOfProceduresTemplate.js +62 -0
- package/lib/esm/src/narratives/templates/typescript/ImmunizationsTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/ImmunizationsTemplate.js +69 -0
- package/lib/esm/src/narratives/templates/typescript/MedicalDevicesTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/MedicalDevicesTemplate.js +63 -0
- package/lib/esm/src/narratives/templates/typescript/MedicationSummaryTemplate.d.ts +50 -0
- package/lib/esm/src/narratives/templates/typescript/MedicationSummaryTemplate.js +202 -0
- package/lib/esm/src/narratives/templates/typescript/PastHistoryOfIllnessTemplate.d.ts +15 -0
- package/lib/esm/src/narratives/templates/typescript/PastHistoryOfIllnessTemplate.js +55 -0
- package/lib/esm/src/narratives/templates/typescript/PatientTemplate.d.ts +65 -0
- package/lib/esm/src/narratives/templates/typescript/PatientTemplate.js +154 -0
- package/lib/esm/src/narratives/templates/typescript/PlanOfCareTemplate.d.ts +15 -0
- package/lib/esm/src/narratives/templates/typescript/PlanOfCareTemplate.js +59 -0
- package/lib/esm/src/narratives/templates/typescript/PregnancyTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/PregnancyTemplate.js +64 -0
- package/lib/esm/src/narratives/templates/typescript/ProblemListTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/ProblemListTemplate.js +115 -0
- package/lib/esm/src/narratives/templates/typescript/SocialHistoryTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/SocialHistoryTemplate.js +66 -0
- package/lib/esm/src/narratives/templates/typescript/TemplateUtilities.d.ts +251 -0
- package/lib/esm/src/narratives/templates/typescript/TemplateUtilities.js +692 -0
- package/lib/esm/src/narratives/templates/typescript/TypeScriptTemplateMapper.d.ts +17 -0
- package/lib/esm/src/narratives/templates/typescript/TypeScriptTemplateMapper.js +60 -0
- package/lib/esm/src/narratives/templates/typescript/VitalSignsTemplate.d.ts +22 -0
- package/lib/esm/src/narratives/templates/typescript/VitalSignsTemplate.js +70 -0
- package/lib/esm/src/narratives/templates/typescript/interfaces/ITemplate.d.ts +13 -0
- package/lib/esm/src/narratives/templates/typescript/interfaces/ITemplate.js +1 -0
- package/lib/esm/src/profiles/ips_resource_profile_registry.d.ts +7 -0
- package/lib/esm/src/profiles/ips_resource_profile_registry.js +139 -0
- package/lib/esm/src/structures/ips_mandatory_sections.d.ts +7 -0
- package/lib/esm/src/structures/ips_mandatory_sections.js +8 -0
- package/lib/esm/src/structures/ips_recommended_sections.d.ts +8 -0
- package/lib/esm/src/structures/ips_recommended_sections.js +9 -0
- package/lib/esm/src/structures/ips_resource_profile.d.ts +7 -0
- package/lib/esm/src/structures/ips_resource_profile.js +1 -0
- package/lib/esm/src/structures/ips_section_loinc_codes.d.ts +4 -0
- package/lib/esm/src/structures/ips_section_loinc_codes.js +44 -0
- package/lib/esm/src/structures/ips_section_resource_map.d.ts +8 -0
- package/lib/esm/src/structures/ips_section_resource_map.js +65 -0
- package/lib/esm/src/structures/ips_sections.d.ts +19 -0
- package/lib/esm/src/structures/ips_sections.js +24 -0
- package/lib/esm/src/types/partials/Address.d.ts +16 -0
- package/lib/esm/src/types/partials/Address.js +2 -0
- package/lib/esm/src/types/partials/AllergyIntoleranceReaction.d.ts +16 -0
- package/lib/esm/src/types/partials/AllergyIntoleranceReaction.js +2 -0
- package/lib/esm/src/types/partials/Annotation.d.ts +12 -0
- package/lib/esm/src/types/partials/Annotation.js +2 -0
- package/lib/esm/src/types/partials/Attachment.d.ts +17 -0
- package/lib/esm/src/types/partials/Attachment.js +2 -0
- package/lib/esm/src/types/partials/BundleEntry.d.ts +18 -0
- package/lib/esm/src/types/partials/BundleEntry.js +2 -0
- package/lib/esm/src/types/partials/BundleLink.d.ts +9 -0
- package/lib/esm/src/types/partials/BundleLink.js +2 -0
- package/lib/esm/src/types/partials/BundleRequest.d.ts +14 -0
- package/lib/esm/src/types/partials/BundleRequest.js +2 -0
- package/lib/esm/src/types/partials/BundleResponse.d.ts +14 -0
- package/lib/esm/src/types/partials/BundleResponse.js +2 -0
- package/lib/esm/src/types/partials/BundleSearch.d.ts +9 -0
- package/lib/esm/src/types/partials/BundleSearch.js +2 -0
- package/lib/esm/src/types/partials/CarePlanActivity.d.ts +15 -0
- package/lib/esm/src/types/partials/CarePlanActivity.js +2 -0
- package/lib/esm/src/types/partials/CarePlanDetail.d.ts +33 -0
- package/lib/esm/src/types/partials/CarePlanDetail.js +2 -0
- package/lib/esm/src/types/partials/ClinicalImpressionFinding.d.ts +11 -0
- package/lib/esm/src/types/partials/ClinicalImpressionFinding.js +2 -0
- package/lib/esm/src/types/partials/ClinicalImpressionInvestigation.d.ts +10 -0
- package/lib/esm/src/types/partials/ClinicalImpressionInvestigation.js +2 -0
- package/lib/esm/src/types/partials/CodeableConcept.d.ts +8 -0
- package/lib/esm/src/types/partials/CodeableConcept.js +2 -0
- package/lib/esm/src/types/partials/CodeableReference.d.ts +9 -0
- package/lib/esm/src/types/partials/CodeableReference.js +2 -0
- package/lib/esm/src/types/partials/Coding.d.ts +11 -0
- package/lib/esm/src/types/partials/Coding.js +2 -0
- package/lib/esm/src/types/partials/CompositionAttester.d.ts +11 -0
- package/lib/esm/src/types/partials/CompositionAttester.js +2 -0
- package/lib/esm/src/types/partials/CompositionEvent.d.ts +12 -0
- package/lib/esm/src/types/partials/CompositionEvent.js +2 -0
- package/lib/esm/src/types/partials/CompositionRelatesTo.d.ts +11 -0
- package/lib/esm/src/types/partials/CompositionRelatesTo.js +2 -0
- package/lib/esm/src/types/partials/CompositionSection.d.ts +19 -0
- package/lib/esm/src/types/partials/CompositionSection.js +2 -0
- package/lib/esm/src/types/partials/ConditionEvidence.d.ts +10 -0
- package/lib/esm/src/types/partials/ConditionEvidence.js +2 -0
- package/lib/esm/src/types/partials/ConditionStage.d.ts +11 -0
- package/lib/esm/src/types/partials/ConditionStage.js +2 -0
- package/lib/esm/src/types/partials/ConsentActor.d.ts +10 -0
- package/lib/esm/src/types/partials/ConsentActor.js +2 -0
- package/lib/esm/src/types/partials/ConsentData.d.ts +9 -0
- package/lib/esm/src/types/partials/ConsentData.js +2 -0
- package/lib/esm/src/types/partials/ConsentPolicy.d.ts +9 -0
- package/lib/esm/src/types/partials/ConsentPolicy.js +2 -0
- package/lib/esm/src/types/partials/ConsentProvision.d.ts +22 -0
- package/lib/esm/src/types/partials/ConsentProvision.js +2 -0
- package/lib/esm/src/types/partials/ConsentVerification.d.ts +11 -0
- package/lib/esm/src/types/partials/ConsentVerification.js +2 -0
- package/lib/esm/src/types/partials/ContactDetail.d.ts +8 -0
- package/lib/esm/src/types/partials/ContactDetail.js +2 -0
- package/lib/esm/src/types/partials/ContactPoint.d.ts +12 -0
- package/lib/esm/src/types/partials/ContactPoint.js +2 -0
- package/lib/esm/src/types/partials/Contributor.d.ts +9 -0
- package/lib/esm/src/types/partials/Contributor.js +2 -0
- package/lib/esm/src/types/partials/DataRequirement.d.ts +21 -0
- package/lib/esm/src/types/partials/DataRequirement.js +2 -0
- package/lib/esm/src/types/partials/DataRequirementCodeFilter.d.ts +11 -0
- package/lib/esm/src/types/partials/DataRequirementCodeFilter.js +2 -0
- package/lib/esm/src/types/partials/DataRequirementDateFilter.d.ts +13 -0
- package/lib/esm/src/types/partials/DataRequirementDateFilter.js +2 -0
- package/lib/esm/src/types/partials/DataRequirementSort.d.ts +7 -0
- package/lib/esm/src/types/partials/DataRequirementSort.js +2 -0
- package/lib/esm/src/types/partials/DeviceDeviceName.d.ts +8 -0
- package/lib/esm/src/types/partials/DeviceDeviceName.js +2 -0
- package/lib/esm/src/types/partials/DeviceProperty.d.ts +11 -0
- package/lib/esm/src/types/partials/DeviceProperty.js +2 -0
- package/lib/esm/src/types/partials/DeviceSpecialization.d.ts +9 -0
- package/lib/esm/src/types/partials/DeviceSpecialization.js +2 -0
- package/lib/esm/src/types/partials/DeviceUdiCarrier.d.ts +14 -0
- package/lib/esm/src/types/partials/DeviceUdiCarrier.js +2 -0
- package/lib/esm/src/types/partials/DeviceVersion.d.ts +11 -0
- package/lib/esm/src/types/partials/DeviceVersion.js +2 -0
- package/lib/esm/src/types/partials/DiagnosticReportMedia.d.ts +9 -0
- package/lib/esm/src/types/partials/DiagnosticReportMedia.js +2 -0
- package/lib/esm/src/types/partials/Dosage.d.ts +26 -0
- package/lib/esm/src/types/partials/Dosage.js +2 -0
- package/lib/esm/src/types/partials/DosageDoseAndRate.d.ts +16 -0
- package/lib/esm/src/types/partials/DosageDoseAndRate.js +2 -0
- package/lib/esm/src/types/partials/Expression.d.ts +12 -0
- package/lib/esm/src/types/partials/Expression.js +2 -0
- package/lib/esm/src/types/partials/Extension.d.ts +99 -0
- package/lib/esm/src/types/partials/Extension.js +2 -0
- package/lib/esm/src/types/partials/FamilyMemberHistoryCondition.d.ts +19 -0
- package/lib/esm/src/types/partials/FamilyMemberHistoryCondition.js +2 -0
- package/lib/esm/src/types/partials/HumanName.d.ts +13 -0
- package/lib/esm/src/types/partials/HumanName.js +2 -0
- package/lib/esm/src/types/partials/Identifier.d.ts +15 -0
- package/lib/esm/src/types/partials/Identifier.js +2 -0
- package/lib/esm/src/types/partials/ImmunizationEducation.d.ts +12 -0
- package/lib/esm/src/types/partials/ImmunizationEducation.js +2 -0
- package/lib/esm/src/types/partials/ImmunizationPerformer.d.ts +10 -0
- package/lib/esm/src/types/partials/ImmunizationPerformer.js +2 -0
- package/lib/esm/src/types/partials/ImmunizationProtocolApplied.d.ts +16 -0
- package/lib/esm/src/types/partials/ImmunizationProtocolApplied.js +2 -0
- package/lib/esm/src/types/partials/ImmunizationReaction.d.ts +11 -0
- package/lib/esm/src/types/partials/ImmunizationReaction.js +2 -0
- package/lib/esm/src/types/partials/MedicationBatch.d.ts +9 -0
- package/lib/esm/src/types/partials/MedicationBatch.js +2 -0
- package/lib/esm/src/types/partials/MedicationIngredient.d.ts +13 -0
- package/lib/esm/src/types/partials/MedicationIngredient.js +2 -0
- package/lib/esm/src/types/partials/MedicationRequestDispenseRequest.d.ts +18 -0
- package/lib/esm/src/types/partials/MedicationRequestDispenseRequest.js +2 -0
- package/lib/esm/src/types/partials/MedicationRequestInitialFill.d.ts +9 -0
- package/lib/esm/src/types/partials/MedicationRequestInitialFill.js +2 -0
- package/lib/esm/src/types/partials/MedicationRequestSubstitution.d.ts +10 -0
- package/lib/esm/src/types/partials/MedicationRequestSubstitution.js +2 -0
- package/lib/esm/src/types/partials/Meta.d.ts +16 -0
- package/lib/esm/src/types/partials/Meta.js +2 -0
- package/lib/esm/src/types/partials/Money.d.ts +8 -0
- package/lib/esm/src/types/partials/Money.js +2 -0
- package/lib/esm/src/types/partials/Narrative.d.ts +8 -0
- package/lib/esm/src/types/partials/Narrative.js +2 -0
- package/lib/esm/src/types/partials/ObservationComponent.d.ts +31 -0
- package/lib/esm/src/types/partials/ObservationComponent.js +2 -0
- package/lib/esm/src/types/partials/ObservationReferenceRange.d.ts +15 -0
- package/lib/esm/src/types/partials/ObservationReferenceRange.js +2 -0
- package/lib/esm/src/types/partials/OrganizationContact.d.ts +14 -0
- package/lib/esm/src/types/partials/OrganizationContact.js +2 -0
- package/lib/esm/src/types/partials/ParameterDefinition.d.ts +14 -0
- package/lib/esm/src/types/partials/ParameterDefinition.js +2 -0
- package/lib/esm/src/types/partials/PatientCommunication.d.ts +9 -0
- package/lib/esm/src/types/partials/PatientCommunication.js +2 -0
- package/lib/esm/src/types/partials/PatientContact.d.ts +19 -0
- package/lib/esm/src/types/partials/PatientContact.js +2 -0
- package/lib/esm/src/types/partials/PatientLink.d.ts +9 -0
- package/lib/esm/src/types/partials/PatientLink.js +2 -0
- package/lib/esm/src/types/partials/Period.d.ts +8 -0
- package/lib/esm/src/types/partials/Period.js +2 -0
- package/lib/esm/src/types/partials/ProcedureFocalDevice.d.ts +10 -0
- package/lib/esm/src/types/partials/ProcedureFocalDevice.js +2 -0
- package/lib/esm/src/types/partials/ProcedurePerformer.d.ts +11 -0
- package/lib/esm/src/types/partials/ProcedurePerformer.js +2 -0
- package/lib/esm/src/types/partials/Quantity.d.ts +12 -0
- package/lib/esm/src/types/partials/Quantity.js +2 -0
- package/lib/esm/src/types/partials/Range.d.ts +8 -0
- package/lib/esm/src/types/partials/Range.js +2 -0
- package/lib/esm/src/types/partials/Ratio.d.ts +8 -0
- package/lib/esm/src/types/partials/Ratio.js +2 -0
- package/lib/esm/src/types/partials/RatioRange.d.ts +9 -0
- package/lib/esm/src/types/partials/RatioRange.js +2 -0
- package/lib/esm/src/types/partials/Reference.d.ts +14 -0
- package/lib/esm/src/types/partials/Reference.js +2 -0
- package/lib/esm/src/types/partials/RelatedArtifact.d.ts +16 -0
- package/lib/esm/src/types/partials/RelatedArtifact.js +2 -0
- package/lib/esm/src/types/partials/SampledData.d.ts +15 -0
- package/lib/esm/src/types/partials/SampledData.js +2 -0
- package/lib/esm/src/types/partials/Signature.d.ts +16 -0
- package/lib/esm/src/types/partials/Signature.js +2 -0
- package/lib/esm/src/types/partials/Timing.d.ts +12 -0
- package/lib/esm/src/types/partials/Timing.js +2 -0
- package/lib/esm/src/types/partials/TimingRepeat.d.ts +30 -0
- package/lib/esm/src/types/partials/TimingRepeat.js +2 -0
- package/lib/esm/src/types/partials/TriggerDefinition.d.ts +19 -0
- package/lib/esm/src/types/partials/TriggerDefinition.js +2 -0
- package/lib/esm/src/types/partials/UsageContext.d.ts +15 -0
- package/lib/esm/src/types/partials/UsageContext.js +2 -0
- package/lib/esm/src/types/resources/AllergyIntolerance.d.ts +45 -0
- package/lib/esm/src/types/resources/AllergyIntolerance.js +2 -0
- package/lib/esm/src/types/resources/Bundle.d.ts +22 -0
- package/lib/esm/src/types/resources/Bundle.js +2 -0
- package/lib/esm/src/types/resources/CarePlan.d.ts +47 -0
- package/lib/esm/src/types/resources/CarePlan.js +2 -0
- package/lib/esm/src/types/resources/ClinicalImpression.d.ts +45 -0
- package/lib/esm/src/types/resources/ClinicalImpression.js +2 -0
- package/lib/esm/src/types/resources/Composition.d.ts +39 -0
- package/lib/esm/src/types/resources/Composition.js +2 -0
- package/lib/esm/src/types/resources/Condition.d.ts +51 -0
- package/lib/esm/src/types/resources/Condition.js +2 -0
- package/lib/esm/src/types/resources/Consent.d.ts +38 -0
- package/lib/esm/src/types/resources/Consent.js +2 -0
- package/lib/esm/src/types/resources/Device.d.ts +53 -0
- package/lib/esm/src/types/resources/Device.js +2 -0
- package/lib/esm/src/types/resources/DeviceUseStatement.d.ts +38 -0
- package/lib/esm/src/types/resources/DeviceUseStatement.js +2 -0
- package/lib/esm/src/types/resources/DiagnosticReport.d.ts +43 -0
- package/lib/esm/src/types/resources/DiagnosticReport.js +2 -0
- package/lib/esm/src/types/resources/DomainResource.d.ts +16 -0
- package/lib/esm/src/types/resources/DomainResource.js +2 -0
- package/lib/esm/src/types/resources/FamilyMemberHistory.d.ts +53 -0
- package/lib/esm/src/types/resources/FamilyMemberHistory.js +2 -0
- package/lib/esm/src/types/resources/Immunization.d.ts +56 -0
- package/lib/esm/src/types/resources/Immunization.js +2 -0
- package/lib/esm/src/types/resources/Medication.d.ts +30 -0
- package/lib/esm/src/types/resources/Medication.js +2 -0
- package/lib/esm/src/types/resources/MedicationRequest.d.ts +59 -0
- package/lib/esm/src/types/resources/MedicationRequest.js +2 -0
- package/lib/esm/src/types/resources/MedicationStatement.d.ts +42 -0
- package/lib/esm/src/types/resources/MedicationStatement.js +2 -0
- package/lib/esm/src/types/resources/Observation.d.ts +69 -0
- package/lib/esm/src/types/resources/Observation.js +2 -0
- package/lib/esm/src/types/resources/Organization.d.ts +32 -0
- package/lib/esm/src/types/resources/Organization.js +2 -0
- package/lib/esm/src/types/resources/Patient.d.ts +47 -0
- package/lib/esm/src/types/resources/Patient.js +2 -0
- package/lib/esm/src/types/resources/Procedure.d.ts +59 -0
- package/lib/esm/src/types/resources/Procedure.js +2 -0
- package/lib/esm/src/types/simpleTypes/Base64Binary.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Base64Binary.js +1 -0
- package/lib/esm/src/types/simpleTypes/Canonical.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Canonical.js +1 -0
- package/lib/esm/src/types/simpleTypes/Date.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Date.js +1 -0
- package/lib/esm/src/types/simpleTypes/DateTime.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/DateTime.js +1 -0
- package/lib/esm/src/types/simpleTypes/Decimal.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Decimal.js +1 -0
- package/lib/esm/src/types/simpleTypes/Id.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Id.js +1 -0
- package/lib/esm/src/types/simpleTypes/Instant.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Instant.js +1 -0
- package/lib/esm/src/types/simpleTypes/Int.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Int.js +1 -0
- package/lib/esm/src/types/simpleTypes/Markdown.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Markdown.js +1 -0
- package/lib/esm/src/types/simpleTypes/Oid.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Oid.js +1 -0
- package/lib/esm/src/types/simpleTypes/ResourceContainer.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/ResourceContainer.js +1 -0
- package/lib/esm/src/types/simpleTypes/Time.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Time.js +1 -0
- package/lib/esm/src/types/simpleTypes/UnsignedInt.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/UnsignedInt.js +1 -0
- package/lib/esm/src/types/simpleTypes/Uri.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Uri.js +1 -0
- package/lib/esm/src/types/simpleTypes/Url.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Url.js +1 -0
- package/lib/esm/src/types/simpleTypes/Uuid.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Uuid.js +1 -0
- package/lib/esm/src/types/simpleTypes/Xhtml.d.ts +1 -0
- package/lib/esm/src/types/simpleTypes/Xhtml.js +1 -0
- package/lib/esm/test/fhir-summary-bundle/fhir-summary-bundle.test.d.ts +1 -0
- package/lib/esm/test/fhir-summary-bundle/fhir-summary-bundle.test.js +67 -0
- package/lib/esm/test/ips-test/ips.test.d.ts +1 -0
- package/lib/esm/test/ips-test/ips.test.js +387 -0
- package/lib/esm/test/narrativeGenerator/narrativeGenerator.test.d.ts +1 -0
- package/lib/esm/test/narrativeGenerator/narrativeGenerator.test.js +641 -0
- package/lib/esm/test/summary.test.d.ts +1 -0
- package/lib/esm/test/summary.test.js +450 -0
- package/lib/esm/test/utilities/testHelpers.d.ts +21 -0
- package/lib/esm/test/utilities/testHelpers.js +129 -0
- package/package.json +11 -3
- /package/lib/{src → cjs/src}/generators/fhir_summary_generator.d.ts +0 -0
- /package/lib/{src → cjs/src}/generators/fhir_summary_generator.js +0 -0
- /package/lib/{src → cjs/src}/generators/narrative_generator.d.ts +0 -0
- /package/lib/{src → cjs/src}/generators/narrative_generator.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/AdvanceDirectivesTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/AdvanceDirectivesTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/AllergyIntoleranceTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/AllergyIntoleranceTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/ClinicalImpressionTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/ClinicalImpressionTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/DiagnosticResultsTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/DiagnosticResultsTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/FamilyHistoryTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/FamilyHistoryTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/FunctionalStatusTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/FunctionalStatusTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/HistoryOfProceduresTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/HistoryOfProceduresTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/ImmunizationsTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/ImmunizationsTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicalDevicesTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicalDevicesTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicationSummaryTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicationSummaryTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PastHistoryOfIllnessTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PastHistoryOfIllnessTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PatientTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PatientTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PlanOfCareTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PlanOfCareTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PregnancyTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/PregnancyTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/ProblemListTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/ProblemListTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/SocialHistoryTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/SocialHistoryTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/TemplateUtilities.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/TemplateUtilities.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/TypeScriptTemplateMapper.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/TypeScriptTemplateMapper.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/VitalSignsTemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/VitalSignsTemplate.js +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/interfaces/ITemplate.d.ts +0 -0
- /package/lib/{src → cjs/src}/narratives/templates/typescript/interfaces/ITemplate.js +0 -0
- /package/lib/{src → cjs/src}/profiles/ips_resource_profile_registry.d.ts +0 -0
- /package/lib/{src → cjs/src}/profiles/ips_resource_profile_registry.js +0 -0
- /package/lib/{src → cjs/src}/structures/ips_mandatory_sections.d.ts +0 -0
- /package/lib/{src → cjs/src}/structures/ips_mandatory_sections.js +0 -0
- /package/lib/{src → cjs/src}/structures/ips_recommended_sections.d.ts +0 -0
- /package/lib/{src → cjs/src}/structures/ips_recommended_sections.js +0 -0
- /package/lib/{src → cjs/src}/structures/ips_resource_profile.d.ts +0 -0
- /package/lib/{src → cjs/src}/structures/ips_resource_profile.js +0 -0
- /package/lib/{src → cjs/src}/structures/ips_section_loinc_codes.d.ts +0 -0
- /package/lib/{src → cjs/src}/structures/ips_section_loinc_codes.js +0 -0
- /package/lib/{src → cjs/src}/structures/ips_section_resource_map.d.ts +0 -0
- /package/lib/{src → cjs/src}/structures/ips_section_resource_map.js +0 -0
- /package/lib/{src → cjs/src}/structures/ips_sections.d.ts +0 -0
- /package/lib/{src → cjs/src}/structures/ips_sections.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Address.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Address.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/AllergyIntoleranceReaction.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/AllergyIntoleranceReaction.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Annotation.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Annotation.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Attachment.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Attachment.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleEntry.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleEntry.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleLink.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleLink.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleRequest.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleRequest.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleResponse.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleResponse.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleSearch.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/BundleSearch.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CarePlanActivity.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CarePlanActivity.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CarePlanDetail.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CarePlanDetail.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionFinding.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionFinding.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionInvestigation.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionInvestigation.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CodeableConcept.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CodeableConcept.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CodeableReference.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CodeableReference.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Coding.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Coding.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionAttester.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionAttester.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionEvent.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionEvent.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionRelatesTo.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionRelatesTo.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionSection.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/CompositionSection.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConditionEvidence.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConditionEvidence.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConditionStage.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConditionStage.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentActor.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentActor.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentData.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentData.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentPolicy.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentPolicy.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentProvision.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentProvision.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentVerification.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ConsentVerification.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ContactDetail.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ContactDetail.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ContactPoint.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ContactPoint.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Contributor.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Contributor.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirement.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirement.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirementCodeFilter.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirementCodeFilter.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirementDateFilter.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirementDateFilter.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirementSort.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DataRequirementSort.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceDeviceName.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceDeviceName.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceProperty.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceProperty.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceSpecialization.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceSpecialization.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceUdiCarrier.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceUdiCarrier.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceVersion.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DeviceVersion.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DiagnosticReportMedia.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DiagnosticReportMedia.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Dosage.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Dosage.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/DosageDoseAndRate.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/DosageDoseAndRate.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Expression.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Expression.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Extension.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Extension.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/FamilyMemberHistoryCondition.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/FamilyMemberHistoryCondition.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/HumanName.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/HumanName.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Identifier.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Identifier.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationEducation.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationEducation.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationPerformer.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationPerformer.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationProtocolApplied.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationProtocolApplied.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationReaction.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ImmunizationReaction.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationBatch.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationBatch.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationIngredient.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationIngredient.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationRequestDispenseRequest.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationRequestDispenseRequest.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationRequestInitialFill.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationRequestInitialFill.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationRequestSubstitution.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/MedicationRequestSubstitution.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Meta.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Meta.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Money.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Money.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Narrative.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Narrative.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ObservationComponent.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ObservationComponent.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ObservationReferenceRange.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ObservationReferenceRange.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/OrganizationContact.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/OrganizationContact.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ParameterDefinition.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ParameterDefinition.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/PatientCommunication.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/PatientCommunication.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/PatientContact.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/PatientContact.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/PatientLink.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/PatientLink.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Period.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Period.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ProcedureFocalDevice.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ProcedureFocalDevice.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/ProcedurePerformer.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/ProcedurePerformer.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Quantity.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Quantity.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Range.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Range.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Ratio.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Ratio.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/RatioRange.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/RatioRange.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Reference.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Reference.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/RelatedArtifact.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/RelatedArtifact.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/SampledData.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/SampledData.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Signature.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Signature.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/Timing.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/Timing.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/TimingRepeat.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/TimingRepeat.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/TriggerDefinition.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/TriggerDefinition.js +0 -0
- /package/lib/{src → cjs/src}/types/partials/UsageContext.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/partials/UsageContext.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/AllergyIntolerance.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/AllergyIntolerance.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Bundle.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Bundle.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/CarePlan.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/CarePlan.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/ClinicalImpression.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/ClinicalImpression.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Composition.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Composition.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Condition.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Condition.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Consent.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Consent.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Device.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Device.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/DeviceUseStatement.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/DeviceUseStatement.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/DiagnosticReport.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/DiagnosticReport.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/DomainResource.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/DomainResource.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/FamilyMemberHistory.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/FamilyMemberHistory.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Immunization.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Immunization.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Medication.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Medication.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/MedicationRequest.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/MedicationRequest.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/MedicationStatement.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/MedicationStatement.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Observation.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Observation.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Organization.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Organization.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Patient.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Patient.js +0 -0
- /package/lib/{src → cjs/src}/types/resources/Procedure.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/resources/Procedure.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Base64Binary.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Base64Binary.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Canonical.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Canonical.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Date.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Date.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/DateTime.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/DateTime.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Decimal.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Decimal.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Id.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Id.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Instant.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Instant.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Int.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Int.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Markdown.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Markdown.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Oid.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Oid.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/ResourceContainer.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/ResourceContainer.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Time.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Time.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/UnsignedInt.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/UnsignedInt.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Uri.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Uri.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Url.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Url.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Uuid.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Uuid.js +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Xhtml.d.ts +0 -0
- /package/lib/{src → cjs/src}/types/simpleTypes/Xhtml.js +0 -0
- /package/lib/{test → cjs/test}/fhir-summary-bundle/fhir-summary-bundle.test.d.ts +0 -0
- /package/lib/{test → cjs/test}/fhir-summary-bundle/fhir-summary-bundle.test.js +0 -0
- /package/lib/{test → cjs/test}/ips-test/ips.test.d.ts +0 -0
- /package/lib/{test → cjs/test}/ips-test/ips.test.js +0 -0
- /package/lib/{test → cjs/test}/narrativeGenerator/narrativeGenerator.test.d.ts +0 -0
- /package/lib/{test → cjs/test}/narrativeGenerator/narrativeGenerator.test.js +0 -0
- /package/lib/{test → cjs/test}/summary.test.d.ts +0 -0
- /package/lib/{test → cjs/test}/summary.test.js +0 -0
- /package/lib/{test → cjs/test}/utilities/testHelpers.d.ts +0 -0
- /package/lib/{test → cjs/test}/utilities/testHelpers.js +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TPatient } from "../types/resources/Patient";
|
|
2
|
+
import { TCompositionSection } from "../types/partials/CompositionSection";
|
|
3
|
+
import { TDomainResource } from "../types/resources/DomainResource";
|
|
4
|
+
import { IPSSections } from "../structures/ips_sections";
|
|
5
|
+
import { TBundle } from "../types/resources/Bundle";
|
|
6
|
+
export declare class ComprehensiveIPSCompositionBuilder {
|
|
7
|
+
private patient;
|
|
8
|
+
private sections;
|
|
9
|
+
private mandatorySectionsAdded;
|
|
10
|
+
private resources;
|
|
11
|
+
/**
|
|
12
|
+
* sets the patient resource for the IPS Composition.
|
|
13
|
+
* This is not needed if you are calling read_bundle, but can be used to set the patient resource directly.
|
|
14
|
+
* @param patient - FHIR Patient resource to set
|
|
15
|
+
*/
|
|
16
|
+
setPatient(patient: TPatient): this;
|
|
17
|
+
addSection<T extends TDomainResource>(sectionType: IPSSections, resources: T[], timezone: string | undefined, options?: {
|
|
18
|
+
isOptional?: boolean;
|
|
19
|
+
customLoincCode?: string;
|
|
20
|
+
}): this;
|
|
21
|
+
/**
|
|
22
|
+
* Reads a FHIR Bundle and extracts resources for each section defined in IPSSections.
|
|
23
|
+
* @param bundle - FHIR Bundle containing resources
|
|
24
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
25
|
+
*/
|
|
26
|
+
read_bundle(bundle: TBundle, timezone: string | undefined): this;
|
|
27
|
+
/**
|
|
28
|
+
* Builds the final Composition sections, ensuring all mandatory sections are present.
|
|
29
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
30
|
+
*/
|
|
31
|
+
build(timezone: string | undefined): TCompositionSection[];
|
|
32
|
+
/**
|
|
33
|
+
* Builds a complete FHIR Bundle containing the Composition and all resources.
|
|
34
|
+
* @param authorOrganizationId - ID of the authoring organization (e.g., hospital or clinic)
|
|
35
|
+
* @param authorOrganizationName - Name of the authoring organization
|
|
36
|
+
* @param baseUrl - Base URL for the FHIR server (e.g., 'https://example.com/fhir')
|
|
37
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
38
|
+
*/
|
|
39
|
+
build_bundle(authorOrganizationId: string, authorOrganizationName: string, baseUrl: string, timezone: string | undefined): TBundle;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a narrative for the composition based on the patient and sections.
|
|
42
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private createCompositionNarrative;
|
|
46
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { IPSSections } from "../structures/ips_sections";
|
|
2
|
+
import { IPS_SECTION_DISPLAY_NAMES, IPS_SECTION_LOINC_CODES } from "../structures/ips_section_loinc_codes";
|
|
3
|
+
import { IPSSectionResourceHelper } from "../structures/ips_section_resource_map";
|
|
4
|
+
import { NarrativeGenerator } from "./narrative_generator";
|
|
5
|
+
export class ComprehensiveIPSCompositionBuilder {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.sections = [];
|
|
8
|
+
this.mandatorySectionsAdded = new Set();
|
|
9
|
+
this.resources = new Set();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* sets the patient resource for the IPS Composition.
|
|
13
|
+
* This is not needed if you are calling read_bundle, but can be used to set the patient resource directly.
|
|
14
|
+
* @param patient - FHIR Patient resource to set
|
|
15
|
+
*/
|
|
16
|
+
setPatient(patient) {
|
|
17
|
+
if (!patient || patient.resourceType !== 'Patient') {
|
|
18
|
+
throw new Error('Invalid Patient resource');
|
|
19
|
+
}
|
|
20
|
+
this.patient = patient;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
// Comprehensive method to add sections with validation
|
|
24
|
+
addSection(sectionType, resources, timezone, options) {
|
|
25
|
+
// Validate resources
|
|
26
|
+
const validResources = resources;
|
|
27
|
+
for (const resource of validResources) {
|
|
28
|
+
// Add resource to the internal set
|
|
29
|
+
this.resources.add(resource);
|
|
30
|
+
}
|
|
31
|
+
// Skip if no valid resources and not mandatory
|
|
32
|
+
if (validResources.length === 0) {
|
|
33
|
+
if (!(options === null || options === void 0 ? void 0 : options.isOptional)) {
|
|
34
|
+
throw new Error(`No valid resources for mandatory section: ${sectionType}`);
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
// Patient resource does not get a section, it is handled separately
|
|
39
|
+
if (sectionType !== IPSSections.PATIENT) {
|
|
40
|
+
// Create section entry
|
|
41
|
+
const narrative = NarrativeGenerator.generateNarrative(sectionType, validResources, timezone);
|
|
42
|
+
const sectionEntry = {
|
|
43
|
+
title: IPS_SECTION_DISPLAY_NAMES[sectionType] || sectionType,
|
|
44
|
+
code: {
|
|
45
|
+
coding: [{
|
|
46
|
+
system: 'http://loinc.org',
|
|
47
|
+
code: (options === null || options === void 0 ? void 0 : options.customLoincCode) || IPS_SECTION_LOINC_CODES[sectionType],
|
|
48
|
+
display: IPS_SECTION_DISPLAY_NAMES[sectionType] || sectionType
|
|
49
|
+
}],
|
|
50
|
+
text: IPS_SECTION_DISPLAY_NAMES[sectionType] || sectionType
|
|
51
|
+
},
|
|
52
|
+
text: narrative,
|
|
53
|
+
entry: validResources.map(resource => ({
|
|
54
|
+
reference: `${resource.resourceType}/${resource.id}`,
|
|
55
|
+
display: resource.resourceType
|
|
56
|
+
}))
|
|
57
|
+
};
|
|
58
|
+
// Track mandatory sections
|
|
59
|
+
if (!(options === null || options === void 0 ? void 0 : options.isOptional)) {
|
|
60
|
+
this.mandatorySectionsAdded.add(sectionType);
|
|
61
|
+
}
|
|
62
|
+
this.sections.push(sectionEntry);
|
|
63
|
+
}
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Reads a FHIR Bundle and extracts resources for each section defined in IPSSections.
|
|
68
|
+
* @param bundle - FHIR Bundle containing resources
|
|
69
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
70
|
+
*/
|
|
71
|
+
read_bundle(bundle, timezone) {
|
|
72
|
+
if (!bundle.entry) {
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
// find the patient resource in the bundle
|
|
76
|
+
const patientEntry = bundle.entry.find(e => { var _a; return ((_a = e.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'Patient'; });
|
|
77
|
+
if (!patientEntry || !patientEntry.resource) {
|
|
78
|
+
throw new Error('Patient resource not found in the bundle');
|
|
79
|
+
}
|
|
80
|
+
this.patient = patientEntry.resource;
|
|
81
|
+
// find resources for each section in IPSSections and add the section
|
|
82
|
+
for (const sectionType of Object.values(IPSSections)) {
|
|
83
|
+
const resourceTypesForSection = IPSSectionResourceHelper.getResourceTypesForSection(sectionType);
|
|
84
|
+
const customFilter = IPSSectionResourceHelper.getResourceFilterForSection(sectionType);
|
|
85
|
+
let resources = bundle.entry
|
|
86
|
+
.map(e => e.resource)
|
|
87
|
+
.filter(r => typeof (r === null || r === void 0 ? void 0 : r.resourceType) === 'string' && resourceTypesForSection.includes(r.resourceType));
|
|
88
|
+
if (customFilter) {
|
|
89
|
+
resources = resources.filter(customFilter);
|
|
90
|
+
}
|
|
91
|
+
if (resources.length > 0) {
|
|
92
|
+
this.addSection(sectionType, resources, timezone, { isOptional: true });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Builds the final Composition sections, ensuring all mandatory sections are present.
|
|
99
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
100
|
+
*/
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
102
|
+
build(timezone) {
|
|
103
|
+
// Ensure all mandatory sections are present
|
|
104
|
+
const mandatorySections = [
|
|
105
|
+
IPSSections.ALLERGIES,
|
|
106
|
+
IPSSections.MEDICATIONS,
|
|
107
|
+
IPSSections.PROBLEMS,
|
|
108
|
+
IPSSections.IMMUNIZATIONS
|
|
109
|
+
];
|
|
110
|
+
const missingMandatorySections = mandatorySections.filter(section => !this.mandatorySectionsAdded.has(section));
|
|
111
|
+
if (missingMandatorySections.length > 0) {
|
|
112
|
+
throw new Error(`Missing mandatory IPS sections: ${missingMandatorySections.join(', ')}`);
|
|
113
|
+
}
|
|
114
|
+
return this.sections;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Builds a complete FHIR Bundle containing the Composition and all resources.
|
|
118
|
+
* @param authorOrganizationId - ID of the authoring organization (e.g., hospital or clinic)
|
|
119
|
+
* @param authorOrganizationName - Name of the authoring organization
|
|
120
|
+
* @param baseUrl - Base URL for the FHIR server (e.g., 'https://example.com/fhir')
|
|
121
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
122
|
+
*/
|
|
123
|
+
build_bundle(authorOrganizationId, authorOrganizationName, baseUrl, timezone) {
|
|
124
|
+
var _a, _b, _c;
|
|
125
|
+
if (baseUrl.endsWith('/')) {
|
|
126
|
+
baseUrl = baseUrl.slice(0, -1); // Remove trailing slash if present
|
|
127
|
+
}
|
|
128
|
+
if (!this.patient) {
|
|
129
|
+
throw new Error('Patient resource must be set before building the bundle');
|
|
130
|
+
}
|
|
131
|
+
// Create the Composition resource
|
|
132
|
+
const composition = {
|
|
133
|
+
id: `Composition-${this.patient.id}`,
|
|
134
|
+
resourceType: 'Composition',
|
|
135
|
+
status: 'final',
|
|
136
|
+
type: {
|
|
137
|
+
coding: [{
|
|
138
|
+
system: 'http://loinc.org',
|
|
139
|
+
code: '60591-5',
|
|
140
|
+
display: 'Patient summary Document'
|
|
141
|
+
}]
|
|
142
|
+
},
|
|
143
|
+
subject: {
|
|
144
|
+
reference: `Patient/${this.patient.id}`
|
|
145
|
+
},
|
|
146
|
+
author: [{
|
|
147
|
+
reference: `Organization/${authorOrganizationId}`, // Assuming patient is also a practitioner for simplicity
|
|
148
|
+
display: authorOrganizationName
|
|
149
|
+
}],
|
|
150
|
+
date: new Date().toISOString(),
|
|
151
|
+
title: 'International Patient Summary',
|
|
152
|
+
section: this.sections,
|
|
153
|
+
text: this.createCompositionNarrative(timezone)
|
|
154
|
+
};
|
|
155
|
+
// Create the bundle with proper document type
|
|
156
|
+
const bundle = {
|
|
157
|
+
resourceType: 'Bundle',
|
|
158
|
+
type: 'document',
|
|
159
|
+
timestamp: new Date().toISOString(),
|
|
160
|
+
identifier: {
|
|
161
|
+
"system": "urn:ietf:rfc:3986",
|
|
162
|
+
"value": "urn:uuid:4dcfd353-49fd-4ab0-b521-c8d57ced74d6"
|
|
163
|
+
},
|
|
164
|
+
entry: []
|
|
165
|
+
};
|
|
166
|
+
// Add Composition as first entry
|
|
167
|
+
(_a = bundle.entry) === null || _a === void 0 ? void 0 : _a.push({
|
|
168
|
+
fullUrl: `${baseUrl}/Composition/${composition.id}`,
|
|
169
|
+
resource: composition
|
|
170
|
+
});
|
|
171
|
+
// Add patient as second entry
|
|
172
|
+
(_b = bundle.entry) === null || _b === void 0 ? void 0 : _b.push({
|
|
173
|
+
fullUrl: `${baseUrl}/Patient/${this.patient.id}`,
|
|
174
|
+
resource: this.patient
|
|
175
|
+
});
|
|
176
|
+
// Extract and add all resources referenced in sections
|
|
177
|
+
this.resources.forEach(resource => {
|
|
178
|
+
var _a;
|
|
179
|
+
if (resource.resourceType !== "Patient") {
|
|
180
|
+
(_a = bundle.entry) === null || _a === void 0 ? void 0 : _a.push({
|
|
181
|
+
fullUrl: `${baseUrl}/${resource.resourceType}/${resource.id}`,
|
|
182
|
+
resource: resource
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
// add a bundle entry for Organization
|
|
187
|
+
(_c = bundle.entry) === null || _c === void 0 ? void 0 : _c.push({
|
|
188
|
+
fullUrl: `${baseUrl}/Organization/${authorOrganizationId}`,
|
|
189
|
+
resource: {
|
|
190
|
+
resourceType: 'Organization',
|
|
191
|
+
id: authorOrganizationId,
|
|
192
|
+
name: authorOrganizationName
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return bundle;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Creates a narrative for the composition based on the patient and sections.
|
|
199
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
createCompositionNarrative(timezone) {
|
|
203
|
+
const patient = this.patient;
|
|
204
|
+
let fullNarrativeContent = "";
|
|
205
|
+
// generate narrative for the patient
|
|
206
|
+
const patientNarrative = NarrativeGenerator.generateNarrativeContent(IPSSections.PATIENT, [patient], timezone);
|
|
207
|
+
fullNarrativeContent = fullNarrativeContent.concat(patientNarrative || '');
|
|
208
|
+
// now generate narrative for the sections and add to this narrative
|
|
209
|
+
for (const sectionType of Object.values(IPSSections)) {
|
|
210
|
+
const resourceTypesForSection = IPSSectionResourceHelper.getResourceTypesForSection(sectionType);
|
|
211
|
+
const allResources = Array.from(this.resources);
|
|
212
|
+
const resources = allResources
|
|
213
|
+
.filter(r => resourceTypesForSection.includes(r.resourceType));
|
|
214
|
+
if (resources.length > 0) {
|
|
215
|
+
const sectionNarrative = NarrativeGenerator.generateNarrativeContent(sectionType, resources, timezone);
|
|
216
|
+
fullNarrativeContent = fullNarrativeContent.concat(sectionNarrative || '');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
status: 'generated',
|
|
221
|
+
div: NarrativeGenerator.wrapInXhtml(fullNarrativeContent)
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TDomainResource } from "../types/resources/DomainResource";
|
|
2
|
+
import { IPSSections } from "../structures/ips_sections";
|
|
3
|
+
export interface Narrative {
|
|
4
|
+
status: 'generated' | 'extensions' | 'additional' | 'empty';
|
|
5
|
+
div: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Generates narrative content for FHIR resources using TypeScript templates
|
|
9
|
+
* Replaces the Nunjucks-based narrative generator
|
|
10
|
+
*/
|
|
11
|
+
export declare class NarrativeGenerator {
|
|
12
|
+
/**
|
|
13
|
+
* Generates narrative HTML content for a section
|
|
14
|
+
* @param section - IPS section type
|
|
15
|
+
* @param resources - Array of domain resources
|
|
16
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
17
|
+
* @returns Generated HTML content or undefined if no resources
|
|
18
|
+
*/
|
|
19
|
+
static generateNarrativeContent<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a complete FHIR Narrative object
|
|
22
|
+
* @param content - HTML content
|
|
23
|
+
* @returns FHIR Narrative object
|
|
24
|
+
*/
|
|
25
|
+
static createNarrative(content: string): Narrative;
|
|
26
|
+
/**
|
|
27
|
+
* Generates a complete FHIR Narrative object for a section
|
|
28
|
+
* @param section - IPS section type
|
|
29
|
+
* @param resources - Array of domain resources
|
|
30
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
31
|
+
* @returns FHIR Narrative object or undefined if no resources
|
|
32
|
+
*/
|
|
33
|
+
static generateNarrative<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined): Narrative | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Wrap content in XHTML div with FHIR namespace
|
|
36
|
+
* @param content - HTML content to wrap
|
|
37
|
+
* @returns XHTML div string
|
|
38
|
+
*/
|
|
39
|
+
static wrapInXhtml(content: string): string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// TypeScriptNarrativeGenerator.ts - TypeScript replacement for narrative_generator.ts using TypeScript templates
|
|
2
|
+
import { TypeScriptTemplateMapper } from "../narratives/templates/typescript/TypeScriptTemplateMapper";
|
|
3
|
+
/**
|
|
4
|
+
* Generates narrative content for FHIR resources using TypeScript templates
|
|
5
|
+
* Replaces the Nunjucks-based narrative generator
|
|
6
|
+
*/
|
|
7
|
+
export class NarrativeGenerator {
|
|
8
|
+
/**
|
|
9
|
+
* Generates narrative HTML content for a section
|
|
10
|
+
* @param section - IPS section type
|
|
11
|
+
* @param resources - Array of domain resources
|
|
12
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
13
|
+
* @returns Generated HTML content or undefined if no resources
|
|
14
|
+
*/
|
|
15
|
+
static generateNarrativeContent(section, resources, timezone) {
|
|
16
|
+
if (!resources || resources.length === 0) {
|
|
17
|
+
return undefined; // No resources to generate narrative
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
// Create a bundle-like structure for the template
|
|
21
|
+
const bundle = {
|
|
22
|
+
resourceType: 'Bundle',
|
|
23
|
+
type: 'collection',
|
|
24
|
+
entry: resources.map(resource => ({
|
|
25
|
+
resource
|
|
26
|
+
}))
|
|
27
|
+
};
|
|
28
|
+
// Use the TypeScript template mapper to generate HTML
|
|
29
|
+
return TypeScriptTemplateMapper.generateNarrative(section, bundle, timezone);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error(`Error generating narrative for section ${section}:`, error);
|
|
33
|
+
return `<div class="error">Error generating narrative: ${error instanceof Error ? error.message : String(error)}</div>`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a complete FHIR Narrative object
|
|
38
|
+
* @param content - HTML content
|
|
39
|
+
* @returns FHIR Narrative object
|
|
40
|
+
*/
|
|
41
|
+
static createNarrative(content) {
|
|
42
|
+
// remove extra whitespace and newlines
|
|
43
|
+
content = content.replace(/\s+/g, ' ').trim();
|
|
44
|
+
// Strip outer <div> wrappers if present
|
|
45
|
+
const divMatch = content.match(/^<div[^>]*>(.*?)<\/div>$/);
|
|
46
|
+
if (divMatch) {
|
|
47
|
+
content = divMatch[1]; // Extract inner content
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
status: 'generated',
|
|
51
|
+
div: `<div xmlns="http://www.w3.org/1999/xhtml">${content}</div>`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generates a complete FHIR Narrative object for a section
|
|
56
|
+
* @param section - IPS section type
|
|
57
|
+
* @param resources - Array of domain resources
|
|
58
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
59
|
+
* @returns FHIR Narrative object or undefined if no resources
|
|
60
|
+
*/
|
|
61
|
+
static generateNarrative(section, resources, timezone) {
|
|
62
|
+
const content = this.generateNarrativeContent(section, resources, timezone);
|
|
63
|
+
if (!content) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return this.createNarrative(content);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Wrap content in XHTML div with FHIR namespace
|
|
70
|
+
* @param content - HTML content to wrap
|
|
71
|
+
* @returns XHTML div string
|
|
72
|
+
*/
|
|
73
|
+
static wrapInXhtml(content) {
|
|
74
|
+
return `<div xmlns="http://www.w3.org/1999/xhtml">${content}</div>`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TBundle } from '../../../types/resources/Bundle';
|
|
2
|
+
import { ITemplate } from './interfaces/ITemplate';
|
|
3
|
+
/**
|
|
4
|
+
* Class to generate HTML narrative for Advance Directives (Consent resources)
|
|
5
|
+
* This replaces the Jinja2 advancedirectives.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export declare class AdvanceDirectivesTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Advance Directives
|
|
10
|
+
* @param resource - FHIR Bundle containing Advance Directive resources
|
|
11
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
12
|
+
* @returns HTML string for rendering
|
|
13
|
+
*/
|
|
14
|
+
generateNarrative(resource: TBundle, timezone: string | undefined): string;
|
|
15
|
+
/**
|
|
16
|
+
* Internal static implementation that actually generates the narrative
|
|
17
|
+
* @param resource - FHIR Bundle containing Advance Directive resources
|
|
18
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
19
|
+
* @returns HTML string for rendering
|
|
20
|
+
*/
|
|
21
|
+
private static generateStaticNarrative;
|
|
22
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// AdvanceDirectivesTemplate.ts - TypeScript replacement for Jinja2 advancedirectives.j2
|
|
2
|
+
import { TemplateUtilities } from './TemplateUtilities';
|
|
3
|
+
/**
|
|
4
|
+
* Class to generate HTML narrative for Advance Directives (Consent resources)
|
|
5
|
+
* This replaces the Jinja2 advancedirectives.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export class AdvanceDirectivesTemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Advance Directives
|
|
10
|
+
* @param resource - FHIR Bundle containing Advance Directive resources
|
|
11
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
12
|
+
* @returns HTML string for rendering
|
|
13
|
+
*/
|
|
14
|
+
generateNarrative(resource, timezone) {
|
|
15
|
+
return AdvanceDirectivesTemplate.generateStaticNarrative(resource, timezone);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Internal static implementation that actually generates the narrative
|
|
19
|
+
* @param resource - FHIR Bundle containing Advance Directive resources
|
|
20
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
21
|
+
* @returns HTML string for rendering
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
static generateStaticNarrative(resource, timezone) {
|
|
25
|
+
var _a;
|
|
26
|
+
const templateUtilities = new TemplateUtilities(resource);
|
|
27
|
+
// Start building the HTML table
|
|
28
|
+
let html = `
|
|
29
|
+
<h5>Advance Directives</h5>
|
|
30
|
+
<table class="hapiPropertyTable">
|
|
31
|
+
<thead>
|
|
32
|
+
<tr>
|
|
33
|
+
<th>Scope</th>
|
|
34
|
+
<th>Status</th>
|
|
35
|
+
<th>Action Controlled</th>
|
|
36
|
+
<th>Date</th>
|
|
37
|
+
</tr>
|
|
38
|
+
</thead>
|
|
39
|
+
<tbody>`;
|
|
40
|
+
// Check if we have entries in the bundle
|
|
41
|
+
if (resource.entry && Array.isArray(resource.entry)) {
|
|
42
|
+
// Loop through entries in the bundle
|
|
43
|
+
for (const entry of resource.entry) {
|
|
44
|
+
const consent = entry.resource;
|
|
45
|
+
// Skip Composition resources
|
|
46
|
+
if (consent.resourceType === 'Composition') {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// Use the enhanced narrativeLinkId utility function to extract the ID
|
|
50
|
+
// Add a table row for this consent
|
|
51
|
+
html += `
|
|
52
|
+
<tr id="${(templateUtilities.narrativeLinkId(consent))}">
|
|
53
|
+
<td>${templateUtilities.codeableConcept(consent.scope, 'display')}</td>
|
|
54
|
+
<td>${consent.status || ''}</td>
|
|
55
|
+
<td>${((_a = consent.provision) === null || _a === void 0 ? void 0 : _a.action) ? templateUtilities.concatCodeableConcept(consent.provision.action) : ''}</td>
|
|
56
|
+
<td>${consent.dateTime || ''}</td>
|
|
57
|
+
</tr>`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Close the HTML table
|
|
61
|
+
html += `
|
|
62
|
+
</tbody>
|
|
63
|
+
</table>`;
|
|
64
|
+
return html;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TBundle } from '../../../types/resources/Bundle';
|
|
2
|
+
import { ITemplate } from './interfaces/ITemplate';
|
|
3
|
+
/**
|
|
4
|
+
* Class to generate HTML narrative for AllergyIntolerance resources
|
|
5
|
+
* This replaces the Jinja2 allergyintolerance.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export declare class AllergyIntoleranceTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for AllergyIntolerance resources
|
|
10
|
+
* @param resource - FHIR Bundle containing AllergyIntolerance resources
|
|
11
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
12
|
+
* @returns HTML string for rendering
|
|
13
|
+
*/
|
|
14
|
+
generateNarrative(resource: TBundle, timezone: string | undefined): string;
|
|
15
|
+
/**
|
|
16
|
+
* Internal static implementation that actually generates the narrative
|
|
17
|
+
* @param resource - FHIR Bundle containing AllergyIntolerance resources
|
|
18
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
19
|
+
* @returns HTML string for rendering
|
|
20
|
+
*/
|
|
21
|
+
private static generateStaticNarrative;
|
|
22
|
+
/**
|
|
23
|
+
* Helper method to generate HTML table rows for allergies
|
|
24
|
+
* @param allergies - Array of allergy resources to process
|
|
25
|
+
* @param templateUtilities - Utilities for formatting
|
|
26
|
+
* @param includeResolved - Whether to include resolved date column
|
|
27
|
+
* @param timezone - Optional timezone to use for date formatting
|
|
28
|
+
* @returns HTML string with table rows
|
|
29
|
+
*/
|
|
30
|
+
private static generateAllergyRows;
|
|
31
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// AllergyIntoleranceTemplate.ts - TypeScript replacement for Jinja2 allergyintolerance.j2
|
|
2
|
+
import { TemplateUtilities } from './TemplateUtilities';
|
|
3
|
+
/**
|
|
4
|
+
* Class to generate HTML narrative for AllergyIntolerance resources
|
|
5
|
+
* This replaces the Jinja2 allergyintolerance.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export class AllergyIntoleranceTemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for AllergyIntolerance resources
|
|
10
|
+
* @param resource - FHIR Bundle containing AllergyIntolerance resources
|
|
11
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
12
|
+
* @returns HTML string for rendering
|
|
13
|
+
*/
|
|
14
|
+
generateNarrative(resource, timezone) {
|
|
15
|
+
return AllergyIntoleranceTemplate.generateStaticNarrative(resource, timezone);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Internal static implementation that actually generates the narrative
|
|
19
|
+
* @param resource - FHIR Bundle containing AllergyIntolerance resources
|
|
20
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
21
|
+
* @returns HTML string for rendering
|
|
22
|
+
*/
|
|
23
|
+
static generateStaticNarrative(resource, timezone) {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
const templateUtilities = new TemplateUtilities(resource);
|
|
26
|
+
// Group allergies by status (active vs resolved/inactive)
|
|
27
|
+
const activeAllergies = [];
|
|
28
|
+
const resolvedAllergies = [];
|
|
29
|
+
if (resource.entry && Array.isArray(resource.entry)) {
|
|
30
|
+
for (const entry of resource.entry) {
|
|
31
|
+
const allergy = entry.resource;
|
|
32
|
+
// Check clinical status to determine if active or resolved
|
|
33
|
+
const status = ((_c = (_b = (_a = allergy.clinicalStatus) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) || '';
|
|
34
|
+
if (status === 'inactive' || status === 'resolved') {
|
|
35
|
+
resolvedAllergies.push(allergy);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
activeAllergies.push(allergy);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Start building the HTML with proper XHTML namespace
|
|
43
|
+
let html = `<div xmlns="http://www.w3.org/1999/xhtml">`;
|
|
44
|
+
// Active Allergies section
|
|
45
|
+
html += `
|
|
46
|
+
<div class="ActiveAllergies">
|
|
47
|
+
<h3>Active Allergies and Intolerances</h3>
|
|
48
|
+
<table class="ActiveAllergyTable">
|
|
49
|
+
<thead>
|
|
50
|
+
<tr>
|
|
51
|
+
<th>Allergen</th>
|
|
52
|
+
<th>Status</th>
|
|
53
|
+
<th>Category</th>
|
|
54
|
+
<th>Reaction</th>
|
|
55
|
+
<th>Severity</th>
|
|
56
|
+
<th>Onset Date</th>
|
|
57
|
+
<th>Comments</th>
|
|
58
|
+
</tr>
|
|
59
|
+
</thead>
|
|
60
|
+
<tbody>`;
|
|
61
|
+
// Process active allergies
|
|
62
|
+
if (activeAllergies.length > 0) {
|
|
63
|
+
html += this.generateAllergyRows(activeAllergies, templateUtilities, timezone);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
html += `
|
|
67
|
+
<tr>
|
|
68
|
+
<td colspan="7">No active allergies recorded</td>
|
|
69
|
+
</tr>`;
|
|
70
|
+
}
|
|
71
|
+
// Close the active allergies table
|
|
72
|
+
html += `
|
|
73
|
+
</tbody>
|
|
74
|
+
</table>
|
|
75
|
+
</div>`;
|
|
76
|
+
// Resolved Allergies section
|
|
77
|
+
html += `
|
|
78
|
+
<div class="ResolvedAllergies">
|
|
79
|
+
<h3>Resolved Allergies and Intolerances</h3>
|
|
80
|
+
<table class="ResolvedAllergyTable">
|
|
81
|
+
<thead>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Allergen</th>
|
|
84
|
+
<th>Status</th>
|
|
85
|
+
<th>Category</th>
|
|
86
|
+
<th>Reaction</th>
|
|
87
|
+
<th>Severity</th>
|
|
88
|
+
<th>Onset Date</th>
|
|
89
|
+
<th>Comments</th>
|
|
90
|
+
<th>Resolved Date</th>
|
|
91
|
+
</tr>
|
|
92
|
+
</thead>
|
|
93
|
+
<tbody>`;
|
|
94
|
+
// Process resolved allergies
|
|
95
|
+
if (resolvedAllergies.length > 0) {
|
|
96
|
+
html += this.generateAllergyRows(resolvedAllergies, templateUtilities, timezone, true);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
html += `
|
|
100
|
+
<tr>
|
|
101
|
+
<td colspan="8">No resolved allergies recorded</td>
|
|
102
|
+
</tr>`;
|
|
103
|
+
}
|
|
104
|
+
// Close the resolved allergies table
|
|
105
|
+
html += `
|
|
106
|
+
</tbody>
|
|
107
|
+
</table>
|
|
108
|
+
</div>
|
|
109
|
+
</div>`;
|
|
110
|
+
return html;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Helper method to generate HTML table rows for allergies
|
|
114
|
+
* @param allergies - Array of allergy resources to process
|
|
115
|
+
* @param templateUtilities - Utilities for formatting
|
|
116
|
+
* @param includeResolved - Whether to include resolved date column
|
|
117
|
+
* @param timezone - Optional timezone to use for date formatting
|
|
118
|
+
* @returns HTML string with table rows
|
|
119
|
+
*/
|
|
120
|
+
static generateAllergyRows(allergies, templateUtilities, timezone, includeResolved = false) {
|
|
121
|
+
let html = '';
|
|
122
|
+
for (const allergy of allergies) {
|
|
123
|
+
// Find the narrative link extension if it exists
|
|
124
|
+
// Add a table row for this allergy with appropriate classes
|
|
125
|
+
html += `
|
|
126
|
+
<tr id="${(templateUtilities.narrativeLinkId(allergy.extension))}">
|
|
127
|
+
<td class="Name"><span class="AllergenName">${templateUtilities.codeableConcept(allergy.code)}</span></td>
|
|
128
|
+
<td class="Status">${templateUtilities.codeableConcept(allergy.clinicalStatus) || '-'}</td>
|
|
129
|
+
<td class="Category">${templateUtilities.safeConcat(allergy.category, 'value') || '-'}</td>
|
|
130
|
+
<td class="Reaction">${templateUtilities.concatReactionManifestation(allergy.reaction) || '-'}</td>
|
|
131
|
+
<td class="Severity">${templateUtilities.safeConcat(allergy.reaction, 'severity') || '-'}</td>
|
|
132
|
+
<td class="OnsetDate">${templateUtilities.renderTime(allergy.onsetDateTime, timezone) || '-'}</td>
|
|
133
|
+
<td class="Comments">${templateUtilities.renderNotes(allergy.note, timezone, { styled: true, warning: true })}</td>`;
|
|
134
|
+
// Add resolved date column for resolved allergies
|
|
135
|
+
if (includeResolved) {
|
|
136
|
+
// Try to find end date from extension or use '-' if not found
|
|
137
|
+
let endDate = '-';
|
|
138
|
+
if (allergy.extension && Array.isArray(allergy.extension)) {
|
|
139
|
+
const endDateExt = allergy.extension.find(ext => ext.url === 'http://hl7.org/fhir/StructureDefinition/allergyintolerance-resolutionDate');
|
|
140
|
+
if (endDateExt && endDateExt.valueDateTime) {
|
|
141
|
+
endDate = templateUtilities.renderDate(endDateExt.valueDateTime);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
html += `
|
|
145
|
+
<td class="ResolvedDate">${endDate}</td>`;
|
|
146
|
+
}
|
|
147
|
+
html += `</tr>`;
|
|
148
|
+
}
|
|
149
|
+
return html;
|
|
150
|
+
}
|
|
151
|
+
}
|