@smile-cdr/fhirts 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +12 -0
- package/.github/workflows/npm-publish.yml +12 -6
- package/.github/workflows/pr-build.yml +7 -3
- package/.prettierignore +22 -0
- package/.prettierrc +10 -0
- package/CHANGELOG.md +4 -0
- package/GETTINGSTARTED.md +57 -15
- package/dist/FHIR-DSTU2.js +1 -1
- package/dist/FHIR-R3.js +3 -1
- package/dist/FHIR-R4/classes/account.js +1 -1
- package/dist/FHIR-R4/classes/activityDefinition.js +1 -1
- package/dist/FHIR-R4/classes/address.js +1 -1
- package/dist/FHIR-R4/classes/adverseEvent.js +1 -1
- package/dist/FHIR-R4/classes/age.js +1 -1
- package/dist/FHIR-R4/classes/allergyIntolerance.js +1 -1
- package/dist/FHIR-R4/classes/allergyIntoleranceReaction.js +1 -1
- package/dist/FHIR-R4/classes/appointment.js +1 -1
- package/dist/FHIR-R4/classes/appointmentParticipant.js +1 -1
- package/dist/FHIR-R4/classes/auditEvent.js +1 -1
- package/dist/FHIR-R4/classes/auditEventNetwork.js +1 -1
- package/dist/FHIR-R4/classes/biologicallyDerivedProduct.js +1 -1
- package/dist/FHIR-R4/classes/biologicallyDerivedProductStorage.js +1 -1
- package/dist/FHIR-R4/classes/bundle.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatement.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementDocument.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementInteraction.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementInteraction1.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementResource.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementRest.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementSearchParam.js +1 -1
- package/dist/FHIR-R4/classes/capabilityStatementSupportedMessage.js +1 -1
- package/dist/FHIR-R4/classes/carePlanDetail.js +1 -1
- package/dist/FHIR-R4/classes/careTeam.js +1 -1
- package/dist/FHIR-R4/classes/catalogEntry.js +1 -1
- package/dist/FHIR-R4/classes/catalogEntryRelatedEntry.js +1 -1
- package/dist/FHIR-R4/classes/chargeItem.js +1 -1
- package/dist/FHIR-R4/classes/chargeItemDefinition.js +1 -1
- package/dist/FHIR-R4/classes/claim.js +1 -1
- package/dist/FHIR-R4/classes/claimResponseProcessNote.js +1 -1
- package/dist/FHIR-R4/classes/codeSystem.js +1 -1
- package/dist/FHIR-R4/classes/codeSystemProperty.js +1 -1
- package/dist/FHIR-R4/classes/compartmentDefinition.js +1 -1
- package/dist/FHIR-R4/classes/composition.js +1 -1
- package/dist/FHIR-R4/classes/compositionAttester.js +1 -1
- package/dist/FHIR-R4/classes/conceptMap.js +1 -1
- package/dist/FHIR-R4/classes/conceptMapTarget.js +1 -1
- package/dist/FHIR-R4/classes/conceptMapUnmapped.js +1 -1
- package/dist/FHIR-R4/classes/consent.js +1 -1
- package/dist/FHIR-R4/classes/consentData.js +1 -1
- package/dist/FHIR-R4/classes/consentProvision.js +1 -1
- package/dist/FHIR-R4/classes/contactPoint.js +1 -1
- package/dist/FHIR-R4/classes/contributor.js +1 -1
- package/dist/FHIR-R4/classes/count.js +1 -1
- package/dist/FHIR-R4/classes/coverageEligibilityResponse.js +1 -1
- package/dist/FHIR-R4/classes/dataRequirementSort.js +1 -1
- package/dist/FHIR-R4/classes/detectedIssue.js +1 -1
- package/dist/FHIR-R4/classes/device.js +1 -1
- package/dist/FHIR-R4/classes/deviceDefinitionDeviceName.js +1 -1
- package/dist/FHIR-R4/classes/deviceDeviceName.js +1 -1
- package/dist/FHIR-R4/classes/deviceMetric.js +1 -1
- package/dist/FHIR-R4/classes/deviceMetricCalibration.js +1 -1
- package/dist/FHIR-R4/classes/deviceUdiCarrier.js +1 -1
- package/dist/FHIR-R4/classes/deviceUseStatement.js +1 -1
- package/dist/FHIR-R4/classes/diagnosticReport.js +1 -1
- package/dist/FHIR-R4/classes/distance.js +1 -1
- package/dist/FHIR-R4/classes/documentManifest.js +1 -1
- package/dist/FHIR-R4/classes/documentReference.js +1 -1
- package/dist/FHIR-R4/classes/documentReferenceRelatesTo.js +1 -1
- package/dist/FHIR-R4/classes/duration.js +1 -1
- package/dist/FHIR-R4/classes/effectEvidenceSynthesis.js +1 -1
- package/dist/FHIR-R4/classes/effectEvidenceSynthesisResultsByExposure.js +1 -1
- package/dist/FHIR-R4/classes/elementDefinitionBinding.js +1 -1
- package/dist/FHIR-R4/classes/elementDefinitionConstraint.js +1 -1
- package/dist/FHIR-R4/classes/elementDefinitionDiscriminator.js +1 -1
- package/dist/FHIR-R4/classes/elementDefinitionSlicing.js +1 -1
- package/dist/FHIR-R4/classes/elementDefinitionType.js +1 -1
- package/dist/FHIR-R4/classes/encounter.js +1 -1
- package/dist/FHIR-R4/classes/encounterLocation.js +1 -1
- package/dist/FHIR-R4/classes/encounterStatusHistory.js +1 -1
- package/dist/FHIR-R4/classes/endpoint.js +1 -1
- package/dist/FHIR-R4/classes/enrollmentResponse.js +1 -1
- package/dist/FHIR-R4/classes/episodeOfCare.js +1 -1
- package/dist/FHIR-R4/classes/episodeOfCareStatusHistory.js +1 -1
- package/dist/FHIR-R4/classes/eventDefinition.js +1 -1
- package/dist/FHIR-R4/classes/evidence.js +1 -1
- package/dist/FHIR-R4/classes/evidenceVariable.js +1 -1
- package/dist/FHIR-R4/classes/evidenceVariableCharacteristic.js +1 -1
- package/dist/FHIR-R4/classes/exampleScenario.js +1 -1
- package/dist/FHIR-R4/classes/exampleScenarioActor.js +1 -1
- package/dist/FHIR-R4/classes/explanationOfBenefit.js +1 -1
- package/dist/FHIR-R4/classes/explanationOfBenefitProcessNote.js +1 -1
- package/dist/FHIR-R4/classes/expression.js +1 -1
- package/dist/FHIR-R4/classes/familyMemberHistory.js +1 -1
- package/dist/FHIR-R4/classes/flag.js +1 -1
- package/dist/FHIR-R4/classes/goal.js +1 -1
- package/dist/FHIR-R4/classes/graphDefinition.js +1 -1
- package/dist/FHIR-R4/classes/graphDefinitionCompartment.js +1 -1
- package/dist/FHIR-R4/classes/group.js +1 -1
- package/dist/FHIR-R4/classes/guidanceResponse.js +1 -1
- package/dist/FHIR-R4/classes/humanName.js +1 -1
- package/dist/FHIR-R4/classes/identifier.js +1 -1
- package/dist/FHIR-R4/classes/imagingStudy.js +1 -1
- package/dist/FHIR-R4/classes/implementationGuide.js +1 -1
- package/dist/FHIR-R4/classes/implementationGuidePage.js +1 -1
- package/dist/FHIR-R4/classes/implementationGuideParameter.js +1 -1
- package/dist/FHIR-R4/classes/insurancePlan.js +1 -1
- package/dist/FHIR-R4/classes/invoice.js +1 -1
- package/dist/FHIR-R4/classes/invoicePriceComponent.js +1 -1
- package/dist/FHIR-R4/classes/library.js +1 -1
- package/dist/FHIR-R4/classes/linkageItem.js +1 -1
- package/dist/FHIR-R4/classes/list.js +1 -1
- package/dist/FHIR-R4/classes/location.js +1 -1
- package/dist/FHIR-R4/classes/measure.js +1 -1
- package/dist/FHIR-R4/classes/measureReport.js +1 -1
- package/dist/FHIR-R4/classes/messageDefinition.js +1 -1
- package/dist/FHIR-R4/classes/messageHeaderResponse.js +1 -1
- package/dist/FHIR-R4/classes/molecularSequence.js +1 -1
- package/dist/FHIR-R4/classes/molecularSequenceQuality.js +1 -1
- package/dist/FHIR-R4/classes/molecularSequenceReferenceSeq.js +1 -1
- package/dist/FHIR-R4/classes/molecularSequenceRepository.js +1 -1
- package/dist/FHIR-R4/classes/namingSystem.js +1 -1
- package/dist/FHIR-R4/classes/namingSystemUniqueId.js +1 -1
- package/dist/FHIR-R4/classes/narrative.js +1 -1
- package/dist/FHIR-R4/classes/observation.js +1 -1
- package/dist/FHIR-R4/classes/observationDefinitionQualifiedInterval.js +1 -1
- package/dist/FHIR-R4/classes/operationDefinition.js +1 -1
- package/dist/FHIR-R4/classes/operationDefinitionBinding.js +1 -1
- package/dist/FHIR-R4/classes/operationDefinitionParameter.js +1 -1
- package/dist/FHIR-R4/classes/patient.js +1 -1
- package/dist/FHIR-R4/classes/patientContact.js +1 -1
- package/dist/FHIR-R4/classes/patientLink.js +1 -1
- package/dist/FHIR-R4/classes/paymentReconciliation.js +1 -1
- package/dist/FHIR-R4/classes/paymentReconciliationProcessNote.js +1 -1
- package/dist/FHIR-R4/classes/person.js +1 -1
- package/dist/FHIR-R4/classes/personLink.js +1 -1
- package/dist/FHIR-R4/classes/planDefinition.js +1 -1
- package/dist/FHIR-R4/classes/planDefinitionAction.js +1 -1
- package/dist/FHIR-R4/classes/planDefinitionCondition.js +1 -1
- package/dist/FHIR-R4/classes/planDefinitionParticipant.js +1 -1
- package/dist/FHIR-R4/classes/planDefinitionRelatedAction.js +1 -1
- package/dist/FHIR-R4/classes/practitioner.js +1 -1
- package/dist/FHIR-R4/classes/provenanceEntity.js +1 -1
- package/dist/FHIR-R4/classes/quantity.js +1 -1
- package/dist/FHIR-R4/classes/questionnaire.js +1 -1
- package/dist/FHIR-R4/classes/questionnaireEnableWhen.js +1 -1
- package/dist/FHIR-R4/classes/questionnaireItem.js +1 -1
- package/dist/FHIR-R4/classes/questionnaireResponse.js +1 -1
- package/dist/FHIR-R4/classes/relatedArtifact.js +1 -1
- package/dist/FHIR-R4/classes/relatedPerson.js +1 -1
- package/dist/FHIR-R4/classes/researchDefinition.js +1 -1
- package/dist/FHIR-R4/classes/researchElementDefinition.js +1 -1
- package/dist/FHIR-R4/classes/researchElementDefinitionCharacteristic.js +1 -1
- package/dist/FHIR-R4/classes/researchStudy.js +1 -1
- package/dist/FHIR-R4/classes/researchSubject.js +1 -1
- package/dist/FHIR-R4/classes/resource.d.ts +3 -1
- package/dist/FHIR-R4/classes/riskEvidenceSynthesis.js +1 -1
- package/dist/FHIR-R4/classes/searchParameter.js +1 -1
- package/dist/FHIR-R4/classes/slot.js +1 -1
- package/dist/FHIR-R4/classes/specimen.js +1 -1
- package/dist/FHIR-R4/classes/specimenDefinitionTypeTested.js +1 -1
- package/dist/FHIR-R4/classes/structureDefinition.js +1 -1
- package/dist/FHIR-R4/classes/structureDefinitionContext.js +1 -1
- package/dist/FHIR-R4/classes/structureMap.js +1 -1
- package/dist/FHIR-R4/classes/structureMapGroup.js +1 -1
- package/dist/FHIR-R4/classes/structureMapInput.js +1 -1
- package/dist/FHIR-R4/classes/structureMapSource.js +1 -1
- package/dist/FHIR-R4/classes/structureMapStructure.js +1 -1
- package/dist/FHIR-R4/classes/structureMapTarget.js +1 -1
- package/dist/FHIR-R4/classes/subscription.js +1 -1
- package/dist/FHIR-R4/classes/subscriptionChannel.js +1 -1
- package/dist/FHIR-R4/classes/substance.js +1 -1
- package/dist/FHIR-R4/classes/supplyDelivery.js +1 -1
- package/dist/FHIR-R4/classes/supplyRequest.js +1 -1
- package/dist/FHIR-R4/classes/task.js +1 -1
- package/dist/FHIR-R4/classes/terminologyCapabilities.js +1 -1
- package/dist/FHIR-R4/classes/testReport.js +1 -1
- package/dist/FHIR-R4/classes/testReportAssert.js +1 -1
- package/dist/FHIR-R4/classes/testReportOperation.js +1 -1
- package/dist/FHIR-R4/classes/testReportParticipant.js +1 -1
- package/dist/FHIR-R4/classes/testScript.js +1 -1
- package/dist/FHIR-R4/classes/testScriptAssert.js +1 -1
- package/dist/FHIR-R4/classes/testScriptOperation.js +1 -1
- package/dist/FHIR-R4/classes/timingRepeat.js +1 -1
- package/dist/FHIR-R4/classes/triggerDefinition.js +1 -1
- package/dist/FHIR-R4/classes/valueSet.js +1 -1
- package/dist/FHIR-R4/classes/valueSetFilter.js +1 -1
- package/dist/FHIR-R4/classes/visionPrescriptionLensSpecification.js +1 -1
- package/dist/FHIR-R4/classes/visionPrescriptionPrism.js +1 -1
- package/dist/FHIR-R4/interfaces/IAccount.js +1 -1
- package/dist/FHIR-R4/interfaces/IActivityDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IAdverseEvent.js +1 -1
- package/dist/FHIR-R4/interfaces/IAllergyIntolerance.js +1 -1
- package/dist/FHIR-R4/interfaces/IAppointment.js +1 -1
- package/dist/FHIR-R4/interfaces/IAuditEvent.js +1 -1
- package/dist/FHIR-R4/interfaces/IBiologicallyDerivedProduct.js +1 -1
- package/dist/FHIR-R4/interfaces/IBundle.js +1 -1
- package/dist/FHIR-R4/interfaces/ICapabilityStatement.js +1 -1
- package/dist/FHIR-R4/interfaces/ICareTeam.js +1 -1
- package/dist/FHIR-R4/interfaces/ICatalogEntry.js +1 -1
- package/dist/FHIR-R4/interfaces/IChargeItem.js +1 -1
- package/dist/FHIR-R4/interfaces/IChargeItemDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IClaim.js +1 -1
- package/dist/FHIR-R4/interfaces/ICodeSystem.js +1 -1
- package/dist/FHIR-R4/interfaces/ICompartmentDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IComposition.js +1 -1
- package/dist/FHIR-R4/interfaces/IConceptMap.js +1 -1
- package/dist/FHIR-R4/interfaces/IConsent.js +1 -1
- package/dist/FHIR-R4/interfaces/ICoverageEligibilityResponse.js +1 -1
- package/dist/FHIR-R4/interfaces/IDetectedIssue.js +1 -1
- package/dist/FHIR-R4/interfaces/IDevice.js +1 -1
- package/dist/FHIR-R4/interfaces/IDeviceMetric.js +1 -1
- package/dist/FHIR-R4/interfaces/IDeviceUseStatement.js +1 -1
- package/dist/FHIR-R4/interfaces/IDiagnosticReport.js +1 -1
- package/dist/FHIR-R4/interfaces/IDocumentManifest.js +1 -1
- package/dist/FHIR-R4/interfaces/IDocumentReference.js +1 -1
- package/dist/FHIR-R4/interfaces/IEffectEvidenceSynthesis.js +1 -1
- package/dist/FHIR-R4/interfaces/IEncounter.js +1 -1
- package/dist/FHIR-R4/interfaces/IEndpoint.js +1 -1
- package/dist/FHIR-R4/interfaces/IEnrollmentResponse.js +1 -1
- package/dist/FHIR-R4/interfaces/IEpisodeOfCare.js +1 -1
- package/dist/FHIR-R4/interfaces/IEventDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IEvidence.js +1 -1
- package/dist/FHIR-R4/interfaces/IEvidenceVariable.js +1 -1
- package/dist/FHIR-R4/interfaces/IExampleScenario.js +1 -1
- package/dist/FHIR-R4/interfaces/IExplanationOfBenefit.js +1 -1
- package/dist/FHIR-R4/interfaces/IFamilyMemberHistory.js +1 -1
- package/dist/FHIR-R4/interfaces/IFlag.js +1 -1
- package/dist/FHIR-R4/interfaces/IGoal.js +1 -1
- package/dist/FHIR-R4/interfaces/IGraphDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IGroup.js +1 -1
- package/dist/FHIR-R4/interfaces/IGuidanceResponse.js +1 -1
- package/dist/FHIR-R4/interfaces/IImagingStudy.js +1 -1
- package/dist/FHIR-R4/interfaces/IImplementationGuide.js +1 -1
- package/dist/FHIR-R4/interfaces/IInsurancePlan.js +1 -1
- package/dist/FHIR-R4/interfaces/IInvoice.js +1 -1
- package/dist/FHIR-R4/interfaces/ILibrary.js +1 -1
- package/dist/FHIR-R4/interfaces/IList.js +1 -1
- package/dist/FHIR-R4/interfaces/ILocation.js +1 -1
- package/dist/FHIR-R4/interfaces/IMeasure.js +1 -1
- package/dist/FHIR-R4/interfaces/IMeasureReport.js +1 -1
- package/dist/FHIR-R4/interfaces/IMessageDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IMolecularSequence.js +1 -1
- package/dist/FHIR-R4/interfaces/INamingSystem.js +1 -1
- package/dist/FHIR-R4/interfaces/IObservation.js +1 -1
- package/dist/FHIR-R4/interfaces/IOperationDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IPatient.js +1 -1
- package/dist/FHIR-R4/interfaces/IPaymentReconciliation.js +1 -1
- package/dist/FHIR-R4/interfaces/IPerson.js +1 -1
- package/dist/FHIR-R4/interfaces/IPlanDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IPractitioner.js +1 -1
- package/dist/FHIR-R4/interfaces/IQuestionnaire.js +1 -1
- package/dist/FHIR-R4/interfaces/IQuestionnaireResponse.js +1 -1
- package/dist/FHIR-R4/interfaces/IRelatedPerson.js +1 -1
- package/dist/FHIR-R4/interfaces/IResearchDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IResearchElementDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IResearchStudy.js +1 -1
- package/dist/FHIR-R4/interfaces/IResearchSubject.js +1 -1
- package/dist/FHIR-R4/interfaces/IRiskEvidenceSynthesis.js +1 -1
- package/dist/FHIR-R4/interfaces/ISearchParameter.js +1 -1
- package/dist/FHIR-R4/interfaces/ISlot.js +1 -1
- package/dist/FHIR-R4/interfaces/ISpecimen.js +1 -1
- package/dist/FHIR-R4/interfaces/IStructureDefinition.js +1 -1
- package/dist/FHIR-R4/interfaces/IStructureMap.js +1 -1
- package/dist/FHIR-R4/interfaces/ISubscription.js +1 -1
- package/dist/FHIR-R4/interfaces/ISubstance.js +1 -1
- package/dist/FHIR-R4/interfaces/ISupplyDelivery.js +1 -1
- package/dist/FHIR-R4/interfaces/ISupplyRequest.js +1 -1
- package/dist/FHIR-R4/interfaces/ITask.js +1 -1
- package/dist/FHIR-R4/interfaces/ITerminologyCapabilities.js +1 -1
- package/dist/FHIR-R4/interfaces/ITestReport.js +1 -1
- package/dist/FHIR-R4/interfaces/ITestScript.js +1 -1
- package/dist/FHIR-R4/interfaces/IValueSet.js +1 -1
- package/dist/FHIR-R5/fHIRJSONRESOURCE.d.ts +172 -0
- package/dist/FHIR-R5/fHIRJSONRESOURCE.js +2 -0
- package/dist/FHIR-R5/openApiSchemaUpdated.d.ts +172 -0
- package/dist/FHIR-R5/openApiSchemaUpdated.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +39 -6
- package/dist/library/BundleUtils/BundleUtils.d.ts +11 -5
- package/dist/library/BundleUtils/BundleUtils.js +23 -5
- package/dist/library/BundleUtils/BundleUtils.spec.js +24 -24
- package/dist/library/PatchUtils/PatchUtils.d.ts +1 -1
- package/dist/library/PatchUtils/PatchUtils.js +31 -31
- package/dist/library/PatchUtils/PatchUtils.spec.js +159 -124
- package/dist/library/QueryBuilder/QueryBuilder.d.ts +1 -1
- package/dist/library/QueryBuilder/QueryBuilder.js +25 -17
- package/dist/library/QueryBuilder/QueryBuilder.spec.js +44 -43
- package/dist/library/ResourceUtils/ResourceUtils.d.ts +15 -7
- package/dist/library/ResourceUtils/ResourceUtils.js +19 -11
- package/dist/library/ResourceUtils/ResourceUtils.spec.js +113 -112
- package/dist/library/constants.js +2 -2
- package/dist/library/dataTypes.d.ts +6 -6
- package/eslint.config.mjs +69 -0
- package/package.json +21 -7
- package/src/FHIR-DSTU2.ts +1 -1
- package/src/FHIR-R3.ts +3 -1
- package/src/FHIR-R4/classes/resource.ts +2 -1
- package/src/index.ts +12 -1
- package/src/library/BundleUtils/BundleUtils.spec.ts +26 -39
- package/src/library/BundleUtils/BundleUtils.ts +43 -29
- package/src/library/PatchUtils/PatchUtils.spec.ts +173 -129
- package/src/library/PatchUtils/PatchUtils.ts +39 -52
- package/src/library/QueryBuilder/QueryBuilder.spec.ts +54 -51
- package/src/library/QueryBuilder/QueryBuilder.ts +41 -31
- package/src/library/ResourceUtils/ResourceUtils.spec.ts +133 -164
- package/src/library/ResourceUtils/ResourceUtils.ts +37 -27
- package/src/library/constants.ts +17 -17
- package/src/library/dataTypes.ts +7 -7
- package/tsconfig.json +25 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodingKeys, IdentifierKeys } from
|
|
1
|
+
import { CodingKeys, IdentifierKeys } from '../dataTypes';
|
|
2
2
|
export declare class ResourceUtils {
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
@@ -7,38 +7,46 @@ export declare class ResourceUtils {
|
|
|
7
7
|
* @returns json property if it exists
|
|
8
8
|
* @limitation currently just supports get for top level property on resource
|
|
9
9
|
*/
|
|
10
|
-
getResourceProperty(inputJson:
|
|
10
|
+
getResourceProperty(inputJson: Record<string, any>, propertyName: string): any;
|
|
11
11
|
/**
|
|
12
|
+
* Get identifiers from a list filtered by property value
|
|
12
13
|
*
|
|
14
|
+
* @template T - The identifier type to return (defaults to any for backward compatibility)
|
|
13
15
|
* @param identifierList list of identifiers
|
|
14
16
|
* @param propertyToCompare identifier property to compare
|
|
15
17
|
* @param propertyValue value we want to compare against
|
|
16
18
|
* @returns array of matches
|
|
17
19
|
* @limitations currently does not work with identifier.type, identifier.period & identifier.assigner
|
|
18
20
|
*/
|
|
19
|
-
getIdentifiersByProperty(identifierList: any[], propertyToCompare: IdentifierKeys, propertyValue: any[IdentifierKeys]):
|
|
21
|
+
getIdentifiersByProperty<T = any>(identifierList: any[] | null, propertyToCompare: IdentifierKeys, propertyValue: any[IdentifierKeys]): T[];
|
|
20
22
|
/**
|
|
23
|
+
* Get extensions from a list filtered by URL
|
|
21
24
|
*
|
|
25
|
+
* @template T - The extension type to return (defaults to any for backward compatibility)
|
|
22
26
|
* @param extensionList list of extensions
|
|
23
27
|
* @param extensionUrl Extension.url to compare
|
|
24
28
|
* @returns array of matches
|
|
25
29
|
*/
|
|
26
|
-
getExtensionsByUrl(extensionList: any[], extensionUrl: string):
|
|
30
|
+
getExtensionsByUrl<T = any>(extensionList: any[] | null, extensionUrl: string): T[];
|
|
27
31
|
/**
|
|
32
|
+
* Get codings from a list filtered by property value
|
|
28
33
|
*
|
|
34
|
+
* @template T - The coding type to return (defaults to any for backward compatibility)
|
|
29
35
|
* @param codingList list of codings
|
|
30
36
|
* @param propertyToCompare coding property to compare
|
|
31
37
|
* @param propertyValue value we want to compare against string or boolean
|
|
32
38
|
* @returns array of matches
|
|
33
39
|
*/
|
|
34
|
-
getCodingsByProperty(codingList: any[], propertyToCompare: CodingKeys, propertyValue: any[CodingKeys]):
|
|
40
|
+
getCodingsByProperty<T = any>(codingList: any[] | null, propertyToCompare: CodingKeys, propertyValue: any[CodingKeys]): T[];
|
|
35
41
|
/**
|
|
42
|
+
* Get values at a specific path in a FHIR resource
|
|
36
43
|
*
|
|
44
|
+
* @template T - The value type to return (defaults to any for backward compatibility)
|
|
37
45
|
* @param resource resource for which path needs to be validated
|
|
38
|
-
* @param elementPath path to validate in resource
|
|
46
|
+
* @param elementPath path to validate in resource (e.g., "Patient.name.given")
|
|
39
47
|
* @returns array of elements found at the provided path
|
|
40
48
|
*/
|
|
41
|
-
getValuesAtResourcePath(resource: any, elementPath: string):
|
|
49
|
+
getValuesAtResourcePath<T = any>(resource: any, elementPath: string): T[];
|
|
42
50
|
private getValuesAtResourcePathInner;
|
|
43
51
|
private isPrimitive;
|
|
44
52
|
/**
|
|
@@ -11,13 +11,15 @@ class ResourceUtils {
|
|
|
11
11
|
*/
|
|
12
12
|
getResourceProperty(inputJson, propertyName) {
|
|
13
13
|
let resourcePropertyValue = null;
|
|
14
|
-
if (
|
|
14
|
+
if (Object.prototype.hasOwnProperty.call(inputJson, propertyName)) {
|
|
15
15
|
resourcePropertyValue = inputJson[propertyName];
|
|
16
16
|
}
|
|
17
17
|
return resourcePropertyValue;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
+
* Get identifiers from a list filtered by property value
|
|
20
21
|
*
|
|
22
|
+
* @template T - The identifier type to return (defaults to any for backward compatibility)
|
|
21
23
|
* @param identifierList list of identifiers
|
|
22
24
|
* @param propertyToCompare identifier property to compare
|
|
23
25
|
* @param propertyValue value we want to compare against
|
|
@@ -30,18 +32,20 @@ class ResourceUtils {
|
|
|
30
32
|
: [];
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
35
|
+
* Get extensions from a list filtered by URL
|
|
33
36
|
*
|
|
37
|
+
* @template T - The extension type to return (defaults to any for backward compatibility)
|
|
34
38
|
* @param extensionList list of extensions
|
|
35
39
|
* @param extensionUrl Extension.url to compare
|
|
36
40
|
* @returns array of matches
|
|
37
41
|
*/
|
|
38
42
|
getExtensionsByUrl(extensionList, extensionUrl) {
|
|
39
|
-
return (extensionList === null || extensionList === void 0 ? void 0 : extensionList.length)
|
|
40
|
-
? extensionList.filter((x) => x["url"] === extensionUrl)
|
|
41
|
-
: [];
|
|
43
|
+
return (extensionList === null || extensionList === void 0 ? void 0 : extensionList.length) ? extensionList.filter((x) => x['url'] === extensionUrl) : [];
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
46
|
+
* Get codings from a list filtered by property value
|
|
44
47
|
*
|
|
48
|
+
* @template T - The coding type to return (defaults to any for backward compatibility)
|
|
45
49
|
* @param codingList list of codings
|
|
46
50
|
* @param propertyToCompare coding property to compare
|
|
47
51
|
* @param propertyValue value we want to compare against string or boolean
|
|
@@ -53,28 +57,32 @@ class ResourceUtils {
|
|
|
53
57
|
: [];
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
60
|
+
* Get values at a specific path in a FHIR resource
|
|
56
61
|
*
|
|
62
|
+
* @template T - The value type to return (defaults to any for backward compatibility)
|
|
57
63
|
* @param resource resource for which path needs to be validated
|
|
58
|
-
* @param elementPath path to validate in resource
|
|
64
|
+
* @param elementPath path to validate in resource (e.g., "Patient.name.given")
|
|
59
65
|
* @returns array of elements found at the provided path
|
|
60
66
|
*/
|
|
61
67
|
getValuesAtResourcePath(resource, elementPath) {
|
|
62
68
|
const pathSections = elementPath.split('.');
|
|
63
|
-
if (!resource ||
|
|
69
|
+
if (!resource || resource.resourceType !== pathSections[0]) {
|
|
64
70
|
return [];
|
|
71
|
+
}
|
|
65
72
|
return this.getValuesAtResourcePathInner(resource, pathSections);
|
|
66
73
|
}
|
|
67
74
|
getValuesAtResourcePathInner(resource, pathSections) {
|
|
75
|
+
var _a;
|
|
68
76
|
let resourcePathValue;
|
|
69
77
|
for (let index = 1; index < pathSections.length; index++) {
|
|
70
|
-
const subPaths = pathSections[index];
|
|
78
|
+
const subPaths = (_a = pathSections[index]) !== null && _a !== void 0 ? _a : '';
|
|
71
79
|
resourcePathValue = resourcePathValue ? resourcePathValue[subPaths] : resource[subPaths];
|
|
72
80
|
if (resourcePathValue) {
|
|
73
81
|
if (this.isPrimitive(resourcePathValue) || pathSections.length === 2) {
|
|
74
82
|
return Array.isArray(resourcePathValue) ? [...resourcePathValue] : [resourcePathValue];
|
|
75
83
|
}
|
|
76
84
|
else if (Array.isArray(resourcePathValue) && resourcePathValue.length > 0) {
|
|
77
|
-
|
|
85
|
+
const resultSet = [];
|
|
78
86
|
for (let subPathIndex = 0; subPathIndex < resourcePathValue.length; subPathIndex++) {
|
|
79
87
|
const subPathValue = resourcePathValue[subPathIndex];
|
|
80
88
|
if (this.isPrimitive(subPathValue)) {
|
|
@@ -86,7 +94,7 @@ class ResourceUtils {
|
|
|
86
94
|
}
|
|
87
95
|
return resultSet;
|
|
88
96
|
}
|
|
89
|
-
else if (typeof
|
|
97
|
+
else if (typeof resourcePathValue === 'object') {
|
|
90
98
|
return this.getValuesAtResourcePathInner(resourcePathValue, pathSections.slice(index));
|
|
91
99
|
}
|
|
92
100
|
}
|
|
@@ -97,7 +105,7 @@ class ResourceUtils {
|
|
|
97
105
|
return [];
|
|
98
106
|
}
|
|
99
107
|
isPrimitive(value) {
|
|
100
|
-
return typeof
|
|
108
|
+
return typeof value === 'boolean' || typeof value === 'string';
|
|
101
109
|
}
|
|
102
110
|
/**
|
|
103
111
|
* @param resource resource to pull out references from
|
|
@@ -106,7 +114,7 @@ class ResourceUtils {
|
|
|
106
114
|
getAllReferencesFromResource(resource) {
|
|
107
115
|
const stringifiedResource = JSON.stringify(resource);
|
|
108
116
|
const referenceJsonString = '"reference":';
|
|
109
|
-
|
|
117
|
+
const references = [];
|
|
110
118
|
let cursor = stringifiedResource.indexOf(referenceJsonString, 0);
|
|
111
119
|
while (cursor > -1) {
|
|
112
120
|
const referenceStart = stringifiedResource.indexOf(referenceJsonString, cursor) + referenceJsonString.length;
|
|
@@ -1,297 +1,298 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ResourceUtils_1 = require("./ResourceUtils");
|
|
4
|
-
const patientPayload = require(
|
|
5
|
-
const careTeamPayload = require(
|
|
6
|
-
const careTeamContainedPayload = require(
|
|
7
|
-
describe(
|
|
8
|
-
|
|
9
|
-
describe(
|
|
10
|
-
it(
|
|
4
|
+
const patientPayload = require('./../../test-resources/Patient-R4.json');
|
|
5
|
+
const careTeamPayload = require('./../../test-resources/CareTeam-R4.json');
|
|
6
|
+
const careTeamContainedPayload = require('./../../test-resources/CareTeam-R4-contained.json');
|
|
7
|
+
describe('ResourceUtils', () => {
|
|
8
|
+
const resourceUtils = new ResourceUtils_1.ResourceUtils();
|
|
9
|
+
describe('#getResourceProperty()', () => {
|
|
10
|
+
it('should return property if property exists in valid inputJson', () => {
|
|
11
11
|
// execute
|
|
12
|
-
const actual = resourceUtils.getResourceProperty(patientPayload,
|
|
12
|
+
const actual = resourceUtils.getResourceProperty(patientPayload, 'deceasedBoolean');
|
|
13
13
|
// validate
|
|
14
14
|
expect(actual).toBeFalse();
|
|
15
15
|
});
|
|
16
|
-
it(
|
|
16
|
+
it('should return null if property exists in valid inputJson', () => {
|
|
17
17
|
// execute
|
|
18
|
-
const actual = resourceUtils.getResourceProperty(patientPayload,
|
|
18
|
+
const actual = resourceUtils.getResourceProperty(patientPayload, 'abcd');
|
|
19
19
|
// validate
|
|
20
20
|
expect(actual).toBeNull();
|
|
21
21
|
});
|
|
22
|
-
it(
|
|
22
|
+
it('should return null if invalid inputJson is passed', () => {
|
|
23
23
|
// setup
|
|
24
24
|
const inputPayload = [1, 2];
|
|
25
25
|
// execute
|
|
26
|
-
const actual = resourceUtils.getResourceProperty(inputPayload,
|
|
26
|
+
const actual = resourceUtils.getResourceProperty(inputPayload, 'deceasedBoolean');
|
|
27
27
|
// validate
|
|
28
28
|
expect(actual).toBeNull();
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
|
-
describe(
|
|
31
|
+
describe('#getIdentifiersByProperty()', () => {
|
|
32
32
|
const identifierList = [
|
|
33
33
|
{
|
|
34
|
-
use:
|
|
35
|
-
system:
|
|
36
|
-
value:
|
|
34
|
+
use: 'temp',
|
|
35
|
+
system: 'http://hl7.org/fhir/sid/us-ssn',
|
|
36
|
+
value: 'abc',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
use:
|
|
40
|
-
system:
|
|
41
|
-
value:
|
|
39
|
+
use: 'usual',
|
|
40
|
+
system: 'http://ns.electronichealth.net.au/id/hi/ihi/1.0',
|
|
41
|
+
value: 'abc',
|
|
42
42
|
},
|
|
43
43
|
];
|
|
44
|
-
it(
|
|
44
|
+
it('should return empty array if null is passed as identifier list', () => {
|
|
45
45
|
// setup
|
|
46
|
-
const value =
|
|
46
|
+
const value = 'shouldBeIgnored';
|
|
47
47
|
// execute
|
|
48
|
-
const actual = resourceUtils.getIdentifiersByProperty(null,
|
|
48
|
+
const actual = resourceUtils.getIdentifiersByProperty(null, 'id', value);
|
|
49
49
|
// validate
|
|
50
50
|
expect(actual.length).toEqual(0);
|
|
51
51
|
});
|
|
52
|
-
it(
|
|
52
|
+
it('should return empty array if property not found', () => {
|
|
53
53
|
// setup
|
|
54
|
-
const value =
|
|
54
|
+
const value = 'abc';
|
|
55
55
|
// execute
|
|
56
|
-
const actual = resourceUtils.getIdentifiersByProperty(identifierList,
|
|
56
|
+
const actual = resourceUtils.getIdentifiersByProperty(identifierList, 'extension', // no extensions in test data
|
|
57
57
|
value);
|
|
58
58
|
// validate
|
|
59
59
|
expect(actual.length).toEqual(0);
|
|
60
60
|
});
|
|
61
|
-
it(
|
|
61
|
+
it('should return empty array if no matches found', () => {
|
|
62
62
|
// setup
|
|
63
|
-
const systemUrl =
|
|
63
|
+
const systemUrl = 'http://somesystem.com';
|
|
64
64
|
// execute
|
|
65
|
-
const actual = resourceUtils.getIdentifiersByProperty(identifierList,
|
|
65
|
+
const actual = resourceUtils.getIdentifiersByProperty(identifierList, 'system', systemUrl);
|
|
66
66
|
// validate
|
|
67
67
|
expect(actual.length).toEqual(0);
|
|
68
68
|
});
|
|
69
|
-
it(
|
|
69
|
+
it('should return array with all matches', () => {
|
|
70
70
|
// setup
|
|
71
|
-
const value =
|
|
71
|
+
const value = 'abc';
|
|
72
72
|
// execute
|
|
73
|
-
const actual = resourceUtils.getIdentifiersByProperty(identifierList,
|
|
73
|
+
const actual = resourceUtils.getIdentifiersByProperty(identifierList, 'value', value);
|
|
74
74
|
// validate
|
|
75
75
|
expect(actual.length).toEqual(2);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
describe(
|
|
78
|
+
describe('#getExtensionsByUrl()', () => {
|
|
79
79
|
const extensionList = [
|
|
80
80
|
{
|
|
81
|
-
url:
|
|
81
|
+
url: 'http://hl7.org/fhir/sid/us-ssn',
|
|
82
82
|
valueBoolean: true,
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
|
-
url:
|
|
86
|
-
valueString:
|
|
85
|
+
url: 'http://ns.electronichealth.net.au/id/hi/ihi/1.0',
|
|
86
|
+
valueString: 'abc',
|
|
87
87
|
},
|
|
88
88
|
];
|
|
89
|
-
it(
|
|
89
|
+
it('should return empty array if null is passed as extension list', () => {
|
|
90
90
|
// execute
|
|
91
|
-
const actual = resourceUtils.getExtensionsByUrl(null,
|
|
91
|
+
const actual = resourceUtils.getExtensionsByUrl(null, 'url');
|
|
92
92
|
// validate
|
|
93
93
|
expect(actual.length).toEqual(0);
|
|
94
94
|
});
|
|
95
|
-
it(
|
|
95
|
+
it('should return empty array if invalid extension array passed', () => {
|
|
96
96
|
// setup
|
|
97
97
|
const extensionListInvalid = [
|
|
98
98
|
{
|
|
99
99
|
// @ts-ignore
|
|
100
|
-
use:
|
|
101
|
-
system:
|
|
102
|
-
value:
|
|
100
|
+
use: 'temp',
|
|
101
|
+
system: 'http://hl7.org/fhir/sid/us-ssn',
|
|
102
|
+
value: 'abc',
|
|
103
103
|
},
|
|
104
104
|
]; // disabling compiler warning for the test
|
|
105
|
-
const url =
|
|
105
|
+
const url = 'http://ns.electronichealth.net.au/id/hi/ihi/1.0';
|
|
106
106
|
// execute
|
|
107
107
|
const actual = resourceUtils.getExtensionsByUrl(extensionListInvalid, url);
|
|
108
108
|
// validate
|
|
109
109
|
expect(actual.length).toEqual(0);
|
|
110
110
|
});
|
|
111
|
-
it(
|
|
111
|
+
it('should return empty array if no matches found', () => {
|
|
112
112
|
// setup
|
|
113
|
-
const url =
|
|
113
|
+
const url = 'http://somesystem.com';
|
|
114
114
|
// execute
|
|
115
115
|
const actual = resourceUtils.getExtensionsByUrl(extensionList, url);
|
|
116
116
|
// validate
|
|
117
117
|
expect(actual.length).toEqual(0);
|
|
118
118
|
});
|
|
119
|
-
it(
|
|
119
|
+
it('should return array with all matches', () => {
|
|
120
120
|
// setup
|
|
121
|
-
const url =
|
|
121
|
+
const url = 'http://ns.electronichealth.net.au/id/hi/ihi/1.0';
|
|
122
122
|
// execute
|
|
123
123
|
const actual = resourceUtils.getExtensionsByUrl(extensionList, url);
|
|
124
124
|
// validate
|
|
125
125
|
expect(actual.length).toEqual(1);
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
|
-
describe(
|
|
128
|
+
describe('#getCodingsByProperty()', () => {
|
|
129
129
|
const codingList = [
|
|
130
130
|
{
|
|
131
|
-
version:
|
|
132
|
-
system:
|
|
133
|
-
code:
|
|
134
|
-
display:
|
|
131
|
+
version: '1.0',
|
|
132
|
+
system: 'http://hl7.org/fhir/sid/us-ssn',
|
|
133
|
+
code: 'abc',
|
|
134
|
+
display: 'abc',
|
|
135
135
|
userSelected: false,
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
|
-
version:
|
|
139
|
-
system:
|
|
140
|
-
code:
|
|
141
|
-
display:
|
|
138
|
+
version: '1.1',
|
|
139
|
+
system: 'http://ns.electronichealth.net.au/id/hi/ihi/1.0',
|
|
140
|
+
code: 'abc',
|
|
141
|
+
display: 'abc',
|
|
142
142
|
},
|
|
143
143
|
];
|
|
144
|
-
it(
|
|
144
|
+
it('should return empty array if null is passed as coding list', () => {
|
|
145
145
|
// setup
|
|
146
|
-
const value =
|
|
146
|
+
const value = 'shouldBeIgnored';
|
|
147
147
|
// execute
|
|
148
|
-
const actual = resourceUtils.getCodingsByProperty(null,
|
|
148
|
+
const actual = resourceUtils.getCodingsByProperty(null, 'extension', value);
|
|
149
149
|
// validate
|
|
150
150
|
expect(actual.length).toEqual(0);
|
|
151
151
|
});
|
|
152
|
-
it(
|
|
152
|
+
it('should return empty array if property not found', () => {
|
|
153
153
|
// setup
|
|
154
|
-
const value =
|
|
154
|
+
const value = 'abc';
|
|
155
155
|
// execute
|
|
156
|
-
const actual = resourceUtils.getCodingsByProperty(codingList,
|
|
156
|
+
const actual = resourceUtils.getCodingsByProperty(codingList, 'id', // expect no ID in codingList
|
|
157
157
|
value);
|
|
158
158
|
// validate
|
|
159
159
|
expect(actual.length).toEqual(0);
|
|
160
160
|
});
|
|
161
|
-
it(
|
|
161
|
+
it('should return empty array if no matches found', () => {
|
|
162
162
|
// setup
|
|
163
|
-
const systemUrl =
|
|
163
|
+
const systemUrl = 'http://somesystem.com';
|
|
164
164
|
// execute
|
|
165
|
-
const actual = resourceUtils.getCodingsByProperty(codingList,
|
|
165
|
+
const actual = resourceUtils.getCodingsByProperty(codingList, 'system', systemUrl);
|
|
166
166
|
// validate
|
|
167
167
|
expect(actual.length).toEqual(0);
|
|
168
168
|
});
|
|
169
|
-
it(
|
|
169
|
+
it('should return array with all matches for string values', () => {
|
|
170
170
|
// setup
|
|
171
|
-
const value =
|
|
171
|
+
const value = 'abc';
|
|
172
172
|
// execute
|
|
173
|
-
const actual = resourceUtils.getCodingsByProperty(codingList,
|
|
173
|
+
const actual = resourceUtils.getCodingsByProperty(codingList, 'code', value);
|
|
174
174
|
// validate
|
|
175
175
|
expect(actual.length).toEqual(2);
|
|
176
176
|
});
|
|
177
|
-
it(
|
|
177
|
+
it('should return array with all matches for boolean values', () => {
|
|
178
178
|
// setup
|
|
179
179
|
const value = false;
|
|
180
180
|
// execute
|
|
181
|
-
const actual = resourceUtils.getCodingsByProperty(codingList,
|
|
181
|
+
const actual = resourceUtils.getCodingsByProperty(codingList, 'userSelected', value);
|
|
182
182
|
// validate
|
|
183
183
|
expect(actual.length).toEqual(1);
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
|
-
describe(
|
|
187
|
-
it(
|
|
186
|
+
describe('#getValuesAtResourcePath()', () => {
|
|
187
|
+
it('should return empty array if the root of the path path does not match the resource type', () => {
|
|
188
188
|
// execute
|
|
189
|
-
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
189
|
+
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Practitioner.name.given');
|
|
190
190
|
// validate
|
|
191
191
|
expect(pathValues.length).toEqual(0);
|
|
192
192
|
});
|
|
193
|
-
it(
|
|
193
|
+
it('should return array with values if path exists for a top level element', () => {
|
|
194
194
|
// execute
|
|
195
|
-
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
195
|
+
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.gender');
|
|
196
196
|
// validate
|
|
197
197
|
expect(pathValues.length).toEqual(1);
|
|
198
|
-
expect(pathValues[0]).toEqual(
|
|
198
|
+
expect(pathValues[0]).toEqual('male');
|
|
199
199
|
});
|
|
200
200
|
it('should return array with values if path exists for a top level element and is an object', () => {
|
|
201
201
|
const expected = [
|
|
202
202
|
{
|
|
203
203
|
coding: [
|
|
204
204
|
{
|
|
205
|
-
system:
|
|
206
|
-
code:
|
|
207
|
-
display:
|
|
208
|
-
}
|
|
205
|
+
system: 'http://terminology.hl7.org/CodeSystem/v3-MaritalStatus',
|
|
206
|
+
code: 'M',
|
|
207
|
+
display: 'Married',
|
|
208
|
+
},
|
|
209
209
|
],
|
|
210
|
-
text:
|
|
211
|
-
}
|
|
210
|
+
text: 'Getrouwd',
|
|
211
|
+
},
|
|
212
212
|
];
|
|
213
213
|
// execute
|
|
214
|
-
const actual = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
214
|
+
const actual = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.maritalStatus');
|
|
215
215
|
// validate
|
|
216
216
|
expect(actual.length).toEqual(1);
|
|
217
217
|
expect(actual).toEqual(expected);
|
|
218
218
|
});
|
|
219
|
-
it(
|
|
219
|
+
it('should return array with values if path exists for a top level element and is an array', () => {
|
|
220
220
|
// setup
|
|
221
221
|
const expected = [
|
|
222
222
|
{
|
|
223
|
-
use:
|
|
224
|
-
family:
|
|
225
|
-
given: [
|
|
226
|
-
suffix: [
|
|
223
|
+
use: 'usual',
|
|
224
|
+
family: 'van de Heuvel',
|
|
225
|
+
given: ['Pieter', 'Peter'],
|
|
226
|
+
suffix: ['MSc'],
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
|
-
use:
|
|
230
|
-
family:
|
|
231
|
-
given: [
|
|
232
|
-
suffix: [
|
|
229
|
+
use: 'usual',
|
|
230
|
+
family: 'van de Heuvel',
|
|
231
|
+
given: ['Pieter'],
|
|
232
|
+
suffix: ['MSc'],
|
|
233
233
|
},
|
|
234
234
|
];
|
|
235
235
|
// execute
|
|
236
|
-
const actual = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
236
|
+
const actual = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.name');
|
|
237
237
|
// validate
|
|
238
238
|
expect(actual.length).toEqual(2);
|
|
239
239
|
expect(actual).toEqual(expected);
|
|
240
240
|
});
|
|
241
|
-
it(
|
|
241
|
+
it('should return array with values for a array under object', () => {
|
|
242
242
|
// execute
|
|
243
|
-
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
243
|
+
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.name.given');
|
|
244
244
|
// validate
|
|
245
245
|
expect(pathValues.length).toEqual(3);
|
|
246
|
-
expect(pathValues[0]).toEqual(
|
|
247
|
-
expect(pathValues[1]).toEqual(
|
|
248
|
-
expect(pathValues[2]).toEqual(
|
|
246
|
+
expect(pathValues[0]).toEqual('Pieter');
|
|
247
|
+
expect(pathValues[1]).toEqual('Peter');
|
|
248
|
+
expect(pathValues[2]).toEqual('Pieter');
|
|
249
249
|
});
|
|
250
|
-
it(
|
|
250
|
+
it('should return array with values if path exists for a deep array element', () => {
|
|
251
251
|
// execute
|
|
252
|
-
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
252
|
+
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.contact.relationship.coding.system');
|
|
253
253
|
// validate
|
|
254
254
|
expect(pathValues.length).toEqual(2);
|
|
255
|
-
expect(pathValues[0]).toEqual(
|
|
256
|
-
expect(pathValues[1]).toEqual(
|
|
255
|
+
expect(pathValues[0]).toEqual('http://terminology.hl7.org/CodeSystem/v2-0131');
|
|
256
|
+
expect(pathValues[1]).toEqual('http://terminology.hl7.org/CodeSystem/v2-0132');
|
|
257
257
|
});
|
|
258
|
-
it(
|
|
258
|
+
it('should return array with values if path exists for a deep json element', () => {
|
|
259
259
|
// execute
|
|
260
|
-
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
260
|
+
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.maritalStatus.coding.system');
|
|
261
261
|
// validate
|
|
262
262
|
expect(pathValues.length).toEqual(1);
|
|
263
|
-
expect(pathValues[0]).toEqual(
|
|
263
|
+
expect(pathValues[0]).toEqual('http://terminology.hl7.org/CodeSystem/v3-MaritalStatus');
|
|
264
264
|
});
|
|
265
|
-
it(
|
|
265
|
+
it('should return empty array if path does not exist', () => {
|
|
266
266
|
// execute
|
|
267
|
-
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload,
|
|
267
|
+
const pathValues = resourceUtils.getValuesAtResourcePath(patientPayload, 'Patient.contact.relationship.coding.abcd');
|
|
268
268
|
// validate
|
|
269
269
|
expect(pathValues.length).toEqual(0);
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
|
-
describe(
|
|
273
|
-
it(
|
|
272
|
+
describe('#getAllResourceReferences()', () => {
|
|
273
|
+
it('should return array of all references in a resource when references found', () => {
|
|
274
274
|
// execute
|
|
275
275
|
const actual = resourceUtils.getAllReferencesFromResource(careTeamPayload);
|
|
276
276
|
// validate
|
|
277
277
|
expect(actual.length).toEqual(6);
|
|
278
278
|
});
|
|
279
|
-
it(
|
|
279
|
+
it('should return empty array if references in a resource not found', () => {
|
|
280
280
|
// setup
|
|
281
281
|
const input = {
|
|
282
|
-
|
|
282
|
+
resourceType: 'Patient',
|
|
283
283
|
};
|
|
284
284
|
// execute
|
|
285
285
|
const actual = resourceUtils.getAllReferencesFromResource(input);
|
|
286
286
|
// validate
|
|
287
287
|
expect(actual.length).toEqual(0);
|
|
288
288
|
});
|
|
289
|
-
it(
|
|
289
|
+
it('should return array of all references in a resource when references found in contained resource', () => {
|
|
290
|
+
var _a;
|
|
290
291
|
// setup
|
|
291
292
|
const input = careTeamContainedPayload;
|
|
292
293
|
expect(input.contained).toHaveSize(1);
|
|
293
294
|
// execute
|
|
294
|
-
const actual = resourceUtils.getAllReferencesFromResource(input.contained[0]);
|
|
295
|
+
const actual = resourceUtils.getAllReferencesFromResource((_a = input.contained) === null || _a === void 0 ? void 0 : _a[0]);
|
|
295
296
|
// validate
|
|
296
297
|
expect(actual.length).toEqual(1);
|
|
297
298
|
});
|
|
@@ -5,7 +5,7 @@ var SORT_ORDER;
|
|
|
5
5
|
(function (SORT_ORDER) {
|
|
6
6
|
SORT_ORDER[SORT_ORDER["ASCENDING"] = 0] = "ASCENDING";
|
|
7
7
|
SORT_ORDER[SORT_ORDER["DESCENDING"] = 1] = "DESCENDING";
|
|
8
|
-
})(SORT_ORDER
|
|
8
|
+
})(SORT_ORDER || (exports.SORT_ORDER = SORT_ORDER = {}));
|
|
9
9
|
var PATCH_DATATYPE;
|
|
10
10
|
(function (PATCH_DATATYPE) {
|
|
11
11
|
PATCH_DATATYPE["CODE"] = "valueCode";
|
|
@@ -19,4 +19,4 @@ var PATCH_DATATYPE;
|
|
|
19
19
|
PATCH_DATATYPE["STRING"] = "valueString";
|
|
20
20
|
PATCH_DATATYPE["ADDRESS"] = "valueAddress";
|
|
21
21
|
PATCH_DATATYPE["REFERENCE"] = "valueReference";
|
|
22
|
-
})(PATCH_DATATYPE
|
|
22
|
+
})(PATCH_DATATYPE || (exports.PATCH_DATATYPE = PATCH_DATATYPE = {}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { fhirR5 } from
|
|
2
|
-
import * as DSTU2 from
|
|
3
|
-
import * as fhirR3 from
|
|
4
|
-
import { Coding as r4Coding } from
|
|
5
|
-
import { Extension as r4Extension } from
|
|
6
|
-
import { Identifier as r4Identifier } from
|
|
1
|
+
import { fhirR5 } from '..';
|
|
2
|
+
import * as DSTU2 from '../FHIR-DSTU2';
|
|
3
|
+
import * as fhirR3 from '../FHIR-R3';
|
|
4
|
+
import { Coding as r4Coding } from '../FHIR-R4/classes/coding';
|
|
5
|
+
import { Extension as r4Extension } from '../FHIR-R4/classes/extension';
|
|
6
|
+
import { Identifier as r4Identifier } from '../FHIR-R4/classes/identifier';
|
|
7
7
|
export type Identifier = r4Identifier & fhirR3.Identifier & DSTU2.Identifier & fhirR5.Identifier;
|
|
8
8
|
export type IdentifierKeys = keyof Identifier;
|
|
9
9
|
export type Extension = r4Extension & fhirR3.Extension & DSTU2.Extension & fhirR5.Extension;
|