@smile-cdr/fhirts 2.3.0 → 2.4.0

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 (306) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/.github/workflows/npm-publish.yml +12 -6
  3. package/.github/workflows/pr-build.yml +7 -3
  4. package/.prettierignore +22 -0
  5. package/.prettierrc +10 -0
  6. package/GETTINGSTARTED.md +57 -15
  7. package/dist/FHIR-DSTU2.js +1 -1
  8. package/dist/FHIR-R3.js +3 -1
  9. package/dist/FHIR-R4/classes/account.js +1 -1
  10. package/dist/FHIR-R4/classes/activityDefinition.js +1 -1
  11. package/dist/FHIR-R4/classes/address.js +1 -1
  12. package/dist/FHIR-R4/classes/adverseEvent.js +1 -1
  13. package/dist/FHIR-R4/classes/age.js +1 -1
  14. package/dist/FHIR-R4/classes/allergyIntolerance.js +1 -1
  15. package/dist/FHIR-R4/classes/allergyIntoleranceReaction.js +1 -1
  16. package/dist/FHIR-R4/classes/appointment.js +1 -1
  17. package/dist/FHIR-R4/classes/appointmentParticipant.js +1 -1
  18. package/dist/FHIR-R4/classes/auditEvent.js +1 -1
  19. package/dist/FHIR-R4/classes/auditEventNetwork.js +1 -1
  20. package/dist/FHIR-R4/classes/biologicallyDerivedProduct.js +1 -1
  21. package/dist/FHIR-R4/classes/biologicallyDerivedProductStorage.js +1 -1
  22. package/dist/FHIR-R4/classes/bundle.js +1 -1
  23. package/dist/FHIR-R4/classes/capabilityStatement.js +1 -1
  24. package/dist/FHIR-R4/classes/capabilityStatementDocument.js +1 -1
  25. package/dist/FHIR-R4/classes/capabilityStatementInteraction.js +1 -1
  26. package/dist/FHIR-R4/classes/capabilityStatementInteraction1.js +1 -1
  27. package/dist/FHIR-R4/classes/capabilityStatementResource.js +1 -1
  28. package/dist/FHIR-R4/classes/capabilityStatementRest.js +1 -1
  29. package/dist/FHIR-R4/classes/capabilityStatementSearchParam.js +1 -1
  30. package/dist/FHIR-R4/classes/capabilityStatementSupportedMessage.js +1 -1
  31. package/dist/FHIR-R4/classes/carePlanDetail.js +1 -1
  32. package/dist/FHIR-R4/classes/careTeam.js +1 -1
  33. package/dist/FHIR-R4/classes/catalogEntry.js +1 -1
  34. package/dist/FHIR-R4/classes/catalogEntryRelatedEntry.js +1 -1
  35. package/dist/FHIR-R4/classes/chargeItem.js +1 -1
  36. package/dist/FHIR-R4/classes/chargeItemDefinition.js +1 -1
  37. package/dist/FHIR-R4/classes/claim.js +1 -1
  38. package/dist/FHIR-R4/classes/claimResponseProcessNote.js +1 -1
  39. package/dist/FHIR-R4/classes/codeSystem.js +1 -1
  40. package/dist/FHIR-R4/classes/codeSystemProperty.js +1 -1
  41. package/dist/FHIR-R4/classes/compartmentDefinition.js +1 -1
  42. package/dist/FHIR-R4/classes/composition.js +1 -1
  43. package/dist/FHIR-R4/classes/compositionAttester.js +1 -1
  44. package/dist/FHIR-R4/classes/conceptMap.js +1 -1
  45. package/dist/FHIR-R4/classes/conceptMapTarget.js +1 -1
  46. package/dist/FHIR-R4/classes/conceptMapUnmapped.js +1 -1
  47. package/dist/FHIR-R4/classes/consent.js +1 -1
  48. package/dist/FHIR-R4/classes/consentData.js +1 -1
  49. package/dist/FHIR-R4/classes/consentProvision.js +1 -1
  50. package/dist/FHIR-R4/classes/contactPoint.js +1 -1
  51. package/dist/FHIR-R4/classes/contributor.js +1 -1
  52. package/dist/FHIR-R4/classes/count.js +1 -1
  53. package/dist/FHIR-R4/classes/coverageEligibilityResponse.js +1 -1
  54. package/dist/FHIR-R4/classes/dataRequirementSort.js +1 -1
  55. package/dist/FHIR-R4/classes/detectedIssue.js +1 -1
  56. package/dist/FHIR-R4/classes/device.js +1 -1
  57. package/dist/FHIR-R4/classes/deviceDefinitionDeviceName.js +1 -1
  58. package/dist/FHIR-R4/classes/deviceDeviceName.js +1 -1
  59. package/dist/FHIR-R4/classes/deviceMetric.js +1 -1
  60. package/dist/FHIR-R4/classes/deviceMetricCalibration.js +1 -1
  61. package/dist/FHIR-R4/classes/deviceUdiCarrier.js +1 -1
  62. package/dist/FHIR-R4/classes/deviceUseStatement.js +1 -1
  63. package/dist/FHIR-R4/classes/diagnosticReport.js +1 -1
  64. package/dist/FHIR-R4/classes/distance.js +1 -1
  65. package/dist/FHIR-R4/classes/documentManifest.js +1 -1
  66. package/dist/FHIR-R4/classes/documentReference.js +1 -1
  67. package/dist/FHIR-R4/classes/documentReferenceRelatesTo.js +1 -1
  68. package/dist/FHIR-R4/classes/duration.js +1 -1
  69. package/dist/FHIR-R4/classes/effectEvidenceSynthesis.js +1 -1
  70. package/dist/FHIR-R4/classes/effectEvidenceSynthesisResultsByExposure.js +1 -1
  71. package/dist/FHIR-R4/classes/elementDefinitionBinding.js +1 -1
  72. package/dist/FHIR-R4/classes/elementDefinitionConstraint.js +1 -1
  73. package/dist/FHIR-R4/classes/elementDefinitionDiscriminator.js +1 -1
  74. package/dist/FHIR-R4/classes/elementDefinitionSlicing.js +1 -1
  75. package/dist/FHIR-R4/classes/elementDefinitionType.js +1 -1
  76. package/dist/FHIR-R4/classes/encounter.js +1 -1
  77. package/dist/FHIR-R4/classes/encounterLocation.js +1 -1
  78. package/dist/FHIR-R4/classes/encounterStatusHistory.js +1 -1
  79. package/dist/FHIR-R4/classes/endpoint.js +1 -1
  80. package/dist/FHIR-R4/classes/enrollmentResponse.js +1 -1
  81. package/dist/FHIR-R4/classes/episodeOfCare.js +1 -1
  82. package/dist/FHIR-R4/classes/episodeOfCareStatusHistory.js +1 -1
  83. package/dist/FHIR-R4/classes/eventDefinition.js +1 -1
  84. package/dist/FHIR-R4/classes/evidence.js +1 -1
  85. package/dist/FHIR-R4/classes/evidenceVariable.js +1 -1
  86. package/dist/FHIR-R4/classes/evidenceVariableCharacteristic.js +1 -1
  87. package/dist/FHIR-R4/classes/exampleScenario.js +1 -1
  88. package/dist/FHIR-R4/classes/exampleScenarioActor.js +1 -1
  89. package/dist/FHIR-R4/classes/explanationOfBenefit.js +1 -1
  90. package/dist/FHIR-R4/classes/explanationOfBenefitProcessNote.js +1 -1
  91. package/dist/FHIR-R4/classes/expression.js +1 -1
  92. package/dist/FHIR-R4/classes/familyMemberHistory.js +1 -1
  93. package/dist/FHIR-R4/classes/flag.js +1 -1
  94. package/dist/FHIR-R4/classes/goal.js +1 -1
  95. package/dist/FHIR-R4/classes/graphDefinition.js +1 -1
  96. package/dist/FHIR-R4/classes/graphDefinitionCompartment.js +1 -1
  97. package/dist/FHIR-R4/classes/group.js +1 -1
  98. package/dist/FHIR-R4/classes/guidanceResponse.js +1 -1
  99. package/dist/FHIR-R4/classes/humanName.js +1 -1
  100. package/dist/FHIR-R4/classes/identifier.js +1 -1
  101. package/dist/FHIR-R4/classes/imagingStudy.js +1 -1
  102. package/dist/FHIR-R4/classes/implementationGuide.js +1 -1
  103. package/dist/FHIR-R4/classes/implementationGuidePage.js +1 -1
  104. package/dist/FHIR-R4/classes/implementationGuideParameter.js +1 -1
  105. package/dist/FHIR-R4/classes/insurancePlan.js +1 -1
  106. package/dist/FHIR-R4/classes/invoice.js +1 -1
  107. package/dist/FHIR-R4/classes/invoicePriceComponent.js +1 -1
  108. package/dist/FHIR-R4/classes/library.js +1 -1
  109. package/dist/FHIR-R4/classes/linkageItem.js +1 -1
  110. package/dist/FHIR-R4/classes/list.js +1 -1
  111. package/dist/FHIR-R4/classes/location.js +1 -1
  112. package/dist/FHIR-R4/classes/measure.js +1 -1
  113. package/dist/FHIR-R4/classes/measureReport.js +1 -1
  114. package/dist/FHIR-R4/classes/messageDefinition.js +1 -1
  115. package/dist/FHIR-R4/classes/messageHeaderResponse.js +1 -1
  116. package/dist/FHIR-R4/classes/molecularSequence.js +1 -1
  117. package/dist/FHIR-R4/classes/molecularSequenceQuality.js +1 -1
  118. package/dist/FHIR-R4/classes/molecularSequenceReferenceSeq.js +1 -1
  119. package/dist/FHIR-R4/classes/molecularSequenceRepository.js +1 -1
  120. package/dist/FHIR-R4/classes/namingSystem.js +1 -1
  121. package/dist/FHIR-R4/classes/namingSystemUniqueId.js +1 -1
  122. package/dist/FHIR-R4/classes/narrative.js +1 -1
  123. package/dist/FHIR-R4/classes/observation.js +1 -1
  124. package/dist/FHIR-R4/classes/observationDefinitionQualifiedInterval.js +1 -1
  125. package/dist/FHIR-R4/classes/operationDefinition.js +1 -1
  126. package/dist/FHIR-R4/classes/operationDefinitionBinding.js +1 -1
  127. package/dist/FHIR-R4/classes/operationDefinitionParameter.js +1 -1
  128. package/dist/FHIR-R4/classes/patient.js +1 -1
  129. package/dist/FHIR-R4/classes/patientContact.js +1 -1
  130. package/dist/FHIR-R4/classes/patientLink.js +1 -1
  131. package/dist/FHIR-R4/classes/paymentReconciliation.js +1 -1
  132. package/dist/FHIR-R4/classes/paymentReconciliationProcessNote.js +1 -1
  133. package/dist/FHIR-R4/classes/person.js +1 -1
  134. package/dist/FHIR-R4/classes/personLink.js +1 -1
  135. package/dist/FHIR-R4/classes/planDefinition.js +1 -1
  136. package/dist/FHIR-R4/classes/planDefinitionAction.js +1 -1
  137. package/dist/FHIR-R4/classes/planDefinitionCondition.js +1 -1
  138. package/dist/FHIR-R4/classes/planDefinitionParticipant.js +1 -1
  139. package/dist/FHIR-R4/classes/planDefinitionRelatedAction.js +1 -1
  140. package/dist/FHIR-R4/classes/practitioner.js +1 -1
  141. package/dist/FHIR-R4/classes/provenanceEntity.js +1 -1
  142. package/dist/FHIR-R4/classes/quantity.js +1 -1
  143. package/dist/FHIR-R4/classes/questionnaire.js +1 -1
  144. package/dist/FHIR-R4/classes/questionnaireEnableWhen.js +1 -1
  145. package/dist/FHIR-R4/classes/questionnaireItem.js +1 -1
  146. package/dist/FHIR-R4/classes/questionnaireResponse.js +1 -1
  147. package/dist/FHIR-R4/classes/relatedArtifact.js +1 -1
  148. package/dist/FHIR-R4/classes/relatedPerson.js +1 -1
  149. package/dist/FHIR-R4/classes/researchDefinition.js +1 -1
  150. package/dist/FHIR-R4/classes/researchElementDefinition.js +1 -1
  151. package/dist/FHIR-R4/classes/researchElementDefinitionCharacteristic.js +1 -1
  152. package/dist/FHIR-R4/classes/researchStudy.js +1 -1
  153. package/dist/FHIR-R4/classes/researchSubject.js +1 -1
  154. package/dist/FHIR-R4/classes/riskEvidenceSynthesis.js +1 -1
  155. package/dist/FHIR-R4/classes/searchParameter.js +1 -1
  156. package/dist/FHIR-R4/classes/slot.js +1 -1
  157. package/dist/FHIR-R4/classes/specimen.js +1 -1
  158. package/dist/FHIR-R4/classes/specimenDefinitionTypeTested.js +1 -1
  159. package/dist/FHIR-R4/classes/structureDefinition.js +1 -1
  160. package/dist/FHIR-R4/classes/structureDefinitionContext.js +1 -1
  161. package/dist/FHIR-R4/classes/structureMap.js +1 -1
  162. package/dist/FHIR-R4/classes/structureMapGroup.js +1 -1
  163. package/dist/FHIR-R4/classes/structureMapInput.js +1 -1
  164. package/dist/FHIR-R4/classes/structureMapSource.js +1 -1
  165. package/dist/FHIR-R4/classes/structureMapStructure.js +1 -1
  166. package/dist/FHIR-R4/classes/structureMapTarget.js +1 -1
  167. package/dist/FHIR-R4/classes/subscription.js +1 -1
  168. package/dist/FHIR-R4/classes/subscriptionChannel.js +1 -1
  169. package/dist/FHIR-R4/classes/substance.js +1 -1
  170. package/dist/FHIR-R4/classes/supplyDelivery.js +1 -1
  171. package/dist/FHIR-R4/classes/supplyRequest.js +1 -1
  172. package/dist/FHIR-R4/classes/task.js +1 -1
  173. package/dist/FHIR-R4/classes/terminologyCapabilities.js +1 -1
  174. package/dist/FHIR-R4/classes/testReport.js +1 -1
  175. package/dist/FHIR-R4/classes/testReportAssert.js +1 -1
  176. package/dist/FHIR-R4/classes/testReportOperation.js +1 -1
  177. package/dist/FHIR-R4/classes/testReportParticipant.js +1 -1
  178. package/dist/FHIR-R4/classes/testScript.js +1 -1
  179. package/dist/FHIR-R4/classes/testScriptAssert.js +1 -1
  180. package/dist/FHIR-R4/classes/testScriptOperation.js +1 -1
  181. package/dist/FHIR-R4/classes/timingRepeat.js +1 -1
  182. package/dist/FHIR-R4/classes/triggerDefinition.js +1 -1
  183. package/dist/FHIR-R4/classes/valueSet.js +1 -1
  184. package/dist/FHIR-R4/classes/valueSetFilter.js +1 -1
  185. package/dist/FHIR-R4/classes/visionPrescriptionLensSpecification.js +1 -1
  186. package/dist/FHIR-R4/classes/visionPrescriptionPrism.js +1 -1
  187. package/dist/FHIR-R4/interfaces/IAccount.js +1 -1
  188. package/dist/FHIR-R4/interfaces/IActivityDefinition.js +1 -1
  189. package/dist/FHIR-R4/interfaces/IAdverseEvent.js +1 -1
  190. package/dist/FHIR-R4/interfaces/IAllergyIntolerance.js +1 -1
  191. package/dist/FHIR-R4/interfaces/IAppointment.js +1 -1
  192. package/dist/FHIR-R4/interfaces/IAuditEvent.js +1 -1
  193. package/dist/FHIR-R4/interfaces/IBiologicallyDerivedProduct.js +1 -1
  194. package/dist/FHIR-R4/interfaces/IBundle.js +1 -1
  195. package/dist/FHIR-R4/interfaces/ICapabilityStatement.js +1 -1
  196. package/dist/FHIR-R4/interfaces/ICareTeam.js +1 -1
  197. package/dist/FHIR-R4/interfaces/ICatalogEntry.js +1 -1
  198. package/dist/FHIR-R4/interfaces/IChargeItem.js +1 -1
  199. package/dist/FHIR-R4/interfaces/IChargeItemDefinition.js +1 -1
  200. package/dist/FHIR-R4/interfaces/IClaim.js +1 -1
  201. package/dist/FHIR-R4/interfaces/ICodeSystem.js +1 -1
  202. package/dist/FHIR-R4/interfaces/ICompartmentDefinition.js +1 -1
  203. package/dist/FHIR-R4/interfaces/IComposition.js +1 -1
  204. package/dist/FHIR-R4/interfaces/IConceptMap.js +1 -1
  205. package/dist/FHIR-R4/interfaces/IConsent.js +1 -1
  206. package/dist/FHIR-R4/interfaces/ICoverageEligibilityResponse.js +1 -1
  207. package/dist/FHIR-R4/interfaces/IDetectedIssue.js +1 -1
  208. package/dist/FHIR-R4/interfaces/IDevice.js +1 -1
  209. package/dist/FHIR-R4/interfaces/IDeviceMetric.js +1 -1
  210. package/dist/FHIR-R4/interfaces/IDeviceUseStatement.js +1 -1
  211. package/dist/FHIR-R4/interfaces/IDiagnosticReport.js +1 -1
  212. package/dist/FHIR-R4/interfaces/IDocumentManifest.js +1 -1
  213. package/dist/FHIR-R4/interfaces/IDocumentReference.js +1 -1
  214. package/dist/FHIR-R4/interfaces/IEffectEvidenceSynthesis.js +1 -1
  215. package/dist/FHIR-R4/interfaces/IEncounter.js +1 -1
  216. package/dist/FHIR-R4/interfaces/IEndpoint.js +1 -1
  217. package/dist/FHIR-R4/interfaces/IEnrollmentResponse.js +1 -1
  218. package/dist/FHIR-R4/interfaces/IEpisodeOfCare.js +1 -1
  219. package/dist/FHIR-R4/interfaces/IEventDefinition.js +1 -1
  220. package/dist/FHIR-R4/interfaces/IEvidence.js +1 -1
  221. package/dist/FHIR-R4/interfaces/IEvidenceVariable.js +1 -1
  222. package/dist/FHIR-R4/interfaces/IExampleScenario.js +1 -1
  223. package/dist/FHIR-R4/interfaces/IExplanationOfBenefit.js +1 -1
  224. package/dist/FHIR-R4/interfaces/IFamilyMemberHistory.js +1 -1
  225. package/dist/FHIR-R4/interfaces/IFlag.js +1 -1
  226. package/dist/FHIR-R4/interfaces/IGoal.js +1 -1
  227. package/dist/FHIR-R4/interfaces/IGraphDefinition.js +1 -1
  228. package/dist/FHIR-R4/interfaces/IGroup.js +1 -1
  229. package/dist/FHIR-R4/interfaces/IGuidanceResponse.js +1 -1
  230. package/dist/FHIR-R4/interfaces/IImagingStudy.js +1 -1
  231. package/dist/FHIR-R4/interfaces/IImplementationGuide.js +1 -1
  232. package/dist/FHIR-R4/interfaces/IInsurancePlan.js +1 -1
  233. package/dist/FHIR-R4/interfaces/IInvoice.js +1 -1
  234. package/dist/FHIR-R4/interfaces/ILibrary.js +1 -1
  235. package/dist/FHIR-R4/interfaces/IList.js +1 -1
  236. package/dist/FHIR-R4/interfaces/ILocation.js +1 -1
  237. package/dist/FHIR-R4/interfaces/IMeasure.js +1 -1
  238. package/dist/FHIR-R4/interfaces/IMeasureReport.js +1 -1
  239. package/dist/FHIR-R4/interfaces/IMessageDefinition.js +1 -1
  240. package/dist/FHIR-R4/interfaces/IMolecularSequence.js +1 -1
  241. package/dist/FHIR-R4/interfaces/INamingSystem.js +1 -1
  242. package/dist/FHIR-R4/interfaces/IObservation.js +1 -1
  243. package/dist/FHIR-R4/interfaces/IOperationDefinition.js +1 -1
  244. package/dist/FHIR-R4/interfaces/IPatient.js +1 -1
  245. package/dist/FHIR-R4/interfaces/IPaymentReconciliation.js +1 -1
  246. package/dist/FHIR-R4/interfaces/IPerson.js +1 -1
  247. package/dist/FHIR-R4/interfaces/IPlanDefinition.js +1 -1
  248. package/dist/FHIR-R4/interfaces/IPractitioner.js +1 -1
  249. package/dist/FHIR-R4/interfaces/IQuestionnaire.js +1 -1
  250. package/dist/FHIR-R4/interfaces/IQuestionnaireResponse.js +1 -1
  251. package/dist/FHIR-R4/interfaces/IRelatedPerson.js +1 -1
  252. package/dist/FHIR-R4/interfaces/IResearchDefinition.js +1 -1
  253. package/dist/FHIR-R4/interfaces/IResearchElementDefinition.js +1 -1
  254. package/dist/FHIR-R4/interfaces/IResearchStudy.js +1 -1
  255. package/dist/FHIR-R4/interfaces/IResearchSubject.js +1 -1
  256. package/dist/FHIR-R4/interfaces/IRiskEvidenceSynthesis.js +1 -1
  257. package/dist/FHIR-R4/interfaces/ISearchParameter.js +1 -1
  258. package/dist/FHIR-R4/interfaces/ISlot.js +1 -1
  259. package/dist/FHIR-R4/interfaces/ISpecimen.js +1 -1
  260. package/dist/FHIR-R4/interfaces/IStructureDefinition.js +1 -1
  261. package/dist/FHIR-R4/interfaces/IStructureMap.js +1 -1
  262. package/dist/FHIR-R4/interfaces/ISubscription.js +1 -1
  263. package/dist/FHIR-R4/interfaces/ISubstance.js +1 -1
  264. package/dist/FHIR-R4/interfaces/ISupplyDelivery.js +1 -1
  265. package/dist/FHIR-R4/interfaces/ISupplyRequest.js +1 -1
  266. package/dist/FHIR-R4/interfaces/ITask.js +1 -1
  267. package/dist/FHIR-R4/interfaces/ITerminologyCapabilities.js +1 -1
  268. package/dist/FHIR-R4/interfaces/ITestReport.js +1 -1
  269. package/dist/FHIR-R4/interfaces/ITestScript.js +1 -1
  270. package/dist/FHIR-R4/interfaces/IValueSet.js +1 -1
  271. package/dist/FHIR-R5/fHIRJSONRESOURCE.d.ts +172 -0
  272. package/dist/FHIR-R5/fHIRJSONRESOURCE.js +2 -0
  273. package/dist/FHIR-R5/openApiSchemaUpdated.d.ts +172 -0
  274. package/dist/FHIR-R5/openApiSchemaUpdated.js +2 -0
  275. package/dist/index.d.ts +1 -1
  276. package/dist/index.js +39 -6
  277. package/dist/library/BundleUtils/BundleUtils.d.ts +11 -5
  278. package/dist/library/BundleUtils/BundleUtils.js +23 -5
  279. package/dist/library/BundleUtils/BundleUtils.spec.js +24 -24
  280. package/dist/library/PatchUtils/PatchUtils.d.ts +1 -1
  281. package/dist/library/PatchUtils/PatchUtils.js +31 -31
  282. package/dist/library/PatchUtils/PatchUtils.spec.js +159 -124
  283. package/dist/library/QueryBuilder/QueryBuilder.d.ts +1 -1
  284. package/dist/library/QueryBuilder/QueryBuilder.js +25 -17
  285. package/dist/library/QueryBuilder/QueryBuilder.spec.js +44 -43
  286. package/dist/library/ResourceUtils/ResourceUtils.d.ts +15 -7
  287. package/dist/library/ResourceUtils/ResourceUtils.js +19 -11
  288. package/dist/library/ResourceUtils/ResourceUtils.spec.js +113 -112
  289. package/dist/library/constants.js +2 -2
  290. package/dist/library/dataTypes.d.ts +6 -6
  291. package/eslint.config.mjs +69 -0
  292. package/package.json +21 -7
  293. package/src/FHIR-DSTU2.ts +1 -1
  294. package/src/FHIR-R3.ts +3 -1
  295. package/src/index.ts +12 -1
  296. package/src/library/BundleUtils/BundleUtils.spec.ts +26 -39
  297. package/src/library/BundleUtils/BundleUtils.ts +43 -29
  298. package/src/library/PatchUtils/PatchUtils.spec.ts +173 -129
  299. package/src/library/PatchUtils/PatchUtils.ts +39 -52
  300. package/src/library/QueryBuilder/QueryBuilder.spec.ts +54 -51
  301. package/src/library/QueryBuilder/QueryBuilder.ts +41 -31
  302. package/src/library/ResourceUtils/ResourceUtils.spec.ts +133 -164
  303. package/src/library/ResourceUtils/ResourceUtils.ts +37 -27
  304. package/src/library/constants.ts +17 -17
  305. package/src/library/dataTypes.ts +7 -7
  306. package/tsconfig.json +25 -2
@@ -1,166 +1,141 @@
1
- import { ResourceUtils } from "./ResourceUtils";
2
- import { Coding, Extension, Identifier, } from "../dataTypes";
3
- import { CareTeam } from "../../FHIR-R4/classes/careTeam";
4
-
5
- const patientPayload = require("./../../test-resources/Patient-R4.json");
6
- const careTeamPayload = require("./../../test-resources/CareTeam-R4.json");
7
- const careTeamContainedPayload = require("./../../test-resources/CareTeam-R4-contained.json");
8
- describe("ResourceUtils", () => {
9
-
10
- let resourceUtils = new ResourceUtils();
11
-
12
- describe("#getResourceProperty()", () => {
13
- it("should return property if property exists in valid inputJson", () => {
1
+ import { ResourceUtils } from './ResourceUtils';
2
+ import { Coding, Extension, Identifier } from '../dataTypes';
3
+ import { CareTeam } from '../../FHIR-R4/classes/careTeam';
4
+
5
+ const patientPayload = require('./../../test-resources/Patient-R4.json');
6
+ const careTeamPayload = require('./../../test-resources/CareTeam-R4.json');
7
+ const careTeamContainedPayload = require('./../../test-resources/CareTeam-R4-contained.json');
8
+ describe('ResourceUtils', () => {
9
+ const resourceUtils = new ResourceUtils();
10
+
11
+ describe('#getResourceProperty()', () => {
12
+ it('should return property if property exists in valid inputJson', () => {
14
13
  // execute
15
- const actual = resourceUtils.getResourceProperty(
16
- patientPayload,
17
- "deceasedBoolean"
18
- );
14
+ const actual = resourceUtils.getResourceProperty(patientPayload, 'deceasedBoolean');
19
15
  // validate
20
16
  expect(actual).toBeFalse();
21
17
  });
22
18
 
23
- it("should return null if property exists in valid inputJson", () => {
19
+ it('should return null if property exists in valid inputJson', () => {
24
20
  // execute
25
- const actual = resourceUtils.getResourceProperty(
26
- patientPayload,
27
- "abcd"
28
- );
21
+ const actual = resourceUtils.getResourceProperty(patientPayload, 'abcd');
29
22
  // validate
30
23
  expect(actual).toBeNull();
31
24
  });
32
25
 
33
- it("should return null if invalid inputJson is passed", () => {
26
+ it('should return null if invalid inputJson is passed', () => {
34
27
  // setup
35
28
  const inputPayload = [1, 2];
36
29
  // execute
37
- const actual = resourceUtils.getResourceProperty(
38
- inputPayload,
39
- "deceasedBoolean"
40
- );
30
+ const actual = resourceUtils.getResourceProperty(inputPayload, 'deceasedBoolean');
41
31
  // validate
42
32
  expect(actual).toBeNull();
43
33
  });
44
34
  });
45
35
 
46
- describe("#getIdentifiersByProperty()", () => {
36
+ describe('#getIdentifiersByProperty()', () => {
47
37
  const identifierList: Identifier[] = [
48
38
  {
49
- use: "temp",
50
- system: "http://hl7.org/fhir/sid/us-ssn",
51
- value: "abc",
39
+ use: 'temp',
40
+ system: 'http://hl7.org/fhir/sid/us-ssn',
41
+ value: 'abc',
52
42
  },
53
43
  {
54
- use: "usual",
55
- system: "http://ns.electronichealth.net.au/id/hi/ihi/1.0",
56
- value: "abc",
44
+ use: 'usual',
45
+ system: 'http://ns.electronichealth.net.au/id/hi/ihi/1.0',
46
+ value: 'abc',
57
47
  },
58
48
  ];
59
49
 
60
- it("should return empty array if null is passed as identifier list", () => {
50
+ it('should return empty array if null is passed as identifier list', () => {
61
51
  // setup
62
- const value = "shouldBeIgnored";
52
+ const value = 'shouldBeIgnored';
63
53
  // execute
64
- const actual = resourceUtils.getIdentifiersByProperty(
65
- null,
66
- "id",
67
- value
68
- );
54
+ const actual = resourceUtils.getIdentifiersByProperty(null, 'id', value);
69
55
  // validate
70
56
  expect(actual.length).toEqual(0);
71
57
  });
72
58
 
73
- it("should return empty array if property not found", () => {
59
+ it('should return empty array if property not found', () => {
74
60
  // setup
75
- const value = "abc";
61
+ const value = 'abc';
76
62
  // execute
77
63
  const actual = resourceUtils.getIdentifiersByProperty(
78
64
  identifierList,
79
- "extension", // no extensions in test data
65
+ 'extension', // no extensions in test data
80
66
  value
81
67
  );
82
68
  // validate
83
69
  expect(actual.length).toEqual(0);
84
70
  });
85
71
 
86
- it("should return empty array if no matches found", () => {
72
+ it('should return empty array if no matches found', () => {
87
73
  // setup
88
- const systemUrl = "http://somesystem.com";
74
+ const systemUrl = 'http://somesystem.com';
89
75
  // execute
90
- const actual = resourceUtils.getIdentifiersByProperty(
91
- identifierList,
92
- "system",
93
- systemUrl
94
- );
76
+ const actual = resourceUtils.getIdentifiersByProperty(identifierList, 'system', systemUrl);
95
77
  // validate
96
78
  expect(actual.length).toEqual(0);
97
79
  });
98
80
 
99
- it("should return array with all matches", () => {
81
+ it('should return array with all matches', () => {
100
82
  // setup
101
- const value = "abc";
83
+ const value = 'abc';
102
84
  // execute
103
- const actual = resourceUtils.getIdentifiersByProperty(
104
- identifierList,
105
- "value",
106
- value
107
- );
85
+ const actual = resourceUtils.getIdentifiersByProperty(identifierList, 'value', value);
108
86
  // validate
109
87
  expect(actual.length).toEqual(2);
110
88
  });
111
89
  });
112
90
 
113
- describe("#getExtensionsByUrl()", () => {
91
+ describe('#getExtensionsByUrl()', () => {
114
92
  const extensionList: Extension[] = [
115
93
  {
116
- url: "http://hl7.org/fhir/sid/us-ssn",
94
+ url: 'http://hl7.org/fhir/sid/us-ssn',
117
95
  valueBoolean: true,
118
96
  },
119
97
  {
120
- url: "http://ns.electronichealth.net.au/id/hi/ihi/1.0",
121
- valueString: "abc",
98
+ url: 'http://ns.electronichealth.net.au/id/hi/ihi/1.0',
99
+ valueString: 'abc',
122
100
  },
123
101
  ];
124
102
 
125
- it("should return empty array if null is passed as extension list", () => {
103
+ it('should return empty array if null is passed as extension list', () => {
126
104
  // execute
127
- const actual = resourceUtils.getExtensionsByUrl(null, "url");
105
+ const actual = resourceUtils.getExtensionsByUrl(null, 'url');
128
106
  // validate
129
107
  expect(actual.length).toEqual(0);
130
108
  });
131
109
 
132
- it("should return empty array if invalid extension array passed", () => {
110
+ it('should return empty array if invalid extension array passed', () => {
133
111
  // setup
134
112
  const extensionListInvalid = [
135
113
  {
136
114
  // @ts-ignore
137
- use: "temp",
138
- system: "http://hl7.org/fhir/sid/us-ssn",
139
- value: "abc",
115
+ use: 'temp',
116
+ system: 'http://hl7.org/fhir/sid/us-ssn',
117
+ value: 'abc',
140
118
  },
141
119
  ] as Extension[]; // disabling compiler warning for the test
142
- const url = "http://ns.electronichealth.net.au/id/hi/ihi/1.0";
120
+ const url = 'http://ns.electronichealth.net.au/id/hi/ihi/1.0';
143
121
  // execute
144
- const actual = resourceUtils.getExtensionsByUrl(
145
- extensionListInvalid,
146
- url
147
- );
122
+ const actual = resourceUtils.getExtensionsByUrl(extensionListInvalid, url);
148
123
  // validate
149
124
  expect(actual.length).toEqual(0);
150
125
  });
151
126
 
152
- it("should return empty array if no matches found", () => {
127
+ it('should return empty array if no matches found', () => {
153
128
  // setup
154
- const url = "http://somesystem.com";
129
+ const url = 'http://somesystem.com';
155
130
  // execute
156
131
  const actual = resourceUtils.getExtensionsByUrl(extensionList, url);
157
132
  // validate
158
133
  expect(actual.length).toEqual(0);
159
134
  });
160
135
 
161
- it("should return array with all matches", () => {
136
+ it('should return array with all matches', () => {
162
137
  // setup
163
- const url = "http://ns.electronichealth.net.au/id/hi/ihi/1.0";
138
+ const url = 'http://ns.electronichealth.net.au/id/hi/ihi/1.0';
164
139
  // execute
165
140
  const actual = resourceUtils.getExtensionsByUrl(extensionList, url);
166
141
  // validate
@@ -168,100 +143,90 @@ describe("ResourceUtils", () => {
168
143
  });
169
144
  });
170
145
 
171
- describe("#getCodingsByProperty()", () => {
146
+ describe('#getCodingsByProperty()', () => {
172
147
  const codingList: Coding[] = [
173
148
  {
174
- version: "1.0",
175
- system: "http://hl7.org/fhir/sid/us-ssn",
176
- code: "abc",
177
- display: "abc",
149
+ version: '1.0',
150
+ system: 'http://hl7.org/fhir/sid/us-ssn',
151
+ code: 'abc',
152
+ display: 'abc',
178
153
  userSelected: false,
179
154
  },
180
155
  {
181
- version: "1.1",
182
- system: "http://ns.electronichealth.net.au/id/hi/ihi/1.0",
183
- code: "abc",
184
- display: "abc",
156
+ version: '1.1',
157
+ system: 'http://ns.electronichealth.net.au/id/hi/ihi/1.0',
158
+ code: 'abc',
159
+ display: 'abc',
185
160
  },
186
161
  ];
187
162
 
188
- it("should return empty array if null is passed as coding list", () => {
163
+ it('should return empty array if null is passed as coding list', () => {
189
164
  // setup
190
- const value = "shouldBeIgnored";
165
+ const value = 'shouldBeIgnored';
191
166
  // execute
192
- const actual = resourceUtils.getCodingsByProperty(null, "extension", value);
167
+ const actual = resourceUtils.getCodingsByProperty(null, 'extension', value);
193
168
  // validate
194
169
  expect(actual.length).toEqual(0);
195
170
  });
196
171
 
197
- it("should return empty array if property not found", () => {
172
+ it('should return empty array if property not found', () => {
198
173
  // setup
199
- const value = "abc";
174
+ const value = 'abc';
200
175
  // execute
201
176
  const actual = resourceUtils.getCodingsByProperty(
202
177
  codingList,
203
- "id", // expect no ID in codingList
178
+ 'id', // expect no ID in codingList
204
179
  value
205
180
  );
206
181
  // validate
207
182
  expect(actual.length).toEqual(0);
208
183
  });
209
184
 
210
- it("should return empty array if no matches found", () => {
185
+ it('should return empty array if no matches found', () => {
211
186
  // setup
212
- const systemUrl = "http://somesystem.com";
187
+ const systemUrl = 'http://somesystem.com';
213
188
  // execute
214
- const actual = resourceUtils.getCodingsByProperty(
215
- codingList,
216
- "system",
217
- systemUrl
218
- );
189
+ const actual = resourceUtils.getCodingsByProperty(codingList, 'system', systemUrl);
219
190
  // validate
220
191
  expect(actual.length).toEqual(0);
221
192
  });
222
193
 
223
- it("should return array with all matches for string values", () => {
194
+ it('should return array with all matches for string values', () => {
224
195
  // setup
225
- const value = "abc";
196
+ const value = 'abc';
226
197
  // execute
227
- const actual = resourceUtils.getCodingsByProperty(
228
- codingList,
229
- "code",
230
- value
231
- );
198
+ const actual = resourceUtils.getCodingsByProperty(codingList, 'code', value);
232
199
  // validate
233
200
  expect(actual.length).toEqual(2);
234
201
  });
235
202
 
236
- it("should return array with all matches for boolean values", () => {
203
+ it('should return array with all matches for boolean values', () => {
237
204
  // setup
238
205
  const value = false;
239
206
  // execute
240
- const actual = resourceUtils.getCodingsByProperty(
241
- codingList,
242
- "userSelected",
243
- value
244
- );
207
+ const actual = resourceUtils.getCodingsByProperty(codingList, 'userSelected', value);
245
208
  // validate
246
209
  expect(actual.length).toEqual(1);
247
210
  });
248
211
  });
249
212
 
250
- describe("#getValuesAtResourcePath()", () => {
251
-
252
- it("should return empty array if the root of the path path does not match the resource type", () => {
213
+ describe('#getValuesAtResourcePath()', () => {
214
+ it('should return empty array if the root of the path path does not match the resource type', () => {
253
215
  // execute
254
- const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, "Practitioner.name.given");
216
+ const pathValues = resourceUtils.getValuesAtResourcePath(
217
+ patientPayload,
218
+ 'Practitioner.name.given'
219
+ );
255
220
  // validate
256
221
  expect(pathValues.length).toEqual(0);
257
222
  });
258
223
 
259
- it("should return array with values if path exists for a top level element", () => {
224
+ it('should return array with values if path exists for a top level element', () => {
260
225
  // execute
261
- const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, "Patient.gender");
226
+ const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.gender');
262
227
  // validate
263
228
  expect(pathValues.length).toEqual(1);
264
- expect(pathValues[0]).toEqual("male");
229
+ expect(pathValues[0]).toEqual('male');
265
230
  });
266
231
 
267
232
  it('should return array with values if path exists for a top level element and is an object', () => {
@@ -269,98 +234,103 @@ describe("ResourceUtils", () => {
269
234
  {
270
235
  coding: [
271
236
  {
272
- system: "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus",
273
- code: "M",
274
- display: "Married"
275
- }
237
+ system: 'http://terminology.hl7.org/CodeSystem/v3-MaritalStatus',
238
+ code: 'M',
239
+ display: 'Married',
240
+ },
276
241
  ],
277
- text: "Getrouwd",
278
- }
242
+ text: 'Getrouwd',
243
+ },
279
244
  ];
280
245
  // execute
281
- const actual = resourceUtils.getValuesAtResourcePath(
282
- patientPayload,
283
- "Patient.maritalStatus"
284
- );
246
+ const actual = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.maritalStatus');
285
247
  // validate
286
248
  expect(actual.length).toEqual(1);
287
249
  expect(actual).toEqual(expected);
288
250
  });
289
251
 
290
- it("should return array with values if path exists for a top level element and is an array", () => {
252
+ it('should return array with values if path exists for a top level element and is an array', () => {
291
253
  // setup
292
254
  const expected = [
293
255
  {
294
- use: "usual",
295
- family: "van de Heuvel",
296
- given: ["Pieter", "Peter"],
297
- suffix: ["MSc"],
256
+ use: 'usual',
257
+ family: 'van de Heuvel',
258
+ given: ['Pieter', 'Peter'],
259
+ suffix: ['MSc'],
298
260
  },
299
261
  {
300
- use: "usual",
301
- family: "van de Heuvel",
302
- given: ["Pieter"],
303
- suffix: ["MSc"],
262
+ use: 'usual',
263
+ family: 'van de Heuvel',
264
+ given: ['Pieter'],
265
+ suffix: ['MSc'],
304
266
  },
305
267
  ];
306
268
  // execute
307
- const actual = resourceUtils.getValuesAtResourcePath(
308
- patientPayload,
309
- "Patient.name"
310
- );
269
+ const actual = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.name');
311
270
  // validate
312
271
  expect(actual.length).toEqual(2);
313
272
  expect(actual).toEqual(expected);
314
273
  });
315
274
 
316
- it("should return array with values for a array under object", () => {
275
+ it('should return array with values for a array under object', () => {
317
276
  // execute
318
- const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, "Patient.name.given");
277
+ const pathValues = resourceUtils.getValuesAtResourcePath(
278
+ patientPayload,
279
+ 'Patient.name.given'
280
+ );
319
281
  // validate
320
282
  expect(pathValues.length).toEqual(3);
321
- expect(pathValues[0]).toEqual("Pieter");
322
- expect(pathValues[1]).toEqual("Peter");
323
- expect(pathValues[2]).toEqual("Pieter");
283
+ expect(pathValues[0]).toEqual('Pieter');
284
+ expect(pathValues[1]).toEqual('Peter');
285
+ expect(pathValues[2]).toEqual('Pieter');
324
286
  });
325
287
 
326
- it("should return array with values if path exists for a deep array element", () => {
288
+ it('should return array with values if path exists for a deep array element', () => {
327
289
  // execute
328
- const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, "Patient.contact.relationship.coding.system");
290
+ const pathValues = resourceUtils.getValuesAtResourcePath(
291
+ patientPayload,
292
+ 'Patient.contact.relationship.coding.system'
293
+ );
329
294
  // validate
330
295
  expect(pathValues.length).toEqual(2);
331
- expect(pathValues[0]).toEqual("http://terminology.hl7.org/CodeSystem/v2-0131");
332
- expect(pathValues[1]).toEqual("http://terminology.hl7.org/CodeSystem/v2-0132");
296
+ expect(pathValues[0]).toEqual('http://terminology.hl7.org/CodeSystem/v2-0131');
297
+ expect(pathValues[1]).toEqual('http://terminology.hl7.org/CodeSystem/v2-0132');
333
298
  });
334
299
 
335
- it("should return array with values if path exists for a deep json element", () => {
300
+ it('should return array with values if path exists for a deep json element', () => {
336
301
  // execute
337
- const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, "Patient.maritalStatus.coding.system");
302
+ const pathValues = resourceUtils.getValuesAtResourcePath(
303
+ patientPayload,
304
+ 'Patient.maritalStatus.coding.system'
305
+ );
338
306
  // validate
339
307
  expect(pathValues.length).toEqual(1);
340
- expect(pathValues[0]).toEqual("http://terminology.hl7.org/CodeSystem/v3-MaritalStatus");
308
+ expect(pathValues[0]).toEqual('http://terminology.hl7.org/CodeSystem/v3-MaritalStatus');
341
309
  });
342
310
 
343
- it("should return empty array if path does not exist", () => {
311
+ it('should return empty array if path does not exist', () => {
344
312
  // execute
345
- const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, "Patient.contact.relationship.coding.abcd");
313
+ const pathValues = resourceUtils.getValuesAtResourcePath(
314
+ patientPayload,
315
+ 'Patient.contact.relationship.coding.abcd'
316
+ );
346
317
  // validate
347
318
  expect(pathValues.length).toEqual(0);
348
319
  });
349
320
  });
350
321
 
351
- describe("#getAllResourceReferences()", () => {
352
-
353
- it("should return array of all references in a resource when references found", () => {
322
+ describe('#getAllResourceReferences()', () => {
323
+ it('should return array of all references in a resource when references found', () => {
354
324
  // execute
355
325
  const actual = resourceUtils.getAllReferencesFromResource(careTeamPayload);
356
326
  // validate
357
327
  expect(actual.length).toEqual(6);
358
328
  });
359
329
 
360
- it("should return empty array if references in a resource not found", () => {
330
+ it('should return empty array if references in a resource not found', () => {
361
331
  // setup
362
332
  const input = {
363
- "resourceType": "Patient"
333
+ resourceType: 'Patient',
364
334
  };
365
335
  // execute
366
336
  const actual = resourceUtils.getAllReferencesFromResource(input);
@@ -368,15 +338,14 @@ describe("ResourceUtils", () => {
368
338
  expect(actual.length).toEqual(0);
369
339
  });
370
340
 
371
- it("should return array of all references in a resource when references found in contained resource", () => {
341
+ it('should return array of all references in a resource when references found in contained resource', () => {
372
342
  // setup
373
343
  const input = careTeamContainedPayload as CareTeam;
374
344
  expect(input.contained).toHaveSize(1);
375
345
  // execute
376
- const actual = resourceUtils.getAllReferencesFromResource(input.contained[0]);
346
+ const actual = resourceUtils.getAllReferencesFromResource(input.contained?.[0]);
377
347
  // validate
378
348
  expect(actual.length).toEqual(1);
379
349
  });
380
350
  });
381
-
382
351
  });