@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.
Files changed (609) hide show
  1. package/lib/esm/src/generators/fhir_summary_generator.d.ts +46 -0
  2. package/lib/esm/src/generators/fhir_summary_generator.js +224 -0
  3. package/lib/esm/src/generators/narrative_generator.d.ts +40 -0
  4. package/lib/esm/src/generators/narrative_generator.js +76 -0
  5. package/lib/esm/src/narratives/templates/typescript/AdvanceDirectivesTemplate.d.ts +22 -0
  6. package/lib/esm/src/narratives/templates/typescript/AdvanceDirectivesTemplate.js +66 -0
  7. package/lib/esm/src/narratives/templates/typescript/AllergyIntoleranceTemplate.d.ts +31 -0
  8. package/lib/esm/src/narratives/templates/typescript/AllergyIntoleranceTemplate.js +151 -0
  9. package/lib/esm/src/narratives/templates/typescript/ClinicalImpressionTemplate.d.ts +15 -0
  10. package/lib/esm/src/narratives/templates/typescript/ClinicalImpressionTemplate.js +107 -0
  11. package/lib/esm/src/narratives/templates/typescript/DiagnosticResultsTemplate.d.ts +50 -0
  12. package/lib/esm/src/narratives/templates/typescript/DiagnosticResultsTemplate.js +149 -0
  13. package/lib/esm/src/narratives/templates/typescript/FamilyHistoryTemplate.d.ts +15 -0
  14. package/lib/esm/src/narratives/templates/typescript/FamilyHistoryTemplate.js +99 -0
  15. package/lib/esm/src/narratives/templates/typescript/FunctionalStatusTemplate.d.ts +22 -0
  16. package/lib/esm/src/narratives/templates/typescript/FunctionalStatusTemplate.js +66 -0
  17. package/lib/esm/src/narratives/templates/typescript/HistoryOfProceduresTemplate.d.ts +22 -0
  18. package/lib/esm/src/narratives/templates/typescript/HistoryOfProceduresTemplate.js +62 -0
  19. package/lib/esm/src/narratives/templates/typescript/ImmunizationsTemplate.d.ts +22 -0
  20. package/lib/esm/src/narratives/templates/typescript/ImmunizationsTemplate.js +69 -0
  21. package/lib/esm/src/narratives/templates/typescript/MedicalDevicesTemplate.d.ts +22 -0
  22. package/lib/esm/src/narratives/templates/typescript/MedicalDevicesTemplate.js +63 -0
  23. package/lib/esm/src/narratives/templates/typescript/MedicationSummaryTemplate.d.ts +50 -0
  24. package/lib/esm/src/narratives/templates/typescript/MedicationSummaryTemplate.js +202 -0
  25. package/lib/esm/src/narratives/templates/typescript/PastHistoryOfIllnessTemplate.d.ts +15 -0
  26. package/lib/esm/src/narratives/templates/typescript/PastHistoryOfIllnessTemplate.js +55 -0
  27. package/lib/esm/src/narratives/templates/typescript/PatientTemplate.d.ts +65 -0
  28. package/lib/esm/src/narratives/templates/typescript/PatientTemplate.js +154 -0
  29. package/lib/esm/src/narratives/templates/typescript/PlanOfCareTemplate.d.ts +15 -0
  30. package/lib/esm/src/narratives/templates/typescript/PlanOfCareTemplate.js +59 -0
  31. package/lib/esm/src/narratives/templates/typescript/PregnancyTemplate.d.ts +22 -0
  32. package/lib/esm/src/narratives/templates/typescript/PregnancyTemplate.js +64 -0
  33. package/lib/esm/src/narratives/templates/typescript/ProblemListTemplate.d.ts +22 -0
  34. package/lib/esm/src/narratives/templates/typescript/ProblemListTemplate.js +115 -0
  35. package/lib/esm/src/narratives/templates/typescript/SocialHistoryTemplate.d.ts +22 -0
  36. package/lib/esm/src/narratives/templates/typescript/SocialHistoryTemplate.js +66 -0
  37. package/lib/esm/src/narratives/templates/typescript/TemplateUtilities.d.ts +251 -0
  38. package/lib/esm/src/narratives/templates/typescript/TemplateUtilities.js +692 -0
  39. package/lib/esm/src/narratives/templates/typescript/TypeScriptTemplateMapper.d.ts +17 -0
  40. package/lib/esm/src/narratives/templates/typescript/TypeScriptTemplateMapper.js +60 -0
  41. package/lib/esm/src/narratives/templates/typescript/VitalSignsTemplate.d.ts +22 -0
  42. package/lib/esm/src/narratives/templates/typescript/VitalSignsTemplate.js +70 -0
  43. package/lib/esm/src/narratives/templates/typescript/interfaces/ITemplate.d.ts +13 -0
  44. package/lib/esm/src/narratives/templates/typescript/interfaces/ITemplate.js +1 -0
  45. package/lib/esm/src/profiles/ips_resource_profile_registry.d.ts +7 -0
  46. package/lib/esm/src/profiles/ips_resource_profile_registry.js +139 -0
  47. package/lib/esm/src/structures/ips_mandatory_sections.d.ts +7 -0
  48. package/lib/esm/src/structures/ips_mandatory_sections.js +8 -0
  49. package/lib/esm/src/structures/ips_recommended_sections.d.ts +8 -0
  50. package/lib/esm/src/structures/ips_recommended_sections.js +9 -0
  51. package/lib/esm/src/structures/ips_resource_profile.d.ts +7 -0
  52. package/lib/esm/src/structures/ips_resource_profile.js +1 -0
  53. package/lib/esm/src/structures/ips_section_loinc_codes.d.ts +4 -0
  54. package/lib/esm/src/structures/ips_section_loinc_codes.js +44 -0
  55. package/lib/esm/src/structures/ips_section_resource_map.d.ts +8 -0
  56. package/lib/esm/src/structures/ips_section_resource_map.js +65 -0
  57. package/lib/esm/src/structures/ips_sections.d.ts +19 -0
  58. package/lib/esm/src/structures/ips_sections.js +24 -0
  59. package/lib/esm/src/types/partials/Address.d.ts +16 -0
  60. package/lib/esm/src/types/partials/Address.js +2 -0
  61. package/lib/esm/src/types/partials/AllergyIntoleranceReaction.d.ts +16 -0
  62. package/lib/esm/src/types/partials/AllergyIntoleranceReaction.js +2 -0
  63. package/lib/esm/src/types/partials/Annotation.d.ts +12 -0
  64. package/lib/esm/src/types/partials/Annotation.js +2 -0
  65. package/lib/esm/src/types/partials/Attachment.d.ts +17 -0
  66. package/lib/esm/src/types/partials/Attachment.js +2 -0
  67. package/lib/esm/src/types/partials/BundleEntry.d.ts +18 -0
  68. package/lib/esm/src/types/partials/BundleEntry.js +2 -0
  69. package/lib/esm/src/types/partials/BundleLink.d.ts +9 -0
  70. package/lib/esm/src/types/partials/BundleLink.js +2 -0
  71. package/lib/esm/src/types/partials/BundleRequest.d.ts +14 -0
  72. package/lib/esm/src/types/partials/BundleRequest.js +2 -0
  73. package/lib/esm/src/types/partials/BundleResponse.d.ts +14 -0
  74. package/lib/esm/src/types/partials/BundleResponse.js +2 -0
  75. package/lib/esm/src/types/partials/BundleSearch.d.ts +9 -0
  76. package/lib/esm/src/types/partials/BundleSearch.js +2 -0
  77. package/lib/esm/src/types/partials/CarePlanActivity.d.ts +15 -0
  78. package/lib/esm/src/types/partials/CarePlanActivity.js +2 -0
  79. package/lib/esm/src/types/partials/CarePlanDetail.d.ts +33 -0
  80. package/lib/esm/src/types/partials/CarePlanDetail.js +2 -0
  81. package/lib/esm/src/types/partials/ClinicalImpressionFinding.d.ts +11 -0
  82. package/lib/esm/src/types/partials/ClinicalImpressionFinding.js +2 -0
  83. package/lib/esm/src/types/partials/ClinicalImpressionInvestigation.d.ts +10 -0
  84. package/lib/esm/src/types/partials/ClinicalImpressionInvestigation.js +2 -0
  85. package/lib/esm/src/types/partials/CodeableConcept.d.ts +8 -0
  86. package/lib/esm/src/types/partials/CodeableConcept.js +2 -0
  87. package/lib/esm/src/types/partials/CodeableReference.d.ts +9 -0
  88. package/lib/esm/src/types/partials/CodeableReference.js +2 -0
  89. package/lib/esm/src/types/partials/Coding.d.ts +11 -0
  90. package/lib/esm/src/types/partials/Coding.js +2 -0
  91. package/lib/esm/src/types/partials/CompositionAttester.d.ts +11 -0
  92. package/lib/esm/src/types/partials/CompositionAttester.js +2 -0
  93. package/lib/esm/src/types/partials/CompositionEvent.d.ts +12 -0
  94. package/lib/esm/src/types/partials/CompositionEvent.js +2 -0
  95. package/lib/esm/src/types/partials/CompositionRelatesTo.d.ts +11 -0
  96. package/lib/esm/src/types/partials/CompositionRelatesTo.js +2 -0
  97. package/lib/esm/src/types/partials/CompositionSection.d.ts +19 -0
  98. package/lib/esm/src/types/partials/CompositionSection.js +2 -0
  99. package/lib/esm/src/types/partials/ConditionEvidence.d.ts +10 -0
  100. package/lib/esm/src/types/partials/ConditionEvidence.js +2 -0
  101. package/lib/esm/src/types/partials/ConditionStage.d.ts +11 -0
  102. package/lib/esm/src/types/partials/ConditionStage.js +2 -0
  103. package/lib/esm/src/types/partials/ConsentActor.d.ts +10 -0
  104. package/lib/esm/src/types/partials/ConsentActor.js +2 -0
  105. package/lib/esm/src/types/partials/ConsentData.d.ts +9 -0
  106. package/lib/esm/src/types/partials/ConsentData.js +2 -0
  107. package/lib/esm/src/types/partials/ConsentPolicy.d.ts +9 -0
  108. package/lib/esm/src/types/partials/ConsentPolicy.js +2 -0
  109. package/lib/esm/src/types/partials/ConsentProvision.d.ts +22 -0
  110. package/lib/esm/src/types/partials/ConsentProvision.js +2 -0
  111. package/lib/esm/src/types/partials/ConsentVerification.d.ts +11 -0
  112. package/lib/esm/src/types/partials/ConsentVerification.js +2 -0
  113. package/lib/esm/src/types/partials/ContactDetail.d.ts +8 -0
  114. package/lib/esm/src/types/partials/ContactDetail.js +2 -0
  115. package/lib/esm/src/types/partials/ContactPoint.d.ts +12 -0
  116. package/lib/esm/src/types/partials/ContactPoint.js +2 -0
  117. package/lib/esm/src/types/partials/Contributor.d.ts +9 -0
  118. package/lib/esm/src/types/partials/Contributor.js +2 -0
  119. package/lib/esm/src/types/partials/DataRequirement.d.ts +21 -0
  120. package/lib/esm/src/types/partials/DataRequirement.js +2 -0
  121. package/lib/esm/src/types/partials/DataRequirementCodeFilter.d.ts +11 -0
  122. package/lib/esm/src/types/partials/DataRequirementCodeFilter.js +2 -0
  123. package/lib/esm/src/types/partials/DataRequirementDateFilter.d.ts +13 -0
  124. package/lib/esm/src/types/partials/DataRequirementDateFilter.js +2 -0
  125. package/lib/esm/src/types/partials/DataRequirementSort.d.ts +7 -0
  126. package/lib/esm/src/types/partials/DataRequirementSort.js +2 -0
  127. package/lib/esm/src/types/partials/DeviceDeviceName.d.ts +8 -0
  128. package/lib/esm/src/types/partials/DeviceDeviceName.js +2 -0
  129. package/lib/esm/src/types/partials/DeviceProperty.d.ts +11 -0
  130. package/lib/esm/src/types/partials/DeviceProperty.js +2 -0
  131. package/lib/esm/src/types/partials/DeviceSpecialization.d.ts +9 -0
  132. package/lib/esm/src/types/partials/DeviceSpecialization.js +2 -0
  133. package/lib/esm/src/types/partials/DeviceUdiCarrier.d.ts +14 -0
  134. package/lib/esm/src/types/partials/DeviceUdiCarrier.js +2 -0
  135. package/lib/esm/src/types/partials/DeviceVersion.d.ts +11 -0
  136. package/lib/esm/src/types/partials/DeviceVersion.js +2 -0
  137. package/lib/esm/src/types/partials/DiagnosticReportMedia.d.ts +9 -0
  138. package/lib/esm/src/types/partials/DiagnosticReportMedia.js +2 -0
  139. package/lib/esm/src/types/partials/Dosage.d.ts +26 -0
  140. package/lib/esm/src/types/partials/Dosage.js +2 -0
  141. package/lib/esm/src/types/partials/DosageDoseAndRate.d.ts +16 -0
  142. package/lib/esm/src/types/partials/DosageDoseAndRate.js +2 -0
  143. package/lib/esm/src/types/partials/Expression.d.ts +12 -0
  144. package/lib/esm/src/types/partials/Expression.js +2 -0
  145. package/lib/esm/src/types/partials/Extension.d.ts +99 -0
  146. package/lib/esm/src/types/partials/Extension.js +2 -0
  147. package/lib/esm/src/types/partials/FamilyMemberHistoryCondition.d.ts +19 -0
  148. package/lib/esm/src/types/partials/FamilyMemberHistoryCondition.js +2 -0
  149. package/lib/esm/src/types/partials/HumanName.d.ts +13 -0
  150. package/lib/esm/src/types/partials/HumanName.js +2 -0
  151. package/lib/esm/src/types/partials/Identifier.d.ts +15 -0
  152. package/lib/esm/src/types/partials/Identifier.js +2 -0
  153. package/lib/esm/src/types/partials/ImmunizationEducation.d.ts +12 -0
  154. package/lib/esm/src/types/partials/ImmunizationEducation.js +2 -0
  155. package/lib/esm/src/types/partials/ImmunizationPerformer.d.ts +10 -0
  156. package/lib/esm/src/types/partials/ImmunizationPerformer.js +2 -0
  157. package/lib/esm/src/types/partials/ImmunizationProtocolApplied.d.ts +16 -0
  158. package/lib/esm/src/types/partials/ImmunizationProtocolApplied.js +2 -0
  159. package/lib/esm/src/types/partials/ImmunizationReaction.d.ts +11 -0
  160. package/lib/esm/src/types/partials/ImmunizationReaction.js +2 -0
  161. package/lib/esm/src/types/partials/MedicationBatch.d.ts +9 -0
  162. package/lib/esm/src/types/partials/MedicationBatch.js +2 -0
  163. package/lib/esm/src/types/partials/MedicationIngredient.d.ts +13 -0
  164. package/lib/esm/src/types/partials/MedicationIngredient.js +2 -0
  165. package/lib/esm/src/types/partials/MedicationRequestDispenseRequest.d.ts +18 -0
  166. package/lib/esm/src/types/partials/MedicationRequestDispenseRequest.js +2 -0
  167. package/lib/esm/src/types/partials/MedicationRequestInitialFill.d.ts +9 -0
  168. package/lib/esm/src/types/partials/MedicationRequestInitialFill.js +2 -0
  169. package/lib/esm/src/types/partials/MedicationRequestSubstitution.d.ts +10 -0
  170. package/lib/esm/src/types/partials/MedicationRequestSubstitution.js +2 -0
  171. package/lib/esm/src/types/partials/Meta.d.ts +16 -0
  172. package/lib/esm/src/types/partials/Meta.js +2 -0
  173. package/lib/esm/src/types/partials/Money.d.ts +8 -0
  174. package/lib/esm/src/types/partials/Money.js +2 -0
  175. package/lib/esm/src/types/partials/Narrative.d.ts +8 -0
  176. package/lib/esm/src/types/partials/Narrative.js +2 -0
  177. package/lib/esm/src/types/partials/ObservationComponent.d.ts +31 -0
  178. package/lib/esm/src/types/partials/ObservationComponent.js +2 -0
  179. package/lib/esm/src/types/partials/ObservationReferenceRange.d.ts +15 -0
  180. package/lib/esm/src/types/partials/ObservationReferenceRange.js +2 -0
  181. package/lib/esm/src/types/partials/OrganizationContact.d.ts +14 -0
  182. package/lib/esm/src/types/partials/OrganizationContact.js +2 -0
  183. package/lib/esm/src/types/partials/ParameterDefinition.d.ts +14 -0
  184. package/lib/esm/src/types/partials/ParameterDefinition.js +2 -0
  185. package/lib/esm/src/types/partials/PatientCommunication.d.ts +9 -0
  186. package/lib/esm/src/types/partials/PatientCommunication.js +2 -0
  187. package/lib/esm/src/types/partials/PatientContact.d.ts +19 -0
  188. package/lib/esm/src/types/partials/PatientContact.js +2 -0
  189. package/lib/esm/src/types/partials/PatientLink.d.ts +9 -0
  190. package/lib/esm/src/types/partials/PatientLink.js +2 -0
  191. package/lib/esm/src/types/partials/Period.d.ts +8 -0
  192. package/lib/esm/src/types/partials/Period.js +2 -0
  193. package/lib/esm/src/types/partials/ProcedureFocalDevice.d.ts +10 -0
  194. package/lib/esm/src/types/partials/ProcedureFocalDevice.js +2 -0
  195. package/lib/esm/src/types/partials/ProcedurePerformer.d.ts +11 -0
  196. package/lib/esm/src/types/partials/ProcedurePerformer.js +2 -0
  197. package/lib/esm/src/types/partials/Quantity.d.ts +12 -0
  198. package/lib/esm/src/types/partials/Quantity.js +2 -0
  199. package/lib/esm/src/types/partials/Range.d.ts +8 -0
  200. package/lib/esm/src/types/partials/Range.js +2 -0
  201. package/lib/esm/src/types/partials/Ratio.d.ts +8 -0
  202. package/lib/esm/src/types/partials/Ratio.js +2 -0
  203. package/lib/esm/src/types/partials/RatioRange.d.ts +9 -0
  204. package/lib/esm/src/types/partials/RatioRange.js +2 -0
  205. package/lib/esm/src/types/partials/Reference.d.ts +14 -0
  206. package/lib/esm/src/types/partials/Reference.js +2 -0
  207. package/lib/esm/src/types/partials/RelatedArtifact.d.ts +16 -0
  208. package/lib/esm/src/types/partials/RelatedArtifact.js +2 -0
  209. package/lib/esm/src/types/partials/SampledData.d.ts +15 -0
  210. package/lib/esm/src/types/partials/SampledData.js +2 -0
  211. package/lib/esm/src/types/partials/Signature.d.ts +16 -0
  212. package/lib/esm/src/types/partials/Signature.js +2 -0
  213. package/lib/esm/src/types/partials/Timing.d.ts +12 -0
  214. package/lib/esm/src/types/partials/Timing.js +2 -0
  215. package/lib/esm/src/types/partials/TimingRepeat.d.ts +30 -0
  216. package/lib/esm/src/types/partials/TimingRepeat.js +2 -0
  217. package/lib/esm/src/types/partials/TriggerDefinition.d.ts +19 -0
  218. package/lib/esm/src/types/partials/TriggerDefinition.js +2 -0
  219. package/lib/esm/src/types/partials/UsageContext.d.ts +15 -0
  220. package/lib/esm/src/types/partials/UsageContext.js +2 -0
  221. package/lib/esm/src/types/resources/AllergyIntolerance.d.ts +45 -0
  222. package/lib/esm/src/types/resources/AllergyIntolerance.js +2 -0
  223. package/lib/esm/src/types/resources/Bundle.d.ts +22 -0
  224. package/lib/esm/src/types/resources/Bundle.js +2 -0
  225. package/lib/esm/src/types/resources/CarePlan.d.ts +47 -0
  226. package/lib/esm/src/types/resources/CarePlan.js +2 -0
  227. package/lib/esm/src/types/resources/ClinicalImpression.d.ts +45 -0
  228. package/lib/esm/src/types/resources/ClinicalImpression.js +2 -0
  229. package/lib/esm/src/types/resources/Composition.d.ts +39 -0
  230. package/lib/esm/src/types/resources/Composition.js +2 -0
  231. package/lib/esm/src/types/resources/Condition.d.ts +51 -0
  232. package/lib/esm/src/types/resources/Condition.js +2 -0
  233. package/lib/esm/src/types/resources/Consent.d.ts +38 -0
  234. package/lib/esm/src/types/resources/Consent.js +2 -0
  235. package/lib/esm/src/types/resources/Device.d.ts +53 -0
  236. package/lib/esm/src/types/resources/Device.js +2 -0
  237. package/lib/esm/src/types/resources/DeviceUseStatement.d.ts +38 -0
  238. package/lib/esm/src/types/resources/DeviceUseStatement.js +2 -0
  239. package/lib/esm/src/types/resources/DiagnosticReport.d.ts +43 -0
  240. package/lib/esm/src/types/resources/DiagnosticReport.js +2 -0
  241. package/lib/esm/src/types/resources/DomainResource.d.ts +16 -0
  242. package/lib/esm/src/types/resources/DomainResource.js +2 -0
  243. package/lib/esm/src/types/resources/FamilyMemberHistory.d.ts +53 -0
  244. package/lib/esm/src/types/resources/FamilyMemberHistory.js +2 -0
  245. package/lib/esm/src/types/resources/Immunization.d.ts +56 -0
  246. package/lib/esm/src/types/resources/Immunization.js +2 -0
  247. package/lib/esm/src/types/resources/Medication.d.ts +30 -0
  248. package/lib/esm/src/types/resources/Medication.js +2 -0
  249. package/lib/esm/src/types/resources/MedicationRequest.d.ts +59 -0
  250. package/lib/esm/src/types/resources/MedicationRequest.js +2 -0
  251. package/lib/esm/src/types/resources/MedicationStatement.d.ts +42 -0
  252. package/lib/esm/src/types/resources/MedicationStatement.js +2 -0
  253. package/lib/esm/src/types/resources/Observation.d.ts +69 -0
  254. package/lib/esm/src/types/resources/Observation.js +2 -0
  255. package/lib/esm/src/types/resources/Organization.d.ts +32 -0
  256. package/lib/esm/src/types/resources/Organization.js +2 -0
  257. package/lib/esm/src/types/resources/Patient.d.ts +47 -0
  258. package/lib/esm/src/types/resources/Patient.js +2 -0
  259. package/lib/esm/src/types/resources/Procedure.d.ts +59 -0
  260. package/lib/esm/src/types/resources/Procedure.js +2 -0
  261. package/lib/esm/src/types/simpleTypes/Base64Binary.d.ts +1 -0
  262. package/lib/esm/src/types/simpleTypes/Base64Binary.js +1 -0
  263. package/lib/esm/src/types/simpleTypes/Canonical.d.ts +1 -0
  264. package/lib/esm/src/types/simpleTypes/Canonical.js +1 -0
  265. package/lib/esm/src/types/simpleTypes/Date.d.ts +1 -0
  266. package/lib/esm/src/types/simpleTypes/Date.js +1 -0
  267. package/lib/esm/src/types/simpleTypes/DateTime.d.ts +1 -0
  268. package/lib/esm/src/types/simpleTypes/DateTime.js +1 -0
  269. package/lib/esm/src/types/simpleTypes/Decimal.d.ts +1 -0
  270. package/lib/esm/src/types/simpleTypes/Decimal.js +1 -0
  271. package/lib/esm/src/types/simpleTypes/Id.d.ts +1 -0
  272. package/lib/esm/src/types/simpleTypes/Id.js +1 -0
  273. package/lib/esm/src/types/simpleTypes/Instant.d.ts +1 -0
  274. package/lib/esm/src/types/simpleTypes/Instant.js +1 -0
  275. package/lib/esm/src/types/simpleTypes/Int.d.ts +1 -0
  276. package/lib/esm/src/types/simpleTypes/Int.js +1 -0
  277. package/lib/esm/src/types/simpleTypes/Markdown.d.ts +1 -0
  278. package/lib/esm/src/types/simpleTypes/Markdown.js +1 -0
  279. package/lib/esm/src/types/simpleTypes/Oid.d.ts +1 -0
  280. package/lib/esm/src/types/simpleTypes/Oid.js +1 -0
  281. package/lib/esm/src/types/simpleTypes/ResourceContainer.d.ts +1 -0
  282. package/lib/esm/src/types/simpleTypes/ResourceContainer.js +1 -0
  283. package/lib/esm/src/types/simpleTypes/Time.d.ts +1 -0
  284. package/lib/esm/src/types/simpleTypes/Time.js +1 -0
  285. package/lib/esm/src/types/simpleTypes/UnsignedInt.d.ts +1 -0
  286. package/lib/esm/src/types/simpleTypes/UnsignedInt.js +1 -0
  287. package/lib/esm/src/types/simpleTypes/Uri.d.ts +1 -0
  288. package/lib/esm/src/types/simpleTypes/Uri.js +1 -0
  289. package/lib/esm/src/types/simpleTypes/Url.d.ts +1 -0
  290. package/lib/esm/src/types/simpleTypes/Url.js +1 -0
  291. package/lib/esm/src/types/simpleTypes/Uuid.d.ts +1 -0
  292. package/lib/esm/src/types/simpleTypes/Uuid.js +1 -0
  293. package/lib/esm/src/types/simpleTypes/Xhtml.d.ts +1 -0
  294. package/lib/esm/src/types/simpleTypes/Xhtml.js +1 -0
  295. package/lib/esm/test/fhir-summary-bundle/fhir-summary-bundle.test.d.ts +1 -0
  296. package/lib/esm/test/fhir-summary-bundle/fhir-summary-bundle.test.js +67 -0
  297. package/lib/esm/test/ips-test/ips.test.d.ts +1 -0
  298. package/lib/esm/test/ips-test/ips.test.js +387 -0
  299. package/lib/esm/test/narrativeGenerator/narrativeGenerator.test.d.ts +1 -0
  300. package/lib/esm/test/narrativeGenerator/narrativeGenerator.test.js +641 -0
  301. package/lib/esm/test/summary.test.d.ts +1 -0
  302. package/lib/esm/test/summary.test.js +450 -0
  303. package/lib/esm/test/utilities/testHelpers.d.ts +21 -0
  304. package/lib/esm/test/utilities/testHelpers.js +129 -0
  305. package/package.json +11 -3
  306. /package/lib/{src → cjs/src}/generators/fhir_summary_generator.d.ts +0 -0
  307. /package/lib/{src → cjs/src}/generators/fhir_summary_generator.js +0 -0
  308. /package/lib/{src → cjs/src}/generators/narrative_generator.d.ts +0 -0
  309. /package/lib/{src → cjs/src}/generators/narrative_generator.js +0 -0
  310. /package/lib/{src → cjs/src}/narratives/templates/typescript/AdvanceDirectivesTemplate.d.ts +0 -0
  311. /package/lib/{src → cjs/src}/narratives/templates/typescript/AdvanceDirectivesTemplate.js +0 -0
  312. /package/lib/{src → cjs/src}/narratives/templates/typescript/AllergyIntoleranceTemplate.d.ts +0 -0
  313. /package/lib/{src → cjs/src}/narratives/templates/typescript/AllergyIntoleranceTemplate.js +0 -0
  314. /package/lib/{src → cjs/src}/narratives/templates/typescript/ClinicalImpressionTemplate.d.ts +0 -0
  315. /package/lib/{src → cjs/src}/narratives/templates/typescript/ClinicalImpressionTemplate.js +0 -0
  316. /package/lib/{src → cjs/src}/narratives/templates/typescript/DiagnosticResultsTemplate.d.ts +0 -0
  317. /package/lib/{src → cjs/src}/narratives/templates/typescript/DiagnosticResultsTemplate.js +0 -0
  318. /package/lib/{src → cjs/src}/narratives/templates/typescript/FamilyHistoryTemplate.d.ts +0 -0
  319. /package/lib/{src → cjs/src}/narratives/templates/typescript/FamilyHistoryTemplate.js +0 -0
  320. /package/lib/{src → cjs/src}/narratives/templates/typescript/FunctionalStatusTemplate.d.ts +0 -0
  321. /package/lib/{src → cjs/src}/narratives/templates/typescript/FunctionalStatusTemplate.js +0 -0
  322. /package/lib/{src → cjs/src}/narratives/templates/typescript/HistoryOfProceduresTemplate.d.ts +0 -0
  323. /package/lib/{src → cjs/src}/narratives/templates/typescript/HistoryOfProceduresTemplate.js +0 -0
  324. /package/lib/{src → cjs/src}/narratives/templates/typescript/ImmunizationsTemplate.d.ts +0 -0
  325. /package/lib/{src → cjs/src}/narratives/templates/typescript/ImmunizationsTemplate.js +0 -0
  326. /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicalDevicesTemplate.d.ts +0 -0
  327. /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicalDevicesTemplate.js +0 -0
  328. /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicationSummaryTemplate.d.ts +0 -0
  329. /package/lib/{src → cjs/src}/narratives/templates/typescript/MedicationSummaryTemplate.js +0 -0
  330. /package/lib/{src → cjs/src}/narratives/templates/typescript/PastHistoryOfIllnessTemplate.d.ts +0 -0
  331. /package/lib/{src → cjs/src}/narratives/templates/typescript/PastHistoryOfIllnessTemplate.js +0 -0
  332. /package/lib/{src → cjs/src}/narratives/templates/typescript/PatientTemplate.d.ts +0 -0
  333. /package/lib/{src → cjs/src}/narratives/templates/typescript/PatientTemplate.js +0 -0
  334. /package/lib/{src → cjs/src}/narratives/templates/typescript/PlanOfCareTemplate.d.ts +0 -0
  335. /package/lib/{src → cjs/src}/narratives/templates/typescript/PlanOfCareTemplate.js +0 -0
  336. /package/lib/{src → cjs/src}/narratives/templates/typescript/PregnancyTemplate.d.ts +0 -0
  337. /package/lib/{src → cjs/src}/narratives/templates/typescript/PregnancyTemplate.js +0 -0
  338. /package/lib/{src → cjs/src}/narratives/templates/typescript/ProblemListTemplate.d.ts +0 -0
  339. /package/lib/{src → cjs/src}/narratives/templates/typescript/ProblemListTemplate.js +0 -0
  340. /package/lib/{src → cjs/src}/narratives/templates/typescript/SocialHistoryTemplate.d.ts +0 -0
  341. /package/lib/{src → cjs/src}/narratives/templates/typescript/SocialHistoryTemplate.js +0 -0
  342. /package/lib/{src → cjs/src}/narratives/templates/typescript/TemplateUtilities.d.ts +0 -0
  343. /package/lib/{src → cjs/src}/narratives/templates/typescript/TemplateUtilities.js +0 -0
  344. /package/lib/{src → cjs/src}/narratives/templates/typescript/TypeScriptTemplateMapper.d.ts +0 -0
  345. /package/lib/{src → cjs/src}/narratives/templates/typescript/TypeScriptTemplateMapper.js +0 -0
  346. /package/lib/{src → cjs/src}/narratives/templates/typescript/VitalSignsTemplate.d.ts +0 -0
  347. /package/lib/{src → cjs/src}/narratives/templates/typescript/VitalSignsTemplate.js +0 -0
  348. /package/lib/{src → cjs/src}/narratives/templates/typescript/interfaces/ITemplate.d.ts +0 -0
  349. /package/lib/{src → cjs/src}/narratives/templates/typescript/interfaces/ITemplate.js +0 -0
  350. /package/lib/{src → cjs/src}/profiles/ips_resource_profile_registry.d.ts +0 -0
  351. /package/lib/{src → cjs/src}/profiles/ips_resource_profile_registry.js +0 -0
  352. /package/lib/{src → cjs/src}/structures/ips_mandatory_sections.d.ts +0 -0
  353. /package/lib/{src → cjs/src}/structures/ips_mandatory_sections.js +0 -0
  354. /package/lib/{src → cjs/src}/structures/ips_recommended_sections.d.ts +0 -0
  355. /package/lib/{src → cjs/src}/structures/ips_recommended_sections.js +0 -0
  356. /package/lib/{src → cjs/src}/structures/ips_resource_profile.d.ts +0 -0
  357. /package/lib/{src → cjs/src}/structures/ips_resource_profile.js +0 -0
  358. /package/lib/{src → cjs/src}/structures/ips_section_loinc_codes.d.ts +0 -0
  359. /package/lib/{src → cjs/src}/structures/ips_section_loinc_codes.js +0 -0
  360. /package/lib/{src → cjs/src}/structures/ips_section_resource_map.d.ts +0 -0
  361. /package/lib/{src → cjs/src}/structures/ips_section_resource_map.js +0 -0
  362. /package/lib/{src → cjs/src}/structures/ips_sections.d.ts +0 -0
  363. /package/lib/{src → cjs/src}/structures/ips_sections.js +0 -0
  364. /package/lib/{src → cjs/src}/types/partials/Address.d.ts +0 -0
  365. /package/lib/{src → cjs/src}/types/partials/Address.js +0 -0
  366. /package/lib/{src → cjs/src}/types/partials/AllergyIntoleranceReaction.d.ts +0 -0
  367. /package/lib/{src → cjs/src}/types/partials/AllergyIntoleranceReaction.js +0 -0
  368. /package/lib/{src → cjs/src}/types/partials/Annotation.d.ts +0 -0
  369. /package/lib/{src → cjs/src}/types/partials/Annotation.js +0 -0
  370. /package/lib/{src → cjs/src}/types/partials/Attachment.d.ts +0 -0
  371. /package/lib/{src → cjs/src}/types/partials/Attachment.js +0 -0
  372. /package/lib/{src → cjs/src}/types/partials/BundleEntry.d.ts +0 -0
  373. /package/lib/{src → cjs/src}/types/partials/BundleEntry.js +0 -0
  374. /package/lib/{src → cjs/src}/types/partials/BundleLink.d.ts +0 -0
  375. /package/lib/{src → cjs/src}/types/partials/BundleLink.js +0 -0
  376. /package/lib/{src → cjs/src}/types/partials/BundleRequest.d.ts +0 -0
  377. /package/lib/{src → cjs/src}/types/partials/BundleRequest.js +0 -0
  378. /package/lib/{src → cjs/src}/types/partials/BundleResponse.d.ts +0 -0
  379. /package/lib/{src → cjs/src}/types/partials/BundleResponse.js +0 -0
  380. /package/lib/{src → cjs/src}/types/partials/BundleSearch.d.ts +0 -0
  381. /package/lib/{src → cjs/src}/types/partials/BundleSearch.js +0 -0
  382. /package/lib/{src → cjs/src}/types/partials/CarePlanActivity.d.ts +0 -0
  383. /package/lib/{src → cjs/src}/types/partials/CarePlanActivity.js +0 -0
  384. /package/lib/{src → cjs/src}/types/partials/CarePlanDetail.d.ts +0 -0
  385. /package/lib/{src → cjs/src}/types/partials/CarePlanDetail.js +0 -0
  386. /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionFinding.d.ts +0 -0
  387. /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionFinding.js +0 -0
  388. /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionInvestigation.d.ts +0 -0
  389. /package/lib/{src → cjs/src}/types/partials/ClinicalImpressionInvestigation.js +0 -0
  390. /package/lib/{src → cjs/src}/types/partials/CodeableConcept.d.ts +0 -0
  391. /package/lib/{src → cjs/src}/types/partials/CodeableConcept.js +0 -0
  392. /package/lib/{src → cjs/src}/types/partials/CodeableReference.d.ts +0 -0
  393. /package/lib/{src → cjs/src}/types/partials/CodeableReference.js +0 -0
  394. /package/lib/{src → cjs/src}/types/partials/Coding.d.ts +0 -0
  395. /package/lib/{src → cjs/src}/types/partials/Coding.js +0 -0
  396. /package/lib/{src → cjs/src}/types/partials/CompositionAttester.d.ts +0 -0
  397. /package/lib/{src → cjs/src}/types/partials/CompositionAttester.js +0 -0
  398. /package/lib/{src → cjs/src}/types/partials/CompositionEvent.d.ts +0 -0
  399. /package/lib/{src → cjs/src}/types/partials/CompositionEvent.js +0 -0
  400. /package/lib/{src → cjs/src}/types/partials/CompositionRelatesTo.d.ts +0 -0
  401. /package/lib/{src → cjs/src}/types/partials/CompositionRelatesTo.js +0 -0
  402. /package/lib/{src → cjs/src}/types/partials/CompositionSection.d.ts +0 -0
  403. /package/lib/{src → cjs/src}/types/partials/CompositionSection.js +0 -0
  404. /package/lib/{src → cjs/src}/types/partials/ConditionEvidence.d.ts +0 -0
  405. /package/lib/{src → cjs/src}/types/partials/ConditionEvidence.js +0 -0
  406. /package/lib/{src → cjs/src}/types/partials/ConditionStage.d.ts +0 -0
  407. /package/lib/{src → cjs/src}/types/partials/ConditionStage.js +0 -0
  408. /package/lib/{src → cjs/src}/types/partials/ConsentActor.d.ts +0 -0
  409. /package/lib/{src → cjs/src}/types/partials/ConsentActor.js +0 -0
  410. /package/lib/{src → cjs/src}/types/partials/ConsentData.d.ts +0 -0
  411. /package/lib/{src → cjs/src}/types/partials/ConsentData.js +0 -0
  412. /package/lib/{src → cjs/src}/types/partials/ConsentPolicy.d.ts +0 -0
  413. /package/lib/{src → cjs/src}/types/partials/ConsentPolicy.js +0 -0
  414. /package/lib/{src → cjs/src}/types/partials/ConsentProvision.d.ts +0 -0
  415. /package/lib/{src → cjs/src}/types/partials/ConsentProvision.js +0 -0
  416. /package/lib/{src → cjs/src}/types/partials/ConsentVerification.d.ts +0 -0
  417. /package/lib/{src → cjs/src}/types/partials/ConsentVerification.js +0 -0
  418. /package/lib/{src → cjs/src}/types/partials/ContactDetail.d.ts +0 -0
  419. /package/lib/{src → cjs/src}/types/partials/ContactDetail.js +0 -0
  420. /package/lib/{src → cjs/src}/types/partials/ContactPoint.d.ts +0 -0
  421. /package/lib/{src → cjs/src}/types/partials/ContactPoint.js +0 -0
  422. /package/lib/{src → cjs/src}/types/partials/Contributor.d.ts +0 -0
  423. /package/lib/{src → cjs/src}/types/partials/Contributor.js +0 -0
  424. /package/lib/{src → cjs/src}/types/partials/DataRequirement.d.ts +0 -0
  425. /package/lib/{src → cjs/src}/types/partials/DataRequirement.js +0 -0
  426. /package/lib/{src → cjs/src}/types/partials/DataRequirementCodeFilter.d.ts +0 -0
  427. /package/lib/{src → cjs/src}/types/partials/DataRequirementCodeFilter.js +0 -0
  428. /package/lib/{src → cjs/src}/types/partials/DataRequirementDateFilter.d.ts +0 -0
  429. /package/lib/{src → cjs/src}/types/partials/DataRequirementDateFilter.js +0 -0
  430. /package/lib/{src → cjs/src}/types/partials/DataRequirementSort.d.ts +0 -0
  431. /package/lib/{src → cjs/src}/types/partials/DataRequirementSort.js +0 -0
  432. /package/lib/{src → cjs/src}/types/partials/DeviceDeviceName.d.ts +0 -0
  433. /package/lib/{src → cjs/src}/types/partials/DeviceDeviceName.js +0 -0
  434. /package/lib/{src → cjs/src}/types/partials/DeviceProperty.d.ts +0 -0
  435. /package/lib/{src → cjs/src}/types/partials/DeviceProperty.js +0 -0
  436. /package/lib/{src → cjs/src}/types/partials/DeviceSpecialization.d.ts +0 -0
  437. /package/lib/{src → cjs/src}/types/partials/DeviceSpecialization.js +0 -0
  438. /package/lib/{src → cjs/src}/types/partials/DeviceUdiCarrier.d.ts +0 -0
  439. /package/lib/{src → cjs/src}/types/partials/DeviceUdiCarrier.js +0 -0
  440. /package/lib/{src → cjs/src}/types/partials/DeviceVersion.d.ts +0 -0
  441. /package/lib/{src → cjs/src}/types/partials/DeviceVersion.js +0 -0
  442. /package/lib/{src → cjs/src}/types/partials/DiagnosticReportMedia.d.ts +0 -0
  443. /package/lib/{src → cjs/src}/types/partials/DiagnosticReportMedia.js +0 -0
  444. /package/lib/{src → cjs/src}/types/partials/Dosage.d.ts +0 -0
  445. /package/lib/{src → cjs/src}/types/partials/Dosage.js +0 -0
  446. /package/lib/{src → cjs/src}/types/partials/DosageDoseAndRate.d.ts +0 -0
  447. /package/lib/{src → cjs/src}/types/partials/DosageDoseAndRate.js +0 -0
  448. /package/lib/{src → cjs/src}/types/partials/Expression.d.ts +0 -0
  449. /package/lib/{src → cjs/src}/types/partials/Expression.js +0 -0
  450. /package/lib/{src → cjs/src}/types/partials/Extension.d.ts +0 -0
  451. /package/lib/{src → cjs/src}/types/partials/Extension.js +0 -0
  452. /package/lib/{src → cjs/src}/types/partials/FamilyMemberHistoryCondition.d.ts +0 -0
  453. /package/lib/{src → cjs/src}/types/partials/FamilyMemberHistoryCondition.js +0 -0
  454. /package/lib/{src → cjs/src}/types/partials/HumanName.d.ts +0 -0
  455. /package/lib/{src → cjs/src}/types/partials/HumanName.js +0 -0
  456. /package/lib/{src → cjs/src}/types/partials/Identifier.d.ts +0 -0
  457. /package/lib/{src → cjs/src}/types/partials/Identifier.js +0 -0
  458. /package/lib/{src → cjs/src}/types/partials/ImmunizationEducation.d.ts +0 -0
  459. /package/lib/{src → cjs/src}/types/partials/ImmunizationEducation.js +0 -0
  460. /package/lib/{src → cjs/src}/types/partials/ImmunizationPerformer.d.ts +0 -0
  461. /package/lib/{src → cjs/src}/types/partials/ImmunizationPerformer.js +0 -0
  462. /package/lib/{src → cjs/src}/types/partials/ImmunizationProtocolApplied.d.ts +0 -0
  463. /package/lib/{src → cjs/src}/types/partials/ImmunizationProtocolApplied.js +0 -0
  464. /package/lib/{src → cjs/src}/types/partials/ImmunizationReaction.d.ts +0 -0
  465. /package/lib/{src → cjs/src}/types/partials/ImmunizationReaction.js +0 -0
  466. /package/lib/{src → cjs/src}/types/partials/MedicationBatch.d.ts +0 -0
  467. /package/lib/{src → cjs/src}/types/partials/MedicationBatch.js +0 -0
  468. /package/lib/{src → cjs/src}/types/partials/MedicationIngredient.d.ts +0 -0
  469. /package/lib/{src → cjs/src}/types/partials/MedicationIngredient.js +0 -0
  470. /package/lib/{src → cjs/src}/types/partials/MedicationRequestDispenseRequest.d.ts +0 -0
  471. /package/lib/{src → cjs/src}/types/partials/MedicationRequestDispenseRequest.js +0 -0
  472. /package/lib/{src → cjs/src}/types/partials/MedicationRequestInitialFill.d.ts +0 -0
  473. /package/lib/{src → cjs/src}/types/partials/MedicationRequestInitialFill.js +0 -0
  474. /package/lib/{src → cjs/src}/types/partials/MedicationRequestSubstitution.d.ts +0 -0
  475. /package/lib/{src → cjs/src}/types/partials/MedicationRequestSubstitution.js +0 -0
  476. /package/lib/{src → cjs/src}/types/partials/Meta.d.ts +0 -0
  477. /package/lib/{src → cjs/src}/types/partials/Meta.js +0 -0
  478. /package/lib/{src → cjs/src}/types/partials/Money.d.ts +0 -0
  479. /package/lib/{src → cjs/src}/types/partials/Money.js +0 -0
  480. /package/lib/{src → cjs/src}/types/partials/Narrative.d.ts +0 -0
  481. /package/lib/{src → cjs/src}/types/partials/Narrative.js +0 -0
  482. /package/lib/{src → cjs/src}/types/partials/ObservationComponent.d.ts +0 -0
  483. /package/lib/{src → cjs/src}/types/partials/ObservationComponent.js +0 -0
  484. /package/lib/{src → cjs/src}/types/partials/ObservationReferenceRange.d.ts +0 -0
  485. /package/lib/{src → cjs/src}/types/partials/ObservationReferenceRange.js +0 -0
  486. /package/lib/{src → cjs/src}/types/partials/OrganizationContact.d.ts +0 -0
  487. /package/lib/{src → cjs/src}/types/partials/OrganizationContact.js +0 -0
  488. /package/lib/{src → cjs/src}/types/partials/ParameterDefinition.d.ts +0 -0
  489. /package/lib/{src → cjs/src}/types/partials/ParameterDefinition.js +0 -0
  490. /package/lib/{src → cjs/src}/types/partials/PatientCommunication.d.ts +0 -0
  491. /package/lib/{src → cjs/src}/types/partials/PatientCommunication.js +0 -0
  492. /package/lib/{src → cjs/src}/types/partials/PatientContact.d.ts +0 -0
  493. /package/lib/{src → cjs/src}/types/partials/PatientContact.js +0 -0
  494. /package/lib/{src → cjs/src}/types/partials/PatientLink.d.ts +0 -0
  495. /package/lib/{src → cjs/src}/types/partials/PatientLink.js +0 -0
  496. /package/lib/{src → cjs/src}/types/partials/Period.d.ts +0 -0
  497. /package/lib/{src → cjs/src}/types/partials/Period.js +0 -0
  498. /package/lib/{src → cjs/src}/types/partials/ProcedureFocalDevice.d.ts +0 -0
  499. /package/lib/{src → cjs/src}/types/partials/ProcedureFocalDevice.js +0 -0
  500. /package/lib/{src → cjs/src}/types/partials/ProcedurePerformer.d.ts +0 -0
  501. /package/lib/{src → cjs/src}/types/partials/ProcedurePerformer.js +0 -0
  502. /package/lib/{src → cjs/src}/types/partials/Quantity.d.ts +0 -0
  503. /package/lib/{src → cjs/src}/types/partials/Quantity.js +0 -0
  504. /package/lib/{src → cjs/src}/types/partials/Range.d.ts +0 -0
  505. /package/lib/{src → cjs/src}/types/partials/Range.js +0 -0
  506. /package/lib/{src → cjs/src}/types/partials/Ratio.d.ts +0 -0
  507. /package/lib/{src → cjs/src}/types/partials/Ratio.js +0 -0
  508. /package/lib/{src → cjs/src}/types/partials/RatioRange.d.ts +0 -0
  509. /package/lib/{src → cjs/src}/types/partials/RatioRange.js +0 -0
  510. /package/lib/{src → cjs/src}/types/partials/Reference.d.ts +0 -0
  511. /package/lib/{src → cjs/src}/types/partials/Reference.js +0 -0
  512. /package/lib/{src → cjs/src}/types/partials/RelatedArtifact.d.ts +0 -0
  513. /package/lib/{src → cjs/src}/types/partials/RelatedArtifact.js +0 -0
  514. /package/lib/{src → cjs/src}/types/partials/SampledData.d.ts +0 -0
  515. /package/lib/{src → cjs/src}/types/partials/SampledData.js +0 -0
  516. /package/lib/{src → cjs/src}/types/partials/Signature.d.ts +0 -0
  517. /package/lib/{src → cjs/src}/types/partials/Signature.js +0 -0
  518. /package/lib/{src → cjs/src}/types/partials/Timing.d.ts +0 -0
  519. /package/lib/{src → cjs/src}/types/partials/Timing.js +0 -0
  520. /package/lib/{src → cjs/src}/types/partials/TimingRepeat.d.ts +0 -0
  521. /package/lib/{src → cjs/src}/types/partials/TimingRepeat.js +0 -0
  522. /package/lib/{src → cjs/src}/types/partials/TriggerDefinition.d.ts +0 -0
  523. /package/lib/{src → cjs/src}/types/partials/TriggerDefinition.js +0 -0
  524. /package/lib/{src → cjs/src}/types/partials/UsageContext.d.ts +0 -0
  525. /package/lib/{src → cjs/src}/types/partials/UsageContext.js +0 -0
  526. /package/lib/{src → cjs/src}/types/resources/AllergyIntolerance.d.ts +0 -0
  527. /package/lib/{src → cjs/src}/types/resources/AllergyIntolerance.js +0 -0
  528. /package/lib/{src → cjs/src}/types/resources/Bundle.d.ts +0 -0
  529. /package/lib/{src → cjs/src}/types/resources/Bundle.js +0 -0
  530. /package/lib/{src → cjs/src}/types/resources/CarePlan.d.ts +0 -0
  531. /package/lib/{src → cjs/src}/types/resources/CarePlan.js +0 -0
  532. /package/lib/{src → cjs/src}/types/resources/ClinicalImpression.d.ts +0 -0
  533. /package/lib/{src → cjs/src}/types/resources/ClinicalImpression.js +0 -0
  534. /package/lib/{src → cjs/src}/types/resources/Composition.d.ts +0 -0
  535. /package/lib/{src → cjs/src}/types/resources/Composition.js +0 -0
  536. /package/lib/{src → cjs/src}/types/resources/Condition.d.ts +0 -0
  537. /package/lib/{src → cjs/src}/types/resources/Condition.js +0 -0
  538. /package/lib/{src → cjs/src}/types/resources/Consent.d.ts +0 -0
  539. /package/lib/{src → cjs/src}/types/resources/Consent.js +0 -0
  540. /package/lib/{src → cjs/src}/types/resources/Device.d.ts +0 -0
  541. /package/lib/{src → cjs/src}/types/resources/Device.js +0 -0
  542. /package/lib/{src → cjs/src}/types/resources/DeviceUseStatement.d.ts +0 -0
  543. /package/lib/{src → cjs/src}/types/resources/DeviceUseStatement.js +0 -0
  544. /package/lib/{src → cjs/src}/types/resources/DiagnosticReport.d.ts +0 -0
  545. /package/lib/{src → cjs/src}/types/resources/DiagnosticReport.js +0 -0
  546. /package/lib/{src → cjs/src}/types/resources/DomainResource.d.ts +0 -0
  547. /package/lib/{src → cjs/src}/types/resources/DomainResource.js +0 -0
  548. /package/lib/{src → cjs/src}/types/resources/FamilyMemberHistory.d.ts +0 -0
  549. /package/lib/{src → cjs/src}/types/resources/FamilyMemberHistory.js +0 -0
  550. /package/lib/{src → cjs/src}/types/resources/Immunization.d.ts +0 -0
  551. /package/lib/{src → cjs/src}/types/resources/Immunization.js +0 -0
  552. /package/lib/{src → cjs/src}/types/resources/Medication.d.ts +0 -0
  553. /package/lib/{src → cjs/src}/types/resources/Medication.js +0 -0
  554. /package/lib/{src → cjs/src}/types/resources/MedicationRequest.d.ts +0 -0
  555. /package/lib/{src → cjs/src}/types/resources/MedicationRequest.js +0 -0
  556. /package/lib/{src → cjs/src}/types/resources/MedicationStatement.d.ts +0 -0
  557. /package/lib/{src → cjs/src}/types/resources/MedicationStatement.js +0 -0
  558. /package/lib/{src → cjs/src}/types/resources/Observation.d.ts +0 -0
  559. /package/lib/{src → cjs/src}/types/resources/Observation.js +0 -0
  560. /package/lib/{src → cjs/src}/types/resources/Organization.d.ts +0 -0
  561. /package/lib/{src → cjs/src}/types/resources/Organization.js +0 -0
  562. /package/lib/{src → cjs/src}/types/resources/Patient.d.ts +0 -0
  563. /package/lib/{src → cjs/src}/types/resources/Patient.js +0 -0
  564. /package/lib/{src → cjs/src}/types/resources/Procedure.d.ts +0 -0
  565. /package/lib/{src → cjs/src}/types/resources/Procedure.js +0 -0
  566. /package/lib/{src → cjs/src}/types/simpleTypes/Base64Binary.d.ts +0 -0
  567. /package/lib/{src → cjs/src}/types/simpleTypes/Base64Binary.js +0 -0
  568. /package/lib/{src → cjs/src}/types/simpleTypes/Canonical.d.ts +0 -0
  569. /package/lib/{src → cjs/src}/types/simpleTypes/Canonical.js +0 -0
  570. /package/lib/{src → cjs/src}/types/simpleTypes/Date.d.ts +0 -0
  571. /package/lib/{src → cjs/src}/types/simpleTypes/Date.js +0 -0
  572. /package/lib/{src → cjs/src}/types/simpleTypes/DateTime.d.ts +0 -0
  573. /package/lib/{src → cjs/src}/types/simpleTypes/DateTime.js +0 -0
  574. /package/lib/{src → cjs/src}/types/simpleTypes/Decimal.d.ts +0 -0
  575. /package/lib/{src → cjs/src}/types/simpleTypes/Decimal.js +0 -0
  576. /package/lib/{src → cjs/src}/types/simpleTypes/Id.d.ts +0 -0
  577. /package/lib/{src → cjs/src}/types/simpleTypes/Id.js +0 -0
  578. /package/lib/{src → cjs/src}/types/simpleTypes/Instant.d.ts +0 -0
  579. /package/lib/{src → cjs/src}/types/simpleTypes/Instant.js +0 -0
  580. /package/lib/{src → cjs/src}/types/simpleTypes/Int.d.ts +0 -0
  581. /package/lib/{src → cjs/src}/types/simpleTypes/Int.js +0 -0
  582. /package/lib/{src → cjs/src}/types/simpleTypes/Markdown.d.ts +0 -0
  583. /package/lib/{src → cjs/src}/types/simpleTypes/Markdown.js +0 -0
  584. /package/lib/{src → cjs/src}/types/simpleTypes/Oid.d.ts +0 -0
  585. /package/lib/{src → cjs/src}/types/simpleTypes/Oid.js +0 -0
  586. /package/lib/{src → cjs/src}/types/simpleTypes/ResourceContainer.d.ts +0 -0
  587. /package/lib/{src → cjs/src}/types/simpleTypes/ResourceContainer.js +0 -0
  588. /package/lib/{src → cjs/src}/types/simpleTypes/Time.d.ts +0 -0
  589. /package/lib/{src → cjs/src}/types/simpleTypes/Time.js +0 -0
  590. /package/lib/{src → cjs/src}/types/simpleTypes/UnsignedInt.d.ts +0 -0
  591. /package/lib/{src → cjs/src}/types/simpleTypes/UnsignedInt.js +0 -0
  592. /package/lib/{src → cjs/src}/types/simpleTypes/Uri.d.ts +0 -0
  593. /package/lib/{src → cjs/src}/types/simpleTypes/Uri.js +0 -0
  594. /package/lib/{src → cjs/src}/types/simpleTypes/Url.d.ts +0 -0
  595. /package/lib/{src → cjs/src}/types/simpleTypes/Url.js +0 -0
  596. /package/lib/{src → cjs/src}/types/simpleTypes/Uuid.d.ts +0 -0
  597. /package/lib/{src → cjs/src}/types/simpleTypes/Uuid.js +0 -0
  598. /package/lib/{src → cjs/src}/types/simpleTypes/Xhtml.d.ts +0 -0
  599. /package/lib/{src → cjs/src}/types/simpleTypes/Xhtml.js +0 -0
  600. /package/lib/{test → cjs/test}/fhir-summary-bundle/fhir-summary-bundle.test.d.ts +0 -0
  601. /package/lib/{test → cjs/test}/fhir-summary-bundle/fhir-summary-bundle.test.js +0 -0
  602. /package/lib/{test → cjs/test}/ips-test/ips.test.d.ts +0 -0
  603. /package/lib/{test → cjs/test}/ips-test/ips.test.js +0 -0
  604. /package/lib/{test → cjs/test}/narrativeGenerator/narrativeGenerator.test.d.ts +0 -0
  605. /package/lib/{test → cjs/test}/narrativeGenerator/narrativeGenerator.test.js +0 -0
  606. /package/lib/{test → cjs/test}/summary.test.d.ts +0 -0
  607. /package/lib/{test → cjs/test}/summary.test.js +0 -0
  608. /package/lib/{test → cjs/test}/utilities/testHelpers.d.ts +0 -0
  609. /package/lib/{test → cjs/test}/utilities/testHelpers.js +0 -0
@@ -0,0 +1,450 @@
1
+ import { IPSResourceProfileRegistry } from "../src/profiles/ips_resource_profile_registry";
2
+ import { ComprehensiveIPSCompositionBuilder } from "../src/generators/fhir_summary_generator";
3
+ import { IPSSections } from "../src/structures/ips_sections";
4
+ import { IPS_SECTION_LOINC_CODES } from "../src/structures/ips_section_loinc_codes";
5
+ describe('ComprehensiveIPSCompositionBuilder', () => {
6
+ // Mock patient resource
7
+ const mockPatient = {
8
+ resourceType: 'Patient',
9
+ id: 'example-patient',
10
+ identifier: [{
11
+ system: 'http://icanbwell.com',
12
+ value: '12345'
13
+ }],
14
+ name: [{
15
+ family: 'Doe',
16
+ given: ['John']
17
+ }],
18
+ gender: 'male',
19
+ birthDate: '1980-01-01'
20
+ };
21
+ // Mock resources for different sections
22
+ const mockAllergies = [{
23
+ resourceType: 'AllergyIntolerance',
24
+ id: 'allergy1',
25
+ clinicalStatus: {
26
+ coding: [{
27
+ "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
28
+ code: 'active'
29
+ }]
30
+ },
31
+ code: {
32
+ coding: [{
33
+ "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
34
+ "code": "7980",
35
+ "display": "Penicillin G"
36
+ }]
37
+ },
38
+ patient: { reference: `Patient/${mockPatient.id}` },
39
+ }];
40
+ const mockMedications = [{
41
+ resourceType: 'MedicationRequest',
42
+ id: 'med1',
43
+ status: 'active',
44
+ medicationReference: { display: 'Test Medication' },
45
+ subject: { reference: `Patient/${mockPatient.id}` },
46
+ intent: 'order',
47
+ }];
48
+ const mockConditions = [
49
+ {
50
+ resourceType: 'Condition',
51
+ id: 'e6.ToRrlZE9pwFAPiLa6E2nRUitzucwMQODU8OsVpNGA3',
52
+ clinicalStatus: {
53
+ coding: [
54
+ {
55
+ system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
56
+ code: 'resolved',
57
+ display: 'Resolved'
58
+ }
59
+ ],
60
+ text: 'Resolved'
61
+ },
62
+ verificationStatus: {
63
+ coding: [
64
+ {
65
+ system: 'http://terminology.hl7.org/CodeSystem/condition-ver-status',
66
+ code: 'confirmed',
67
+ display: 'Confirmed'
68
+ }
69
+ ],
70
+ text: 'Confirmed'
71
+ },
72
+ category: [
73
+ {
74
+ coding: [
75
+ {
76
+ system: 'http://terminology.hl7.org/CodeSystem/condition-category',
77
+ code: 'problem-list-item',
78
+ display: 'Problem List Item'
79
+ }
80
+ ],
81
+ text: 'Problem List Item'
82
+ }
83
+ ],
84
+ code: {
85
+ coding: [
86
+ {
87
+ system: 'http://hl7.org/fhir/sid/icd-10-cm',
88
+ code: 'J18.9',
89
+ display: 'Pneumonia, unspecified organism'
90
+ }
91
+ ],
92
+ text: 'Pneumonia'
93
+ },
94
+ subject: {
95
+ reference: 'Patient/example-patient',
96
+ display: 'FHIR, Automation'
97
+ },
98
+ onsetDateTime: '2016-12-05',
99
+ abatementDateTime: '2016-12-20',
100
+ recordedDate: '2020-03-04'
101
+ },
102
+ {
103
+ resourceType: 'Condition',
104
+ id: 'eK.v1ndIFKTZm1ve0TRFa2byekZbTkS0xnsoQOqN-o5I3',
105
+ clinicalStatus: {
106
+ coding: [
107
+ {
108
+ system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
109
+ code: 'active',
110
+ display: 'Active'
111
+ }
112
+ ],
113
+ text: 'Active'
114
+ },
115
+ verificationStatus: {
116
+ coding: [
117
+ {
118
+ system: 'http://terminology.hl7.org/CodeSystem/condition-ver-status',
119
+ code: 'confirmed',
120
+ display: 'Confirmed'
121
+ }
122
+ ],
123
+ text: 'Confirmed'
124
+ },
125
+ category: [
126
+ {
127
+ coding: [
128
+ {
129
+ system: 'http://terminology.hl7.org/CodeSystem/condition-category',
130
+ code: 'problem-list-item',
131
+ display: 'Problem List Item'
132
+ }
133
+ ],
134
+ text: 'Problem List Item'
135
+ }
136
+ ],
137
+ code: {
138
+ coding: [
139
+ {
140
+ system: 'http://hl7.org/fhir/sid/icd-10-cm',
141
+ code: 'I10',
142
+ display: 'Essential (primary) hypertension'
143
+ }
144
+ ],
145
+ text: 'Essential hypertension'
146
+ },
147
+ subject: {
148
+ reference: 'Patient/example-patient',
149
+ display: 'FHIR, Automation'
150
+ },
151
+ onsetDateTime: '2020-03-04',
152
+ recordedDate: '2020-03-04',
153
+ severity: {
154
+ text: 'Med'
155
+ }
156
+ }
157
+ ];
158
+ const mockImmunizations = [
159
+ {
160
+ resourceType: 'Immunization',
161
+ id: 'emAKcOP2creGzeLlEt5R4MBF6oYm0wzxJ9aWwOTiOqHI3',
162
+ identifier: [
163
+ {
164
+ use: 'usual',
165
+ system: 'urn:oid:1.2.840.114350.1.13.1.1.7.2.768076',
166
+ value: '1000000246'
167
+ }
168
+ ],
169
+ status: 'completed',
170
+ vaccineCode: {
171
+ coding: [
172
+ {
173
+ system: 'http://hl7.org/fhir/sid/cvx',
174
+ code: '03'
175
+ }
176
+ ],
177
+ text: 'MMR'
178
+ },
179
+ patient: {
180
+ reference: 'Patient/example-patient',
181
+ display: 'FHIR, Automation'
182
+ },
183
+ occurrenceDateTime: '2000-03-04',
184
+ primarySource: false,
185
+ reportOrigin: {
186
+ coding: [
187
+ {
188
+ system: 'urn:oid:1.2.840.114350.1.13.1.1.7.10.768076.4082',
189
+ code: '1',
190
+ display: 'Patient reported'
191
+ }
192
+ ],
193
+ text: 'Patient reported'
194
+ },
195
+ location: {
196
+ display: 'right arm'
197
+ },
198
+ performer: [
199
+ {
200
+ function_: {
201
+ coding: [
202
+ {
203
+ system: 'http://terminology.hl7.org/CodeSystem/v2-0443',
204
+ code: 'AP',
205
+ display: 'Administering Provider'
206
+ }
207
+ ],
208
+ text: 'Administering Provider'
209
+ },
210
+ actor: {
211
+ reference: 'Practitioner/example-practitioner',
212
+ type: 'Practitioner',
213
+ display: 'Starter Provider'
214
+ }
215
+ }
216
+ ],
217
+ note: [
218
+ {
219
+ text: 'comment on MMR'
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ resourceType: 'Immunization',
225
+ id: 'emAKcOP2creGzeLlEt5R4MFyM.TLHisGiY2OL7vh-KKI3',
226
+ identifier: [
227
+ {
228
+ use: 'usual',
229
+ system: 'urn:oid:1.2.840.114350.1.13.1.1.7.2.768076',
230
+ value: '1000000244'
231
+ }
232
+ ],
233
+ status: 'completed',
234
+ vaccineCode: {
235
+ coding: [
236
+ {
237
+ system: 'http://hl7.org/fhir/sid/cvx',
238
+ code: '107'
239
+ }
240
+ ],
241
+ text: 'DTaP, Unspecified Formulation (IST) Imm-rx'
242
+ },
243
+ patient: {
244
+ reference: 'Patient/example-patient',
245
+ display: 'FHIR, Automation'
246
+ },
247
+ occurrenceDateTime: '2020-03-04T18:56:00Z',
248
+ primarySource: true,
249
+ location: {
250
+ display: 'connectathon-testing for EpicConnect and Pulsar testing only'
251
+ },
252
+ manufacturer: {
253
+ display: 'Merck, Sharp, Dohme'
254
+ },
255
+ lotNumber: '486745',
256
+ expirationDate: '2030-03-04',
257
+ site: {
258
+ coding: [
259
+ {
260
+ system: 'urn:oid:1.2.840.114350.1.13.1.1.7.10.768076.4040',
261
+ code: '14',
262
+ display: 'Left arm'
263
+ }
264
+ ],
265
+ text: 'Left arm'
266
+ },
267
+ route: {
268
+ coding: [
269
+ {
270
+ system: 'urn:oid:1.2.840.114350.1.13.1.1.7.10.768076.4030',
271
+ code: '2',
272
+ display: 'Intramuscular'
273
+ }
274
+ ],
275
+ text: 'Intramuscular'
276
+ },
277
+ doseQuantity: {
278
+ value: 0.5,
279
+ unit: 'mL',
280
+ system: 'urn:oid:1.2.840.114350.1.13.1.1.7.10.768076.4019',
281
+ code: '1'
282
+ },
283
+ performer: [
284
+ {
285
+ function_: {
286
+ coding: [
287
+ {
288
+ system: 'http://terminology.hl7.org/CodeSystem/v2-0443',
289
+ code: 'AP',
290
+ display: 'Administering Provider'
291
+ }
292
+ ],
293
+ text: 'Administering Provider'
294
+ },
295
+ actor: {
296
+ reference: 'Practitioner/example-practitioner',
297
+ type: 'Practitioner',
298
+ display: 'Emily Williams, MD'
299
+ }
300
+ }
301
+ ],
302
+ note: [
303
+ {
304
+ text: 'comment on DTAP'
305
+ }
306
+ ]
307
+ }
308
+ ];
309
+ // Mock validation method
310
+ const mockValidateResource = jest.spyOn(IPSResourceProfileRegistry, 'validateResource');
311
+ beforeEach(() => {
312
+ mockValidateResource.mockClear();
313
+ mockValidateResource.mockReturnValue(true);
314
+ });
315
+ describe('constructor', () => {
316
+ it('should create an instance with a valid patient', () => {
317
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
318
+ expect(builder).toBeTruthy();
319
+ });
320
+ it('should throw an error if patient resource is invalid', () => {
321
+ // mockValidateResource.mockReturnValueOnce(false);
322
+ // expect(() => {
323
+ // new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
324
+ // }).toThrow('Patient resource does not meet IPS requirements');
325
+ });
326
+ });
327
+ describe('addSection', () => {
328
+ it('should add a section with valid resources', () => {
329
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
330
+ const result = builder.addSection(IPSSections.ALLERGIES, mockAllergies, 'America/New_York');
331
+ expect(result).toBe(builder);
332
+ });
333
+ it('should filter out invalid resources', () => {
334
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
335
+ // Should throw error when trying to build with no valid sections
336
+ expect(() => {
337
+ builder.build('America/New_York');
338
+ }).toThrow(/Missing mandatory IPS sections/);
339
+ });
340
+ });
341
+ describe('build', () => {
342
+ const timezone = 'America/New_York';
343
+ it('should build a composition with all mandatory sections', () => {
344
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
345
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
346
+ builder
347
+ .addSection(IPSSections.ALLERGIES, mockAllergies, timezone)
348
+ .addSection(IPSSections.MEDICATIONS, mockMedications, timezone)
349
+ .addSection(IPSSections.PROBLEMS, mockConditions, timezone)
350
+ .addSection(IPSSections.IMMUNIZATIONS, mockImmunizations, timezone);
351
+ const sections = builder.build(timezone);
352
+ for (const section of sections) {
353
+ console.info((_c = (_b = (_a = section.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.display);
354
+ }
355
+ expect(sections.length).toBe(4);
356
+ expect((_f = (_e = (_d = sections[0].code) === null || _d === void 0 ? void 0 : _d.coding) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.code).toBe(IPS_SECTION_LOINC_CODES.AllergyIntoleranceSection);
357
+ expect((_j = (_h = (_g = sections[1].code) === null || _g === void 0 ? void 0 : _g.coding) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.code).toBe(IPS_SECTION_LOINC_CODES.MedicationSection);
358
+ expect((_m = (_l = (_k = sections[2].code) === null || _k === void 0 ? void 0 : _k.coding) === null || _l === void 0 ? void 0 : _l[0]) === null || _m === void 0 ? void 0 : _m.code).toBe(IPS_SECTION_LOINC_CODES.ProblemSection);
359
+ expect((_q = (_p = (_o = sections[3].code) === null || _o === void 0 ? void 0 : _o.coding) === null || _p === void 0 ? void 0 : _p[0]) === null || _q === void 0 ? void 0 : _q.code).toBe(IPS_SECTION_LOINC_CODES.ImmunizationSection);
360
+ });
361
+ it('should throw an error if mandatory sections are missing', () => {
362
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
363
+ // Not adding all mandatory sections
364
+ builder.addSection(IPSSections.ALLERGIES, mockAllergies, timezone);
365
+ expect(() => {
366
+ builder.build('America/New_York');
367
+ }).toThrow(/Missing mandatory IPS sections/);
368
+ });
369
+ });
370
+ describe('integration', () => {
371
+ it('should create a complete IPS composition', () => {
372
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
373
+ const timezone = 'America/New_York';
374
+ builder
375
+ .addSection(IPSSections.ALLERGIES, mockAllergies, timezone)
376
+ .addSection(IPSSections.MEDICATIONS, mockMedications, timezone)
377
+ .addSection(IPSSections.PROBLEMS, [{
378
+ resourceType: 'Condition',
379
+ id: 'condition1',
380
+ clinicalStatus: { coding: [{ code: 'active' }] },
381
+ code: { coding: [{ code: 'hypertension' }] }
382
+ }], timezone)
383
+ .addSection(IPSSections.IMMUNIZATIONS, [{
384
+ resourceType: 'Immunization',
385
+ id: 'immunization1',
386
+ status: 'completed',
387
+ vaccineCode: { coding: [{ code: 'MMR' }] }
388
+ }], timezone);
389
+ const sections = builder.build(timezone);
390
+ expect(sections.length).toBe(4);
391
+ sections.forEach(section => {
392
+ var _a, _b, _c;
393
+ expect(section.entry).toBeTruthy();
394
+ expect((_c = (_b = (_a = section.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.system).toBe('http://loinc.org');
395
+ });
396
+ });
397
+ });
398
+ describe('integration_bundle', () => {
399
+ it('should create a complete IPS composition bundle', () => {
400
+ var _a, _b, _c, _d, _e, _f, _g;
401
+ const builder = new ComprehensiveIPSCompositionBuilder().setPatient(mockPatient);
402
+ builder
403
+ .addSection(IPSSections.ALLERGIES, mockAllergies, 'America/New_York')
404
+ .addSection(IPSSections.MEDICATIONS, mockMedications, 'America/New_York')
405
+ .addSection(IPSSections.PROBLEMS, mockConditions, 'America/New_York')
406
+ .addSection(IPSSections.IMMUNIZATIONS, mockImmunizations, 'America/New_York');
407
+ const bundle = builder.build_bundle('example-organization', 'Example Organization', 'https://fhir.icanbwell.com/4_0_0/', 'America/New_York');
408
+ console.info('---- Bundle ----');
409
+ console.info(JSON.stringify(bundle, (key, value) => {
410
+ if (value === undefined) {
411
+ return undefined; // This will omit undefined properties
412
+ }
413
+ return value;
414
+ }));
415
+ console.info('-----------------');
416
+ expect(bundle.resourceType).toBe('Bundle');
417
+ expect(bundle.type).toBe('document');
418
+ expect(bundle.entry).toBeDefined();
419
+ if (bundle.entry) {
420
+ expect(bundle.entry.length).toBeGreaterThan(0);
421
+ // first entry should be the Composition resource
422
+ const composition = bundle.entry[0].resource;
423
+ expect(composition.resourceType).toBe('Composition');
424
+ expect((_c = (_b = (_a = composition.type) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.system).toBe('http://loinc.org');
425
+ expect((_f = (_e = (_d = composition.type) === null || _d === void 0 ? void 0 : _d.coding) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.code).toBe('60591-5'); // LOINC code for IPS
426
+ expect((_g = composition.subject) === null || _g === void 0 ? void 0 : _g.reference).toBe(`Patient/${mockPatient.id}`);
427
+ // check that the sections in the composition are present
428
+ expect(composition.section).toBeDefined();
429
+ console.assert(composition.section);
430
+ if (composition.section) {
431
+ expect(composition.section.length).toBeGreaterThan(0);
432
+ // check that there is NOT a patient section
433
+ const patientSection = composition.section.find(section => { var _a, _b, _c; return ((_c = (_b = (_a = section.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) === IPS_SECTION_LOINC_CODES.Patient; });
434
+ expect(patientSection).toBeUndefined();
435
+ const medicationSection = composition.section.find(section => { var _a, _b, _c; return ((_c = (_b = (_a = section.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) === IPS_SECTION_LOINC_CODES.MedicationSection; });
436
+ expect(medicationSection).toBeDefined();
437
+ const conditionSection = composition.section.find(section => { var _a, _b, _c; return ((_c = (_b = (_a = section.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) === IPS_SECTION_LOINC_CODES.ProblemSection; });
438
+ expect(conditionSection).toBeDefined();
439
+ }
440
+ // subsequent entries should be the sections
441
+ expect(bundle.entry.length).toEqual(9);
442
+ // check that each section has a valid LOINC code
443
+ bundle.entry.slice(1).forEach((entry) => {
444
+ const section = entry.resource;
445
+ expect(section.resourceType).toBeDefined();
446
+ });
447
+ }
448
+ });
449
+ });
450
+ });
@@ -0,0 +1,21 @@
1
+ import { TBundle } from "../../src/types/resources/Bundle";
2
+ /**
3
+ * Reads a narrative file based on the provided folder, code value, and section title.
4
+ * @param folder - The folder where narrative files are stored
5
+ * @param codeValue - The LOINC code value to identify the narrative file
6
+ * @param sectionTitle - The title of the section to create a filename-friendly format
7
+ */
8
+ export declare function readNarrativeFile(folder: string, codeValue: string, sectionTitle: string): string | undefined;
9
+ /**
10
+ * Compares generated HTML narratives with expected narratives.
11
+ * @param generatedHtml - The generated HTML narrative string
12
+ * @param expectedHtml - The expected HTML narrative string
13
+ */
14
+ export declare function compareNarratives(generatedHtml: string | undefined, expectedHtml: string | undefined): Promise<void>;
15
+ /**
16
+ * Compares two FHIR bundles by checking their sections and narratives.
17
+ * @param folder - The folder where narrative files are stored
18
+ * @param bundle - The generated FHIR bundle to compare
19
+ * @param expectedBundle - The expected FHIR bundle to compare against
20
+ */
21
+ export declare function compare_bundles(folder: string, bundle: TBundle, expectedBundle: TBundle): Promise<void>;
@@ -0,0 +1,129 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import fs from 'fs';
11
+ import path from 'path';
12
+ import { html as beautify } from 'js-beautify';
13
+ /**
14
+ * Beautifies HTML using js-beautify
15
+ * @param html - The input HTML string to be formatted
16
+ * @returns Beautifully formatted HTML string
17
+ */
18
+ function beautifyHtml(html) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ try {
21
+ // Preprocess HTML to fix specific cases
22
+ // Join empty <ul></ul> elements with their preceding text within table cells
23
+ const preprocessedHtml = html
24
+ .replace(/(<td>[^<]+?)[\s\r\n]+([ \t]*)<ul><\/ul>/g, '$1<ul></ul>')
25
+ .replace(/(<td>[^<]+?)<ul><\/ul>[\s\r\n]+([ \t]*)<\/td>/g, '$1<ul></ul></td>');
26
+ // Add configuration to prevent line breaks between text and adjacent elements
27
+ return beautify(preprocessedHtml, {
28
+ indent_size: 4,
29
+ wrap_line_length: 100,
30
+ preserve_newlines: true,
31
+ max_preserve_newlines: 1,
32
+ unformatted: ['ul', 'li', 'span', 'a'], // Keep these tags inline
33
+ inline: ['span', 'a', 'ul'], // Treat these tags as inline elements
34
+ content_unformatted: ['pre', 'textarea', 'td'], // Preserve content formatting in these tags
35
+ indent_inner_html: true,
36
+ extra_liners: ['body', 'html', 'head', 'table', 'tbody', 'thead', 'tr']
37
+ });
38
+ }
39
+ catch (error) {
40
+ console.error('Formatting Error:', error);
41
+ return html;
42
+ }
43
+ });
44
+ }
45
+ /**
46
+ * Reads a narrative file based on the provided folder, code value, and section title.
47
+ * @param folder - The folder where narrative files are stored
48
+ * @param codeValue - The LOINC code value to identify the narrative file
49
+ * @param sectionTitle - The title of the section to create a filename-friendly format
50
+ */
51
+ export function readNarrativeFile(folder, codeValue, sectionTitle) {
52
+ // Convert the section title to a filename-friendly format
53
+ const safeSectionTitle = sectionTitle.replace(/[^a-zA-Z0-9]/g, '_').replace(/_{2,}/g, '_');
54
+ const filename = `${codeValue}_${safeSectionTitle}.html`;
55
+ const filePath = path.join(folder, filename);
56
+ try {
57
+ return fs.readFileSync(filePath, 'utf-8');
58
+ }
59
+ catch (error) {
60
+ throw new Error(`Narrative file not found: ${filePath}: ${error}`);
61
+ }
62
+ }
63
+ /**
64
+ * Compares generated HTML narratives with expected narratives.
65
+ * @param generatedHtml - The generated HTML narrative string
66
+ * @param expectedHtml - The expected HTML narrative string
67
+ */
68
+ export function compareNarratives(generatedHtml, expectedHtml) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ if (!generatedHtml || !expectedHtml) {
71
+ throw new Error('Both generated and expected HTML narratives must be provided for comparison.');
72
+ }
73
+ // Beautify both HTML strings for comparison
74
+ const generatedFormattedHtml = yield beautifyHtml(generatedHtml);
75
+ const expectedFormattedHtml = yield beautifyHtml(expectedHtml);
76
+ // Compare the formatted HTML strings
77
+ if (generatedFormattedHtml === expectedFormattedHtml) {
78
+ console.info('Narrative matches expected output.');
79
+ }
80
+ else {
81
+ console.info('Narrative does not match expected output.');
82
+ console.info(`Generated:\n${generatedFormattedHtml}`);
83
+ console.info(`Expected:\n${expectedFormattedHtml}`);
84
+ }
85
+ expect(generatedFormattedHtml).toStrictEqual(expectedFormattedHtml);
86
+ });
87
+ }
88
+ /**
89
+ * Compares two FHIR bundles by checking their sections and narratives.
90
+ * @param folder - The folder where narrative files are stored
91
+ * @param bundle - The generated FHIR bundle to compare
92
+ * @param expectedBundle - The expected FHIR bundle to compare against
93
+ */
94
+ export function compare_bundles(folder, bundle, expectedBundle) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ var _a, _b, _c, _d, _e, _f, _g, _h;
97
+ // remove the date from the bundle for comparison
98
+ bundle.timestamp = expectedBundle.timestamp;
99
+ if (bundle.entry && ((_a = bundle.entry[0].resource) === null || _a === void 0 ? void 0 : _a.date)) {
100
+ bundle.entry[0].resource.date = (_c = (_b = expectedBundle.entry) === null || _b === void 0 ? void 0 : _b[0].resource) === null || _c === void 0 ? void 0 : _c.date;
101
+ }
102
+ // extract the div from each section and compare
103
+ const generatedSections = (_d = bundle.entry) === null || _d === void 0 ? void 0 : _d.filter((e) => { var _a; return ((_a = e.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'Composition'; }).map((e) => { var _a; return (_a = e.resource) === null || _a === void 0 ? void 0 : _a.section; }).flat().filter((s) => s);
104
+ const expectedSections = (_e = expectedBundle.entry) === null || _e === void 0 ? void 0 : _e.filter((e) => { var _a; return ((_a = e.resource) === null || _a === void 0 ? void 0 : _a.resourceType) === 'Composition'; }).map((e) => { var _a; return (_a = e.resource) === null || _a === void 0 ? void 0 : _a.section; }).flat().filter((s) => s);
105
+ // compare the div of each section
106
+ expect(generatedSections).toBeDefined();
107
+ expect(expectedSections).toBeDefined();
108
+ // const turndownService = new TurndownService();
109
+ // expect(generatedSections?.length).toBe(expectedSections?.length);
110
+ if (generatedSections && expectedSections) {
111
+ for (let i = 0; i < generatedSections.length; i++) {
112
+ const generatedSection = generatedSections[i];
113
+ console.info(`======= Comparing section ${generatedSection.title} ${i + 1}/${generatedSections.length} ====`);
114
+ const generatedDiv = (_f = generatedSection.text) === null || _f === void 0 ? void 0 : _f.div;
115
+ // Get LOINC code for the section
116
+ const codeValue = (_h = (_g = generatedSection.code) === null || _g === void 0 ? void 0 : _g.coding) === null || _h === void 0 ? void 0 : _h[0].code;
117
+ if (!codeValue) {
118
+ expect(codeValue).toBeDefined();
119
+ }
120
+ // Read narrative from file
121
+ const expectedDiv = readNarrativeFile(folder, codeValue, generatedSection.title || '');
122
+ expect(expectedDiv === null || expectedDiv === void 0 ? void 0 : expectedDiv.length).toBeGreaterThan(0);
123
+ console.info(`Using narrative from file for ${generatedSection.title}`);
124
+ yield compareNarratives(generatedDiv || '', expectedDiv || '');
125
+ }
126
+ }
127
+ // expect(bundle).toEqual(expectedBundle);
128
+ });
129
+ }
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@imranq2/fhirpatientsummary",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A template for creating npm packages using TypeScript and VSCode",
5
- "main": "./lib/index.js",
5
+ "main": "./lib/cjs/src/index.js",
6
+ "module": "./lib/esm/src/index.js",
7
+ "exports": {
8
+ "import": "./lib/esm/src/index.js",
9
+ "require": "./lib/cjs/src/index.js"
10
+ },
11
+ "types": "./lib/cjs/src/index.d.ts",
6
12
  "files": [
7
13
  "lib/**/*"
8
14
  ],
9
15
  "type": "module",
10
16
  "scripts": {
11
- "build": "tsc --project tsconfig.build.json",
17
+ "build:cjs": "tsc --project tsconfig.cjs.json",
18
+ "build:esm": "tsc --project tsconfig.esm.json",
19
+ "build": "npm run build:cjs && npm run build:esm",
12
20
  "clean": "rm -rf ./lib/",
13
21
  "cm": "cz",
14
22
  "lint": "eslint ./src/ --ext .ts --fix",