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