@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,389 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ips_resource_profile_registry_1 = require("../../src/profiles/ips_resource_profile_registry");
|
|
4
|
+
const ips_mandatory_sections_1 = require("../../src/structures/ips_mandatory_sections");
|
|
5
|
+
const fhir_summary_generator_1 = require("../../src/generators/fhir_summary_generator");
|
|
6
|
+
const narrative_generator_1 = require("../../src/generators/narrative_generator");
|
|
7
|
+
const ips_sections_1 = require("../../src/structures/ips_sections");
|
|
8
|
+
describe('International Patient Summary (IPS) Implementation', () => {
|
|
9
|
+
// Mock Resources for Testing
|
|
10
|
+
const mockPatient = {
|
|
11
|
+
resourceType: 'Patient',
|
|
12
|
+
id: 'test-patient-01',
|
|
13
|
+
identifier: [{
|
|
14
|
+
system: 'https://example.org',
|
|
15
|
+
value: '12345'
|
|
16
|
+
}],
|
|
17
|
+
name: [{
|
|
18
|
+
family: 'Doe',
|
|
19
|
+
given: ['John']
|
|
20
|
+
}],
|
|
21
|
+
gender: 'male',
|
|
22
|
+
birthDate: '1980-01-01'
|
|
23
|
+
};
|
|
24
|
+
const mockAllergies = [
|
|
25
|
+
{
|
|
26
|
+
resourceType: 'AllergyIntolerance',
|
|
27
|
+
id: 'allergy-01',
|
|
28
|
+
clinicalStatus: {
|
|
29
|
+
coding: [
|
|
30
|
+
{
|
|
31
|
+
code: 'active'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
verificationStatus: {
|
|
36
|
+
coding: [
|
|
37
|
+
{
|
|
38
|
+
code: 'confirmed'
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
code: { text: 'Penicillin' },
|
|
43
|
+
patient: { reference: 'Patient/test-patient-01' }
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
resourceType: 'AllergyIntolerance',
|
|
47
|
+
id: 'allergy-02',
|
|
48
|
+
clinicalStatus: {
|
|
49
|
+
coding: [
|
|
50
|
+
{
|
|
51
|
+
code: 'active'
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
verificationStatus: {
|
|
56
|
+
coding: [
|
|
57
|
+
{
|
|
58
|
+
code: 'confirmed'
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
code: { text: 'Peanuts' },
|
|
63
|
+
patient: { reference: 'Patient/test-patient-01' }
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
resourceType: 'AllergyIntolerance',
|
|
67
|
+
id: 'allergy-03',
|
|
68
|
+
clinicalStatus: {
|
|
69
|
+
coding: [
|
|
70
|
+
{
|
|
71
|
+
code: 'inactive'
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
verificationStatus: {
|
|
76
|
+
coding: [
|
|
77
|
+
{
|
|
78
|
+
code: 'confirmed'
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
code: { text: 'Latex' },
|
|
83
|
+
patient: { reference: 'Patient/test-patient-01' }
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
const mockMedications = [
|
|
87
|
+
{
|
|
88
|
+
resourceType: 'MedicationStatement',
|
|
89
|
+
id: 'med-01',
|
|
90
|
+
status: 'active',
|
|
91
|
+
medicationCodeableConcept: { text: 'Aspirin' },
|
|
92
|
+
subject: { reference: 'Patient/test-patient-01' }
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
resourceType: 'MedicationStatement',
|
|
96
|
+
id: 'med-02',
|
|
97
|
+
status: 'active',
|
|
98
|
+
medicationCodeableConcept: { text: 'Lisinopril' },
|
|
99
|
+
subject: { reference: 'Patient/test-patient-01' }
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
resourceType: 'MedicationStatement',
|
|
103
|
+
id: 'med-03',
|
|
104
|
+
status: 'completed',
|
|
105
|
+
medicationCodeableConcept: { text: 'Amoxicillin' },
|
|
106
|
+
subject: { reference: 'Patient/test-patient-01' },
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
const mockConditions = [
|
|
110
|
+
{
|
|
111
|
+
resourceType: 'Condition',
|
|
112
|
+
id: 'condition-01',
|
|
113
|
+
clinicalStatus: {
|
|
114
|
+
coding: [
|
|
115
|
+
{
|
|
116
|
+
code: 'active'
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
verificationStatus: {
|
|
121
|
+
coding: [
|
|
122
|
+
{
|
|
123
|
+
code: 'confirmed'
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
code: { text: 'Hypertension' },
|
|
128
|
+
subject: { reference: 'Patient/test-patient-01' }
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
resourceType: 'Condition',
|
|
132
|
+
id: 'condition-02',
|
|
133
|
+
clinicalStatus: {
|
|
134
|
+
coding: [
|
|
135
|
+
{
|
|
136
|
+
code: 'active'
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
verificationStatus: {
|
|
141
|
+
coding: [
|
|
142
|
+
{
|
|
143
|
+
code: 'confirmed'
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
code: { text: 'Type 2 Diabetes' },
|
|
148
|
+
subject: { reference: 'Patient/test-patient-01' }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
resourceType: 'Condition',
|
|
152
|
+
id: 'condition-03',
|
|
153
|
+
clinicalStatus: {
|
|
154
|
+
coding: [
|
|
155
|
+
{
|
|
156
|
+
code: 'resolved'
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
verificationStatus: {
|
|
161
|
+
coding: [
|
|
162
|
+
{
|
|
163
|
+
code: 'confirmed'
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
code: { text: 'Pneumonia' },
|
|
168
|
+
subject: { reference: 'Patient/test-patient-01' }
|
|
169
|
+
}
|
|
170
|
+
];
|
|
171
|
+
const mockImmunizations = [
|
|
172
|
+
{
|
|
173
|
+
resourceType: 'Immunization',
|
|
174
|
+
id: 'imm-01',
|
|
175
|
+
status: 'completed',
|
|
176
|
+
vaccineCode: { text: 'COVID-19 Vaccine' },
|
|
177
|
+
patient: { reference: 'Patient/test-patient-01' },
|
|
178
|
+
primarySource: true,
|
|
179
|
+
occurrenceDateTime: '2024-01-01'
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
resourceType: 'Immunization',
|
|
183
|
+
id: 'imm-02',
|
|
184
|
+
status: 'completed',
|
|
185
|
+
vaccineCode: { text: 'Influenza Vaccine' },
|
|
186
|
+
patient: { reference: 'Patient/test-patient-01' },
|
|
187
|
+
primarySource: true,
|
|
188
|
+
occurrenceDateTime: '2023-10-15'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
resourceType: 'Immunization',
|
|
192
|
+
id: 'imm-03',
|
|
193
|
+
status: 'completed',
|
|
194
|
+
vaccineCode: { text: 'Tetanus Vaccine' },
|
|
195
|
+
patient: { reference: 'Patient/test-patient-01' },
|
|
196
|
+
primarySource: false,
|
|
197
|
+
occurrenceDateTime: '2022-05-20'
|
|
198
|
+
}
|
|
199
|
+
];
|
|
200
|
+
const mockLaboratoryResults = [
|
|
201
|
+
{
|
|
202
|
+
resourceType: 'Observation',
|
|
203
|
+
id: 'lab-01',
|
|
204
|
+
status: 'final',
|
|
205
|
+
category: [{
|
|
206
|
+
coding: [{ code: 'laboratory' }]
|
|
207
|
+
}],
|
|
208
|
+
code: { text: 'Blood Glucose' },
|
|
209
|
+
subject: { reference: 'Patient/test-patient-01' },
|
|
210
|
+
effectiveDateTime: '2023-01-01',
|
|
211
|
+
valueQuantity: {
|
|
212
|
+
value: 100,
|
|
213
|
+
unit: 'mg/dL'
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
resourceType: 'Observation',
|
|
218
|
+
id: 'lab-02',
|
|
219
|
+
status: 'final',
|
|
220
|
+
category: [{
|
|
221
|
+
coding: [{ code: 'laboratory' }]
|
|
222
|
+
}],
|
|
223
|
+
code: { text: 'Hemoglobin A1C' },
|
|
224
|
+
subject: { reference: 'Patient/test-patient-01' },
|
|
225
|
+
effectiveDateTime: '2023-01-01',
|
|
226
|
+
valueQuantity: {
|
|
227
|
+
value: 6.5,
|
|
228
|
+
unit: '%'
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
resourceType: 'Observation',
|
|
233
|
+
id: 'lab-03',
|
|
234
|
+
status: 'preliminary',
|
|
235
|
+
category: [{
|
|
236
|
+
coding: [{ code: 'laboratory' }]
|
|
237
|
+
}],
|
|
238
|
+
code: { text: 'Lipid Panel' },
|
|
239
|
+
subject: { reference: 'Patient/test-patient-01' },
|
|
240
|
+
effectiveDateTime: '2023-02-15',
|
|
241
|
+
hasMember: [
|
|
242
|
+
{ reference: 'Observation/lab-04' },
|
|
243
|
+
{ reference: 'Observation/lab-05' }
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
resourceType: 'Observation',
|
|
248
|
+
id: 'lab-04',
|
|
249
|
+
status: 'final',
|
|
250
|
+
category: [{
|
|
251
|
+
coding: [{ code: 'laboratory' }]
|
|
252
|
+
}],
|
|
253
|
+
code: { text: 'LDL Cholesterol' },
|
|
254
|
+
subject: { reference: 'Patient/test-patient-01' },
|
|
255
|
+
effectiveDateTime: '2023-02-15',
|
|
256
|
+
valueQuantity: {
|
|
257
|
+
value: 120,
|
|
258
|
+
unit: 'mg/dL'
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
];
|
|
262
|
+
// Resource Profile Validation Tests
|
|
263
|
+
describe('Resource Profile Validation', () => {
|
|
264
|
+
test('Patient resource should pass validation', () => {
|
|
265
|
+
const isValid = ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(mockPatient, ips_mandatory_sections_1.IPSMandatorySections.PATIENT);
|
|
266
|
+
expect(isValid).toBe(true);
|
|
267
|
+
});
|
|
268
|
+
test('Allergy resource should pass validation', () => {
|
|
269
|
+
const isValid = ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(mockAllergies[0], ips_mandatory_sections_1.IPSMandatorySections.ALLERGIES);
|
|
270
|
+
expect(isValid).toBe(true);
|
|
271
|
+
});
|
|
272
|
+
test('Medication resource should pass validation', () => {
|
|
273
|
+
const isValid = ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(mockMedications[0], ips_mandatory_sections_1.IPSMandatorySections.MEDICATIONS);
|
|
274
|
+
expect(isValid).toBe(true);
|
|
275
|
+
});
|
|
276
|
+
test('Condition resource should pass validation', () => {
|
|
277
|
+
const isValid = ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(mockConditions[0], ips_mandatory_sections_1.IPSMandatorySections.PROBLEMS);
|
|
278
|
+
expect(isValid).toBe(true);
|
|
279
|
+
});
|
|
280
|
+
test('Immunization resource should pass validation', () => {
|
|
281
|
+
const isValid = ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(mockImmunizations[0], ips_mandatory_sections_1.IPSMandatorySections.IMMUNIZATIONS);
|
|
282
|
+
expect(isValid).toBe(true);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
// Narrative Generation Tests
|
|
286
|
+
describe('Narrative Generation', () => {
|
|
287
|
+
test('Patient narrative should be generated', () => {
|
|
288
|
+
const narrative = narrative_generator_1.NarrativeGenerator.generateNarrative(ips_sections_1.IPSSections.PATIENT, [mockPatient], 'America/New_York');
|
|
289
|
+
expect(narrative).toBeDefined();
|
|
290
|
+
expect(narrative === null || narrative === void 0 ? void 0 : narrative.status).toBe('generated');
|
|
291
|
+
console.info(narrative === null || narrative === void 0 ? void 0 : narrative.div);
|
|
292
|
+
expect(narrative === null || narrative === void 0 ? void 0 : narrative.div).toContain('John Doe');
|
|
293
|
+
expect(narrative === null || narrative === void 0 ? void 0 : narrative.div).toContain('Male');
|
|
294
|
+
});
|
|
295
|
+
test('Allergy narrative should be generated', () => {
|
|
296
|
+
const narrative = narrative_generator_1.NarrativeGenerator.generateNarrative(ips_sections_1.IPSSections.ALLERGIES, [mockAllergies[0]], 'America/New_York');
|
|
297
|
+
expect(narrative).toBeDefined();
|
|
298
|
+
expect(narrative === null || narrative === void 0 ? void 0 : narrative.status).toBe('generated');
|
|
299
|
+
expect(narrative === null || narrative === void 0 ? void 0 : narrative.div).toContain('Penicillin');
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
// Composition Builder Tests
|
|
303
|
+
describe('IPS Composition Builder', () => {
|
|
304
|
+
test('Should create composition with all mandatory sections', () => {
|
|
305
|
+
const ipsBuilder = new fhir_summary_generator_1.ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
|
|
306
|
+
const buildIPS = () => {
|
|
307
|
+
const timezone = 'America/New_York';
|
|
308
|
+
ipsBuilder
|
|
309
|
+
.addSection(ips_sections_1.IPSSections.ALLERGIES, mockAllergies, timezone)
|
|
310
|
+
.addSection(ips_sections_1.IPSSections.MEDICATIONS, mockMedications, timezone)
|
|
311
|
+
.addSection(ips_sections_1.IPSSections.PROBLEMS, mockConditions, timezone)
|
|
312
|
+
.addSection(ips_sections_1.IPSSections.IMMUNIZATIONS, mockImmunizations, timezone)
|
|
313
|
+
.addSection(ips_sections_1.IPSSections.PATIENT, [mockPatient], timezone)
|
|
314
|
+
.build('America/New_York');
|
|
315
|
+
};
|
|
316
|
+
expect(buildIPS).not.toThrow();
|
|
317
|
+
});
|
|
318
|
+
test('Should throw error if mandatory sections are missing', () => {
|
|
319
|
+
const ipsBuilder = new fhir_summary_generator_1.ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
|
|
320
|
+
const buildInvalidIPS = () => {
|
|
321
|
+
ipsBuilder.build('America/New_York');
|
|
322
|
+
};
|
|
323
|
+
expect(buildInvalidIPS).toThrow('Missing mandatory IPS sections');
|
|
324
|
+
});
|
|
325
|
+
test('Should support optional sections', () => {
|
|
326
|
+
const ipsBuilder = new fhir_summary_generator_1.ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
|
|
327
|
+
const buildFullIPS = () => {
|
|
328
|
+
ipsBuilder
|
|
329
|
+
.addSection(ips_sections_1.IPSSections.PATIENT, [mockPatient], 'America/New_York')
|
|
330
|
+
.addSection(ips_sections_1.IPSSections.ALLERGIES, mockAllergies, 'America/New_York')
|
|
331
|
+
.addSection(ips_sections_1.IPSSections.MEDICATIONS, mockMedications, 'America/New_York')
|
|
332
|
+
.addSection(ips_sections_1.IPSSections.PROBLEMS, mockConditions, 'America/New_York')
|
|
333
|
+
.addSection(ips_sections_1.IPSSections.IMMUNIZATIONS, mockImmunizations, 'America/New_York')
|
|
334
|
+
.addSection(ips_sections_1.IPSSections.DIAGNOSTIC_REPORTS, mockLaboratoryResults, 'America/New_York')
|
|
335
|
+
.build('America/New_York');
|
|
336
|
+
};
|
|
337
|
+
expect(buildFullIPS).not.toThrow();
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
// Error Handling Tests
|
|
341
|
+
describe('Error Handling', () => {
|
|
342
|
+
test('Should reject invalid patient resource', () => {
|
|
343
|
+
const invalidPatient = {
|
|
344
|
+
resourceType: 'Patient'
|
|
345
|
+
// Missing mandatory fields
|
|
346
|
+
};
|
|
347
|
+
expect(() => {
|
|
348
|
+
ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(invalidPatient, ips_mandatory_sections_1.IPSMandatorySections.PATIENT);
|
|
349
|
+
}).toBeTruthy(); // Expect some form of validation failure
|
|
350
|
+
});
|
|
351
|
+
test('Should handle resources with missing mandatory fields', () => {
|
|
352
|
+
// @ts-expect-error Missing mandatory fields
|
|
353
|
+
const incompleteAllergy = {
|
|
354
|
+
resourceType: 'AllergyIntolerance'
|
|
355
|
+
// Missing mandatory fields
|
|
356
|
+
};
|
|
357
|
+
const isValid = ips_resource_profile_registry_1.IPSResourceProfileRegistry.validateResource(incompleteAllergy, ips_mandatory_sections_1.IPSMandatorySections.ALLERGIES);
|
|
358
|
+
expect(isValid).toBe(false);
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
// Performance and Scalability Tests
|
|
362
|
+
describe('Performance Considerations', () => {
|
|
363
|
+
test('Should handle multiple resources efficiently', () => {
|
|
364
|
+
// Generate a large number of resources
|
|
365
|
+
const largeMedicationList = Array.from({ length: 100 }, (_, index) => ({
|
|
366
|
+
resourceType: 'MedicationStatement',
|
|
367
|
+
id: `med-${index}`,
|
|
368
|
+
status: 'active',
|
|
369
|
+
medicationCodeableConcept: { text: `Medication ${index}` },
|
|
370
|
+
subject: { reference: 'Patient/test-patient-01' },
|
|
371
|
+
taken: 'y'
|
|
372
|
+
}));
|
|
373
|
+
const ipsBuilder = new fhir_summary_generator_1.ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
|
|
374
|
+
const buildLargeIPS = () => {
|
|
375
|
+
ipsBuilder
|
|
376
|
+
.addSection(ips_sections_1.IPSSections.PATIENT, [mockPatient], 'America/New_York')
|
|
377
|
+
.addSection(ips_sections_1.IPSSections.MEDICATIONS, largeMedicationList, 'America/New_York')
|
|
378
|
+
.addSection(ips_sections_1.IPSSections.ALLERGIES, mockAllergies, 'America/New_York')
|
|
379
|
+
.addSection(ips_sections_1.IPSSections.PROBLEMS, mockConditions, 'America/New_York')
|
|
380
|
+
.addSection(ips_sections_1.IPSSections.IMMUNIZATIONS, mockImmunizations, 'America/New_York')
|
|
381
|
+
.build('America/New_York');
|
|
382
|
+
};
|
|
383
|
+
const start = performance.now();
|
|
384
|
+
buildLargeIPS();
|
|
385
|
+
const end = performance.now();
|
|
386
|
+
expect(end - start).toBeLessThan(100); // Expect processing under 100ms
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|