@imranq2/fhirpatientsummary 0.0.1
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/LICENSE +201 -0
- package/README.md +81 -0
- package/lib/src/generators/fhir_summary_generator.d.ts +46 -0
- package/lib/src/generators/fhir_summary_generator.js +228 -0
- package/lib/src/generators/narrative_generator.d.ts +40 -0
- package/lib/src/generators/narrative_generator.js +80 -0
- package/lib/src/narratives/templates/typescript/AdvanceDirectivesTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/AdvanceDirectivesTemplate.js +70 -0
- package/lib/src/narratives/templates/typescript/AllergyIntoleranceTemplate.d.ts +31 -0
- package/lib/src/narratives/templates/typescript/AllergyIntoleranceTemplate.js +155 -0
- package/lib/src/narratives/templates/typescript/ClinicalImpressionTemplate.d.ts +15 -0
- package/lib/src/narratives/templates/typescript/ClinicalImpressionTemplate.js +111 -0
- package/lib/src/narratives/templates/typescript/DiagnosticResultsTemplate.d.ts +50 -0
- package/lib/src/narratives/templates/typescript/DiagnosticResultsTemplate.js +153 -0
- package/lib/src/narratives/templates/typescript/FamilyHistoryTemplate.d.ts +15 -0
- package/lib/src/narratives/templates/typescript/FamilyHistoryTemplate.js +103 -0
- package/lib/src/narratives/templates/typescript/FunctionalStatusTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/FunctionalStatusTemplate.js +70 -0
- package/lib/src/narratives/templates/typescript/HistoryOfProceduresTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/HistoryOfProceduresTemplate.js +66 -0
- package/lib/src/narratives/templates/typescript/ImmunizationsTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/ImmunizationsTemplate.js +73 -0
- package/lib/src/narratives/templates/typescript/MedicalDevicesTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/MedicalDevicesTemplate.js +67 -0
- package/lib/src/narratives/templates/typescript/MedicationSummaryTemplate.d.ts +50 -0
- package/lib/src/narratives/templates/typescript/MedicationSummaryTemplate.js +206 -0
- package/lib/src/narratives/templates/typescript/PastHistoryOfIllnessTemplate.d.ts +15 -0
- package/lib/src/narratives/templates/typescript/PastHistoryOfIllnessTemplate.js +59 -0
- package/lib/src/narratives/templates/typescript/PatientTemplate.d.ts +65 -0
- package/lib/src/narratives/templates/typescript/PatientTemplate.js +158 -0
- package/lib/src/narratives/templates/typescript/PlanOfCareTemplate.d.ts +15 -0
- package/lib/src/narratives/templates/typescript/PlanOfCareTemplate.js +63 -0
- package/lib/src/narratives/templates/typescript/PregnancyTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/PregnancyTemplate.js +68 -0
- package/lib/src/narratives/templates/typescript/ProblemListTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/ProblemListTemplate.js +119 -0
- package/lib/src/narratives/templates/typescript/SocialHistoryTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/SocialHistoryTemplate.js +70 -0
- package/lib/src/narratives/templates/typescript/TemplateUtilities.d.ts +251 -0
- package/lib/src/narratives/templates/typescript/TemplateUtilities.js +696 -0
- package/lib/src/narratives/templates/typescript/TypeScriptTemplateMapper.d.ts +17 -0
- package/lib/src/narratives/templates/typescript/TypeScriptTemplateMapper.js +64 -0
- package/lib/src/narratives/templates/typescript/VitalSignsTemplate.d.ts +22 -0
- package/lib/src/narratives/templates/typescript/VitalSignsTemplate.js +74 -0
- package/lib/src/narratives/templates/typescript/interfaces/ITemplate.d.ts +13 -0
- package/lib/src/narratives/templates/typescript/interfaces/ITemplate.js +2 -0
- package/lib/src/profiles/ips_resource_profile_registry.d.ts +7 -0
- package/lib/src/profiles/ips_resource_profile_registry.js +143 -0
- package/lib/src/structures/ips_mandatory_sections.d.ts +7 -0
- package/lib/src/structures/ips_mandatory_sections.js +11 -0
- package/lib/src/structures/ips_recommended_sections.d.ts +8 -0
- package/lib/src/structures/ips_recommended_sections.js +12 -0
- package/lib/src/structures/ips_resource_profile.d.ts +7 -0
- package/lib/src/structures/ips_resource_profile.js +2 -0
- package/lib/src/structures/ips_section_loinc_codes.d.ts +4 -0
- package/lib/src/structures/ips_section_loinc_codes.js +48 -0
- package/lib/src/structures/ips_section_resource_map.d.ts +8 -0
- package/lib/src/structures/ips_section_resource_map.js +69 -0
- package/lib/src/structures/ips_sections.d.ts +19 -0
- package/lib/src/structures/ips_sections.js +27 -0
- package/lib/src/types/partials/Address.d.ts +16 -0
- package/lib/src/types/partials/Address.js +3 -0
- package/lib/src/types/partials/AllergyIntoleranceReaction.d.ts +16 -0
- package/lib/src/types/partials/AllergyIntoleranceReaction.js +3 -0
- package/lib/src/types/partials/Annotation.d.ts +12 -0
- package/lib/src/types/partials/Annotation.js +3 -0
- package/lib/src/types/partials/Attachment.d.ts +17 -0
- package/lib/src/types/partials/Attachment.js +3 -0
- package/lib/src/types/partials/BundleEntry.d.ts +18 -0
- package/lib/src/types/partials/BundleEntry.js +3 -0
- package/lib/src/types/partials/BundleLink.d.ts +9 -0
- package/lib/src/types/partials/BundleLink.js +3 -0
- package/lib/src/types/partials/BundleRequest.d.ts +14 -0
- package/lib/src/types/partials/BundleRequest.js +3 -0
- package/lib/src/types/partials/BundleResponse.d.ts +14 -0
- package/lib/src/types/partials/BundleResponse.js +3 -0
- package/lib/src/types/partials/BundleSearch.d.ts +9 -0
- package/lib/src/types/partials/BundleSearch.js +3 -0
- package/lib/src/types/partials/CarePlanActivity.d.ts +15 -0
- package/lib/src/types/partials/CarePlanActivity.js +3 -0
- package/lib/src/types/partials/CarePlanDetail.d.ts +33 -0
- package/lib/src/types/partials/CarePlanDetail.js +3 -0
- package/lib/src/types/partials/ClinicalImpressionFinding.d.ts +11 -0
- package/lib/src/types/partials/ClinicalImpressionFinding.js +3 -0
- package/lib/src/types/partials/ClinicalImpressionInvestigation.d.ts +10 -0
- package/lib/src/types/partials/ClinicalImpressionInvestigation.js +3 -0
- package/lib/src/types/partials/CodeableConcept.d.ts +8 -0
- package/lib/src/types/partials/CodeableConcept.js +3 -0
- package/lib/src/types/partials/CodeableReference.d.ts +9 -0
- package/lib/src/types/partials/CodeableReference.js +3 -0
- package/lib/src/types/partials/Coding.d.ts +11 -0
- package/lib/src/types/partials/Coding.js +3 -0
- package/lib/src/types/partials/CompositionAttester.d.ts +11 -0
- package/lib/src/types/partials/CompositionAttester.js +3 -0
- package/lib/src/types/partials/CompositionEvent.d.ts +12 -0
- package/lib/src/types/partials/CompositionEvent.js +3 -0
- package/lib/src/types/partials/CompositionRelatesTo.d.ts +11 -0
- package/lib/src/types/partials/CompositionRelatesTo.js +3 -0
- package/lib/src/types/partials/CompositionSection.d.ts +19 -0
- package/lib/src/types/partials/CompositionSection.js +3 -0
- package/lib/src/types/partials/ConditionEvidence.d.ts +10 -0
- package/lib/src/types/partials/ConditionEvidence.js +3 -0
- package/lib/src/types/partials/ConditionStage.d.ts +11 -0
- package/lib/src/types/partials/ConditionStage.js +3 -0
- package/lib/src/types/partials/ConsentActor.d.ts +10 -0
- package/lib/src/types/partials/ConsentActor.js +3 -0
- package/lib/src/types/partials/ConsentData.d.ts +9 -0
- package/lib/src/types/partials/ConsentData.js +3 -0
- package/lib/src/types/partials/ConsentPolicy.d.ts +9 -0
- package/lib/src/types/partials/ConsentPolicy.js +3 -0
- package/lib/src/types/partials/ConsentProvision.d.ts +22 -0
- package/lib/src/types/partials/ConsentProvision.js +3 -0
- package/lib/src/types/partials/ConsentVerification.d.ts +11 -0
- package/lib/src/types/partials/ConsentVerification.js +3 -0
- package/lib/src/types/partials/ContactDetail.d.ts +8 -0
- package/lib/src/types/partials/ContactDetail.js +3 -0
- package/lib/src/types/partials/ContactPoint.d.ts +12 -0
- package/lib/src/types/partials/ContactPoint.js +3 -0
- package/lib/src/types/partials/Contributor.d.ts +9 -0
- package/lib/src/types/partials/Contributor.js +3 -0
- package/lib/src/types/partials/DataRequirement.d.ts +21 -0
- package/lib/src/types/partials/DataRequirement.js +3 -0
- package/lib/src/types/partials/DataRequirementCodeFilter.d.ts +11 -0
- package/lib/src/types/partials/DataRequirementCodeFilter.js +3 -0
- package/lib/src/types/partials/DataRequirementDateFilter.d.ts +13 -0
- package/lib/src/types/partials/DataRequirementDateFilter.js +3 -0
- package/lib/src/types/partials/DataRequirementSort.d.ts +7 -0
- package/lib/src/types/partials/DataRequirementSort.js +3 -0
- package/lib/src/types/partials/DeviceDeviceName.d.ts +8 -0
- package/lib/src/types/partials/DeviceDeviceName.js +3 -0
- package/lib/src/types/partials/DeviceProperty.d.ts +11 -0
- package/lib/src/types/partials/DeviceProperty.js +3 -0
- package/lib/src/types/partials/DeviceSpecialization.d.ts +9 -0
- package/lib/src/types/partials/DeviceSpecialization.js +3 -0
- package/lib/src/types/partials/DeviceUdiCarrier.d.ts +14 -0
- package/lib/src/types/partials/DeviceUdiCarrier.js +3 -0
- package/lib/src/types/partials/DeviceVersion.d.ts +11 -0
- package/lib/src/types/partials/DeviceVersion.js +3 -0
- package/lib/src/types/partials/DiagnosticReportMedia.d.ts +9 -0
- package/lib/src/types/partials/DiagnosticReportMedia.js +3 -0
- package/lib/src/types/partials/Dosage.d.ts +26 -0
- package/lib/src/types/partials/Dosage.js +3 -0
- package/lib/src/types/partials/DosageDoseAndRate.d.ts +16 -0
- package/lib/src/types/partials/DosageDoseAndRate.js +3 -0
- package/lib/src/types/partials/Expression.d.ts +12 -0
- package/lib/src/types/partials/Expression.js +3 -0
- package/lib/src/types/partials/Extension.d.ts +99 -0
- package/lib/src/types/partials/Extension.js +3 -0
- package/lib/src/types/partials/FamilyMemberHistoryCondition.d.ts +19 -0
- package/lib/src/types/partials/FamilyMemberHistoryCondition.js +3 -0
- package/lib/src/types/partials/HumanName.d.ts +13 -0
- package/lib/src/types/partials/HumanName.js +3 -0
- package/lib/src/types/partials/Identifier.d.ts +15 -0
- package/lib/src/types/partials/Identifier.js +3 -0
- package/lib/src/types/partials/ImmunizationEducation.d.ts +12 -0
- package/lib/src/types/partials/ImmunizationEducation.js +3 -0
- package/lib/src/types/partials/ImmunizationPerformer.d.ts +10 -0
- package/lib/src/types/partials/ImmunizationPerformer.js +3 -0
- package/lib/src/types/partials/ImmunizationProtocolApplied.d.ts +16 -0
- package/lib/src/types/partials/ImmunizationProtocolApplied.js +3 -0
- package/lib/src/types/partials/ImmunizationReaction.d.ts +11 -0
- package/lib/src/types/partials/ImmunizationReaction.js +3 -0
- package/lib/src/types/partials/MedicationBatch.d.ts +9 -0
- package/lib/src/types/partials/MedicationBatch.js +3 -0
- package/lib/src/types/partials/MedicationIngredient.d.ts +13 -0
- package/lib/src/types/partials/MedicationIngredient.js +3 -0
- package/lib/src/types/partials/MedicationRequestDispenseRequest.d.ts +18 -0
- package/lib/src/types/partials/MedicationRequestDispenseRequest.js +3 -0
- package/lib/src/types/partials/MedicationRequestInitialFill.d.ts +9 -0
- package/lib/src/types/partials/MedicationRequestInitialFill.js +3 -0
- package/lib/src/types/partials/MedicationRequestSubstitution.d.ts +10 -0
- package/lib/src/types/partials/MedicationRequestSubstitution.js +3 -0
- package/lib/src/types/partials/Meta.d.ts +16 -0
- package/lib/src/types/partials/Meta.js +3 -0
- package/lib/src/types/partials/Money.d.ts +8 -0
- package/lib/src/types/partials/Money.js +3 -0
- package/lib/src/types/partials/Narrative.d.ts +8 -0
- package/lib/src/types/partials/Narrative.js +3 -0
- package/lib/src/types/partials/ObservationComponent.d.ts +31 -0
- package/lib/src/types/partials/ObservationComponent.js +3 -0
- package/lib/src/types/partials/ObservationReferenceRange.d.ts +15 -0
- package/lib/src/types/partials/ObservationReferenceRange.js +3 -0
- package/lib/src/types/partials/OrganizationContact.d.ts +14 -0
- package/lib/src/types/partials/OrganizationContact.js +3 -0
- package/lib/src/types/partials/ParameterDefinition.d.ts +14 -0
- package/lib/src/types/partials/ParameterDefinition.js +3 -0
- package/lib/src/types/partials/PatientCommunication.d.ts +9 -0
- package/lib/src/types/partials/PatientCommunication.js +3 -0
- package/lib/src/types/partials/PatientContact.d.ts +19 -0
- package/lib/src/types/partials/PatientContact.js +3 -0
- package/lib/src/types/partials/PatientLink.d.ts +9 -0
- package/lib/src/types/partials/PatientLink.js +3 -0
- package/lib/src/types/partials/Period.d.ts +8 -0
- package/lib/src/types/partials/Period.js +3 -0
- package/lib/src/types/partials/ProcedureFocalDevice.d.ts +10 -0
- package/lib/src/types/partials/ProcedureFocalDevice.js +3 -0
- package/lib/src/types/partials/ProcedurePerformer.d.ts +11 -0
- package/lib/src/types/partials/ProcedurePerformer.js +3 -0
- package/lib/src/types/partials/Quantity.d.ts +12 -0
- package/lib/src/types/partials/Quantity.js +3 -0
- package/lib/src/types/partials/Range.d.ts +8 -0
- package/lib/src/types/partials/Range.js +3 -0
- package/lib/src/types/partials/Ratio.d.ts +8 -0
- package/lib/src/types/partials/Ratio.js +3 -0
- package/lib/src/types/partials/RatioRange.d.ts +9 -0
- package/lib/src/types/partials/RatioRange.js +3 -0
- package/lib/src/types/partials/Reference.d.ts +14 -0
- package/lib/src/types/partials/Reference.js +3 -0
- package/lib/src/types/partials/RelatedArtifact.d.ts +16 -0
- package/lib/src/types/partials/RelatedArtifact.js +3 -0
- package/lib/src/types/partials/SampledData.d.ts +15 -0
- package/lib/src/types/partials/SampledData.js +3 -0
- package/lib/src/types/partials/Signature.d.ts +16 -0
- package/lib/src/types/partials/Signature.js +3 -0
- package/lib/src/types/partials/Timing.d.ts +12 -0
- package/lib/src/types/partials/Timing.js +3 -0
- package/lib/src/types/partials/TimingRepeat.d.ts +30 -0
- package/lib/src/types/partials/TimingRepeat.js +3 -0
- package/lib/src/types/partials/TriggerDefinition.d.ts +19 -0
- package/lib/src/types/partials/TriggerDefinition.js +3 -0
- package/lib/src/types/partials/UsageContext.d.ts +15 -0
- package/lib/src/types/partials/UsageContext.js +3 -0
- package/lib/src/types/resources/AllergyIntolerance.d.ts +45 -0
- package/lib/src/types/resources/AllergyIntolerance.js +3 -0
- package/lib/src/types/resources/Bundle.d.ts +22 -0
- package/lib/src/types/resources/Bundle.js +3 -0
- package/lib/src/types/resources/CarePlan.d.ts +47 -0
- package/lib/src/types/resources/CarePlan.js +3 -0
- package/lib/src/types/resources/ClinicalImpression.d.ts +45 -0
- package/lib/src/types/resources/ClinicalImpression.js +3 -0
- package/lib/src/types/resources/Composition.d.ts +39 -0
- package/lib/src/types/resources/Composition.js +3 -0
- package/lib/src/types/resources/Condition.d.ts +51 -0
- package/lib/src/types/resources/Condition.js +3 -0
- package/lib/src/types/resources/Consent.d.ts +38 -0
- package/lib/src/types/resources/Consent.js +3 -0
- package/lib/src/types/resources/Device.d.ts +53 -0
- package/lib/src/types/resources/Device.js +3 -0
- package/lib/src/types/resources/DeviceUseStatement.d.ts +38 -0
- package/lib/src/types/resources/DeviceUseStatement.js +3 -0
- package/lib/src/types/resources/DiagnosticReport.d.ts +43 -0
- package/lib/src/types/resources/DiagnosticReport.js +3 -0
- package/lib/src/types/resources/DomainResource.d.ts +16 -0
- package/lib/src/types/resources/DomainResource.js +3 -0
- package/lib/src/types/resources/FamilyMemberHistory.d.ts +53 -0
- package/lib/src/types/resources/FamilyMemberHistory.js +3 -0
- package/lib/src/types/resources/Immunization.d.ts +56 -0
- package/lib/src/types/resources/Immunization.js +3 -0
- package/lib/src/types/resources/Medication.d.ts +30 -0
- package/lib/src/types/resources/Medication.js +3 -0
- package/lib/src/types/resources/MedicationRequest.d.ts +59 -0
- package/lib/src/types/resources/MedicationRequest.js +3 -0
- package/lib/src/types/resources/MedicationStatement.d.ts +42 -0
- package/lib/src/types/resources/MedicationStatement.js +3 -0
- package/lib/src/types/resources/Observation.d.ts +69 -0
- package/lib/src/types/resources/Observation.js +3 -0
- package/lib/src/types/resources/Organization.d.ts +32 -0
- package/lib/src/types/resources/Organization.js +3 -0
- package/lib/src/types/resources/Patient.d.ts +47 -0
- package/lib/src/types/resources/Patient.js +3 -0
- package/lib/src/types/resources/Procedure.d.ts +59 -0
- package/lib/src/types/resources/Procedure.js +3 -0
- package/lib/src/types/simpleTypes/Base64Binary.d.ts +1 -0
- package/lib/src/types/simpleTypes/Base64Binary.js +2 -0
- package/lib/src/types/simpleTypes/Canonical.d.ts +1 -0
- package/lib/src/types/simpleTypes/Canonical.js +2 -0
- package/lib/src/types/simpleTypes/Date.d.ts +1 -0
- package/lib/src/types/simpleTypes/Date.js +2 -0
- package/lib/src/types/simpleTypes/DateTime.d.ts +1 -0
- package/lib/src/types/simpleTypes/DateTime.js +2 -0
- package/lib/src/types/simpleTypes/Decimal.d.ts +1 -0
- package/lib/src/types/simpleTypes/Decimal.js +2 -0
- package/lib/src/types/simpleTypes/Id.d.ts +1 -0
- package/lib/src/types/simpleTypes/Id.js +2 -0
- package/lib/src/types/simpleTypes/Instant.d.ts +1 -0
- package/lib/src/types/simpleTypes/Instant.js +2 -0
- package/lib/src/types/simpleTypes/Int.d.ts +1 -0
- package/lib/src/types/simpleTypes/Int.js +2 -0
- package/lib/src/types/simpleTypes/Markdown.d.ts +1 -0
- package/lib/src/types/simpleTypes/Markdown.js +2 -0
- package/lib/src/types/simpleTypes/Oid.d.ts +1 -0
- package/lib/src/types/simpleTypes/Oid.js +2 -0
- package/lib/src/types/simpleTypes/ResourceContainer.d.ts +1 -0
- package/lib/src/types/simpleTypes/ResourceContainer.js +2 -0
- package/lib/src/types/simpleTypes/Time.d.ts +1 -0
- package/lib/src/types/simpleTypes/Time.js +2 -0
- package/lib/src/types/simpleTypes/UnsignedInt.d.ts +1 -0
- package/lib/src/types/simpleTypes/UnsignedInt.js +2 -0
- package/lib/src/types/simpleTypes/Uri.d.ts +1 -0
- package/lib/src/types/simpleTypes/Uri.js +2 -0
- package/lib/src/types/simpleTypes/Url.d.ts +1 -0
- package/lib/src/types/simpleTypes/Url.js +2 -0
- package/lib/src/types/simpleTypes/Uuid.d.ts +1 -0
- package/lib/src/types/simpleTypes/Uuid.js +2 -0
- package/lib/src/types/simpleTypes/Xhtml.d.ts +1 -0
- package/lib/src/types/simpleTypes/Xhtml.js +2 -0
- package/lib/test/fhir-summary-bundle/fhir-summary-bundle.test.d.ts +1 -0
- package/lib/test/fhir-summary-bundle/fhir-summary-bundle.test.js +72 -0
- package/lib/test/ips-test/ips.test.d.ts +1 -0
- package/lib/test/ips-test/ips.test.js +389 -0
- package/lib/test/narrativeGenerator/narrativeGenerator.test.d.ts +1 -0
- package/lib/test/narrativeGenerator/narrativeGenerator.test.js +676 -0
- package/lib/test/summary.test.d.ts +1 -0
- package/lib/test/summary.test.js +452 -0
- package/lib/test/utilities/testHelpers.d.ts +21 -0
- package/lib/test/utilities/testHelpers.js +137 -0
- package/package.json +126 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiagnosticResultsTemplate = void 0;
|
|
4
|
+
// DiagnosticResultsTemplate.ts - TypeScript replacement for Jinja2 diagnosticresults.j2
|
|
5
|
+
const TemplateUtilities_1 = require("./TemplateUtilities");
|
|
6
|
+
/**
|
|
7
|
+
* Class to generate HTML narrative for Diagnostic Results (Observation resources)
|
|
8
|
+
* This replaces the Jinja2 diagnosticresults.j2 template
|
|
9
|
+
*/
|
|
10
|
+
class DiagnosticResultsTemplate {
|
|
11
|
+
/**
|
|
12
|
+
* Generate HTML narrative for Diagnostic Results
|
|
13
|
+
* @param resource - FHIR Bundle containing Observation and DiagnosticReport resources
|
|
14
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
15
|
+
* @returns HTML string for rendering
|
|
16
|
+
*/
|
|
17
|
+
generateNarrative(resource, timezone) {
|
|
18
|
+
return DiagnosticResultsTemplate.generateStaticNarrative(resource, timezone);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Internal static implementation that actually generates the narrative
|
|
22
|
+
* @param resource - FHIR Bundle containing Observation and DiagnosticReport resources
|
|
23
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
24
|
+
* @returns HTML string for rendering
|
|
25
|
+
*/
|
|
26
|
+
static generateStaticNarrative(resource, timezone) {
|
|
27
|
+
const templateUtilities = new TemplateUtilities_1.TemplateUtilities(resource);
|
|
28
|
+
let html = '';
|
|
29
|
+
// Generate Observations section if we have any Observation resources
|
|
30
|
+
const observations = this.getObservations(resource);
|
|
31
|
+
if (observations.length > 0) {
|
|
32
|
+
html += this.renderObservations(templateUtilities, observations, timezone);
|
|
33
|
+
}
|
|
34
|
+
// Generate DiagnosticReports section if we have any DiagnosticReport resources
|
|
35
|
+
const diagnosticReports = this.getDiagnosticReports(resource);
|
|
36
|
+
if (diagnosticReports.length > 0) {
|
|
37
|
+
html += this.renderDiagnosticReports(templateUtilities, diagnosticReports, timezone);
|
|
38
|
+
}
|
|
39
|
+
return html;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract Observation resources from the bundle
|
|
43
|
+
* @param resource - FHIR Bundle
|
|
44
|
+
* @returns Array of Observation resources
|
|
45
|
+
*/
|
|
46
|
+
static getObservations(resource) {
|
|
47
|
+
if (!resource.entry || !Array.isArray(resource.entry)) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
return resource.entry
|
|
51
|
+
.filter(entry => { var _a; return ((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'Observation'; })
|
|
52
|
+
.map(entry => entry.resource);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extract DiagnosticReport resources from the bundle
|
|
56
|
+
* @param resource - FHIR Bundle
|
|
57
|
+
* @returns Array of DiagnosticReport resources
|
|
58
|
+
*/
|
|
59
|
+
static getDiagnosticReports(resource) {
|
|
60
|
+
if (!resource.entry || !Array.isArray(resource.entry)) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return resource.entry
|
|
64
|
+
.filter(entry => { var _a; return ((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'DiagnosticReport'; })
|
|
65
|
+
.map(entry => entry.resource);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Render HTML table for Observation resources
|
|
69
|
+
* @param templateUtilities - Instance of TemplateUtilities for utility functions
|
|
70
|
+
* @param observations - Array of Observation resources
|
|
71
|
+
* @param timezone - Optional timezone to use for date formatting
|
|
72
|
+
* @returns HTML string for rendering
|
|
73
|
+
*/
|
|
74
|
+
static renderObservations(templateUtilities, observations, timezone) {
|
|
75
|
+
let html = `
|
|
76
|
+
<h5>Diagnostic Results: Observations</h5>
|
|
77
|
+
<table class="hapiPropertyTable">
|
|
78
|
+
<thead>
|
|
79
|
+
<tr>
|
|
80
|
+
<th>Code</th>
|
|
81
|
+
<th>Result</th>
|
|
82
|
+
<th>Unit</th>
|
|
83
|
+
<th>Interpretation</th>
|
|
84
|
+
<th>Reference Range</th>
|
|
85
|
+
<th>Comments</th>
|
|
86
|
+
<th>Date</th>
|
|
87
|
+
</tr>
|
|
88
|
+
</thead>
|
|
89
|
+
<tbody>`;
|
|
90
|
+
for (const obs of observations) {
|
|
91
|
+
// Use the enhanced narrativeLinkId utility function to extract the ID directly from the resource
|
|
92
|
+
// Add table row
|
|
93
|
+
html += `
|
|
94
|
+
<tr id="${(templateUtilities.narrativeLinkId(obs))}">
|
|
95
|
+
<td>${templateUtilities.codeableConcept(obs.code)}</td>
|
|
96
|
+
<td>${templateUtilities.extractObservationValue(obs)}</td>
|
|
97
|
+
<td>${templateUtilities.extractObservationValueUnit(obs)}</td>
|
|
98
|
+
<td>${templateUtilities.firstFromCodeableConceptList(obs.interpretation)}</td>
|
|
99
|
+
<td>${templateUtilities.concatReferenceRange(obs.referenceRange)}</td>
|
|
100
|
+
<td>${templateUtilities.renderNotes(obs.note, timezone)}</td>
|
|
101
|
+
<td>${templateUtilities.renderTime(obs.effectiveDateTime, timezone)}</td>
|
|
102
|
+
</tr>`;
|
|
103
|
+
}
|
|
104
|
+
html += `
|
|
105
|
+
</tbody>
|
|
106
|
+
</table>`;
|
|
107
|
+
return html;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Render HTML table for DiagnosticReport resources
|
|
111
|
+
* @param templateUtilities - Instance of TemplateUtilities for utility functions
|
|
112
|
+
* @param reports - Array of DiagnosticReport resources
|
|
113
|
+
* @param timezone - Optional timezone to use for date formatting
|
|
114
|
+
* @returns HTML string for rendering
|
|
115
|
+
*/
|
|
116
|
+
static renderDiagnosticReports(templateUtilities, reports, timezone) {
|
|
117
|
+
let html = `
|
|
118
|
+
<h5>Diagnostic Results: Reports</h5>
|
|
119
|
+
<table class="hapiPropertyTable">
|
|
120
|
+
<thead>
|
|
121
|
+
<tr>
|
|
122
|
+
<th>Report</th>
|
|
123
|
+
<th>Status</th>
|
|
124
|
+
<th>Category</th>
|
|
125
|
+
<th>Result</th>
|
|
126
|
+
<th>Issued</th>
|
|
127
|
+
</tr>
|
|
128
|
+
</thead>
|
|
129
|
+
<tbody>`;
|
|
130
|
+
for (const report of reports) {
|
|
131
|
+
// Use the enhanced narrativeLinkId utility function to extract the ID directly from the resource
|
|
132
|
+
// Format result count
|
|
133
|
+
let resultCount = '';
|
|
134
|
+
if (report.result && Array.isArray(report.result)) {
|
|
135
|
+
resultCount = `${report.result.length} result${report.result.length !== 1 ? 's' : ''}`;
|
|
136
|
+
}
|
|
137
|
+
// Add table row
|
|
138
|
+
html += `
|
|
139
|
+
<tr id="${(templateUtilities.narrativeLinkId(report))}">
|
|
140
|
+
<td>${templateUtilities.codeableConcept(report.code)}</td>
|
|
141
|
+
<td>${report.status || ''}</td>
|
|
142
|
+
<td>${templateUtilities.firstFromCodeableConceptList(report.category)}</td>
|
|
143
|
+
<td>${resultCount}</td>
|
|
144
|
+
<td>${report.issued ? templateUtilities.renderTime(report.issued, timezone) : ''}</td>
|
|
145
|
+
</tr>`;
|
|
146
|
+
}
|
|
147
|
+
html += `
|
|
148
|
+
</tbody>
|
|
149
|
+
</table>`;
|
|
150
|
+
return html;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.DiagnosticResultsTemplate = DiagnosticResultsTemplate;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TBundle } from '../../../types/resources/Bundle';
|
|
2
|
+
import { ITemplate } from './interfaces/ITemplate';
|
|
3
|
+
/**
|
|
4
|
+
* Class to generate HTML narrative for Family History (FamilyMemberHistory resources)
|
|
5
|
+
* This generates narrative for the Family History section of the IPS
|
|
6
|
+
*/
|
|
7
|
+
export declare class FamilyHistoryTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Family History
|
|
10
|
+
* @param resource - FHIR Bundle containing FamilyMemberHistory 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
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FamilyHistoryTemplate = void 0;
|
|
4
|
+
// FamilyHistoryTemplate.ts - TypeScript template for Family History section
|
|
5
|
+
const TemplateUtilities_1 = require("./TemplateUtilities");
|
|
6
|
+
/**
|
|
7
|
+
* Class to generate HTML narrative for Family History (FamilyMemberHistory resources)
|
|
8
|
+
* This generates narrative for the Family History section of the IPS
|
|
9
|
+
*/
|
|
10
|
+
class FamilyHistoryTemplate {
|
|
11
|
+
/**
|
|
12
|
+
* Generate HTML narrative for Family History
|
|
13
|
+
* @param resource - FHIR Bundle containing FamilyMemberHistory resources
|
|
14
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
15
|
+
* @returns HTML string for rendering
|
|
16
|
+
*/
|
|
17
|
+
generateNarrative(resource, timezone) {
|
|
18
|
+
const templateUtilities = new TemplateUtilities_1.TemplateUtilities(resource);
|
|
19
|
+
// Start building the HTML table
|
|
20
|
+
let html = `
|
|
21
|
+
<h5>Family History</h5>
|
|
22
|
+
<table class="hapiPropertyTable">
|
|
23
|
+
<thead>
|
|
24
|
+
<tr>
|
|
25
|
+
<th>Relationship</th>
|
|
26
|
+
<th>Condition</th>
|
|
27
|
+
<th>Status</th>
|
|
28
|
+
<th>Onset</th>
|
|
29
|
+
<th>Notes</th>
|
|
30
|
+
</tr>
|
|
31
|
+
</thead>
|
|
32
|
+
<tbody>`;
|
|
33
|
+
// Check if we have entries in the bundle
|
|
34
|
+
if (resource.entry && Array.isArray(resource.entry)) {
|
|
35
|
+
let hasFamilyHistory = false;
|
|
36
|
+
// Loop through entries in the bundle
|
|
37
|
+
for (const entry of resource.entry) {
|
|
38
|
+
const familyHistory = entry.resource;
|
|
39
|
+
// Skip non-FamilyMemberHistory resources
|
|
40
|
+
if (!familyHistory || familyHistory.resourceType !== 'FamilyMemberHistory') {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
hasFamilyHistory = true;
|
|
44
|
+
const fmh = familyHistory;
|
|
45
|
+
// Extract relationship
|
|
46
|
+
const relationship = templateUtilities.codeableConcept(fmh.relationship, 'display');
|
|
47
|
+
// Process conditions if they exist
|
|
48
|
+
if (fmh.condition && Array.isArray(fmh.condition)) {
|
|
49
|
+
for (const condition of fmh.condition) {
|
|
50
|
+
const conditionCode = templateUtilities.codeableConcept(condition.code, 'display');
|
|
51
|
+
const status = fmh.status || '';
|
|
52
|
+
// Handle onset which could be various types (dateTime, Age, Range, string, Period)
|
|
53
|
+
let onset = '';
|
|
54
|
+
if (condition.onsetAge) {
|
|
55
|
+
onset = templateUtilities.renderOnset(condition.onsetAge, timezone);
|
|
56
|
+
}
|
|
57
|
+
// Notes can be at the condition level or the family history level
|
|
58
|
+
const notes = condition.note ?
|
|
59
|
+
templateUtilities.renderNotes(condition.note, timezone) :
|
|
60
|
+
templateUtilities.renderNotes(fmh.note, timezone);
|
|
61
|
+
html += `
|
|
62
|
+
<tr id="${templateUtilities.narrativeLinkId(fmh)}">
|
|
63
|
+
<td>${relationship}</td>
|
|
64
|
+
<td>${conditionCode}</td>
|
|
65
|
+
<td>${status}</td>
|
|
66
|
+
<td>${onset}</td>
|
|
67
|
+
<td>${notes}</td>
|
|
68
|
+
</tr>`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// If no specific conditions are listed, just show the relationship
|
|
73
|
+
html += `
|
|
74
|
+
<tr id="${templateUtilities.narrativeLinkId(fmh)}">
|
|
75
|
+
<td>${relationship}</td>
|
|
76
|
+
<td>Not specified</td>
|
|
77
|
+
<td>${fmh.status || ''}</td>
|
|
78
|
+
<td></td>
|
|
79
|
+
<td>${templateUtilities.renderNotes(fmh.note, timezone)}</td>
|
|
80
|
+
</tr>`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// If no family history entries were found
|
|
84
|
+
if (!hasFamilyHistory) {
|
|
85
|
+
html += `
|
|
86
|
+
<tr>
|
|
87
|
+
<td colspan="5">No family history recorded</td>
|
|
88
|
+
</tr>`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
html += `
|
|
93
|
+
<tr>
|
|
94
|
+
<td colspan="5">No family history recorded</td>
|
|
95
|
+
</tr>`;
|
|
96
|
+
}
|
|
97
|
+
html += `
|
|
98
|
+
</tbody>
|
|
99
|
+
</table>`;
|
|
100
|
+
return html;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.FamilyHistoryTemplate = FamilyHistoryTemplate;
|
|
@@ -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 Functional Status (Observation resources)
|
|
5
|
+
* This replaces the Jinja2 functionalstatus.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export declare class FunctionalStatusTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Functional Status
|
|
10
|
+
* @param resource - FHIR Bundle containing Observation 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 Observation 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,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionalStatusTemplate = void 0;
|
|
4
|
+
// FunctionalStatusTemplate.ts - TypeScript replacement for Jinja2 functionalstatus.j2
|
|
5
|
+
const TemplateUtilities_1 = require("./TemplateUtilities");
|
|
6
|
+
/**
|
|
7
|
+
* Class to generate HTML narrative for Functional Status (Observation resources)
|
|
8
|
+
* This replaces the Jinja2 functionalstatus.j2 template
|
|
9
|
+
*/
|
|
10
|
+
class FunctionalStatusTemplate {
|
|
11
|
+
/**
|
|
12
|
+
* Generate HTML narrative for Functional Status
|
|
13
|
+
* @param resource - FHIR Bundle containing Observation resources
|
|
14
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
15
|
+
* @returns HTML string for rendering
|
|
16
|
+
*/
|
|
17
|
+
generateNarrative(resource, timezone) {
|
|
18
|
+
return FunctionalStatusTemplate.generateStaticNarrative(resource, timezone);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Internal static implementation that actually generates the narrative
|
|
22
|
+
* @param resource - FHIR Bundle containing Observation resources
|
|
23
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
24
|
+
* @returns HTML string for rendering
|
|
25
|
+
*/
|
|
26
|
+
static generateStaticNarrative(resource, timezone) {
|
|
27
|
+
const templateUtilities = new TemplateUtilities_1.TemplateUtilities(resource);
|
|
28
|
+
// Start building the HTML table
|
|
29
|
+
let html = `
|
|
30
|
+
<h5>Functional Status</h5>
|
|
31
|
+
<table class="hapiPropertyTable">
|
|
32
|
+
<thead>
|
|
33
|
+
<tr>
|
|
34
|
+
<th>Assessment</th>
|
|
35
|
+
<th>Status</th>
|
|
36
|
+
<th>Finding</th>
|
|
37
|
+
<th>Comments</th>
|
|
38
|
+
<th>Date</th>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody>`;
|
|
42
|
+
// Check if we have entries in the bundle
|
|
43
|
+
if (resource.entry && Array.isArray(resource.entry)) {
|
|
44
|
+
// Loop through entries in the bundle
|
|
45
|
+
for (const entry of resource.entry) {
|
|
46
|
+
const ci = entry.resource;
|
|
47
|
+
// Skip Composition resources
|
|
48
|
+
if (ci.resourceType === 'Composition') {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
// Use the enhanced narrativeLinkId utility function to extract the ID directly from the resource
|
|
52
|
+
// Add a table row for this clinical impression
|
|
53
|
+
html += `
|
|
54
|
+
<tr id="${(templateUtilities.narrativeLinkId(ci))}">
|
|
55
|
+
<td>${templateUtilities.codeableConcept(ci.code, 'display')}</td>
|
|
56
|
+
<td>${ci.status || ''}</td>
|
|
57
|
+
<td>${ci.summary || ''}</td>
|
|
58
|
+
<td>${templateUtilities.renderNotes(ci.note, timezone)}</td>
|
|
59
|
+
<td>${templateUtilities.renderEffective(ci.effectiveDateTime, timezone)}</td>
|
|
60
|
+
</tr>`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Close the HTML table
|
|
64
|
+
html += `
|
|
65
|
+
</tbody>
|
|
66
|
+
</table>`;
|
|
67
|
+
return html;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.FunctionalStatusTemplate = FunctionalStatusTemplate;
|
|
@@ -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 Procedure resources
|
|
5
|
+
* This replaces the Jinja2 historyofprocedures.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export declare class HistoryOfProceduresTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Procedure resources
|
|
10
|
+
* @param resource - FHIR Bundle containing Procedure 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 Procedure 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
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HistoryOfProceduresTemplate = void 0;
|
|
4
|
+
// HistoryOfProceduresTemplate.ts - TypeScript replacement for Jinja2 historyofprocedures.j2
|
|
5
|
+
const TemplateUtilities_1 = require("./TemplateUtilities");
|
|
6
|
+
/**
|
|
7
|
+
* Class to generate HTML narrative for Procedure resources
|
|
8
|
+
* This replaces the Jinja2 historyofprocedures.j2 template
|
|
9
|
+
*/
|
|
10
|
+
class HistoryOfProceduresTemplate {
|
|
11
|
+
/**
|
|
12
|
+
* Generate HTML narrative for Procedure resources
|
|
13
|
+
* @param resource - FHIR Bundle containing Procedure resources
|
|
14
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
15
|
+
* @returns HTML string for rendering
|
|
16
|
+
*/
|
|
17
|
+
generateNarrative(resource, timezone) {
|
|
18
|
+
return HistoryOfProceduresTemplate.generateStaticNarrative(resource, timezone);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Internal static implementation that actually generates the narrative
|
|
22
|
+
* @param resource - FHIR Bundle containing Procedure resources
|
|
23
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
24
|
+
* @returns HTML string for rendering
|
|
25
|
+
*/
|
|
26
|
+
static generateStaticNarrative(resource, timezone) {
|
|
27
|
+
const templateUtilities = new TemplateUtilities_1.TemplateUtilities(resource);
|
|
28
|
+
// Start building the HTML table
|
|
29
|
+
let html = `
|
|
30
|
+
<h5>History Of Procedures</h5>
|
|
31
|
+
<table class="hapiPropertyTable">
|
|
32
|
+
<thead>
|
|
33
|
+
<tr>
|
|
34
|
+
<th>Procedure</th>
|
|
35
|
+
<th>Comments</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 proc = entry.resource;
|
|
45
|
+
// Skip Composition resources
|
|
46
|
+
if (proc.resourceType === 'Composition') {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// Use the enhanced narrativeLinkId utility function to extract the ID directly from the resource
|
|
50
|
+
// Add a table row for this procedure
|
|
51
|
+
html += `
|
|
52
|
+
<tr id="${(templateUtilities.narrativeLinkId(proc))}">
|
|
53
|
+
<td>${templateUtilities.codeableConcept(proc.code, 'display')}</td>
|
|
54
|
+
<td>${templateUtilities.renderNotes(proc.note, timezone)}</td>
|
|
55
|
+
<td>${templateUtilities.renderTime(proc.performedDateTime, timezone)}</td>
|
|
56
|
+
</tr>`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Close the HTML table
|
|
60
|
+
html += `
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>`;
|
|
63
|
+
return html;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.HistoryOfProceduresTemplate = HistoryOfProceduresTemplate;
|
|
@@ -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 Immunization resources
|
|
5
|
+
* This replaces the Jinja2 immunizations.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export declare class ImmunizationsTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Immunization resources
|
|
10
|
+
* @param resource - FHIR Bundle containing Immunization 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 Immunization 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,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImmunizationsTemplate = void 0;
|
|
4
|
+
// ImmunizationsTemplate.ts - TypeScript replacement for Jinja2 immunizations.j2
|
|
5
|
+
const TemplateUtilities_1 = require("./TemplateUtilities");
|
|
6
|
+
/**
|
|
7
|
+
* Class to generate HTML narrative for Immunization resources
|
|
8
|
+
* This replaces the Jinja2 immunizations.j2 template
|
|
9
|
+
*/
|
|
10
|
+
class ImmunizationsTemplate {
|
|
11
|
+
/**
|
|
12
|
+
* Generate HTML narrative for Immunization resources
|
|
13
|
+
* @param resource - FHIR Bundle containing Immunization resources
|
|
14
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
15
|
+
* @returns HTML string for rendering
|
|
16
|
+
*/
|
|
17
|
+
generateNarrative(resource, timezone) {
|
|
18
|
+
return ImmunizationsTemplate.generateStaticNarrative(resource, timezone);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Internal static implementation that actually generates the narrative
|
|
22
|
+
* @param resource - FHIR Bundle containing Immunization resources
|
|
23
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
24
|
+
* @returns HTML string for rendering
|
|
25
|
+
*/
|
|
26
|
+
static generateStaticNarrative(resource, timezone) {
|
|
27
|
+
var _a;
|
|
28
|
+
const templateUtilities = new TemplateUtilities_1.TemplateUtilities(resource);
|
|
29
|
+
// Start building the HTML table
|
|
30
|
+
let html = `
|
|
31
|
+
<h5>Immunizations</h5>
|
|
32
|
+
<table class="hapiPropertyTable">
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th>Immunization</th>
|
|
36
|
+
<th>Status</th>
|
|
37
|
+
<th>Dose Number</th>
|
|
38
|
+
<th>Manufacturer</th>
|
|
39
|
+
<th>Lot Number</th>
|
|
40
|
+
<th>Comments</th>
|
|
41
|
+
<th>Date</th>
|
|
42
|
+
</tr>
|
|
43
|
+
</thead>
|
|
44
|
+
<tbody>`;
|
|
45
|
+
// Check if we have entries in the bundle
|
|
46
|
+
if (resource.entry && Array.isArray(resource.entry)) {
|
|
47
|
+
// Loop through entries to find Immunization resources
|
|
48
|
+
for (const entry of resource.entry) {
|
|
49
|
+
if (((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'Immunization') {
|
|
50
|
+
const imm = entry.resource;
|
|
51
|
+
// Find the narrative link extension if it exists
|
|
52
|
+
// Add a table row for this immunization
|
|
53
|
+
html += `
|
|
54
|
+
<tr id="${(templateUtilities.narrativeLinkId(imm))}">
|
|
55
|
+
<td>${templateUtilities.codeableConcept(imm.vaccineCode)}</td>
|
|
56
|
+
<td>${imm.status || ''}</td>
|
|
57
|
+
<td>${templateUtilities.concatDoseNumber(imm.protocolApplied)}</td>
|
|
58
|
+
<td>${templateUtilities.renderVaccineManufacturer(imm)}</td>
|
|
59
|
+
<td>${imm.lotNumber || ''}</td>
|
|
60
|
+
<td>${templateUtilities.renderNotes(imm.note, timezone)}</td>
|
|
61
|
+
<td>${templateUtilities.renderTime(imm.occurrenceDateTime, timezone)}</td>
|
|
62
|
+
</tr>`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Close the HTML table
|
|
67
|
+
html += `
|
|
68
|
+
</tbody>
|
|
69
|
+
</table>`;
|
|
70
|
+
return html;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.ImmunizationsTemplate = ImmunizationsTemplate;
|
|
@@ -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 Medical Device resources
|
|
5
|
+
* This replaces the Jinja2 medicaldevices.j2 template
|
|
6
|
+
*/
|
|
7
|
+
export declare class MedicalDevicesTemplate implements ITemplate {
|
|
8
|
+
/**
|
|
9
|
+
* Generate HTML narrative for Medical Device resources
|
|
10
|
+
* @param resource - FHIR Bundle containing Device 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 Device 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,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MedicalDevicesTemplate = void 0;
|
|
4
|
+
// MedicalDevicesTemplate.ts - TypeScript replacement for Jinja2 medicaldevices.j2
|
|
5
|
+
const TemplateUtilities_1 = require("./TemplateUtilities");
|
|
6
|
+
/**
|
|
7
|
+
* Class to generate HTML narrative for Medical Device resources
|
|
8
|
+
* This replaces the Jinja2 medicaldevices.j2 template
|
|
9
|
+
*/
|
|
10
|
+
class MedicalDevicesTemplate {
|
|
11
|
+
/**
|
|
12
|
+
* Generate HTML narrative for Medical Device resources
|
|
13
|
+
* @param resource - FHIR Bundle containing Device resources
|
|
14
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
15
|
+
* @returns HTML string for rendering
|
|
16
|
+
*/
|
|
17
|
+
generateNarrative(resource, timezone) {
|
|
18
|
+
return MedicalDevicesTemplate.generateStaticNarrative(resource, timezone);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Internal static implementation that actually generates the narrative
|
|
22
|
+
* @param resource - FHIR Bundle containing Device resources
|
|
23
|
+
* @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
|
|
24
|
+
* @returns HTML string for rendering
|
|
25
|
+
*/
|
|
26
|
+
static generateStaticNarrative(resource, timezone) {
|
|
27
|
+
var _a;
|
|
28
|
+
const templateUtilities = new TemplateUtilities_1.TemplateUtilities(resource);
|
|
29
|
+
// Start building the HTML table
|
|
30
|
+
let html = `
|
|
31
|
+
<h5>Medical Devices</h5>
|
|
32
|
+
<table class="hapiPropertyTable">
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th>Device</th>
|
|
36
|
+
<th>Status</th>
|
|
37
|
+
<th>Comments</th>
|
|
38
|
+
<th>Date Recorded</th>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody>`;
|
|
42
|
+
// Check if we have entries in the bundle
|
|
43
|
+
if (resource.entry && Array.isArray(resource.entry)) {
|
|
44
|
+
// Loop through entries in the bundle to find DeviceUseStatement resources
|
|
45
|
+
for (const entry of resource.entry) {
|
|
46
|
+
if (((_a = entry.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'DeviceUseStatement') {
|
|
47
|
+
const dus = entry.resource;
|
|
48
|
+
// Use the enhanced narrativeLinkId utility function to extract the ID directly from the resource
|
|
49
|
+
// Add a table row for this device use statement
|
|
50
|
+
html += `
|
|
51
|
+
<tr id="${(templateUtilities.narrativeLinkId(dus))}">
|
|
52
|
+
<td>${templateUtilities.renderDevice(dus.device)}</td>
|
|
53
|
+
<td>${dus.status || ''}</td>
|
|
54
|
+
<td>${templateUtilities.renderNotes(dus.note, timezone)}</td>
|
|
55
|
+
<td>${templateUtilities.renderRecorded(dus.recordedOn, timezone)}</td>
|
|
56
|
+
</tr>`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Close the HTML table
|
|
61
|
+
html += `
|
|
62
|
+
</tbody>
|
|
63
|
+
</table>`;
|
|
64
|
+
return html;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.MedicalDevicesTemplate = MedicalDevicesTemplate;
|