@medplum/core 0.1.6 → 0.3.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.
- package/README.md +29 -25
- package/dist/cache.d.ts +1 -0
- package/dist/cache.js +3 -2
- package/dist/cache.js.map +1 -1
- package/dist/client.d.ts +72 -54
- package/dist/client.js +267 -223
- package/dist/client.js.map +1 -1
- package/dist/crypto.js +13 -2
- package/dist/crypto.js.map +1 -1
- package/dist/eventtarget.js +1 -2
- package/dist/eventtarget.js.map +1 -1
- package/dist/format.d.ts +1 -1
- package/dist/format.js +4 -4
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/jwt.js.map +1 -1
- package/dist/outcomes.d.ts +4 -1
- package/dist/outcomes.js +71 -24
- package/dist/outcomes.js.map +1 -1
- package/dist/search.js +7 -9
- package/dist/search.js.map +1 -1
- package/dist/searchparams.d.ts +34 -0
- package/dist/searchparams.js +128 -0
- package/dist/searchparams.js.map +1 -0
- package/dist/storage.d.ts +36 -12
- package/dist/storage.js +55 -22
- package/dist/storage.js.map +1 -1
- package/dist/types.d.ts +3 -5
- package/dist/types.js +32 -18
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +14 -3
- package/dist/utils.js +57 -12
- package/dist/utils.js.map +1 -1
- package/package.json +3 -16
- package/dist/cache.test.d.ts +0 -1
- package/dist/cache.test.js +0 -29
- package/dist/cache.test.js.map +0 -1
- package/dist/client.test.d.ts +0 -1
- package/dist/client.test.js +0 -294
- package/dist/client.test.js.map +0 -1
- package/dist/eventtarget.test.d.ts +0 -1
- package/dist/eventtarget.test.js +0 -44
- package/dist/eventtarget.test.js.map +0 -1
- package/dist/fhir/Account.d.ts +0 -240
- package/dist/fhir/Account.js +0 -7
- package/dist/fhir/Account.js.map +0 -1
- package/dist/fhir/ActivityDefinition.d.ts +0 -494
- package/dist/fhir/ActivityDefinition.js +0 -7
- package/dist/fhir/ActivityDefinition.js.map +0 -1
- package/dist/fhir/Address.d.ts +0 -74
- package/dist/fhir/Address.js +0 -7
- package/dist/fhir/Address.js.map +0 -1
- package/dist/fhir/AdverseEvent.d.ts +0 -287
- package/dist/fhir/AdverseEvent.js +0 -7
- package/dist/fhir/AdverseEvent.js.map +0 -1
- package/dist/fhir/Age.d.ts +0 -47
- package/dist/fhir/Age.js +0 -7
- package/dist/fhir/Age.js.map +0 -1
- package/dist/fhir/AllergyIntolerance.d.ts +0 -278
- package/dist/fhir/AllergyIntolerance.js +0 -7
- package/dist/fhir/AllergyIntolerance.js.map +0 -1
- package/dist/fhir/Annotation.d.ts +0 -38
- package/dist/fhir/Annotation.js +0 -7
- package/dist/fhir/Annotation.js.map +0 -1
- package/dist/fhir/Appointment.d.ts +0 -273
- package/dist/fhir/Appointment.js +0 -7
- package/dist/fhir/Appointment.js.map +0 -1
- package/dist/fhir/AppointmentResponse.d.ts +0 -123
- package/dist/fhir/AppointmentResponse.js +0 -7
- package/dist/fhir/AppointmentResponse.js.map +0 -1
- package/dist/fhir/Attachment.d.ts +0 -57
- package/dist/fhir/Attachment.js +0 -7
- package/dist/fhir/Attachment.js.map +0 -1
- package/dist/fhir/AuditEvent.d.ts +0 -458
- package/dist/fhir/AuditEvent.js +0 -7
- package/dist/fhir/AuditEvent.js.map +0 -1
- package/dist/fhir/Basic.d.ts +0 -105
- package/dist/fhir/Basic.js +0 -7
- package/dist/fhir/Basic.js.map +0 -1
- package/dist/fhir/Binary.d.ts +0 -58
- package/dist/fhir/Binary.js +0 -7
- package/dist/fhir/Binary.js.map +0 -1
- package/dist/fhir/BiologicallyDerivedProduct.d.ts +0 -356
- package/dist/fhir/BiologicallyDerivedProduct.js +0 -7
- package/dist/fhir/BiologicallyDerivedProduct.js.map +0 -1
- package/dist/fhir/BodyStructure.d.ts +0 -118
- package/dist/fhir/BodyStructure.js +0 -7
- package/dist/fhir/BodyStructure.js.map +0 -1
- package/dist/fhir/Bundle.d.ts +0 -373
- package/dist/fhir/Bundle.js +0 -7
- package/dist/fhir/Bundle.js.map +0 -1
- package/dist/fhir/CapabilityStatement.d.ts +0 -1068
- package/dist/fhir/CapabilityStatement.js +0 -7
- package/dist/fhir/CapabilityStatement.js.map +0 -1
- package/dist/fhir/CarePlan.d.ts +0 -421
- package/dist/fhir/CarePlan.js +0 -7
- package/dist/fhir/CarePlan.js.map +0 -1
- package/dist/fhir/CareTeam.d.ts +0 -203
- package/dist/fhir/CareTeam.js +0 -7
- package/dist/fhir/CareTeam.js.map +0 -1
- package/dist/fhir/CatalogEntry.d.ts +0 -184
- package/dist/fhir/CatalogEntry.js +0 -7
- package/dist/fhir/CatalogEntry.js.map +0 -1
- package/dist/fhir/ChargeItem.d.ts +0 -270
- package/dist/fhir/ChargeItem.js +0 -7
- package/dist/fhir/ChargeItem.js.map +0 -1
- package/dist/fhir/ChargeItemDefinition.d.ts +0 -402
- package/dist/fhir/ChargeItemDefinition.js +0 -7
- package/dist/fhir/ChargeItemDefinition.js.map +0 -1
- package/dist/fhir/Claim.d.ts +0 -1089
- package/dist/fhir/Claim.js +0 -7
- package/dist/fhir/Claim.js.map +0 -1
- package/dist/fhir/ClaimResponse.d.ts +0 -1037
- package/dist/fhir/ClaimResponse.js +0 -7
- package/dist/fhir/ClaimResponse.js.map +0 -1
- package/dist/fhir/ClientApplication.d.ts +0 -54
- package/dist/fhir/ClientApplication.js +0 -7
- package/dist/fhir/ClientApplication.js.map +0 -1
- package/dist/fhir/ClinicalImpression.d.ts +0 -301
- package/dist/fhir/ClinicalImpression.js +0 -7
- package/dist/fhir/ClinicalImpression.js.map +0 -1
- package/dist/fhir/CodeSystem.d.ts +0 -546
- package/dist/fhir/CodeSystem.js +0 -7
- package/dist/fhir/CodeSystem.js.map +0 -1
- package/dist/fhir/CodeableConcept.d.ts +0 -32
- package/dist/fhir/CodeableConcept.js +0 -7
- package/dist/fhir/CodeableConcept.js.map +0 -1
- package/dist/fhir/Coding.d.ts +0 -49
- package/dist/fhir/Coding.js +0 -7
- package/dist/fhir/Coding.js.map +0 -1
- package/dist/fhir/Communication.d.ts +0 -251
- package/dist/fhir/Communication.js +0 -7
- package/dist/fhir/Communication.js.map +0 -1
- package/dist/fhir/CommunicationRequest.d.ts +0 -248
- package/dist/fhir/CommunicationRequest.js +0 -7
- package/dist/fhir/CommunicationRequest.js.map +0 -1
- package/dist/fhir/CompartmentDefinition.d.ts +0 -218
- package/dist/fhir/CompartmentDefinition.js +0 -7
- package/dist/fhir/CompartmentDefinition.js.map +0 -1
- package/dist/fhir/Composition.d.ts +0 -455
- package/dist/fhir/Composition.js +0 -7
- package/dist/fhir/Composition.js.map +0 -1
- package/dist/fhir/ConceptMap.d.ts +0 -523
- package/dist/fhir/ConceptMap.js +0 -7
- package/dist/fhir/ConceptMap.js.map +0 -1
- package/dist/fhir/Condition.d.ts +0 -316
- package/dist/fhir/Condition.js +0 -7
- package/dist/fhir/Condition.js.map +0 -1
- package/dist/fhir/Consent.d.ts +0 -457
- package/dist/fhir/Consent.js +0 -7
- package/dist/fhir/Consent.js.map +0 -1
- package/dist/fhir/ContactDetail.d.ts +0 -30
- package/dist/fhir/ContactDetail.js +0 -7
- package/dist/fhir/ContactDetail.js.map +0 -1
- package/dist/fhir/ContactPoint.d.ts +0 -46
- package/dist/fhir/ContactPoint.js +0 -7
- package/dist/fhir/ContactPoint.js.map +0 -1
- package/dist/fhir/Contract.d.ts +0 -1431
- package/dist/fhir/Contract.js +0 -7
- package/dist/fhir/Contract.js.map +0 -1
- package/dist/fhir/Contributor.d.ts +0 -36
- package/dist/fhir/Contributor.js +0 -7
- package/dist/fhir/Contributor.js.map +0 -1
- package/dist/fhir/Count.d.ts +0 -49
- package/dist/fhir/Count.js +0 -7
- package/dist/fhir/Count.js.map +0 -1
- package/dist/fhir/Coverage.d.ts +0 -323
- package/dist/fhir/Coverage.js +0 -7
- package/dist/fhir/Coverage.js.map +0 -1
- package/dist/fhir/CoverageEligibilityRequest.d.ts +0 -409
- package/dist/fhir/CoverageEligibilityRequest.js +0 -7
- package/dist/fhir/CoverageEligibilityRequest.js.map +0 -1
- package/dist/fhir/CoverageEligibilityResponse.d.ts +0 -430
- package/dist/fhir/CoverageEligibilityResponse.js +0 -7
- package/dist/fhir/CoverageEligibilityResponse.js.map +0 -1
- package/dist/fhir/DataRequirement.d.ts +0 -288
- package/dist/fhir/DataRequirement.js +0 -7
- package/dist/fhir/DataRequirement.js.map +0 -1
- package/dist/fhir/DetectedIssue.d.ts +0 -249
- package/dist/fhir/DetectedIssue.js +0 -7
- package/dist/fhir/DetectedIssue.js.map +0 -1
- package/dist/fhir/Device.d.ts +0 -488
- package/dist/fhir/Device.js +0 -7
- package/dist/fhir/Device.js.map +0 -1
- package/dist/fhir/DeviceDefinition.d.ts +0 -484
- package/dist/fhir/DeviceDefinition.js +0 -7
- package/dist/fhir/DeviceDefinition.js.map +0 -1
- package/dist/fhir/DeviceMetric.d.ts +0 -198
- package/dist/fhir/DeviceMetric.js +0 -7
- package/dist/fhir/DeviceMetric.js.map +0 -1
- package/dist/fhir/DeviceRequest.d.ts +0 -279
- package/dist/fhir/DeviceRequest.js +0 -7
- package/dist/fhir/DeviceRequest.js.map +0 -1
- package/dist/fhir/DeviceUseStatement.d.ts +0 -153
- package/dist/fhir/DeviceUseStatement.js +0 -7
- package/dist/fhir/DeviceUseStatement.js.map +0 -1
- package/dist/fhir/DiagnosticReport.d.ts +0 -239
- package/dist/fhir/DiagnosticReport.js +0 -7
- package/dist/fhir/DiagnosticReport.js.map +0 -1
- package/dist/fhir/Distance.d.ts +0 -46
- package/dist/fhir/Distance.js +0 -7
- package/dist/fhir/Distance.js.map +0 -1
- package/dist/fhir/DocumentManifest.d.ts +0 -190
- package/dist/fhir/DocumentManifest.js +0 -7
- package/dist/fhir/DocumentManifest.js.map +0 -1
- package/dist/fhir/DocumentReference.d.ts +0 -353
- package/dist/fhir/DocumentReference.js +0 -7
- package/dist/fhir/DocumentReference.js.map +0 -1
- package/dist/fhir/Dosage.d.ts +0 -171
- package/dist/fhir/Dosage.js +0 -7
- package/dist/fhir/Dosage.js.map +0 -1
- package/dist/fhir/Duration.d.ts +0 -46
- package/dist/fhir/Duration.js +0 -7
- package/dist/fhir/Duration.js.map +0 -1
- package/dist/fhir/EffectEvidenceSynthesis.d.ts +0 -600
- package/dist/fhir/EffectEvidenceSynthesis.js +0 -7
- package/dist/fhir/EffectEvidenceSynthesis.js.map +0 -1
- package/dist/fhir/Element.d.ts +0 -20
- package/dist/fhir/Element.js +0 -7
- package/dist/fhir/Element.js.map +0 -1
- package/dist/fhir/ElementDefinition.d.ts +0 -2828
- package/dist/fhir/ElementDefinition.js +0 -7
- package/dist/fhir/ElementDefinition.js.map +0 -1
- package/dist/fhir/Encounter.d.ts +0 -546
- package/dist/fhir/Encounter.js +0 -7
- package/dist/fhir/Encounter.js.map +0 -1
- package/dist/fhir/Endpoint.d.ts +0 -139
- package/dist/fhir/Endpoint.js +0 -7
- package/dist/fhir/Endpoint.js.map +0 -1
- package/dist/fhir/EnrollmentRequest.d.ts +0 -108
- package/dist/fhir/EnrollmentRequest.js +0 -7
- package/dist/fhir/EnrollmentRequest.js.map +0 -1
- package/dist/fhir/EnrollmentResponse.d.ts +0 -113
- package/dist/fhir/EnrollmentResponse.js +0 -7
- package/dist/fhir/EnrollmentResponse.js.map +0 -1
- package/dist/fhir/EpisodeOfCare.d.ts +0 -243
- package/dist/fhir/EpisodeOfCare.js +0 -7
- package/dist/fhir/EpisodeOfCare.js.map +0 -1
- package/dist/fhir/EventDefinition.d.ts +0 -252
- package/dist/fhir/EventDefinition.js +0 -7
- package/dist/fhir/EventDefinition.js.map +0 -1
- package/dist/fhir/Evidence.d.ts +0 -251
- package/dist/fhir/Evidence.js +0 -7
- package/dist/fhir/Evidence.js.map +0 -1
- package/dist/fhir/EvidenceVariable.d.ts +0 -369
- package/dist/fhir/EvidenceVariable.js +0 -7
- package/dist/fhir/EvidenceVariable.js.map +0 -1
- package/dist/fhir/ExampleScenario.d.ts +0 -626
- package/dist/fhir/ExampleScenario.js +0 -7
- package/dist/fhir/ExampleScenario.js.map +0 -1
- package/dist/fhir/ExplanationOfBenefit.d.ts +0 -1854
- package/dist/fhir/ExplanationOfBenefit.js +0 -7
- package/dist/fhir/ExplanationOfBenefit.js.map +0 -1
- package/dist/fhir/Expression.d.ts +0 -45
- package/dist/fhir/Expression.js +0 -7
- package/dist/fhir/Expression.js.map +0 -1
- package/dist/fhir/Extension.d.ts +0 -305
- package/dist/fhir/Extension.js +0 -7
- package/dist/fhir/Extension.js.map +0 -1
- package/dist/fhir/FamilyMemberHistory.d.ts +0 -297
- package/dist/fhir/FamilyMemberHistory.js +0 -7
- package/dist/fhir/FamilyMemberHistory.js.map +0 -1
- package/dist/fhir/Flag.d.ts +0 -121
- package/dist/fhir/Flag.js +0 -7
- package/dist/fhir/Flag.js.map +0 -1
- package/dist/fhir/Goal.d.ts +0 -290
- package/dist/fhir/Goal.js +0 -7
- package/dist/fhir/Goal.js.map +0 -1
- package/dist/fhir/GraphDefinition.d.ts +0 -359
- package/dist/fhir/GraphDefinition.js +0 -7
- package/dist/fhir/GraphDefinition.js.map +0 -1
- package/dist/fhir/Group.d.ts +0 -268
- package/dist/fhir/Group.js +0 -7
- package/dist/fhir/Group.js.map +0 -1
- package/dist/fhir/GuidanceResponse.d.ts +0 -184
- package/dist/fhir/GuidanceResponse.js +0 -7
- package/dist/fhir/GuidanceResponse.js.map +0 -1
- package/dist/fhir/HealthcareService.d.ts +0 -351
- package/dist/fhir/HealthcareService.js +0 -7
- package/dist/fhir/HealthcareService.js.map +0 -1
- package/dist/fhir/HumanName.d.ts +0 -57
- package/dist/fhir/HumanName.js +0 -7
- package/dist/fhir/HumanName.js.map +0 -1
- package/dist/fhir/Identifier.d.ts +0 -51
- package/dist/fhir/Identifier.js +0 -7
- package/dist/fhir/Identifier.js.map +0 -1
- package/dist/fhir/ImagingStudy.d.ts +0 -398
- package/dist/fhir/ImagingStudy.js +0 -7
- package/dist/fhir/ImagingStudy.js.map +0 -1
- package/dist/fhir/Immunization.d.ts +0 -440
- package/dist/fhir/Immunization.js +0 -7
- package/dist/fhir/Immunization.js.map +0 -1
- package/dist/fhir/ImmunizationEvaluation.d.ts +0 -146
- package/dist/fhir/ImmunizationEvaluation.js +0 -7
- package/dist/fhir/ImmunizationEvaluation.js.map +0 -1
- package/dist/fhir/ImmunizationRecommendation.d.ts +0 -253
- package/dist/fhir/ImmunizationRecommendation.js +0 -7
- package/dist/fhir/ImmunizationRecommendation.js.map +0 -1
- package/dist/fhir/ImplementationGuide.d.ts +0 -854
- package/dist/fhir/ImplementationGuide.js +0 -7
- package/dist/fhir/ImplementationGuide.js.map +0 -1
- package/dist/fhir/InsurancePlan.d.ts +0 -630
- package/dist/fhir/InsurancePlan.js +0 -7
- package/dist/fhir/InsurancePlan.js.map +0 -1
- package/dist/fhir/Invoice.d.ts +0 -331
- package/dist/fhir/Invoice.js +0 -7
- package/dist/fhir/Invoice.js.map +0 -1
- package/dist/fhir/JsonWebKey.d.ts +0 -99
- package/dist/fhir/JsonWebKey.js +0 -7
- package/dist/fhir/JsonWebKey.js.map +0 -1
- package/dist/fhir/Library.d.ts +0 -276
- package/dist/fhir/Library.js +0 -7
- package/dist/fhir/Library.js.map +0 -1
- package/dist/fhir/Linkage.d.ts +0 -142
- package/dist/fhir/Linkage.js +0 -7
- package/dist/fhir/Linkage.js.map +0 -1
- package/dist/fhir/List.d.ts +0 -193
- package/dist/fhir/List.js +0 -7
- package/dist/fhir/List.js.map +0 -1
- package/dist/fhir/Location.d.ts +0 -278
- package/dist/fhir/Location.js +0 -7
- package/dist/fhir/Location.js.map +0 -1
- package/dist/fhir/Login.d.ts +0 -108
- package/dist/fhir/Login.js +0 -7
- package/dist/fhir/Login.js.map +0 -1
- package/dist/fhir/MarketingStatus.d.ts +0 -82
- package/dist/fhir/MarketingStatus.js +0 -7
- package/dist/fhir/MarketingStatus.js.map +0 -1
- package/dist/fhir/Measure.d.ts +0 -613
- package/dist/fhir/Measure.js +0 -7
- package/dist/fhir/Measure.js.map +0 -1
- package/dist/fhir/MeasureReport.d.ts +0 -460
- package/dist/fhir/MeasureReport.js +0 -7
- package/dist/fhir/MeasureReport.js.map +0 -1
- package/dist/fhir/Media.d.ts +0 -191
- package/dist/fhir/Media.js +0 -7
- package/dist/fhir/Media.js.map +0 -1
- package/dist/fhir/Medication.d.ts +0 -234
- package/dist/fhir/Medication.js +0 -7
- package/dist/fhir/Medication.js.map +0 -1
- package/dist/fhir/MedicationAdministration.d.ts +0 -343
- package/dist/fhir/MedicationAdministration.js +0 -7
- package/dist/fhir/MedicationAdministration.js.map +0 -1
- package/dist/fhir/MedicationDispense.d.ts +0 -332
- package/dist/fhir/MedicationDispense.js +0 -7
- package/dist/fhir/MedicationDispense.js.map +0 -1
- package/dist/fhir/MedicationKnowledge.d.ts +0 -979
- package/dist/fhir/MedicationKnowledge.js +0 -7
- package/dist/fhir/MedicationKnowledge.js.map +0 -1
- package/dist/fhir/MedicationRequest.d.ts +0 -468
- package/dist/fhir/MedicationRequest.js +0 -7
- package/dist/fhir/MedicationRequest.js.map +0 -1
- package/dist/fhir/MedicationStatement.d.ts +0 -210
- package/dist/fhir/MedicationStatement.js +0 -7
- package/dist/fhir/MedicationStatement.js.map +0 -1
- package/dist/fhir/MedicinalProduct.d.ts +0 -449
- package/dist/fhir/MedicinalProduct.js +0 -7
- package/dist/fhir/MedicinalProduct.js.map +0 -1
- package/dist/fhir/MedicinalProductAuthorization.d.ts +0 -267
- package/dist/fhir/MedicinalProductAuthorization.js +0 -7
- package/dist/fhir/MedicinalProductAuthorization.js.map +0 -1
- package/dist/fhir/MedicinalProductContraindication.d.ts +0 -165
- package/dist/fhir/MedicinalProductContraindication.js +0 -7
- package/dist/fhir/MedicinalProductContraindication.js.map +0 -1
- package/dist/fhir/MedicinalProductIndication.d.ts +0 -173
- package/dist/fhir/MedicinalProductIndication.js +0 -7
- package/dist/fhir/MedicinalProductIndication.js.map +0 -1
- package/dist/fhir/MedicinalProductIngredient.d.ts +0 -334
- package/dist/fhir/MedicinalProductIngredient.js +0 -7
- package/dist/fhir/MedicinalProductIngredient.js.map +0 -1
- package/dist/fhir/MedicinalProductInteraction.d.ts +0 -155
- package/dist/fhir/MedicinalProductInteraction.js +0 -7
- package/dist/fhir/MedicinalProductInteraction.js.map +0 -1
- package/dist/fhir/MedicinalProductManufactured.d.ts +0 -111
- package/dist/fhir/MedicinalProductManufactured.js +0 -7
- package/dist/fhir/MedicinalProductManufactured.js.map +0 -1
- package/dist/fhir/MedicinalProductPackaged.d.ts +0 -253
- package/dist/fhir/MedicinalProductPackaged.js +0 -7
- package/dist/fhir/MedicinalProductPackaged.js.map +0 -1
- package/dist/fhir/MedicinalProductPharmaceutical.d.ts +0 -331
- package/dist/fhir/MedicinalProductPharmaceutical.js +0 -7
- package/dist/fhir/MedicinalProductPharmaceutical.js.map +0 -1
- package/dist/fhir/MedicinalProductUndesirableEffect.d.ts +0 -99
- package/dist/fhir/MedicinalProductUndesirableEffect.js +0 -7
- package/dist/fhir/MedicinalProductUndesirableEffect.js.map +0 -1
- package/dist/fhir/MessageDefinition.d.ts +0 -331
- package/dist/fhir/MessageDefinition.js +0 -7
- package/dist/fhir/MessageDefinition.js.map +0 -1
- package/dist/fhir/MessageHeader.d.ts +0 -329
- package/dist/fhir/MessageHeader.js +0 -7
- package/dist/fhir/MessageHeader.js.map +0 -1
- package/dist/fhir/Meta.d.ts +0 -68
- package/dist/fhir/Meta.js +0 -7
- package/dist/fhir/Meta.js.map +0 -1
- package/dist/fhir/MolecularSequence.d.ts +0 -746
- package/dist/fhir/MolecularSequence.js +0 -7
- package/dist/fhir/MolecularSequence.js.map +0 -1
- package/dist/fhir/Money.d.ts +0 -28
- package/dist/fhir/Money.js +0 -7
- package/dist/fhir/Money.js.map +0 -1
- package/dist/fhir/NamingSystem.d.ts +0 -219
- package/dist/fhir/NamingSystem.js +0 -7
- package/dist/fhir/NamingSystem.js.map +0 -1
- package/dist/fhir/Narrative.d.ts +0 -31
- package/dist/fhir/Narrative.js +0 -7
- package/dist/fhir/Narrative.js.map +0 -1
- package/dist/fhir/NutritionOrder.d.ts +0 -558
- package/dist/fhir/NutritionOrder.js +0 -7
- package/dist/fhir/NutritionOrder.js.map +0 -1
- package/dist/fhir/Observation.d.ts +0 -487
- package/dist/fhir/Observation.js +0 -7
- package/dist/fhir/Observation.js.map +0 -1
- package/dist/fhir/ObservationDefinition.d.ts +0 -277
- package/dist/fhir/ObservationDefinition.js +0 -7
- package/dist/fhir/ObservationDefinition.js.map +0 -1
- package/dist/fhir/OperationDefinition.d.ts +0 -468
- package/dist/fhir/OperationDefinition.js +0 -7
- package/dist/fhir/OperationDefinition.js.map +0 -1
- package/dist/fhir/OperationOutcome.d.ts +0 -168
- package/dist/fhir/OperationOutcome.js +0 -7
- package/dist/fhir/OperationOutcome.js.map +0 -1
- package/dist/fhir/Organization.d.ts +0 -187
- package/dist/fhir/Organization.js +0 -7
- package/dist/fhir/Organization.js.map +0 -1
- package/dist/fhir/OrganizationAffiliation.d.ts +0 -141
- package/dist/fhir/OrganizationAffiliation.js +0 -7
- package/dist/fhir/OrganizationAffiliation.js.map +0 -1
- package/dist/fhir/ParameterDefinition.d.ts +0 -56
- package/dist/fhir/ParameterDefinition.js +0 -7
- package/dist/fhir/ParameterDefinition.js.map +0 -1
- package/dist/fhir/Parameters.d.ts +0 -321
- package/dist/fhir/Parameters.js +0 -7
- package/dist/fhir/Parameters.js.map +0 -1
- package/dist/fhir/PasswordChangeRequest.d.ts +0 -50
- package/dist/fhir/PasswordChangeRequest.js +0 -7
- package/dist/fhir/PasswordChangeRequest.js.map +0 -1
- package/dist/fhir/Patient.d.ts +0 -339
- package/dist/fhir/Patient.js +0 -7
- package/dist/fhir/Patient.js.map +0 -1
- package/dist/fhir/PaymentNotice.d.ts +0 -131
- package/dist/fhir/PaymentNotice.js +0 -7
- package/dist/fhir/PaymentNotice.js.map +0 -1
- package/dist/fhir/PaymentReconciliation.d.ts +0 -276
- package/dist/fhir/PaymentReconciliation.js +0 -7
- package/dist/fhir/PaymentReconciliation.js.map +0 -1
- package/dist/fhir/Period.d.ts +0 -31
- package/dist/fhir/Period.js +0 -7
- package/dist/fhir/Period.js.map +0 -1
- package/dist/fhir/Person.d.ts +0 -172
- package/dist/fhir/Person.js +0 -7
- package/dist/fhir/Person.js.map +0 -1
- package/dist/fhir/PlanDefinition.d.ts +0 -855
- package/dist/fhir/PlanDefinition.js +0 -7
- package/dist/fhir/PlanDefinition.js.map +0 -1
- package/dist/fhir/Population.d.ts +0 -61
- package/dist/fhir/Population.js +0 -7
- package/dist/fhir/Population.js.map +0 -1
- package/dist/fhir/Practitioner.d.ts +0 -188
- package/dist/fhir/Practitioner.js +0 -7
- package/dist/fhir/Practitioner.js.map +0 -1
- package/dist/fhir/PractitionerRole.d.ts +0 -254
- package/dist/fhir/PractitionerRole.js +0 -7
- package/dist/fhir/PractitionerRole.js.map +0 -1
- package/dist/fhir/Procedure.d.ts +0 -355
- package/dist/fhir/Procedure.js +0 -7
- package/dist/fhir/Procedure.js.map +0 -1
- package/dist/fhir/ProdCharacteristic.d.ts +0 -112
- package/dist/fhir/ProdCharacteristic.js +0 -7
- package/dist/fhir/ProdCharacteristic.js.map +0 -1
- package/dist/fhir/ProductShelfLife.d.ts +0 -69
- package/dist/fhir/ProductShelfLife.js +0 -7
- package/dist/fhir/ProductShelfLife.js.map +0 -1
- package/dist/fhir/Project.d.ts +0 -46
- package/dist/fhir/Project.js +0 -7
- package/dist/fhir/Project.js.map +0 -1
- package/dist/fhir/ProjectMembership.d.ts +0 -54
- package/dist/fhir/ProjectMembership.js +0 -7
- package/dist/fhir/ProjectMembership.js.map +0 -1
- package/dist/fhir/Provenance.d.ts +0 -270
- package/dist/fhir/Provenance.js +0 -7
- package/dist/fhir/Provenance.js.map +0 -1
- package/dist/fhir/Quantity.d.ts +0 -49
- package/dist/fhir/Quantity.js +0 -7
- package/dist/fhir/Quantity.js.map +0 -1
- package/dist/fhir/Questionnaire.d.ts +0 -610
- package/dist/fhir/Questionnaire.js +0 -7
- package/dist/fhir/Questionnaire.js.map +0 -1
- package/dist/fhir/QuestionnaireResponse.d.ts +0 -305
- package/dist/fhir/QuestionnaireResponse.js +0 -7
- package/dist/fhir/QuestionnaireResponse.js.map +0 -1
- package/dist/fhir/Range.d.ts +0 -29
- package/dist/fhir/Range.js +0 -7
- package/dist/fhir/Range.js.map +0 -1
- package/dist/fhir/Ratio.d.ts +0 -30
- package/dist/fhir/Ratio.js +0 -7
- package/dist/fhir/Ratio.js.map +0 -1
- package/dist/fhir/Reference.d.ts +0 -66
- package/dist/fhir/Reference.js +0 -7
- package/dist/fhir/Reference.js.map +0 -1
- package/dist/fhir/RefreshToken.d.ts +0 -45
- package/dist/fhir/RefreshToken.js +0 -7
- package/dist/fhir/RefreshToken.js.map +0 -1
- package/dist/fhir/RelatedArtifact.d.ts +0 -56
- package/dist/fhir/RelatedArtifact.js +0 -7
- package/dist/fhir/RelatedArtifact.js.map +0 -1
- package/dist/fhir/RelatedPerson.d.ts +0 -190
- package/dist/fhir/RelatedPerson.js +0 -7
- package/dist/fhir/RelatedPerson.js.map +0 -1
- package/dist/fhir/RequestGroup.d.ts +0 -427
- package/dist/fhir/RequestGroup.js +0 -7
- package/dist/fhir/RequestGroup.js.map +0 -1
- package/dist/fhir/ResearchDefinition.d.ts +0 -289
- package/dist/fhir/ResearchDefinition.js +0 -7
- package/dist/fhir/ResearchDefinition.js.map +0 -1
- package/dist/fhir/ResearchElementDefinition.d.ts +0 -430
- package/dist/fhir/ResearchElementDefinition.js +0 -7
- package/dist/fhir/ResearchElementDefinition.js.map +0 -1
- package/dist/fhir/ResearchStudy.d.ts +0 -320
- package/dist/fhir/ResearchStudy.js +0 -7
- package/dist/fhir/ResearchStudy.js.map +0 -1
- package/dist/fhir/ResearchSubject.d.ts +0 -116
- package/dist/fhir/ResearchSubject.js +0 -7
- package/dist/fhir/ResearchSubject.js.map +0 -1
- package/dist/fhir/Resource.d.ts +0 -154
- package/dist/fhir/Resource.js +0 -7
- package/dist/fhir/Resource.js.map +0 -1
- package/dist/fhir/RiskAssessment.d.ts +0 -237
- package/dist/fhir/RiskAssessment.js +0 -7
- package/dist/fhir/RiskAssessment.js.map +0 -1
- package/dist/fhir/RiskEvidenceSynthesis.d.ts +0 -539
- package/dist/fhir/RiskEvidenceSynthesis.js +0 -7
- package/dist/fhir/RiskEvidenceSynthesis.js.map +0 -1
- package/dist/fhir/SampledData.d.ts +0 -61
- package/dist/fhir/SampledData.js +0 -7
- package/dist/fhir/SampledData.js.map +0 -1
- package/dist/fhir/Schedule.d.ts +0 -122
- package/dist/fhir/Schedule.js +0 -7
- package/dist/fhir/Schedule.js.map +0 -1
- package/dist/fhir/SearchParameter.d.ts +0 -278
- package/dist/fhir/SearchParameter.js +0 -7
- package/dist/fhir/SearchParameter.js.map +0 -1
- package/dist/fhir/ServiceRequest.d.ts +0 -288
- package/dist/fhir/ServiceRequest.js +0 -7
- package/dist/fhir/ServiceRequest.js.map +0 -1
- package/dist/fhir/Signature.d.ts +0 -65
- package/dist/fhir/Signature.js +0 -7
- package/dist/fhir/Signature.js.map +0 -1
- package/dist/fhir/Slot.d.ts +0 -133
- package/dist/fhir/Slot.js +0 -7
- package/dist/fhir/Slot.js.map +0 -1
- package/dist/fhir/Specimen.d.ts +0 -357
- package/dist/fhir/Specimen.js +0 -7
- package/dist/fhir/Specimen.js.map +0 -1
- package/dist/fhir/SpecimenDefinition.d.ts +0 -359
- package/dist/fhir/SpecimenDefinition.js +0 -7
- package/dist/fhir/SpecimenDefinition.js.map +0 -1
- package/dist/fhir/StructureDefinition.d.ts +0 -443
- package/dist/fhir/StructureDefinition.js +0 -7
- package/dist/fhir/StructureDefinition.js.map +0 -1
- package/dist/fhir/StructureMap.d.ts +0 -908
- package/dist/fhir/StructureMap.js +0 -7
- package/dist/fhir/StructureMap.js.map +0 -1
- package/dist/fhir/Subscription.d.ts +0 -176
- package/dist/fhir/Subscription.js +0 -7
- package/dist/fhir/Subscription.js.map +0 -1
- package/dist/fhir/Substance.d.ts +0 -212
- package/dist/fhir/Substance.js +0 -7
- package/dist/fhir/Substance.js.map +0 -1
- package/dist/fhir/SubstanceAmount.d.ts +0 -138
- package/dist/fhir/SubstanceAmount.js +0 -7
- package/dist/fhir/SubstanceAmount.js.map +0 -1
- package/dist/fhir/SubstanceNucleicAcid.d.ts +0 -316
- package/dist/fhir/SubstanceNucleicAcid.js +0 -7
- package/dist/fhir/SubstanceNucleicAcid.js.map +0 -1
- package/dist/fhir/SubstancePolymer.d.ts +0 -405
- package/dist/fhir/SubstancePolymer.js +0 -7
- package/dist/fhir/SubstancePolymer.js.map +0 -1
- package/dist/fhir/SubstanceProtein.d.ts +0 -217
- package/dist/fhir/SubstanceProtein.js +0 -7
- package/dist/fhir/SubstanceProtein.js.map +0 -1
- package/dist/fhir/SubstanceReferenceInformation.d.ts +0 -329
- package/dist/fhir/SubstanceReferenceInformation.js +0 -7
- package/dist/fhir/SubstanceReferenceInformation.js.map +0 -1
- package/dist/fhir/SubstanceSourceMaterial.d.ts +0 -594
- package/dist/fhir/SubstanceSourceMaterial.js +0 -7
- package/dist/fhir/SubstanceSourceMaterial.js.map +0 -1
- package/dist/fhir/SubstanceSpecification.d.ts +0 -826
- package/dist/fhir/SubstanceSpecification.js +0 -7
- package/dist/fhir/SubstanceSpecification.js.map +0 -1
- package/dist/fhir/SupplyDelivery.d.ts +0 -195
- package/dist/fhir/SupplyDelivery.js +0 -7
- package/dist/fhir/SupplyDelivery.js.map +0 -1
- package/dist/fhir/SupplyRequest.d.ts +0 -223
- package/dist/fhir/SupplyRequest.js +0 -7
- package/dist/fhir/SupplyRequest.js.map +0 -1
- package/dist/fhir/Task.d.ts +0 -789
- package/dist/fhir/Task.js +0 -7
- package/dist/fhir/Task.js.map +0 -1
- package/dist/fhir/TerminologyCapabilities.d.ts +0 -734
- package/dist/fhir/TerminologyCapabilities.js +0 -7
- package/dist/fhir/TerminologyCapabilities.js.map +0 -1
- package/dist/fhir/TestReport.d.ts +0 -554
- package/dist/fhir/TestReport.js +0 -7
- package/dist/fhir/TestReport.js.map +0 -1
- package/dist/fhir/TestScript.d.ts +0 -1192
- package/dist/fhir/TestScript.js +0 -7
- package/dist/fhir/TestScript.js.map +0 -1
- package/dist/fhir/Timing.d.ts +0 -201
- package/dist/fhir/Timing.js +0 -7
- package/dist/fhir/Timing.js.map +0 -1
- package/dist/fhir/TriggerDefinition.d.ts +0 -63
- package/dist/fhir/TriggerDefinition.js +0 -7
- package/dist/fhir/TriggerDefinition.js.map +0 -1
- package/dist/fhir/UsageContext.d.ts +0 -54
- package/dist/fhir/UsageContext.js +0 -7
- package/dist/fhir/UsageContext.js.map +0 -1
- package/dist/fhir/User.d.ts +0 -44
- package/dist/fhir/User.js +0 -7
- package/dist/fhir/User.js.map +0 -1
- package/dist/fhir/ValueSet.d.ts +0 -736
- package/dist/fhir/ValueSet.js +0 -7
- package/dist/fhir/ValueSet.js.map +0 -1
- package/dist/fhir/VerificationResult.d.ts +0 -340
- package/dist/fhir/VerificationResult.js +0 -7
- package/dist/fhir/VerificationResult.js.map +0 -1
- package/dist/fhir/VisionPrescription.d.ts +0 -261
- package/dist/fhir/VisionPrescription.js +0 -7
- package/dist/fhir/VisionPrescription.js.map +0 -1
- package/dist/fhir/index.d.ts +0 -194
- package/dist/fhir/index.js +0 -211
- package/dist/fhir/index.js.map +0 -1
- package/dist/fhirpath/functions.d.ts +0 -6
- package/dist/fhirpath/functions.js +0 -349
- package/dist/fhirpath/functions.js.map +0 -1
- package/dist/fhirpath/functions.test.d.ts +0 -1
- package/dist/fhirpath/functions.test.js +0 -162
- package/dist/fhirpath/functions.test.js.map +0 -1
- package/dist/fhirpath/index.d.ts +0 -2
- package/dist/fhirpath/index.js +0 -15
- package/dist/fhirpath/index.js.map +0 -1
- package/dist/fhirpath/parse.d.ts +0 -10
- package/dist/fhirpath/parse.js +0 -285
- package/dist/fhirpath/parse.js.map +0 -1
- package/dist/fhirpath/parse.test.d.ts +0 -1
- package/dist/fhirpath/parse.test.js +0 -239
- package/dist/fhirpath/parse.test.js.map +0 -1
- package/dist/fhirpath/tokenize.d.ts +0 -13
- package/dist/fhirpath/tokenize.js +0 -43
- package/dist/fhirpath/tokenize.js.map +0 -1
- package/dist/fhirpath/tokenize.test.d.ts +0 -1
- package/dist/fhirpath/tokenize.test.js +0 -69
- package/dist/fhirpath/tokenize.test.js.map +0 -1
- package/dist/fhirpath/utils.d.ts +0 -13
- package/dist/fhirpath/utils.js +0 -34
- package/dist/fhirpath/utils.js.map +0 -1
- package/dist/fhirpath/utils.test.d.ts +0 -1
- package/dist/fhirpath/utils.test.js +0 -22
- package/dist/fhirpath/utils.test.js.map +0 -1
- package/dist/format.test.d.ts +0 -1
- package/dist/format.test.js +0 -127
- package/dist/format.test.js.map +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/index.test.js +0 -11
- package/dist/index.test.js.map +0 -1
- package/dist/outcomes.test.d.ts +0 -1
- package/dist/outcomes.test.js +0 -30
- package/dist/outcomes.test.js.map +0 -1
- package/dist/search.test.d.ts +0 -1
- package/dist/search.test.js +0 -70
- package/dist/search.test.js.map +0 -1
- package/dist/storage.test.d.ts +0 -1
- package/dist/storage.test.js +0 -19
- package/dist/storage.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils.test.d.ts +0 -1
- package/dist/utils.test.js +0 -90
- package/dist/utils.test.js.map +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExpressionForResourceType = exports.getSearchParameterDetails = exports.SearchParameterType = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
var SearchParameterType;
|
|
6
|
+
(function (SearchParameterType) {
|
|
7
|
+
SearchParameterType["BOOLEAN"] = "BOOLEAN";
|
|
8
|
+
SearchParameterType["NUMBER"] = "NUMBER";
|
|
9
|
+
SearchParameterType["QUANTITY"] = "QUANTITY";
|
|
10
|
+
SearchParameterType["TEXT"] = "TEXT";
|
|
11
|
+
SearchParameterType["REFERENCE"] = "REFERENCE";
|
|
12
|
+
SearchParameterType["DATE"] = "DATE";
|
|
13
|
+
SearchParameterType["DATETIME"] = "DATETIME";
|
|
14
|
+
SearchParameterType["PERIOD"] = "PERIOD";
|
|
15
|
+
})(SearchParameterType = exports.SearchParameterType || (exports.SearchParameterType = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Returns the type details of a SearchParameter.
|
|
18
|
+
*
|
|
19
|
+
* The SearchParameter resource has a "type" parameter, but that is missing some critical information.
|
|
20
|
+
*
|
|
21
|
+
* For example:
|
|
22
|
+
* 1) The "date" type includes "date", "datetime", and "period".
|
|
23
|
+
* 2) The "token" type includes enums and booleans.
|
|
24
|
+
* 3) Arrays/multiple values are not reflected at all.
|
|
25
|
+
*
|
|
26
|
+
* @param structureDefinitions Collection of StructureDefinition resources indexed by name.
|
|
27
|
+
* @param resourceType The root resource type.
|
|
28
|
+
* @param searchParam The search parameter.
|
|
29
|
+
* @returns The search parameter type details.
|
|
30
|
+
*/
|
|
31
|
+
function getSearchParameterDetails(structureDefinitions, resourceType, searchParam) {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
const columnName = convertCodeToColumnName(searchParam.code);
|
|
34
|
+
const expression = (_a = getExpressionForResourceType(resourceType, searchParam.expression)) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
35
|
+
if (!expression) {
|
|
36
|
+
// This happens on compound types
|
|
37
|
+
// In the future, explore returning multiple column definitions
|
|
38
|
+
return { columnName, type: SearchParameterType.TEXT };
|
|
39
|
+
}
|
|
40
|
+
let baseType = resourceType;
|
|
41
|
+
let propertyType = undefined;
|
|
42
|
+
let array = false;
|
|
43
|
+
for (let i = 1; i < expression.length; i++) {
|
|
44
|
+
const propertyName = expression[i];
|
|
45
|
+
const propertyDef = (_c = (_b = structureDefinitions.types[baseType]) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c[propertyName];
|
|
46
|
+
if (!propertyDef) {
|
|
47
|
+
// This happens on complex properties such as "collected[x]"/"collectedDateTime"/"collectedPeriod"
|
|
48
|
+
// In the future, explore returning multiple column definitions
|
|
49
|
+
return { columnName, type: SearchParameterType.TEXT, array };
|
|
50
|
+
}
|
|
51
|
+
if (propertyDef.max === '*') {
|
|
52
|
+
array = true;
|
|
53
|
+
}
|
|
54
|
+
propertyType = (_d = propertyDef.type) === null || _d === void 0 ? void 0 : _d[0].code;
|
|
55
|
+
if (!propertyType) {
|
|
56
|
+
// This happens when one of parent properties uses contentReference
|
|
57
|
+
// In the future, explore following the reference
|
|
58
|
+
return { columnName, type: SearchParameterType.TEXT, array };
|
|
59
|
+
}
|
|
60
|
+
if (i < expression.length - 1) {
|
|
61
|
+
if (propertyType === 'Element' || propertyType === 'BackboneElement') {
|
|
62
|
+
baseType = baseType + (0, utils_1.capitalize)(propertyName);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
baseType = propertyType;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const type = getSearchParameterType(searchParam, propertyType);
|
|
70
|
+
return { columnName, type, array };
|
|
71
|
+
}
|
|
72
|
+
exports.getSearchParameterDetails = getSearchParameterDetails;
|
|
73
|
+
/**
|
|
74
|
+
* Converts a hyphen-delimited code to camelCase string.
|
|
75
|
+
* @param code The search parameter code.
|
|
76
|
+
* @returns The SQL column name.
|
|
77
|
+
*/
|
|
78
|
+
function convertCodeToColumnName(code) {
|
|
79
|
+
return code.split('-').reduce((result, word, index) => result + (index ? (0, utils_1.capitalize)(word) : word), '');
|
|
80
|
+
}
|
|
81
|
+
function getSearchParameterType(searchParam, propertyType) {
|
|
82
|
+
let type = SearchParameterType.TEXT;
|
|
83
|
+
switch (searchParam.type) {
|
|
84
|
+
case 'date':
|
|
85
|
+
type = SearchParameterType.DATE;
|
|
86
|
+
break;
|
|
87
|
+
case 'number':
|
|
88
|
+
type = SearchParameterType.NUMBER;
|
|
89
|
+
break;
|
|
90
|
+
case 'quantity':
|
|
91
|
+
type = SearchParameterType.QUANTITY;
|
|
92
|
+
break;
|
|
93
|
+
case 'reference':
|
|
94
|
+
type = SearchParameterType.REFERENCE;
|
|
95
|
+
break;
|
|
96
|
+
case 'token':
|
|
97
|
+
if (propertyType === 'boolean') {
|
|
98
|
+
type = SearchParameterType.BOOLEAN;
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return type;
|
|
103
|
+
}
|
|
104
|
+
function getExpressionForResourceType(resourceType, expression) {
|
|
105
|
+
const expressions = expression.split(' | ');
|
|
106
|
+
for (const e of expressions) {
|
|
107
|
+
const simplified = simplifyExpression(e);
|
|
108
|
+
if (simplified.startsWith(resourceType + '.')) {
|
|
109
|
+
return simplified;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
exports.getExpressionForResourceType = getExpressionForResourceType;
|
|
115
|
+
function simplifyExpression(input) {
|
|
116
|
+
let result = input.trim();
|
|
117
|
+
if (result.startsWith('(') && result.endsWith(')')) {
|
|
118
|
+
result = result.substring(1, result.length - 1);
|
|
119
|
+
}
|
|
120
|
+
if (result.includes(' as ')) {
|
|
121
|
+
result = result.substring(0, result.indexOf(' as '));
|
|
122
|
+
}
|
|
123
|
+
if (result.includes('.where(')) {
|
|
124
|
+
result = result.substring(0, result.indexOf('.where('));
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=searchparams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"searchparams.js","sourceRoot":"","sources":["../src/searchparams.ts"],"names":[],"mappings":";;;AAEA,mCAAqC;AAErC,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,wCAAiB,CAAA;IACjB,4CAA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;KACzD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { SearchParameter } from '@medplum/fhirtypes';\nimport { IndexedStructureDefinition } from './types';\nimport { capitalize } from './utils';\n\nexport enum SearchParameterType {\n BOOLEAN = 'BOOLEAN',\n NUMBER = 'NUMBER',\n QUANTITY = 'QUANTITY',\n TEXT = 'TEXT',\n REFERENCE = 'REFERENCE',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n PERIOD = 'PERIOD',\n}\n\nexport interface SearchParameterDetails {\n readonly columnName: string;\n readonly type: SearchParameterType;\n readonly array?: boolean;\n}\n\n/**\n * Returns the type details of a SearchParameter.\n *\n * The SearchParameter resource has a \"type\" parameter, but that is missing some critical information.\n *\n * For example:\n * 1) The \"date\" type includes \"date\", \"datetime\", and \"period\".\n * 2) The \"token\" type includes enums and booleans.\n * 3) Arrays/multiple values are not reflected at all.\n *\n * @param structureDefinitions Collection of StructureDefinition resources indexed by name.\n * @param resourceType The root resource type.\n * @param searchParam The search parameter.\n * @returns The search parameter type details.\n */\nexport function getSearchParameterDetails(\n structureDefinitions: IndexedStructureDefinition,\n resourceType: string,\n searchParam: SearchParameter\n): SearchParameterDetails {\n const columnName = convertCodeToColumnName(searchParam.code as string);\n const expression = getExpressionForResourceType(resourceType, searchParam.expression as string)?.split('.');\n if (!expression) {\n // This happens on compound types\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT };\n }\n\n let baseType = resourceType;\n let propertyType = undefined;\n let array = false;\n\n for (let i = 1; i < expression.length; i++) {\n const propertyName = expression[i];\n const propertyDef = structureDefinitions.types[baseType]?.properties?.[propertyName];\n if (!propertyDef) {\n // This happens on complex properties such as \"collected[x]\"/\"collectedDateTime\"/\"collectedPeriod\"\n // In the future, explore returning multiple column definitions\n return { columnName, type: SearchParameterType.TEXT, array };\n }\n\n if (propertyDef.max === '*') {\n array = true;\n }\n\n propertyType = propertyDef.type?.[0].code;\n if (!propertyType) {\n // This happens when one of parent properties uses contentReference\n // In the future, explore following the reference\n return { columnName, type: SearchParameterType.TEXT, array };\n }\n\n if (i < expression.length - 1) {\n if (propertyType === 'Element' || propertyType === 'BackboneElement') {\n baseType = baseType + capitalize(propertyName);\n } else {\n baseType = propertyType;\n }\n }\n }\n\n const type = getSearchParameterType(searchParam, propertyType as string);\n return { columnName, type, array };\n}\n\n/**\n * Converts a hyphen-delimited code to camelCase string.\n * @param code The search parameter code.\n * @returns The SQL column name.\n */\nfunction convertCodeToColumnName(code: string): string {\n return code.split('-').reduce((result, word, index) => result + (index ? capitalize(word) : word), '');\n}\n\nfunction getSearchParameterType(searchParam: SearchParameter, propertyType: string): SearchParameterType {\n let type = SearchParameterType.TEXT;\n switch (searchParam.type) {\n case 'date':\n type = SearchParameterType.DATE;\n break;\n case 'number':\n type = SearchParameterType.NUMBER;\n break;\n case 'quantity':\n type = SearchParameterType.QUANTITY;\n break;\n case 'reference':\n type = SearchParameterType.REFERENCE;\n break;\n case 'token':\n if (propertyType === 'boolean') {\n type = SearchParameterType.BOOLEAN;\n }\n break;\n }\n return type;\n}\n\nexport function getExpressionForResourceType(resourceType: string, expression: string): string | undefined {\n const expressions = expression.split(' | ');\n for (const e of expressions) {\n const simplified = simplifyExpression(e);\n if (simplified.startsWith(resourceType + '.')) {\n return simplified;\n }\n }\n return undefined;\n}\n\nfunction simplifyExpression(input: string): string {\n let result = input.trim();\n\n if (result.startsWith('(') && result.endsWith(')')) {\n result = result.substring(1, result.length - 1);\n }\n\n if (result.includes(' as ')) {\n result = result.substring(0, result.indexOf(' as '));\n }\n\n if (result.includes('.where(')) {\n result = result.substring(0, result.indexOf('.where('));\n }\n\n return result;\n}\n"]}
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,23 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The ClientStorage class is a utility class for storing strings and objects.
|
|
3
|
+
*
|
|
4
|
+
* When using MedplumClient in the browser, it will be backed by browser localStorage.
|
|
5
|
+
*
|
|
6
|
+
* When Using MedplumClient in the server, it will be backed by the MemoryStorage class.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ClientStorage {
|
|
9
|
+
private readonly storage;
|
|
10
|
+
constructor();
|
|
2
11
|
clear(): void;
|
|
3
12
|
getString(key: string): string | undefined;
|
|
4
13
|
setString(key: string, value: string | undefined): void;
|
|
5
14
|
getObject<T>(key: string): T | undefined;
|
|
6
15
|
setObject<T>(key: string, value: T): void;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The MemoryStorage class is a minimal in-memory implementation of the Storage interface.
|
|
19
|
+
*/
|
|
8
20
|
export declare class MemoryStorage implements Storage {
|
|
9
21
|
private data;
|
|
10
22
|
constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Returns the number of key/value pairs.
|
|
25
|
+
*/
|
|
26
|
+
get length(): number;
|
|
27
|
+
/**
|
|
28
|
+
* Removes all key/value pairs, if there are any.
|
|
29
|
+
*/
|
|
11
30
|
clear(): void;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
|
33
|
+
*/
|
|
34
|
+
getItem(key: string): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
37
|
+
*/
|
|
38
|
+
setItem(key: string, value: string | null): void;
|
|
39
|
+
/**
|
|
40
|
+
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
|
41
|
+
*/
|
|
42
|
+
removeItem(key: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
|
45
|
+
*/
|
|
46
|
+
key(index: number): string | null;
|
|
23
47
|
}
|
package/dist/storage.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MemoryStorage = exports.ClientStorage = void 0;
|
|
4
4
|
const utils_1 = require("./utils");
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The ClientStorage class is a utility class for storing strings and objects.
|
|
7
|
+
*
|
|
8
|
+
* When using MedplumClient in the browser, it will be backed by browser localStorage.
|
|
9
|
+
*
|
|
10
|
+
* When Using MedplumClient in the server, it will be backed by the MemoryStorage class.
|
|
11
|
+
*/
|
|
12
|
+
class ClientStorage {
|
|
7
13
|
constructor() {
|
|
8
|
-
this.
|
|
14
|
+
this.storage = typeof localStorage !== 'undefined' ? localStorage : new MemoryStorage();
|
|
9
15
|
}
|
|
10
16
|
clear() {
|
|
11
|
-
this.
|
|
17
|
+
this.storage.clear();
|
|
12
18
|
}
|
|
13
19
|
getString(key) {
|
|
14
|
-
return this.
|
|
20
|
+
return this.storage.getItem(key) || undefined;
|
|
15
21
|
}
|
|
16
22
|
setString(key, value) {
|
|
17
23
|
if (value) {
|
|
18
|
-
this.
|
|
24
|
+
this.storage.setItem(key, value);
|
|
19
25
|
}
|
|
20
26
|
else {
|
|
21
|
-
|
|
27
|
+
this.storage.removeItem(key);
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
getObject(key) {
|
|
@@ -29,29 +35,56 @@ class MemoryStorage {
|
|
|
29
35
|
this.setString(key, value ? (0, utils_1.stringify)(value) : undefined);
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
|
-
exports.
|
|
33
|
-
|
|
38
|
+
exports.ClientStorage = ClientStorage;
|
|
39
|
+
/**
|
|
40
|
+
* The MemoryStorage class is a minimal in-memory implementation of the Storage interface.
|
|
41
|
+
*/
|
|
42
|
+
class MemoryStorage {
|
|
43
|
+
constructor() {
|
|
44
|
+
this.data = new Map();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns the number of key/value pairs.
|
|
48
|
+
*/
|
|
49
|
+
get length() {
|
|
50
|
+
return this.data.size;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Removes all key/value pairs, if there are any.
|
|
54
|
+
*/
|
|
34
55
|
clear() {
|
|
35
|
-
|
|
56
|
+
this.data.clear();
|
|
36
57
|
}
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Returns the current value associated with the given key, or null if the given key does not exist.
|
|
60
|
+
*/
|
|
61
|
+
getItem(key) {
|
|
62
|
+
var _a;
|
|
63
|
+
return (_a = this.data.get(key)) !== null && _a !== void 0 ? _a : null;
|
|
39
64
|
}
|
|
40
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
|
|
67
|
+
*/
|
|
68
|
+
setItem(key, value) {
|
|
41
69
|
if (value) {
|
|
42
|
-
|
|
70
|
+
this.data.set(key, value);
|
|
43
71
|
}
|
|
44
72
|
else {
|
|
45
|
-
|
|
73
|
+
this.data.delete(key);
|
|
46
74
|
}
|
|
47
75
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
|
|
78
|
+
*/
|
|
79
|
+
removeItem(key) {
|
|
80
|
+
this.data.delete(key);
|
|
51
81
|
}
|
|
52
|
-
|
|
53
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
|
|
84
|
+
*/
|
|
85
|
+
key(index) {
|
|
86
|
+
return Array.from(this.data.keys())[index];
|
|
54
87
|
}
|
|
55
88
|
}
|
|
56
|
-
exports.
|
|
89
|
+
exports.MemoryStorage = MemoryStorage;
|
|
57
90
|
//# sourceMappingURL=storage.js.map
|
package/dist/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAEpC;;;;;;GAMG;AACH,MAAa,aAAa;IAGxB;QACE,IAAI,CAAC,OAAO,GAAG,OAAO,YAAY,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,CAAC;IAC1F,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;IAChD,CAAC;IAED,SAAS,CAAC,GAAW,EAAE,KAAyB;QAC9C,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAClC;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;SAC9B;IACH,CAAC;IAED,SAAS,CAAI,GAAW;QACtB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,GAAG,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAClD,CAAC;IAED,SAAS,CAAI,GAAW,EAAE,KAAQ;QAChC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,IAAA,iBAAS,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC5D,CAAC;CACF;AA/BD,sCA+BC;AAED;;GAEG;AACH,MAAa,aAAa;IAGxB;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,GAAW;;QACjB,OAAO,MAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,GAAW,EAAE,KAAoB;QACvC,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;SAC3B;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACvB;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,GAAW;QACpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,KAAa;QACf,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AApDD,sCAoDC","sourcesContent":["import { stringify } from './utils';\n\n/**\n * The ClientStorage class is a utility class for storing strings and objects.\n *\n * When using MedplumClient in the browser, it will be backed by browser localStorage.\n *\n * When Using MedplumClient in the server, it will be backed by the MemoryStorage class.\n */\nexport class ClientStorage {\n private readonly storage: Storage;\n\n constructor() {\n this.storage = typeof localStorage !== 'undefined' ? localStorage : new MemoryStorage();\n }\n\n clear(): void {\n this.storage.clear();\n }\n\n getString(key: string): string | undefined {\n return this.storage.getItem(key) || undefined;\n }\n\n setString(key: string, value: string | undefined): void {\n if (value) {\n this.storage.setItem(key, value);\n } else {\n this.storage.removeItem(key);\n }\n }\n\n getObject<T>(key: string): T | undefined {\n const str = this.getString(key);\n return str ? (JSON.parse(str) as T) : undefined;\n }\n\n setObject<T>(key: string, value: T) {\n this.setString(key, value ? stringify(value) : undefined);\n }\n}\n\n/**\n * The MemoryStorage class is a minimal in-memory implementation of the Storage interface.\n */\nexport class MemoryStorage implements Storage {\n private data: Map<string, string>;\n\n constructor() {\n this.data = new Map<string, string>();\n }\n\n /**\n * Returns the number of key/value pairs.\n */\n get length(): number {\n return this.data.size;\n }\n\n /**\n * Removes all key/value pairs, if there are any.\n */\n clear(): void {\n this.data.clear();\n }\n\n /**\n * Returns the current value associated with the given key, or null if the given key does not exist.\n */\n getItem(key: string): string | null {\n return this.data.get(key) ?? null;\n }\n\n /**\n * Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.\n */\n setItem(key: string, value: string | null): void {\n if (value) {\n this.data.set(key, value);\n } else {\n this.data.delete(key);\n }\n }\n\n /**\n * Removes the key/value pair with the given key, if a key/value pair with the given key exists.\n */\n removeItem(key: string): void {\n this.data.delete(key);\n }\n\n /**\n * Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.\n */\n key(index: number): string | null {\n return Array.from(this.data.keys())[index];\n }\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementDefinition, SearchParameter, StructureDefinition } from '
|
|
1
|
+
import { ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';
|
|
2
2
|
/**
|
|
3
3
|
* List of property types.
|
|
4
4
|
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
@@ -20,7 +20,6 @@ export declare enum PropertyType {
|
|
|
20
20
|
Distance = "Distance",
|
|
21
21
|
Dosage = "Dosage",
|
|
22
22
|
Duration = "Duration",
|
|
23
|
-
ElementDefinition = "ElementDefinition",
|
|
24
23
|
Expression = "Expression",
|
|
25
24
|
Extension = "Extension",
|
|
26
25
|
HumanName = "HumanName",
|
|
@@ -112,7 +111,7 @@ export interface TypeSchema {
|
|
|
112
111
|
};
|
|
113
112
|
searchParams?: SearchParameter[];
|
|
114
113
|
description?: string;
|
|
115
|
-
|
|
114
|
+
parentType?: string;
|
|
116
115
|
}
|
|
117
116
|
/**
|
|
118
117
|
* Indexes a StructureDefinition for fast lookup.
|
|
@@ -120,7 +119,6 @@ export interface TypeSchema {
|
|
|
120
119
|
* @param structureDefinition The original StructureDefinition.
|
|
121
120
|
* @return An indexed IndexedStructureDefinition.
|
|
122
121
|
*/
|
|
123
|
-
export declare function indexStructureDefinition(structureDefinition: StructureDefinition): IndexedStructureDefinition;
|
|
122
|
+
export declare function indexStructureDefinition(structureDefinition: StructureDefinition, output?: IndexedStructureDefinition): IndexedStructureDefinition;
|
|
124
123
|
export declare function buildTypeName(components: string[]): string;
|
|
125
|
-
export declare function capitalize(word: string): string;
|
|
126
124
|
export declare function getPropertyDisplayName(property: ElementDefinition): string;
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPropertyDisplayName = exports.
|
|
3
|
+
exports.getPropertyDisplayName = exports.buildTypeName = exports.indexStructureDefinition = exports.PropertyType = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
4
5
|
/**
|
|
5
6
|
* List of property types.
|
|
6
7
|
* http://www.hl7.org/fhir/valueset-defined-types.html
|
|
@@ -23,7 +24,6 @@ var PropertyType;
|
|
|
23
24
|
PropertyType["Distance"] = "Distance";
|
|
24
25
|
PropertyType["Dosage"] = "Dosage";
|
|
25
26
|
PropertyType["Duration"] = "Duration";
|
|
26
|
-
PropertyType["ElementDefinition"] = "ElementDefinition";
|
|
27
27
|
PropertyType["Expression"] = "Expression";
|
|
28
28
|
PropertyType["Extension"] = "Extension";
|
|
29
29
|
PropertyType["HumanName"] = "HumanName";
|
|
@@ -76,22 +76,30 @@ var PropertyType;
|
|
|
76
76
|
* @param structureDefinition The original StructureDefinition.
|
|
77
77
|
* @return An indexed IndexedStructureDefinition.
|
|
78
78
|
*/
|
|
79
|
-
function indexStructureDefinition(structureDefinition) {
|
|
79
|
+
function indexStructureDefinition(structureDefinition, output) {
|
|
80
|
+
var _a;
|
|
80
81
|
const typeName = structureDefinition.name;
|
|
81
|
-
if (!typeName
|
|
82
|
+
if (!typeName) {
|
|
82
83
|
throw new Error('Invalid StructureDefinition');
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
if (!output) {
|
|
86
|
+
output = {
|
|
87
|
+
types: {},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
output.types[typeName] = {
|
|
91
|
+
display: typeName,
|
|
92
|
+
description: structureDefinition.description,
|
|
93
|
+
properties: {},
|
|
86
94
|
};
|
|
87
|
-
const elements = structureDefinition.snapshot
|
|
95
|
+
const elements = (_a = structureDefinition.snapshot) === null || _a === void 0 ? void 0 : _a.element;
|
|
88
96
|
if (elements) {
|
|
89
97
|
// Filter out any elements missing path or type
|
|
90
|
-
const filtered = elements.filter(e => e.path !== typeName && e.path && e.type && e.type.length > 0);
|
|
98
|
+
const filtered = elements.filter((e) => e.path !== typeName && e.path); // && e.type && e.type.length > 0);
|
|
91
99
|
// First pass, build types
|
|
92
|
-
filtered.forEach(element => indexType(output, element));
|
|
100
|
+
filtered.forEach((element) => indexType(output, element));
|
|
93
101
|
// Second pass, build properties
|
|
94
|
-
filtered.forEach(element => indexProperty(output, element));
|
|
102
|
+
filtered.forEach((element) => indexProperty(output, element));
|
|
95
103
|
}
|
|
96
104
|
return output;
|
|
97
105
|
}
|
|
@@ -104,13 +112,20 @@ exports.indexStructureDefinition = indexStructureDefinition;
|
|
|
104
112
|
* @param element The input ElementDefinition.
|
|
105
113
|
*/
|
|
106
114
|
function indexType(output, element) {
|
|
115
|
+
var _a, _b;
|
|
107
116
|
const path = element.path;
|
|
117
|
+
const typeCode = (_b = (_a = element.type) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.code;
|
|
118
|
+
if (typeCode !== 'Element' && typeCode !== 'BackboneElement') {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
108
121
|
const parts = path.split('.');
|
|
109
|
-
const typeName = buildTypeName(parts
|
|
122
|
+
const typeName = buildTypeName(parts);
|
|
110
123
|
if (!(typeName in output.types)) {
|
|
111
124
|
output.types[typeName] = {
|
|
112
125
|
display: typeName,
|
|
113
|
-
|
|
126
|
+
description: element.definition,
|
|
127
|
+
parentType: buildTypeName(parts.slice(0, parts.length - 1)),
|
|
128
|
+
properties: {},
|
|
114
129
|
};
|
|
115
130
|
}
|
|
116
131
|
}
|
|
@@ -122,19 +137,18 @@ function indexType(output, element) {
|
|
|
122
137
|
function indexProperty(output, element) {
|
|
123
138
|
const path = element.path;
|
|
124
139
|
const parts = path.split('.');
|
|
140
|
+
if (parts.length === 1) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
125
143
|
const typeName = buildTypeName(parts.slice(0, parts.length - 1));
|
|
126
144
|
const typeSchema = output.types[typeName];
|
|
127
145
|
const key = parts[parts.length - 1];
|
|
128
146
|
typeSchema.properties[key] = element;
|
|
129
147
|
}
|
|
130
148
|
function buildTypeName(components) {
|
|
131
|
-
return components.map(capitalize).join('
|
|
149
|
+
return components.map(utils_1.capitalize).join('');
|
|
132
150
|
}
|
|
133
151
|
exports.buildTypeName = buildTypeName;
|
|
134
|
-
function capitalize(word) {
|
|
135
|
-
return word.charAt(0).toUpperCase() + word.substr(1);
|
|
136
|
-
}
|
|
137
|
-
exports.capitalize = capitalize;
|
|
138
152
|
function getPropertyDisplayName(property) {
|
|
139
153
|
// Get the property name, which is the remainder after the last period
|
|
140
154
|
// For example, for path "Patient.birthDate"
|
|
@@ -148,7 +162,7 @@ function getPropertyDisplayName(property) {
|
|
|
148
162
|
// the display name is "Birth Date".
|
|
149
163
|
return propertyName
|
|
150
164
|
.split(/(?=[A-Z])/)
|
|
151
|
-
.map(capitalize)
|
|
165
|
+
.map(utils_1.capitalize)
|
|
152
166
|
.join(' ')
|
|
153
167
|
.replace('_', ' ')
|
|
154
168
|
.replace(/\s+/g, ' ');
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,IAAY,YA8DX;AA9DD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;IACX,yCAAyB,CAAA;IACzB,yCAAyB,CAAA;IACzB,mDAAmC,CAAA;IACnC,mDAAmC,CAAA;IACnC,iCAAiB,CAAA;IACjB,+CAA+B,CAAA;IAC/B,6CAA6B,CAAA;IAC7B,2CAA2B,CAAA;IAC3B,+BAAe,CAAA;IACf,mDAAmC,CAAA;IACnC,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,uDAAuC,CAAA;IACvC,yCAAyB,CAAA;IACzB,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;IACvB,yCAAyB,CAAA;IACzB,mDAAmC,CAAA;IACnC,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,uCAAuB,CAAA;IACvB,2DAA2C,CAAA;IAC3C,iCAAiB,CAAA;IACjB,yCAAyB,CAAA;IACzB,yDAAyC,CAAA;IACzC,qDAAqC,CAAA;IACrC,qCAAqB,CAAA;IACrB,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,uCAAuB,CAAA;IACvB,mDAAmC,CAAA;IACnC,qCAAqB,CAAA;IACrB,2CAA2B,CAAA;IAC3B,uCAAuB,CAAA;IACvB,mDAAmC,CAAA;IACnC,sEAAsD,CAAA;IACtD,iCAAiB,CAAA;IACjB,uDAAuC,CAAA;IACvC,6CAA6B,CAAA;IAC7B,6CAA6B,CAAA;IAC7B,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,6BAAa,CAAA;IACb,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,mCAAmB,CAAA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wDAkBC","sourcesContent":["import { ElementDefinition, SearchParameter, StructureDefinition } from '@medplum/fhirtypes';\nimport { capitalize } from './utils';\n\n/**\n * List of property types.\n * http://www.hl7.org/fhir/valueset-defined-types.html\n * The list here includes additions found from StructureDefinition resources.\n */\nexport enum PropertyType {\n Address = 'Address',\n Age = 'Age',\n Annotation = 'Annotation',\n Attachment = 'Attachment',\n BackboneElement = 'BackboneElement',\n CodeableConcept = 'CodeableConcept',\n Coding = 'Coding',\n ContactDetail = 'ContactDetail',\n ContactPoint = 'ContactPoint',\n Contributor = 'Contributor',\n Count = 'Count',\n DataRequirement = 'DataRequirement',\n Distance = 'Distance',\n Dosage = 'Dosage',\n Duration = 'Duration',\n Expression = 'Expression',\n Extension = 'Extension',\n HumanName = 'HumanName',\n Identifier = 'Identifier',\n MarketingStatus = 'MarketingStatus',\n Meta = 'Meta',\n Money = 'Money',\n Narrative = 'Narrative',\n ParameterDefinition = 'ParameterDefinition',\n Period = 'Period',\n Population = 'Population',\n ProdCharacteristic = 'ProdCharacteristic',\n ProductShelfLife = 'ProductShelfLife',\n Quantity = 'Quantity',\n Range = 'Range',\n Ratio = 'Ratio',\n Reference = 'Reference',\n RelatedArtifact = 'RelatedArtifact',\n Resource = 'Resource',\n SampledData = 'SampledData',\n Signature = 'Signature',\n SubstanceAmount = 'SubstanceAmount',\n SystemString = 'http://hl7.org/fhirpath/System.String',\n Timing = 'Timing',\n TriggerDefinition = 'TriggerDefinition',\n UsageContext = 'UsageContext',\n base64Binary = 'base64Binary',\n boolean = 'boolean',\n canonical = 'canonical',\n code = 'code',\n date = 'date',\n dateTime = 'dateTime',\n decimal = 'decimal',\n id = 'id',\n instant = 'instant',\n integer = 'integer',\n markdown = 'markdown',\n oid = 'oid',\n positiveInt = 'positiveInt',\n string = 'string',\n time = 'time',\n unsignedInt = 'unsignedInt',\n uri = 'uri',\n url = 'url',\n uuid = 'uuid',\n}\n\n/**\n * An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition.\n *\n * StructureDefinition resources contain schema information for other resource types.\n * These schemas can be used to automatically generate user interface elements for\n * resources.\n *\n * However, a StructureDefinition resource is not optimized for realtime lookups. All\n * resource types, sub types, and property definitions are stored in a flat array of\n * ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., \"Patient.name\")\n * requires a linear scan of all ElementDefinition objects\n *\n * A StructureDefinition resource contains information about one or more types.\n * For example, the \"Patient\" StructureDefinition includes \"Patient\", \"Patient_Contact\",\n * \"Patient_Communication\", and \"Patient_Link\". This is inefficient.\n *\n * Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition.\n * In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup.\n *\n * The hierarchy is:\n * IndexedStructureDefinition - top level for one resource type\n * TypeSchema - one per resource type and all contained BackboneElements\n * PropertySchema - one per property/field\n */\nexport interface IndexedStructureDefinition {\n types: { [resourceType: string]: TypeSchema };\n}\n\n/**\n * An indexed TypeSchema.\n *\n * Example: The IndexedStructureDefinition for \"Patient\" would include the following TypeSchemas:\n * 1) Patient\n * 2) Patient_Contact\n * 3) Patient_Communication\n * 4) Patient_Link\n */\nexport interface TypeSchema {\n display: string;\n properties: { [name: string]: ElementDefinition };\n searchParams?: SearchParameter[];\n description?: string;\n parentType?: string;\n}\n\n/**\n * Indexes a StructureDefinition for fast lookup.\n * See comments on IndexedStructureDefinition for more details.\n * @param structureDefinition The original StructureDefinition.\n * @return An indexed IndexedStructureDefinition.\n */\nexport function indexStructureDefinition(\n structureDefinition: StructureDefinition,\n output?: IndexedStructureDefinition\n): IndexedStructureDefinition {\n const typeName = structureDefinition.name;\n if (!typeName) {\n throw new Error('Invalid StructureDefinition');\n }\n\n if (!output) {\n output = {\n types: {},\n } as IndexedStructureDefinition;\n }\n\n output.types[typeName] = {\n display: typeName,\n description: structureDefinition.description,\n properties: {},\n };\n\n const elements = structureDefinition.snapshot?.element;\n if (elements) {\n // Filter out any elements missing path or type\n const filtered = elements.filter((e) => e.path !== typeName && e.path); // && e.type && e.type.length > 0);\n\n // First pass, build types\n filtered.forEach((element) => indexType(output as IndexedStructureDefinition, element));\n\n // Second pass, build properties\n filtered.forEach((element) => indexProperty(output as IndexedStructureDefinition, element));\n }\n\n return output;\n}\n\n/**\n * Indexes TypeSchema from an ElementDefinition.\n * In the common case, there will be many ElementDefinition instances per TypeSchema.\n * Only the first occurrence is saved.\n * @param output The work-in-progress IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexType(output: IndexedStructureDefinition, element: ElementDefinition): void {\n const path = element.path as string;\n const typeCode = element.type?.[0]?.code;\n if (typeCode !== 'Element' && typeCode !== 'BackboneElement') {\n return;\n }\n const parts = path.split('.');\n const typeName = buildTypeName(parts);\n if (!(typeName in output.types)) {\n output.types[typeName] = {\n display: typeName,\n description: element.definition,\n parentType: buildTypeName(parts.slice(0, parts.length - 1)),\n properties: {},\n };\n }\n}\n\n/**\n * Indexes PropertySchema from an ElementDefinition.\n * @param output The work-in-progress IndexedStructureDefinition.\n * @param element The input ElementDefinition.\n */\nfunction indexProperty(output: IndexedStructureDefinition, element: ElementDefinition): void {\n const path = element.path as string;\n const parts = path.split('.');\n if (parts.length === 1) {\n return;\n }\n const typeName = buildTypeName(parts.slice(0, parts.length - 1));\n const typeSchema = output.types[typeName];\n const key = parts[parts.length - 1];\n typeSchema.properties[key] = element;\n}\n\nexport function buildTypeName(components: string[]): string {\n return components.map(capitalize).join('');\n}\n\nexport function getPropertyDisplayName(property: ElementDefinition): string {\n // Get the property name, which is the remainder after the last period\n // For example, for path \"Patient.birthDate\"\n // the property name is \"birthDate\"\n const propertyName = (property.path as string).split('.').pop() as string;\n\n // Split by capital letters\n // Capitalize the first letter of each word\n // Join together with spaces in between\n // Then normalize whitespace to single space character\n // For example, for property name \"birthDate\",\n // the display name is \"Birth Date\".\n return propertyName\n .split(/(?=[A-Z])/)\n .map(capitalize)\n .join(' ')\n .replace('_', ' ')\n .replace(/\\s+/g, ' ');\n}\n"]}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Patient, Practitioner, Reference, RelatedPerson, Resource } from '
|
|
1
|
+
import { Patient, Practitioner, Reference, RelatedPerson, Resource } from '@medplum/fhirtypes';
|
|
2
2
|
export declare type ProfileResource = Patient | Practitioner | RelatedPerson;
|
|
3
3
|
/**
|
|
4
4
|
* Creates a reference resource.
|
|
5
5
|
* @param resource The FHIR reesource.
|
|
6
6
|
* @returns A reference resource.
|
|
7
7
|
*/
|
|
8
|
-
export declare function createReference(resource:
|
|
8
|
+
export declare function createReference<T extends Resource>(resource: T): Reference<T>;
|
|
9
9
|
/**
|
|
10
10
|
* Returns a reference string for a resource.
|
|
11
11
|
* @param resource The FHIR resource.
|
|
@@ -37,7 +37,7 @@ export declare function getImageSrc(resource: Resource): string | undefined;
|
|
|
37
37
|
* @param date The date property value, which could be a string or a Date object.
|
|
38
38
|
* @returns A Date object.
|
|
39
39
|
*/
|
|
40
|
-
export declare function getDateProperty(date:
|
|
40
|
+
export declare function getDateProperty(date: string | undefined): Date | undefined;
|
|
41
41
|
/**
|
|
42
42
|
* FHIR JSON stringify.
|
|
43
43
|
* Removes properties with empty string values.
|
|
@@ -48,6 +48,15 @@ export declare function getDateProperty(date: Date | string | undefined): Date |
|
|
|
48
48
|
* @returns The resulting JSON string.
|
|
49
49
|
*/
|
|
50
50
|
export declare function stringify(value: any, pretty?: boolean): string;
|
|
51
|
+
/**
|
|
52
|
+
* Resource equality.
|
|
53
|
+
* Ignores meta.versionId and meta.lastUpdated.
|
|
54
|
+
* See: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/#4-deep-equality
|
|
55
|
+
* @param object1 The first object.
|
|
56
|
+
* @param object2 The second object.
|
|
57
|
+
* @returns True if the objects are equal.
|
|
58
|
+
*/
|
|
59
|
+
export declare function deepEquals(object1: any, object2: any, path?: string): boolean;
|
|
51
60
|
/**
|
|
52
61
|
* Converts an ArrayBuffer to hex string.
|
|
53
62
|
* See: https://stackoverflow.com/a/55200387
|
|
@@ -61,3 +70,5 @@ export declare function arrayBufferToHex(arrayBuffer: ArrayBuffer): string;
|
|
|
61
70
|
* @returns The base-64 encoded string.
|
|
62
71
|
*/
|
|
63
72
|
export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
73
|
+
export declare function capitalize(word: string): string;
|
|
74
|
+
export declare function isLowerCase(c: string): boolean;
|