@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,692 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
/**
|
|
3
|
+
* Utility class containing methods for formatting and rendering FHIR resources
|
|
4
|
+
* This replaces the Jinja2 utility-fragments.j2 macros
|
|
5
|
+
*/
|
|
6
|
+
export class TemplateUtilities {
|
|
7
|
+
/**
|
|
8
|
+
* Constructor to initialize the TemplateUtilities with a FHIR Bundle
|
|
9
|
+
* @param bundle - FHIR Bundle containing resources
|
|
10
|
+
*/
|
|
11
|
+
constructor(bundle) {
|
|
12
|
+
this.bundle = bundle;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Formats a CodeableConcept object
|
|
16
|
+
* @param cc - The CodeableConcept object
|
|
17
|
+
* @param field - Optional specific field to return
|
|
18
|
+
* @returns Formatted string representation
|
|
19
|
+
*/
|
|
20
|
+
codeableConcept(cc, field) {
|
|
21
|
+
if (!cc) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
// If a specific field is requested, use it if available
|
|
25
|
+
if (field) {
|
|
26
|
+
if (cc[field]) {
|
|
27
|
+
return cc[field];
|
|
28
|
+
}
|
|
29
|
+
else if (cc.coding && cc.coding[0] && cc.coding[0][field]) {
|
|
30
|
+
return cc.coding[0][field];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Default order: text, display, code, coding[0].display, coding[0].code
|
|
34
|
+
if (cc.text) {
|
|
35
|
+
return cc.text;
|
|
36
|
+
}
|
|
37
|
+
else if ('display' in cc && cc.display) {
|
|
38
|
+
return cc.display;
|
|
39
|
+
}
|
|
40
|
+
else if (cc.coding && cc.coding[0]) {
|
|
41
|
+
if (cc.coding[0].display) {
|
|
42
|
+
return cc.coding[0].display;
|
|
43
|
+
}
|
|
44
|
+
else if (cc.coding[0].code) {
|
|
45
|
+
return cc.coding[0].code;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
resolveReference(ref) {
|
|
51
|
+
var _a;
|
|
52
|
+
// find the resource in the bundle that matches the reference
|
|
53
|
+
if (!ref || !this.bundle || !this.bundle.entry) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
// split the reference into referenceResourceType and id on /
|
|
57
|
+
const referenceParts = (_a = ref.reference) === null || _a === void 0 ? void 0 : _a.split('/');
|
|
58
|
+
if (!referenceParts || referenceParts.length !== 2) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const referenceResourceType = referenceParts[0];
|
|
62
|
+
const referenceResourceId = referenceParts[1];
|
|
63
|
+
const resource = this.bundle.entry.find(entry => {
|
|
64
|
+
return entry.resource && entry.resource.resourceType === referenceResourceType &&
|
|
65
|
+
entry.resource.id === referenceResourceId;
|
|
66
|
+
});
|
|
67
|
+
return resource ? resource.resource : null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Renders a Device reference
|
|
71
|
+
* @param deviceRef - Reference to a Device resource
|
|
72
|
+
* @returns Formatted device description
|
|
73
|
+
*/
|
|
74
|
+
renderDevice(deviceRef) {
|
|
75
|
+
const device = deviceRef && this.resolveReference(deviceRef);
|
|
76
|
+
if (device && device.resourceType === 'Device' && device.type) {
|
|
77
|
+
return this.codeableConcept(device.type, 'display');
|
|
78
|
+
}
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Renders an Organization reference
|
|
83
|
+
* @param orgRef - Reference to an Organization resource
|
|
84
|
+
* @returns Organization name
|
|
85
|
+
*/
|
|
86
|
+
renderOrganization(orgRef) {
|
|
87
|
+
const organization = orgRef && this.resolveReference(orgRef);
|
|
88
|
+
if (organization && organization.resourceType === 'Organization' && organization.name) {
|
|
89
|
+
return organization.name;
|
|
90
|
+
}
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Renders a vaccine manufacturer
|
|
95
|
+
* @param immunization - Immunization resource
|
|
96
|
+
* @returns Manufacturer name
|
|
97
|
+
*/
|
|
98
|
+
renderVaccineManufacturer(immunization) {
|
|
99
|
+
const organization = immunization.manufacturer && this.resolveReference(immunization.manufacturer);
|
|
100
|
+
if (organization && organization.resourceType === 'Organization' && organization.name) {
|
|
101
|
+
return organization.name;
|
|
102
|
+
}
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Renders a medication
|
|
107
|
+
* @param medicationType - Resource containing medication information
|
|
108
|
+
* @returns Formatted medication description
|
|
109
|
+
*/
|
|
110
|
+
renderMedicationStatement(medicationType) {
|
|
111
|
+
if (typeof medicationType !== 'object' || medicationType === null) {
|
|
112
|
+
return '';
|
|
113
|
+
}
|
|
114
|
+
if (medicationType.medicationCodeableConcept) {
|
|
115
|
+
return this.codeableConcept(medicationType.medicationCodeableConcept);
|
|
116
|
+
}
|
|
117
|
+
else if (medicationType.medicationReference) {
|
|
118
|
+
return this.renderMedicationRef(medicationType.medicationReference);
|
|
119
|
+
}
|
|
120
|
+
return '';
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Renders a medication reference
|
|
124
|
+
* @param medicationRef - Reference to a Medication resource
|
|
125
|
+
* @returns Formatted medication description
|
|
126
|
+
*/
|
|
127
|
+
renderMedicationRef(medicationRef) {
|
|
128
|
+
const medication = medicationRef && this.resolveReference(medicationRef);
|
|
129
|
+
if (medication) {
|
|
130
|
+
return this.renderMedicationCode(medication);
|
|
131
|
+
}
|
|
132
|
+
return '';
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Renders a medication code
|
|
136
|
+
* @param medication - Medication resource
|
|
137
|
+
* @returns Formatted medication code
|
|
138
|
+
*/
|
|
139
|
+
renderMedicationCode(medication) {
|
|
140
|
+
if (medication && medication.code) {
|
|
141
|
+
return this.codeableConcept(medication.code, 'display');
|
|
142
|
+
}
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Renders a dose number
|
|
147
|
+
* @param doseNumber - Dose number object
|
|
148
|
+
* @returns Formatted dose number
|
|
149
|
+
*/
|
|
150
|
+
renderDoseNumber(doseNumber) {
|
|
151
|
+
if (doseNumber && doseNumber.value !== undefined) {
|
|
152
|
+
return doseNumber.value.toString();
|
|
153
|
+
}
|
|
154
|
+
return '';
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Renders the unit of a value
|
|
158
|
+
* @param value - Value object
|
|
159
|
+
* @returns Unit string
|
|
160
|
+
*/
|
|
161
|
+
renderValueUnit(value) {
|
|
162
|
+
var _a;
|
|
163
|
+
if (value && ((_a = value.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Quantity' && value.unit) {
|
|
164
|
+
return value.unit;
|
|
165
|
+
}
|
|
166
|
+
return '';
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Renders an effective date
|
|
170
|
+
* @param effective - Date value
|
|
171
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
172
|
+
* @returns Formatted date string
|
|
173
|
+
*/
|
|
174
|
+
renderEffective(effective, timezone) {
|
|
175
|
+
return this.formatDateTime(effective, timezone);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Renders a time value
|
|
179
|
+
* @param time - Time value
|
|
180
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
181
|
+
* @returns Formatted time string
|
|
182
|
+
*/
|
|
183
|
+
renderTime(time, timezone) {
|
|
184
|
+
return this.formatDateTime(time, timezone);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Renders a date value
|
|
188
|
+
* @param date - Date value
|
|
189
|
+
* @returns Formatted date string (date only, no time component)
|
|
190
|
+
*/
|
|
191
|
+
renderDate(date) {
|
|
192
|
+
return this.formatDateTime(date, undefined, true);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Renders a recorded date
|
|
196
|
+
* @param recorded - Date value
|
|
197
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
198
|
+
* @returns Formatted date string
|
|
199
|
+
*/
|
|
200
|
+
renderRecorded(recorded, timezone) {
|
|
201
|
+
return this.formatDateTime(recorded, timezone);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Concatenates a list of items, optionally extracting a specific attribute
|
|
205
|
+
* @param list - Array of items
|
|
206
|
+
* @param attr - Optional attribute to extract from each item
|
|
207
|
+
* @returns Comma-separated string of items
|
|
208
|
+
*/
|
|
209
|
+
concat(list, attr) {
|
|
210
|
+
if (!list || !Array.isArray(list)) {
|
|
211
|
+
return '';
|
|
212
|
+
}
|
|
213
|
+
const items = [];
|
|
214
|
+
for (const item of list) {
|
|
215
|
+
if (attr && item && typeof item === 'object' && attr in item) {
|
|
216
|
+
items.push(item[attr]);
|
|
217
|
+
}
|
|
218
|
+
else if (!attr && item !== undefined) {
|
|
219
|
+
items.push(item);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return items
|
|
223
|
+
.filter(item => typeof item === 'string' || typeof item === 'number')
|
|
224
|
+
.join(', ');
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Safely concatenates a list of items, handling undefined/null lists
|
|
228
|
+
* @param list - Array of items (or undefined/null)
|
|
229
|
+
* @param attr - Optional attribute to extract from each item
|
|
230
|
+
* @returns Comma-separated string of items
|
|
231
|
+
*/
|
|
232
|
+
safeConcat(list, attr) {
|
|
233
|
+
return this.concat(list || [], attr);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Concatenates text from a list of CodeableConcept objects
|
|
237
|
+
* @param list - Array of CodeableConcept objects
|
|
238
|
+
* @returns Comma-separated string of text values
|
|
239
|
+
*/
|
|
240
|
+
concatCodeableConcept(list) {
|
|
241
|
+
if (!list || !Array.isArray(list)) {
|
|
242
|
+
return '';
|
|
243
|
+
}
|
|
244
|
+
const items = [];
|
|
245
|
+
for (const item of list) {
|
|
246
|
+
if (item && item.text) {
|
|
247
|
+
items.push(item.text);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return items.join(', ');
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Concatenates reaction manifestations
|
|
254
|
+
* @param list - Array of reaction objects
|
|
255
|
+
* @returns Comma-separated string of manifestation texts
|
|
256
|
+
*/
|
|
257
|
+
concatReactionManifestation(list) {
|
|
258
|
+
if (!list || !Array.isArray(list)) {
|
|
259
|
+
return '';
|
|
260
|
+
}
|
|
261
|
+
const texts = [];
|
|
262
|
+
for (const item of list) {
|
|
263
|
+
if (item && item.manifestation && item.manifestation[0] && item.manifestation[0].text) {
|
|
264
|
+
texts.push(item.manifestation[0].text);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return texts.join(', ');
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Concatenates dose numbers
|
|
271
|
+
* @param list - Array of dose objects
|
|
272
|
+
* @returns Comma-separated string of dose numbers
|
|
273
|
+
*/
|
|
274
|
+
concatDoseNumber(list) {
|
|
275
|
+
if (!list || !Array.isArray(list)) {
|
|
276
|
+
return '';
|
|
277
|
+
}
|
|
278
|
+
const doseNumbers = [];
|
|
279
|
+
for (const item of list) {
|
|
280
|
+
if (item && item.doseNumberPositiveInt) {
|
|
281
|
+
doseNumbers.push(item.doseNumberPositiveInt.toString());
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return doseNumbers.join(', ');
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Concatenates dosage routes
|
|
288
|
+
* @param list - Array of dosage objects
|
|
289
|
+
* @returns Comma-separated string of route texts
|
|
290
|
+
*/
|
|
291
|
+
concatDosageRoute(list) {
|
|
292
|
+
if (!list || !Array.isArray(list)) {
|
|
293
|
+
return '';
|
|
294
|
+
}
|
|
295
|
+
const routes = [];
|
|
296
|
+
for (const item of list) {
|
|
297
|
+
if (item && item.route && item.route.text) {
|
|
298
|
+
routes.push(item.route.text);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return routes.join(', ');
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Returns the first item from a list of CodeableConcept objects
|
|
305
|
+
* @param list - Array of CodeableConcept objects
|
|
306
|
+
* @returns Display text from the first item
|
|
307
|
+
*/
|
|
308
|
+
firstFromCodeableConceptList(list) {
|
|
309
|
+
if (list && Array.isArray(list) && list[0]) {
|
|
310
|
+
return this.codeableConcept(list[0], 'display');
|
|
311
|
+
}
|
|
312
|
+
return '';
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Concatenates reference range texts
|
|
316
|
+
* @param list - Array of reference range objects
|
|
317
|
+
* @returns Comma-separated string of texts
|
|
318
|
+
*/
|
|
319
|
+
concatReferenceRange(list) {
|
|
320
|
+
if (!list || !Array.isArray(list)) {
|
|
321
|
+
return '';
|
|
322
|
+
}
|
|
323
|
+
const texts = [];
|
|
324
|
+
for (const item of list) {
|
|
325
|
+
if (item && item.text) {
|
|
326
|
+
texts.push(item.text);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return texts.join(', ');
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Renders component codes
|
|
333
|
+
* @param list - Array of component objects
|
|
334
|
+
* @returns Comma-separated string of code texts
|
|
335
|
+
*/
|
|
336
|
+
renderComponent(list) {
|
|
337
|
+
if (!list || !Array.isArray(list)) {
|
|
338
|
+
return '';
|
|
339
|
+
}
|
|
340
|
+
const texts = [];
|
|
341
|
+
for (const item of list) {
|
|
342
|
+
if (item && item.code && item.code.text) {
|
|
343
|
+
texts.push(item.code.text);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return texts.join(', ');
|
|
347
|
+
}
|
|
348
|
+
narrativeLinkExtension(source) {
|
|
349
|
+
// If source is undefined or null, return empty string
|
|
350
|
+
if (!source) {
|
|
351
|
+
return undefined;
|
|
352
|
+
}
|
|
353
|
+
// Case 1: Source is a resource with an extensions array
|
|
354
|
+
if (source.extension && Array.isArray(source.extension)) {
|
|
355
|
+
const extension = source.extension.find((ext) => ext.url === 'http://hl7.org/fhir/StructureDefinition/narrativeLink');
|
|
356
|
+
if (extension) {
|
|
357
|
+
return extension;
|
|
358
|
+
}
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
// Case 2: Source is the extension itself
|
|
362
|
+
return source;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Extracts narrative link ID from extension or resource
|
|
366
|
+
* @param source - Extension object or resource with extensions array
|
|
367
|
+
* @returns Extracted ID or empty string
|
|
368
|
+
*/
|
|
369
|
+
narrativeLinkId(source) {
|
|
370
|
+
const extension = this.narrativeLinkExtension(source);
|
|
371
|
+
// If no extension found, return empty string
|
|
372
|
+
if (!extension) {
|
|
373
|
+
return '';
|
|
374
|
+
}
|
|
375
|
+
// Case 2: Source is the extension itself
|
|
376
|
+
return this.extractIdFromExtension(extension);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Helper method to extract ID from an extension object
|
|
380
|
+
* @param extension - Extension object
|
|
381
|
+
* @returns Extracted ID or empty string
|
|
382
|
+
*/
|
|
383
|
+
extractIdFromExtension(extension) {
|
|
384
|
+
if (typeof extension === 'object' &&
|
|
385
|
+
extension.value &&
|
|
386
|
+
extension.value.value &&
|
|
387
|
+
typeof extension.value.value === 'string' &&
|
|
388
|
+
extension.value.value.includes('#')) {
|
|
389
|
+
return extension.value.value.split('#')[1];
|
|
390
|
+
}
|
|
391
|
+
return '';
|
|
392
|
+
}
|
|
393
|
+
extractObservationValue(observation) {
|
|
394
|
+
// Check all possible value fields in order
|
|
395
|
+
const valueFields = [
|
|
396
|
+
'valueString',
|
|
397
|
+
'valueInteger',
|
|
398
|
+
'valueBoolean',
|
|
399
|
+
'valueQuantity',
|
|
400
|
+
'valueCodeableConcept',
|
|
401
|
+
'valueDateTime',
|
|
402
|
+
'valueTime',
|
|
403
|
+
'valuePeriod'
|
|
404
|
+
];
|
|
405
|
+
for (const field of valueFields) {
|
|
406
|
+
// @ts-expect-error accessing dynamic field
|
|
407
|
+
const observationElement = observation[`${field}`];
|
|
408
|
+
if (observationElement !== undefined) {
|
|
409
|
+
switch (field) {
|
|
410
|
+
case 'valueQuantity':
|
|
411
|
+
// For quantity, return a string representation
|
|
412
|
+
return this.formatQuantityValue(observationElement);
|
|
413
|
+
case 'valueCodeableConcept':
|
|
414
|
+
// For codeable concept, return code or text
|
|
415
|
+
return this.formatCodeableConceptValue(observationElement);
|
|
416
|
+
default:
|
|
417
|
+
return observationElement;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// Check component values if no direct value found
|
|
422
|
+
// @ts-expect-error accessing dynamic field
|
|
423
|
+
if ((observation === null || observation === void 0 ? void 0 : observation.component) && observation.component.length > 0) {
|
|
424
|
+
// @ts-expect-error accessing dynamic field
|
|
425
|
+
for (const component of observation.component) {
|
|
426
|
+
const componentValue = this.extractObservationValue(component);
|
|
427
|
+
if (componentValue !== null) {
|
|
428
|
+
return componentValue;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
// Check for data absent reason if no value found
|
|
433
|
+
if (observation.dataAbsentReason) {
|
|
434
|
+
return this.formatCodeableConceptValue(observation.dataAbsentReason);
|
|
435
|
+
}
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
formatQuantityValue(quantity) {
|
|
439
|
+
if (!quantity)
|
|
440
|
+
return '';
|
|
441
|
+
const parts = [];
|
|
442
|
+
if (quantity.comparator)
|
|
443
|
+
parts.push(quantity.comparator);
|
|
444
|
+
if (quantity.value !== undefined)
|
|
445
|
+
parts.push(quantity.value.toString());
|
|
446
|
+
if (quantity.unit)
|
|
447
|
+
parts.push(quantity.unit);
|
|
448
|
+
return parts.join(' ').trim();
|
|
449
|
+
}
|
|
450
|
+
formatCodeableConceptValue(concept) {
|
|
451
|
+
if (!concept)
|
|
452
|
+
return '';
|
|
453
|
+
// Prefer text if available
|
|
454
|
+
if (concept.text)
|
|
455
|
+
return concept.text;
|
|
456
|
+
// Otherwise, use the first coding's display or code
|
|
457
|
+
if (concept.coding && concept.coding.length > 0) {
|
|
458
|
+
return concept.coding[0].display || concept.coding[0].code || '';
|
|
459
|
+
}
|
|
460
|
+
return '';
|
|
461
|
+
}
|
|
462
|
+
extractObservationValueUnit(observation) {
|
|
463
|
+
// Check if the observation has a valueQuantity field
|
|
464
|
+
if (observation.valueQuantity && observation.valueQuantity.unit) {
|
|
465
|
+
return observation.valueQuantity.unit;
|
|
466
|
+
}
|
|
467
|
+
// If no valueQuantity, check components
|
|
468
|
+
// @ts-expect-error accessing dynamic field
|
|
469
|
+
if (observation.component && observation.component.length > 0) {
|
|
470
|
+
// @ts-expect-error accessing dynamic field
|
|
471
|
+
for (const component of observation.component) {
|
|
472
|
+
const unit = this.extractObservationValueUnit(component);
|
|
473
|
+
if (unit) {
|
|
474
|
+
return unit;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
// If no unit found, return empty string
|
|
479
|
+
return '';
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Gets the medication name from various types of medication references or resources
|
|
483
|
+
* @param medicationSource - Can be a Reference to Medication, a CodeableConcept, or a Medication resource
|
|
484
|
+
* @returns The medication name as a string
|
|
485
|
+
*/
|
|
486
|
+
getMedicationName(medicationSource) {
|
|
487
|
+
if (!medicationSource) {
|
|
488
|
+
return '';
|
|
489
|
+
}
|
|
490
|
+
// Case 1: It's a Medication resource
|
|
491
|
+
if (typeof medicationSource === 'object' && 'resourceType' in medicationSource && medicationSource.resourceType === 'Medication') {
|
|
492
|
+
return this.renderMedicationCode(medicationSource);
|
|
493
|
+
}
|
|
494
|
+
// Case 2: It's a CodeableConcept (medicationCodeableConcept)
|
|
495
|
+
if (typeof medicationSource === 'object' && ('coding' in medicationSource || 'text' in medicationSource)) {
|
|
496
|
+
return this.codeableConcept(medicationSource);
|
|
497
|
+
}
|
|
498
|
+
// Case 3: It's a Reference to a Medication resource (medicationReference)
|
|
499
|
+
if (typeof medicationSource === 'object' && 'reference' in medicationSource) {
|
|
500
|
+
const medication = this.resolveReference(medicationSource);
|
|
501
|
+
if (medication && medication.code) {
|
|
502
|
+
return this.codeableConcept(medication.code);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return '';
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Renders text as HTML, escaping special characters and replacing newlines with <br />
|
|
509
|
+
* @param text - The text to render
|
|
510
|
+
* @private
|
|
511
|
+
*/
|
|
512
|
+
renderTextAsHtml(text) {
|
|
513
|
+
// Check for empty string
|
|
514
|
+
if (!text || text.trim() === '') {
|
|
515
|
+
return '';
|
|
516
|
+
}
|
|
517
|
+
// Escape
|
|
518
|
+
const escapedText = text.replace(/</g, '<').replace(/>/g, '>');
|
|
519
|
+
// Replace newlines with <br />
|
|
520
|
+
return escapedText.replace(/\n/g, '<br />');
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Renders note elements from a FHIR resource in a standardized format
|
|
524
|
+
* Can render as simple comma-separated text or as styled HTML with timestamps
|
|
525
|
+
*
|
|
526
|
+
* @param notes - Array of note objects (or undefined/null)
|
|
527
|
+
* @param timezone - Optional timezone to use for date formatting
|
|
528
|
+
* @param options - Rendering options
|
|
529
|
+
* @returns Formatted string representation of notes
|
|
530
|
+
*/
|
|
531
|
+
renderNotes(notes, timezone, options = {}) {
|
|
532
|
+
if (!notes || !Array.isArray(notes) || notes.length === 0) {
|
|
533
|
+
return '';
|
|
534
|
+
}
|
|
535
|
+
// Simple text-only rendering (comma-separated)
|
|
536
|
+
if (!options.styled) {
|
|
537
|
+
return notes.map(n => this.renderTextAsHtml(n.text)).join('<br />');
|
|
538
|
+
}
|
|
539
|
+
// Styled HTML rendering with timestamps
|
|
540
|
+
let noteHtml = '<ul>';
|
|
541
|
+
for (const note of notes) {
|
|
542
|
+
if (note.text) {
|
|
543
|
+
const noteType = note.authorString || 'Overview';
|
|
544
|
+
noteHtml += `<li class="Note"><span class="NoteTitle">${noteType} (${this.renderTime(note.time, timezone)}):</span><br />`;
|
|
545
|
+
// Optional warning message about formatting
|
|
546
|
+
if (options.warning) {
|
|
547
|
+
noteHtml += `<span class="WarningMsg"><em>Formatting of this note might be different from the original.</em></span><br />`;
|
|
548
|
+
}
|
|
549
|
+
noteHtml += `<span class="NoteText">${this.renderTextAsHtml(note.text)}<br /></span></li>`;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
noteHtml += '</ul>';
|
|
553
|
+
return noteHtml;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Helper method to format dates with Luxon
|
|
557
|
+
* @param dateValue - The date value to format
|
|
558
|
+
* @param timezone - Optional timezone
|
|
559
|
+
* @param dateOnly - Whether to format as date only (without time)
|
|
560
|
+
* @returns Formatted date string
|
|
561
|
+
* @private
|
|
562
|
+
*/
|
|
563
|
+
formatDateTime(dateValue, timezone, dateOnly = false) {
|
|
564
|
+
if (!dateValue)
|
|
565
|
+
return '';
|
|
566
|
+
try {
|
|
567
|
+
let dateTime;
|
|
568
|
+
// Handle different input types
|
|
569
|
+
if (dateValue instanceof Date) {
|
|
570
|
+
dateTime = DateTime.fromJSDate(dateValue);
|
|
571
|
+
}
|
|
572
|
+
else if (typeof dateValue === 'string') {
|
|
573
|
+
// Luxon can handle ISO format dates correctly
|
|
574
|
+
dateTime = DateTime.fromISO(dateValue);
|
|
575
|
+
// For date-only strings (YYYY-MM-DD), use date-only formatting
|
|
576
|
+
if (!dateValue.includes('T')) {
|
|
577
|
+
dateOnly = true;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
dateTime = DateTime.fromISO(String(dateValue));
|
|
582
|
+
}
|
|
583
|
+
if (!dateTime.isValid) {
|
|
584
|
+
return String(dateValue);
|
|
585
|
+
}
|
|
586
|
+
// Set timezone if provided
|
|
587
|
+
if (timezone && !dateOnly) {
|
|
588
|
+
dateTime = dateTime.toUTC().setZone(timezone);
|
|
589
|
+
}
|
|
590
|
+
// Format options
|
|
591
|
+
const formatOptions = dateOnly ?
|
|
592
|
+
{ year: 'numeric', month: '2-digit', day: '2-digit' } :
|
|
593
|
+
{
|
|
594
|
+
year: 'numeric',
|
|
595
|
+
month: 'numeric',
|
|
596
|
+
day: 'numeric',
|
|
597
|
+
hour: 'numeric',
|
|
598
|
+
minute: 'numeric',
|
|
599
|
+
hour12: true,
|
|
600
|
+
timeZoneName: 'short'
|
|
601
|
+
};
|
|
602
|
+
return dateTime.toLocaleString(formatOptions);
|
|
603
|
+
}
|
|
604
|
+
catch (_a) {
|
|
605
|
+
return String(dateValue);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Renders the onset age in a human-readable format
|
|
610
|
+
* @param onsetAge - The onset age value, which can be a string, number, or an object with value and unit
|
|
611
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
612
|
+
*/
|
|
613
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
614
|
+
renderOnset(onsetAge, timezone) {
|
|
615
|
+
if (!onsetAge) {
|
|
616
|
+
return '';
|
|
617
|
+
}
|
|
618
|
+
// Check if onsetAge is a valid object with value and unit
|
|
619
|
+
if (typeof onsetAge === 'object' && 'value' in onsetAge && 'unit' in onsetAge) {
|
|
620
|
+
// Format the value and unit
|
|
621
|
+
return `${onsetAge.value} ${onsetAge.unit}`;
|
|
622
|
+
}
|
|
623
|
+
return '';
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Renders a period of time in a human-readable format
|
|
627
|
+
* @param effectivePeriod - The effective period object containing start and end dates
|
|
628
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
629
|
+
*/
|
|
630
|
+
renderPeriod(effectivePeriod, timezone) {
|
|
631
|
+
if (!effectivePeriod || !effectivePeriod.start || !effectivePeriod.end) {
|
|
632
|
+
return '';
|
|
633
|
+
}
|
|
634
|
+
// Format start and end dates using the renderTime method
|
|
635
|
+
const start = this.renderTime(effectivePeriod.start, timezone);
|
|
636
|
+
const end = this.renderTime(effectivePeriod.end, timezone);
|
|
637
|
+
// Return the formatted period string
|
|
638
|
+
return `${start} - ${end}`;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Renders a reference to a FHIR resource
|
|
642
|
+
* @param itemReference - The reference object containing the resource type and ID
|
|
643
|
+
*/
|
|
644
|
+
renderReference(itemReference) {
|
|
645
|
+
var _a;
|
|
646
|
+
// check if the type of reference is Condition, Observation
|
|
647
|
+
if (itemReference && itemReference.reference) {
|
|
648
|
+
const parts = itemReference.reference.split('/');
|
|
649
|
+
if (parts.length === 2) {
|
|
650
|
+
const resourceType = parts[0];
|
|
651
|
+
const resourceId = parts[1];
|
|
652
|
+
// Find the resource in the bundle
|
|
653
|
+
const resource = (_a = this.bundle.entry) === null || _a === void 0 ? void 0 : _a.find(entry => { var _a, _b; return ((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === resourceType && ((_b = entry.resource) === null || _b === void 0 ? void 0 : _b.id) === resourceId; });
|
|
654
|
+
if (resource) {
|
|
655
|
+
return `${resourceType}/${resourceId}`;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Formats a range of values in a human-readable format
|
|
662
|
+
* @param valueRange - The range object containing low and high values
|
|
663
|
+
*/
|
|
664
|
+
formatRange(valueRange) {
|
|
665
|
+
if (!valueRange || !valueRange.low || !valueRange.high) {
|
|
666
|
+
return '';
|
|
667
|
+
}
|
|
668
|
+
// Format low and high values
|
|
669
|
+
const low = valueRange.low.value !== undefined ? valueRange.low.value.toString() : '';
|
|
670
|
+
const high = valueRange.high.value !== undefined ? valueRange.high.value.toString() : '';
|
|
671
|
+
// Include units if available
|
|
672
|
+
const lowUnit = valueRange.low.unit ? ` ${valueRange.low.unit}` : '';
|
|
673
|
+
const highUnit = valueRange.high.unit ? ` ${valueRange.high.unit}` : '';
|
|
674
|
+
return `${low}${lowUnit} - ${high}${highUnit}`;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Formats a ratio value in a human-readable format
|
|
678
|
+
* @param valueRatio - The ratio object containing numerator and denominator values
|
|
679
|
+
*/
|
|
680
|
+
formatRatio(valueRatio) {
|
|
681
|
+
if (!valueRatio || !valueRatio.numerator || !valueRatio.denominator) {
|
|
682
|
+
return '';
|
|
683
|
+
}
|
|
684
|
+
// Format numerator and denominator values
|
|
685
|
+
const numerator = valueRatio.numerator.value !== undefined ? valueRatio.numerator.value.toString() : '';
|
|
686
|
+
const denominator = valueRatio.denominator.value !== undefined ? valueRatio.denominator.value.toString() : '';
|
|
687
|
+
// Include units if available
|
|
688
|
+
const numeratorUnit = valueRatio.numerator.unit ? ` ${valueRatio.numerator.unit}` : '';
|
|
689
|
+
const denominatorUnit = valueRatio.denominator.unit ? ` ${valueRatio.denominator.unit}` : '';
|
|
690
|
+
return `${numerator}${numeratorUnit} / ${denominator}${denominatorUnit}`;
|
|
691
|
+
}
|
|
692
|
+
}
|