@medplum/core
Enumerations
- AccessPolicyInteraction
- OAuthGrantType
- OAuthTokenType
- OAuthClientAssertionType
- SearchParameterType
- Operator
Classes
- LRUCache
- MedplumClient
- EventTarget
- TypedEventTarget
- FhircastConnection
- PrefixOperatorAtom
- InfixOperatorAtom
- ParserBuilder
- Parser
- Tokenizer
- FhirFilterComparison
- FhirFilterNegation
- FhirFilterConnective
- Hl7Context
- Hl7Message
- Hl7Segment
- Hl7Field
- OperationOutcomeError
- ReadablePromise
- ClientStorage
- MemoryStorage
Interfaces
- MedplumClientOptions
- CreatePdfFunction
- BaseLoginRequest
- EmailPasswordLoginRequest
- NewUserRequest
- NewProjectRequest
- NewPatientRequest
- GoogleCredentialResponse
- GoogleLoginRequest
- LoginAuthenticationResponse
- LoginProfileResponse
- LoginScopeResponse
- LoginState
- TokenResponse
- BotEvent
- InviteRequest
- PatchOperation
- MailAddress
- MailAttachment
- MailOptions
- MedplumSourceInfraConfig
- MedplumInfraConfig
- Event
- AtomContext
- Atom
- PrefixParselet
- InfixParselet
- Marker
- Token
- TokenizerOptions
- AddressFormatOptions
- HumanNameFormatOptions
- Hl7DateParseOptions
- SearchParameterDetails
- SearchRequest
- Filter
- SortRule
- IncludeTarget
- TypedValue
- IndexedStructureDefinition
- TypeInfo
- ResourceVisitor
- InternalTypeSchema
- InternalSchemaElement
- ElementType
- Constraint
- SlicingRules
- SliceDefinition
- SliceDiscriminator
- Code
Type Aliases
BaseSchema
Ƭ BaseSchema: Record<string, { elements: Record<string, Partial<InternalSchemaElement>> }>
Defined in
packages/core/src/base-schema.ts:3
FetchLike
Ƭ FetchLike: (url: string, options?: any) => Promise<any>
Type declaration
▸ (url, options?): Promise<any>
Parameters
| Name | Type |
|---|---|
url | string |
options? | any |
Returns
Promise<any>
Defined in
packages/core/src/client.ts:278
QueryTypes
Ƭ QueryTypes: URLSearchParams | string[][] | Record<string, any> | string | undefined
QueryTypes defines the different ways to specify FHIR search parameters.
Can be any valid input to the URLSearchParams() constructor.
TypeScript definitions for URLSearchParams do not match runtime behavior. The official spec only accepts string values. Web browsers and Node.js automatically coerce values to strings. See: https://github.com/microsoft/TypeScript/issues/32951
Defined in
packages/core/src/client.ts:290
ResourceArray
Ƭ ResourceArray<T>: T[] & { bundle: Bundle<T> }
ResourceArray is an array of resources with a bundle property. The bundle property is a FHIR Bundle containing the search results. This is useful for retrieving bundle metadata such as total, offset, and next link.
Type parameters
| Name | Type |
|---|---|
T | extends Resource = Resource |
Defined in
packages/core/src/client.ts:297
BinarySource
Ƭ BinarySource: string | File | Blob | Uint8Array
Source for a FHIR Binary.
Defined in
packages/core/src/client.ts:430
MailDestination
Ƭ MailDestination: string | MailAddress | string[] | MailAddress[]
Email destination definition.
Defined in
packages/core/src/client.ts:444
ExternalSecretSystem
Ƭ ExternalSecretSystem: keyof typeof ExternalSecretSystems
Defined in
packages/core/src/config.ts:7
ExternalSecretPrimitive
Ƭ ExternalSecretPrimitive: string | boolean | number
Defined in
packages/core/src/config.ts:8
ExternalSecretPrimitiveType
Ƭ ExternalSecretPrimitiveType: "string" | "boolean" | "number"
Defined in
packages/core/src/config.ts:9
ExternalSecret
Ƭ ExternalSecret<T>: Object
Type parameters
| Name | Type |
|---|---|
T | extends ExternalSecretPrimitive = ExternalSecretPrimitive |
Type declaration
| Name | Type |
|---|---|
system | ExternalSecretSystem |
key | string |
type | TypeName<T> |
Defined in
packages/core/src/config.ts:10
ValueOrExternalSecret
Ƭ ValueOrExternalSecret<T>: T | ExternalSecret<T>
Type parameters
| Name | Type |
|---|---|
T | extends ExternalSecretPrimitive |
Defined in
packages/core/src/config.ts:15
EventListener
Ƭ EventListener: (e: Event) => void
Type declaration
▸ (e): void
Parameters
| Name | Type |
|---|---|
e | Event |
Returns
void
Defined in
packages/core/src/eventtarget.ts:10
FhircastEventName
Ƭ FhircastEventName: keyof typeof FHIRCAST_EVENT_NAMES
Defined in
packages/core/src/fhircast/index.ts:28
FhircastResourceType
Ƭ FhircastResourceType: typeof FHIRCAST_RESOURCE_TYPES[number]
Defined in
packages/core/src/fhircast/index.ts:29
FhircastEventContextDetails
Ƭ FhircastEventContextDetails: Object
Type declaration
| Name | Type |
|---|---|
resourceType | FhircastResourceType |
optional? | boolean |
manyAllowed? | boolean |
Defined in
packages/core/src/fhircast/index.ts:31
SubscriptionRequest
Ƭ SubscriptionRequest: Object
A FHIRcast subscription request.
Can be passed to MedplumClient.fhircastConnect or MedplumClient.fhircastUnsubscribe to either open a FHIRcast connection, or unsubscribe from the subscription.
Type declaration
| Name | Type |
|---|---|
channelType | "websocket" |
mode | "subscribe" | "unsubscribe" |
events | FhircastEventName[] |
topic | string |
endpoint | string |
Defined in
packages/core/src/fhircast/index.ts:99
PendingSubscriptionRequest
Ƭ PendingSubscriptionRequest: Omit<SubscriptionRequest, "endpoint">
Defined in
packages/core/src/fhircast/index.ts:107
FhircastEventContextMap
Ƭ FhircastEventContextMap<EventName>: typeof FHIRCAST_EVENT_RESOURCES[EventName]
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
Defined in
packages/core/src/fhircast/index.ts:125
FhircastEventContextKey
Ƭ FhircastEventContextKey<EventName>: keyof FhircastEventContextMap<EventName>
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
Defined in
packages/core/src/fhircast/index.ts:127
FhircastEventResourceType
Ƭ FhircastEventResourceType<EventName, K>: FhircastEventContextMap<EventName>[K] extends infer Ev ? Ev["resourceType"] : never
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
K | extends FhircastEventContextKey<EventName> = FhircastEventContextKey<EventName> |
Defined in
packages/core/src/fhircast/index.ts:130
FhircastEventResource
Ƭ FhircastEventResource<EventName, K>: FhircastEventContextMap<EventName>[K] extends infer _Ev ? Resource & { resourceType: FhircastEventResourceType<EventName, K> ; id: string } : never
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
K | extends FhircastEventContextKey<EventName> = FhircastEventContextKey<EventName> |
Defined in
packages/core/src/fhircast/index.ts:137
FhircastEventContext
Ƭ FhircastEventContext<EventName, K>: FhircastEventContextMap<EventName>[K] extends infer _Ev ? { key: K ; resource: FhircastEventResource<EventName, K> } : never
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
K | extends FhircastEventContextKey<EventName> = FhircastEventContextKey<EventName> |
Defined in
packages/core/src/fhircast/index.ts:144
FhircastEventPayload
Ƭ FhircastEventPayload<EventName>: Object
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
Type declaration
| Name | Type |
|---|---|
hub.topic | string |
hub.event | EventName |
context | FhircastEventContext<EventName>[] |
context.versionId? | string |
Defined in
packages/core/src/fhircast/index.ts:154
FhircastMessagePayload
Ƭ FhircastMessagePayload<EventName>: Object
Type parameters
| Name | Type |
|---|---|
EventName | extends FhircastEventName = FhircastEventName |
Type declaration
| Name | Type |
|---|---|
timestamp | string |
id | string |
event | FhircastEventPayload<EventName> |
Defined in
packages/core/src/fhircast/index.ts:161
FhircastConnectEvent
Ƭ FhircastConnectEvent: Object
Type declaration
| Name | Type |
|---|---|
type | "connect" |
Defined in
packages/core/src/fhircast/index.ts:393
FhircastMessageEvent
Ƭ FhircastMessageEvent: Object
Type declaration
| Name | Type |
|---|---|
type | "message" |
payload | FhircastMessagePayload |
Defined in
packages/core/src/fhircast/index.ts:394
FhircastDisconnectEvent
Ƭ FhircastDisconnectEvent: Object
Type declaration
| Name | Type |
|---|---|
type | "disconnect" |
Defined in
packages/core/src/fhircast/index.ts:395
FhircastSubscriptionEventMap
Ƭ FhircastSubscriptionEventMap: Object
Type declaration
| Name | Type |
|---|---|
connect | FhircastConnectEvent |
message | FhircastMessageEvent |
disconnect | FhircastDisconnectEvent |
Defined in
packages/core/src/fhircast/index.ts:397
FhirFilterExpression
Ƭ FhirFilterExpression: FhirFilterComparison | FhirFilterNegation | FhirFilterConnective
The FhirFilterExpression type is the base type of all filter expressions.
Defined in
packages/core/src/filter/types.ts:8
TypeName
Ƭ TypeName<T>: T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends undefined ? "undefined" : "object"
Type parameters
| Name |
|---|
T |
Defined in
packages/core/src/types.ts:17
ProfileResource
Ƭ ProfileResource: Patient | Practitioner | RelatedPerson
Defined in
packages/core/src/utils.ts:23
CodeChallengeMethod
Ƭ CodeChallengeMethod: "plain" | "S256"
Allowed values for code_challenge_method in a PKCE exchange.
Defined in
packages/core/src/utils.ts:28
ResourceWithCode
Ƭ ResourceWithCode: Resource & Code
Defined in
packages/core/src/utils.ts:34
Variables
protectedResourceTypes
• Const protectedResourceTypes: string[]
Protected resource types are in the "medplum" project. Reading and writing is limited to the system account.
Defined in
packages/core/src/access.ts:13
projectAdminResourceTypes
• Const projectAdminResourceTypes: string[]
Project admin resource types are special resources that are only accessible to project administrators.
Defined in
packages/core/src/access.ts:19
MEDPLUM_VERSION
• Const MEDPLUM_VERSION: string
Defined in
packages/core/src/client.ts:76
DEFAULT_ACCEPT
• Const DEFAULT_ACCEPT: string
Defined in
packages/core/src/client.ts:77
ExternalSecretSystems
• Const ExternalSecretSystems: Object
Type declaration
| Name | Type |
|---|---|
aws_ssm_parameter_store | "aws_ssm_parameter_store" |
Defined in
packages/core/src/config.ts:3
UCUM
• Const UCUM: "http://unitsofmeasure.org"
Defined in
packages/core/src/constants.ts:2
LOINC
• Const LOINC: "http://loinc.org"
Defined in
packages/core/src/constants.ts:3
SNOMED
• Const SNOMED: "http://snomed.info/sct"
Defined in
packages/core/src/constants.ts:4
RXNORM
• Const RXNORM: "http://www.nlm.nih.gov/research/umls/rxnorm"
Defined in
packages/core/src/constants.ts:5
CPT
• Const CPT: "http://www.ama-assn.org/go/cpt"
Defined in
packages/core/src/constants.ts:6
ICD10
• Const ICD10: "http://hl7.org/fhir/sid/icd-10"
Defined in
packages/core/src/constants.ts:7
ContentType
• Const ContentType: Object
Content type constants.
Type declaration
| Name | Type |
|---|---|
CSS | string |
FAVICON | string |
FHIR_JSON | string |
FORM_URL_ENCODED | string |
HL7_V2 | string |
HTML | string |
JAVASCRIPT | string |
JSON | string |
JSON_PATCH | string |
PNG | string |
SVG | string |
TEXT | string |
TYPESCRIPT | string |
Defined in
packages/core/src/contenttype.ts:4
FHIRCAST_EVENT_NAMES
• Const FHIRCAST_EVENT_NAMES: Object
Type declaration
| Name | Type |
|---|---|
patient-open | "patient-open" |
patient-close | "patient-close" |
imagingstudy-open | "imagingstudy-open" |
imagingstudy-close | "imagingstudy-close" |
encounter-open | "encounter-open" |
encounter-close | "encounter-close" |
diagnosticreport-open | "diagnosticreport-open" |
diagnosticreport-close | "diagnosticreport-close" |
syncerror | "syncerror" |
Defined in
packages/core/src/fhircast/index.ts:8
FHIRCAST_RESOURCE_TYPES
• Const FHIRCAST_RESOURCE_TYPES: readonly ["Patient", "Encounter", "ImagingStudy", "DiagnosticReport", "OperationOutcome"]
Defined in
packages/core/src/fhircast/index.ts:20
FHIRCAST_EVENT_RESOURCES
• Const FHIRCAST_EVENT_RESOURCES: Object
Type declaration
| Name | Type |
|---|---|
patient-open | { patient: { resourceType: "Patient" = 'Patient' } ; encounter: { resourceType: "Encounter" = 'Encounter'; optional: true = true } } |
patient-open.patient | { resourceType: "Patient" = 'Patient' } |
patient-open.patient.resourceType | "Patient" |
patient-open.encounter | { resourceType: "Encounter" = 'Encounter'; optional: true = true } |
patient-open.encounter.resourceType | "Encounter" |
patient-open.encounter.optional | true |
patient-close | { patient: { resourceType: "Patient" = 'Patient' } ; encounter: { resourceType: "Encounter" = 'Encounter'; optional: true = true } } |
patient-close.patient | { resourceType: "Patient" = 'Patient' } |
patient-close.patient.resourceType | "Patient" |
patient-close.encounter | { resourceType: "Encounter" = 'Encounter'; optional: true = true } |
patient-close.encounter.resourceType | "Encounter" |
patient-close.encounter.optional | true |
imagingstudy-open | { study: { resourceType: "ImagingStudy" = 'ImagingStudy' } ; encounter: { resourceType: "Encounter" = 'Encounter'; optional: true = true } ; patient: { resourceType: "Patient" = 'Patient'; optional: true = true } } |
imagingstudy-open.study | { resourceType: "ImagingStudy" = 'ImagingStudy' } |
imagingstudy-open.study.resourceType | "ImagingStudy" |
imagingstudy-open.encounter | { resourceType: "Encounter" = 'Encounter'; optional: true = true } |
imagingstudy-open.encounter.resourceType | "Encounter" |
imagingstudy-open.encounter.optional | true |
imagingstudy-open.patient | { resourceType: "Patient" = 'Patient'; optional: true = true } |
imagingstudy-open.patient.resourceType | "Patient" |
imagingstudy-open.patient.optional | true |
imagingstudy-close | { study: { resourceType: "ImagingStudy" = 'ImagingStudy' } ; encounter: { resourceType: "Encounter" = 'Encounter'; optional: true = true } ; patient: { resourceType: "Patient" = 'Patient'; optional: true = true } } |
imagingstudy-close.study | { resourceType: "ImagingStudy" = 'ImagingStudy' } |
imagingstudy-close.study.resourceType | "ImagingStudy" |
imagingstudy-close.encounter | { resourceType: "Encounter" = 'Encounter'; optional: true = true } |
imagingstudy-close.encounter.resourceType | "Encounter" |
imagingstudy-close.encounter.optional | true |
imagingstudy-close.patient | { resourceType: "Patient" = 'Patient'; optional: true = true } |
imagingstudy-close.patient.resourceType | "Patient" |
imagingstudy-close.patient.optional | true |
encounter-open | { encounter: { resourceType: "Encounter" = 'Encounter' } ; patient: { resourceType: "Patient" = 'Patient' } } |
encounter-open.encounter | { resourceType: "Encounter" = 'Encounter' } |
encounter-open.encounter.resourceType | "Encounter" |
encounter-open.patient | { resourceType: "Patient" = 'Patient' } |
encounter-open.patient.resourceType | "Patient" |
encounter-close | { encounter: { resourceType: "Encounter" = 'Encounter' } ; patient: { resourceType: "Patient" = 'Patient' } } |
encounter-close.encounter | { resourceType: "Encounter" = 'Encounter' } |
encounter-close.encounter.resourceType | "Encounter" |
encounter-close.patient | { resourceType: "Patient" = 'Patient' } |
encounter-close.patient.resourceType | "Patient" |
diagnosticreport-open | { report: { resourceType: "DiagnosticReport" = 'DiagnosticReport' } ; encounter: { resourceType: "Encounter" = 'Encounter'; optional: true = true } ; study: { resourceType: "ImagingStudy" = 'ImagingStudy'; optional: true = true; manyAllowed: true = true } ; patient: { resourceType: "Patient" = 'Patient' } } |
diagnosticreport-open.report | { resourceType: "DiagnosticReport" = 'DiagnosticReport' } |
diagnosticreport-open.report.resourceType | "DiagnosticReport" |
diagnosticreport-open.encounter | { resourceType: "Encounter" = 'Encounter'; optional: true = true } |
diagnosticreport-open.encounter.resourceType | "Encounter" |
diagnosticreport-open.encounter.optional | true |
diagnosticreport-open.study | { resourceType: "ImagingStudy" = 'ImagingStudy'; optional: true = true; manyAllowed: true = true } |
diagnosticreport-open.study.resourceType | "ImagingStudy" |
diagnosticreport-open.study.optional | true |
diagnosticreport-open.study.manyAllowed | true |
diagnosticreport-open.patient | { resourceType: "Patient" = 'Patient' } |
diagnosticreport-open.patient.resourceType | "Patient" |
diagnosticreport-close | { report: { resourceType: "DiagnosticReport" = 'DiagnosticReport' } ; encounter: { resourceType: "Encounter" = 'Encounter'; optional: true = true } ; study: { resourceType: "ImagingStudy" = 'ImagingStudy'; optional: true = true; manyAllowed: true = true } ; patient: { resourceType: "Patient" = 'Patient' } } |
diagnosticreport-close.report | { resourceType: "DiagnosticReport" = 'DiagnosticReport' } |
diagnosticreport-close.report.resourceType | "DiagnosticReport" |
diagnosticreport-close.encounter | { resourceType: "Encounter" = 'Encounter'; optional: true = true } |
diagnosticreport-close.encounter.resourceType | "Encounter" |
diagnosticreport-close.encounter.optional | true |
diagnosticreport-close.study | { resourceType: "ImagingStudy" = 'ImagingStudy'; optional: true = true; manyAllowed: true = true } |
diagnosticreport-close.study.resourceType | "ImagingStudy" |
diagnosticreport-close.study.optional | true |
diagnosticreport-close.study.manyAllowed | true |
diagnosticreport-close.patient | { resourceType: "Patient" = 'Patient' } |
diagnosticreport-close.patient.resourceType | "Patient" |
syncerror | { operationoutcome: { resourceType: "OperationOutcome" = 'OperationOutcome' } } |
syncerror.operationoutcome | { resourceType: "OperationOutcome" = 'OperationOutcome' } |
syncerror.operationoutcome.resourceType | "OperationOutcome" |
Defined in
packages/core/src/fhircast/index.ts:38
FHIRCAST_CONTEXT_KEY_LOOKUP
• Const FHIRCAST_CONTEXT_KEY_LOOKUP: Object
Type declaration
| Name | Type |
|---|---|
study | "ImagingStudy" |
patient | "Patient" |
encounter | "Encounter" |
report | "DiagnosticReport" |
operationoutcome | "OperationOutcome" |
Defined in
packages/core/src/fhircast/index.ts:109
FHIRCAST_CONTEXT_KEY_REVERSE_LOOKUP
• Const FHIRCAST_CONTEXT_KEY_REVERSE_LOOKUP: Object
Type declaration
| Name | Type |
|---|---|
ImagingStudy | "study" |
Patient | "patient" |
Encounter | "encounter" |
DiagnosticReport | "report" |
OperationOutcome | "operationoutcome" |
Defined in
packages/core/src/fhircast/index.ts:117
allOk
• Const allOk: OperationOutcome
Defined in
packages/core/src/outcomes.ts:14
created
• Const created: OperationOutcome
Defined in
packages/core/src/outcomes.ts:28
notModified
• Const notModified: OperationOutcome
Defined in
packages/core/src/outcomes.ts:42
notFound
• Const notFound: OperationOutcome
Defined in
packages/core/src/outcomes.ts:56
unauthorized
• Const unauthorized: OperationOutcome
Defined in
packages/core/src/outcomes.ts:70
forbidden
• Const forbidden: OperationOutcome
Defined in
packages/core/src/outcomes.ts:84
gone
• Const gone: OperationOutcome
Defined in
packages/core/src/outcomes.ts:98
tooManyRequests
• Const tooManyRequests: OperationOutcome
Defined in
packages/core/src/outcomes.ts:112
DEFAULT_SEARCH_COUNT
• Const DEFAULT_SEARCH_COUNT: 20
Defined in
packages/core/src/search/search.ts:6
PropertyType
• Const PropertyType: Object
List of property types. http://www.hl7.org/fhir/valueset-defined-types.html The list here includes additions found from StructureDefinition resources.
Type declaration
| Name | Type |
|---|---|
Address | string |
Age | string |
Annotation | string |
Attachment | string |
BackboneElement | string |
CodeableConcept | string |
Coding | string |
ContactDetail | string |
ContactPoint | string |
Contributor | string |
Count | string |
DataRequirement | string |
Distance | string |
Dosage | string |
Duration | string |
Expression | string |
Extension | string |
HumanName | string |
Identifier | string |
MarketingStatus | string |
Meta | string |
Money | string |
Narrative | string |
ParameterDefinition | string |
Period | string |
Population | string |
ProdCharacteristic | string |
ProductShelfLife | string |
Quantity | string |
Range | string |
Ratio | string |
Reference | string |
RelatedArtifact | string |
SampledData | string |
Signature | string |
SubstanceAmount | string |
SystemString | string |
Timing | string |
TriggerDefinition | string |
UsageContext | string |
base64Binary | string |
boolean | string |
canonical | string |
code | string |
date | string |
dateTime | string |
decimal | string |
id | string |
instant | string |
integer | string |
markdown | string |
oid | string |
positiveInt | string |
string | string |
time | string |
unsignedInt | string |
uri | string |
url | string |
uuid | string |
Defined in
packages/core/src/types.ts:37
globalSchema
• Const globalSchema: IndexedStructureDefinition
Global schema singleton.
Defined in
packages/core/src/types.ts:351
fhirTypeToJsType
• Const fhirTypeToJsType: Object
Type declaration
| Name | Type |
|---|---|
base64Binary | "string" |
boolean | "boolean" |
canonical | "string" |
code | "string" |
date | "string" |
dateTime | "string" |
decimal | "number" |
id | "string" |
instant | "string" |
integer | "number" |
markdown | "string" |
oid | "string" |
positiveInt | "number" |
string | "string" |
time | "string" |
unsignedInt | "number" |
uri | "string" |
url | "string" |
uuid | "string" |
xhtml | "string" |
http://hl7.org/fhirpath/System.String | "string" |
Defined in
packages/core/src/typeschema/validation.ts:32
Functions
canReadResourceType
▸ canReadResourceType(accessPolicy, resourceType): boolean
Determines if the current user can read the specified resource type.
Parameters
| Name | Type | Description |
|---|---|---|
accessPolicy | AccessPolicy | The access policy. |
resourceType | "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "Agent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AsyncJob" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "BulkDataExport" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "DomainConfiguration" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "SmartAppLaunch" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription" | The resource type. |
Returns
boolean
True if the current user can read the specified resource type.
Defined in
packages/core/src/access.ts:59
canWriteResourceType
▸ canWriteResourceType(accessPolicy, resourceType): boolean
Determines if the current user can write the specified resource type. This is a preliminary check before evaluating a write operation in depth. If a user cannot write a resource type at all, then don't bother looking up previous versions.
Parameters
| Name | Type | Description |
|---|---|---|
accessPolicy | AccessPolicy | The access policy. |
resourceType | "Patient" | "Practitioner" | "RelatedPerson" | "AccessPolicy" | "Account" | "ActivityDefinition" | "AdverseEvent" | "Agent" | "AllergyIntolerance" | "Appointment" | "AppointmentResponse" | "AsyncJob" | "AuditEvent" | "Basic" | "Binary" | "BiologicallyDerivedProduct" | "BodyStructure" | "Bot" | "BulkDataExport" | "Bundle" | "CapabilityStatement" | "CarePlan" | "CareTeam" | "CatalogEntry" | "ChargeItem" | "ChargeItemDefinition" | "Claim" | "ClaimResponse" | "ClientApplication" | "ClinicalImpression" | "CodeSystem" | "Communication" | "CommunicationRequest" | "CompartmentDefinition" | "Composition" | "ConceptMap" | "Condition" | "Consent" | "Contract" | "Coverage" | "CoverageEligibilityRequest" | "CoverageEligibilityResponse" | "DetectedIssue" | "Device" | "DeviceDefinition" | "DeviceMetric" | "DeviceRequest" | "DeviceUseStatement" | "DiagnosticReport" | "DocumentManifest" | "DocumentReference" | "DomainConfiguration" | "EffectEvidenceSynthesis" | "Encounter" | "Endpoint" | "EnrollmentRequest" | "EnrollmentResponse" | "EpisodeOfCare" | "EventDefinition" | "Evidence" | "EvidenceVariable" | "ExampleScenario" | "ExplanationOfBenefit" | "FamilyMemberHistory" | "Flag" | "Goal" | "GraphDefinition" | "Group" | "GuidanceResponse" | "HealthcareService" | "ImagingStudy" | "Immunization" | "ImmunizationEvaluation" | "ImmunizationRecommendation" | "ImplementationGuide" | "InsurancePlan" | "Invoice" | "JsonWebKey" | "Library" | "Linkage" | "List" | "Location" | "Login" | "Measure" | "MeasureReport" | "Media" | "Medication" | "MedicationAdministration" | "MedicationDispense" | "MedicationKnowledge" | "MedicationRequest" | "MedicationStatement" | "MedicinalProduct" | "MedicinalProductAuthorization" | "MedicinalProductContraindication" | "MedicinalProductIndication" | "MedicinalProductIngredient" | "MedicinalProductInteraction" | "MedicinalProductManufactured" | "MedicinalProductPackaged" | "MedicinalProductPharmaceutical" | "MedicinalProductUndesirableEffect" | "MessageDefinition" | "MessageHeader" | "MolecularSequence" | "NamingSystem" | "NutritionOrder" | "Observation" | "ObservationDefinition" | "OperationDefinition" | "OperationOutcome" | "Organization" | "OrganizationAffiliation" | "Parameters" | "PasswordChangeRequest" | "PaymentNotice" | "PaymentReconciliation" | "Person" | "PlanDefinition" | "PractitionerRole" | "Procedure" | "Project" | "ProjectMembership" | "Provenance" | "Questionnaire" | "QuestionnaireResponse" | "RequestGroup" | "ResearchDefinition" | "ResearchElementDefinition" | "ResearchStudy" | "ResearchSubject" | "RiskAssessment" | "RiskEvidenceSynthesis" | "Schedule" | "SearchParameter" | "ServiceRequest" | "Slot" | "SmartAppLaunch" | "Specimen" | "SpecimenDefinition" | "StructureDefinition" | "StructureMap" | "Subscription" | "Substance" | "SubstanceNucleicAcid" | "SubstancePolymer" | "SubstanceProtein" | "SubstanceReferenceInformation" | "SubstanceSourceMaterial" | "SubstanceSpecification" | "SupplyDelivery" | "SupplyRequest" | "Task" | "TerminologyCapabilities" | "TestReport" | "TestScript" | "User" | "UserConfiguration" | "ValueSet" | "VerificationResult" | "VisionPrescription" | The resource type. |
Returns
boolean
True if the current user can write the specified resource type.
Defined in
packages/core/src/access.ts:78
canWriteResource
▸ canWriteResource(accessPolicy, resource): boolean
Determines if the current user can write the specified resource. This is a more in-depth check after building the candidate result of a write operation.
Parameters
| Name | Type | Description |
|---|---|---|
accessPolicy | AccessPolicy | The access policy. |
resource | Resource | The resource. |
Returns
boolean
True if the current user can write the specified resource type.
Defined in
packages/core/src/access.ts:99
matchesAccessPolicy
▸ matchesAccessPolicy(accessPolicy, resource, readonlyMode): boolean
Returns true if the resource satisfies the current access policy.
Parameters
| Name | Type | Description |
|---|---|---|
accessPolicy | AccessPolicy | The access policy. |
resource | Resource | The resource. |
readonlyMode | boolean | True if the resource is being read. |
Returns
boolean
True if the resource matches the access policy.
Deprecated
Use satisfiedAccessPolicy() instead.
Defined in
packages/core/src/access.ts:115
satisfiedAccessPolicy
▸ satisfiedAccessPolicy(resource, interaction, accessPolicy): AccessPolicyResource | undefined
Checks that there is an access policy permitting the given resource interaction, returning the matching policy object.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Resource | The resource being acted upon. |
interaction | AccessPolicyInteraction | The interaction being performed on the resource. |
accessPolicy | undefined | AccessPolicy | The relevant access policy for the current user. |
Returns
AccessPolicyResource | undefined
The satisfied access policy, or undefined if the access policy does not permit the given interaction.
Defined in
packages/core/src/access.ts:139
compressElement
▸ compressElement(element): Partial<InternalSchemaElement>
Parameters
| Name | Type |
|---|---|
element | InternalSchemaElement |
Returns
Partial<InternalSchemaElement>
Defined in
packages/core/src/base-schema.ts:9
inflateElement
▸ inflateElement(partial): InternalSchemaElement
Parameters
| Name | Type |
|---|---|
partial | Partial<InternalSchemaElement> |
Returns
Defined in
packages/core/src/base-schema.ts:32
inflateBaseSchema
▸ inflateBaseSchema(base): Record<string, InternalTypeSchema>
Parameters
| Name | Type |
|---|---|
base | BaseSchema |
Returns
Record<string, InternalTypeSchema>
Defined in
packages/core/src/base-schema.ts:45
decodeBase64
▸ decodeBase64(data): string
Decodes a base64 string. Handles both browser and Node environments.
Parameters
| Name | Type | Description |
|---|---|---|
data | string | The base-64 encoded input string. |
Returns
string
The decoded string.
Defined in
packages/core/src/base64.ts:7
encodeBase64
▸ encodeBase64(data): string
Encodes a base64 string. Handles both browser and Node environments.
Parameters
| Name | Type | Description |
|---|---|---|
data | string | The unencoded input string. |
Returns
string
The base-64 encoded string.
Defined in
packages/core/src/base64.ts:23
convertToTransactionBundle
▸ convertToTransactionBundle(bundle): Bundle
Takes a bundle and creates a Transaction Type bundle
Parameters
| Name | Type | Description |
|---|---|---|
bundle | Bundle<Resource> | The Bundle object that we'll receive from the search query |
Returns
Bundle
transaction type bundle
Defined in
packages/core/src/bundle.ts:16
reorderBundle
▸ reorderBundle(bundle): Bundle
Topologically sorts a batch or transaction bundle to improve reference resolution.
The bundle is sorted such that a resource is created before references to that resource appear in the bundle.
In the event of cycles, this function will first create a POST request for each resource in the cycle, and then will append a PUT request to the bundle. This ensures that each resources in the cycle is visited twice, and all references can be resolved
Parameters
| Name | Type | Description |
|---|---|---|
bundle | Bundle<Resource> | Input bundle with type batch or transaction |
Returns
Bundle
Bundle of the same type, with Bundle.entry reordered
Defined in
packages/core/src/bundle.ts:76
convertContainedResourcesToBundle
▸ convertContainedResourcesToBundle(resource): Bundle
Converts a resource with contained resources to a transaction bundle. This function is useful when creating a resource that contains other resources. Handles local references and topological sorting.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Object | The input resource which may or may not include contained resources. |
Returns
Bundle
A bundle with the input resource and all contained resources.
Defined in
packages/core/src/bundle.ts:221
getRandomString
▸ getRandomString(): string
Returns a cryptographically secure random string.
Returns
string
A cryptographically secure random string.
Defined in
packages/core/src/crypto.ts:7
encryptSHA256
▸ encryptSHA256(str): Promise<ArrayBuffer>
Encrypts a string with SHA256 encryption.
Parameters
| Name | Type | Description |
|---|---|---|
str | string | The unencrypted input string. |
Returns
Promise<ArrayBuffer>
The encrypted value in an ArrayBuffer.
Defined in
packages/core/src/crypto.ts:18
generateId
▸ generateId(): string
Cross platform random UUID generator Note that this is not intended for production use, but rather for testing This should be replaced when crypto.randomUUID is fully supported See: https://stackoverflow.com/revisions/2117523/28
Returns
string
A random UUID.
Defined in
packages/core/src/crypto.ts:29
isFhircastResourceType
▸ isFhircastResourceType(resourceType): boolean
Checks if a ResourceType can be used in a FHIRcast context.
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | "Patient" | "DiagnosticReport" | "Encounter" | "ImagingStudy" | "OperationOutcome" | A ResourceType to test. |
Returns
boolean
true if this is a resource type associated with FHIRcast contexts, otherwise returns false.
Defined in
packages/core/src/fhircast/index.ts:90
isCompletedSubscriptionRequest
▸ isCompletedSubscriptionRequest(subscriptionRequest): subscriptionRequest is SubscriptionRequest
Parameters
| Name | Type |
|---|---|
subscriptionRequest | SubscriptionRequest | PendingSubscriptionRequest |
Returns
subscriptionRequest is SubscriptionRequest
Defined in
packages/core/src/fhircast/index.ts:167
serializeFhircastSubscriptionRequest
▸ serializeFhircastSubscriptionRequest(subscriptionRequest): string
Creates a serialized url-encoded payload for a FHIRcast subscription from a SubscriptionRequest object that can be directly used in an HTTP request to the Hub.
Parameters
| Name | Type | Description |
|---|---|---|
subscriptionRequest | SubscriptionRequest | PendingSubscriptionRequest | An object representing a subscription request. |
Returns
string
A serialized subscription in url-encoded form.
Defined in
packages/core/src/fhircast/index.ts:179
validateFhircastSubscriptionRequest
▸ validateFhircastSubscriptionRequest(subscriptionRequest): boolean
Validates that a SubscriptionRequest.
Parameters
| Name | Type | Description |
|---|---|---|
subscriptionRequest | SubscriptionRequest | PendingSubscriptionRequest | The SubscriptionRequest to validate. |
Returns
boolean
A boolean indicating whether or not the SubscriptionRequest is valid.
Defined in
packages/core/src/fhircast/index.ts:209
createFhircastMessagePayload
▸ createFhircastMessagePayload<EventName>(topic, event, context): FhircastMessagePayload<EventName>
Creates a serializable JSON payload for the FHIRcast protocol
Type parameters
| Name | Type |
|---|---|
EventName | extends "patient-open" | "patient-close" | "imagingstudy-open" | "imagingstudy-close" | "encounter-open" | "encounter-close" | "diagnosticreport-open" | "diagnosticreport-close" | "syncerror" |
Parameters
| Name | Type | Description |
|---|---|---|
topic | string | The topic that this message will be published on. Usually a UUID. |
event | EventName | The event name, ie. "patient-open" or "patient-close". |
context | FhircastEventContext<EventName, keyof FhircastEventContextMap<EventName>> | FhircastEventContext<EventName, keyof FhircastEventContextMap<EventName>>[] | The updated context, containing new versions of resources related to this event. |
Returns
FhircastMessagePayload<EventName>
A serializable FhircastMessagePayload.
Defined in
packages/core/src/fhircast/index.ts:360
parseMappingLanguage
▸ parseMappingLanguage(input): StructureMap
Parses a FHIR Mapping Language document into an AST.
Parameters
| Name | Type | Description |
|---|---|---|
input | string | The FHIR Mapping Language document to parse. |
Returns
StructureMap
The AST representing the document.
Defined in
packages/core/src/fhirmapper/parse.ts:370
parseFilterParameter
▸ parseFilterParameter(input): FhirFilterExpression
Parses a FHIR _filter parameter expression into an AST.
Parameters
| Name | Type | Description |
|---|---|---|
input | string | The FHIR _filter parameter expression. |
Returns
The AST representing the filters.
Defined in
packages/core/src/filter/parse.ts:101
formatAddress
▸ formatAddress(address, options?): string
Formats a FHIR Address as a string.
Parameters
| Name | Type | Description |
|---|---|---|
address | Address | The address to format. |
options? | AddressFormatOptions | Optional address format options. |
Returns
string
The formatted address string.
Defined in
packages/core/src/format.ts:36
formatHumanName
▸ formatHumanName(name, options?): string
Formats a FHIR HumanName as a string.
Parameters
| Name | Type | Description |
|---|---|---|
name | HumanName | The name to format. |
options? | HumanNameFormatOptions | Optional name format options. |
Returns
string
The formatted name string.
Defined in
packages/core/src/format.ts:70
formatGivenName
▸ formatGivenName(name): string
Formats the given name portion of a FHIR HumanName element.
Parameters
| Name | Type | Description |
|---|---|---|
name | HumanName | The name to format. |
Returns
string
The formatted given name string.
Defined in
packages/core/src/format.ts:105
formatFamilyName
▸ formatFamilyName(name): string
Formats the family name portion of a FHIR HumanName element.
Parameters
| Name | Type | Description |
|---|---|---|
name | HumanName | The name to format. |
Returns
string
The formatted family name string.
Defined in
packages/core/src/format.ts:118
isValidDate
▸ isValidDate(date): boolean
Returns true if the given date object is a valid date. Dates can be invalid if created by parsing an invalid string.
Parameters
| Name | Type | Description |
|---|---|---|
date | Date | A date object. |
Returns
boolean
Returns true if the date is a valid date.
Defined in
packages/core/src/format.ts:128
formatDate
▸ formatDate(date, locales?, options?): string
Formats a FHIR date string as a human readable string. Handles missing values and invalid dates.
Parameters
| Name | Type | Description |
|---|---|---|
date | undefined | string | The date to format. |
locales? | LocalesArgument | Optional locales. |
options? | DateTimeFormatOptions | Optional date format options. |
Returns
string
The formatted date string.
Defined in
packages/core/src/format.ts:140
formatTime
▸ formatTime(time, locales?, options?): string
Formats a FHIR time string as a human readable string. Handles missing values and invalid dates.
Parameters
| Name | Type | Description |
|---|---|---|
time | undefined | string | The date to format. |
locales? | LocalesArgument | Optional locales. |
options? | DateTimeFormatOptions | Optional time format options. |
Returns
string
The formatted time string.
Defined in
packages/core/src/format.ts:164
formatDateTime
▸ formatDateTime(dateTime, locales?, options?): string
Formats a FHIR dateTime string as a human readable string. Handles missing values and invalid dates.
Parameters
| Name | Type | Description |
|---|---|---|
dateTime | undefined | string | The dateTime to format. |
locales? | LocalesArgument | Optional locales. |
options? | DateTimeFormatOptions | Optional dateTime format options. |
Returns
string
The formatted dateTime string.
Defined in
packages/core/src/format.ts:187
formatPeriod
▸ formatPeriod(period, locales?, options?): string
Formats a FHIR Period as a human readable string.
Parameters
| Name | Type | Description |
|---|---|---|
period | undefined | Period | The period to format. |
locales? | LocalesArgument | Optional locales. |
options? | DateTimeFormatOptions | Optional period format options. |
Returns
string
The formatted period string.
Defined in
packages/core/src/format.ts:209
formatTiming
▸ formatTiming(timing): string
Formats a FHIR Timing as a human readable string.
Parameters
| Name | Type | Description |
|---|---|---|
timing | undefined | Timing | The timing to format. |
Returns
string
The formatted timing string.
Defined in
packages/core/src/format.ts:255
formatRange
▸ formatRange(range, precision?, exclusive?): string
Returns a human-readable string for a FHIR Range datatype, taking into account one-sided ranges
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
range | undefined | Range | undefined | A FHIR Range element |
precision? | number | undefined | Number of decimal places to display in the rendered quantity values |
exclusive | boolean | false | If true, one-sided ranges will be rendered with the > or < bounds rather than >= or <= |
Returns
string
A human-readable string representation of the Range
Defined in
packages/core/src/format.ts:317
formatQuantity
▸ formatQuantity(quantity, precision?): string
Returns a human-readable string for a FHIR Quantity datatype, taking into account units and comparators
Parameters
| Name | Type | Description |
|---|---|---|
quantity | undefined | Quantity | A FHIR Quantity element |
precision? | number | Number of decimal places to display in the rendered quantity values |
Returns
string
A human-readable string representation of the Quantity
Defined in
packages/core/src/format.ts:359
formatMoney
▸ formatMoney(money): string
Parameters
| Name | Type |
|---|---|
money | undefined | Money |
Returns
string
Defined in
packages/core/src/format.ts:389
formatCodeableConcept
▸ formatCodeableConcept(codeableConcept): string
Formats a CodeableConcept element as a string.
Parameters
| Name | Type | Description |
|---|---|---|
codeableConcept | undefined | CodeableConcept | A FHIR CodeableConcept element |
Returns
string
The codeable concept as a string.
Defined in
packages/core/src/format.ts:406
formatCoding
▸ formatCoding(coding): string
Formats a Coding element as a string.
Parameters
| Name | Type | Description |
|---|---|---|
coding | undefined | Coding | A FHIR Coding element |
Returns
string
The coding as a string.
Defined in
packages/core/src/format.ts:424
formatObservationValue
▸ formatObservationValue(obs): string
Formats a FHIR Observation resource value as a string.
Parameters
| Name | Type | Description |
|---|---|---|
obs | undefined | Observation | ObservationComponent | A FHIR Observation resource. |
Returns
string
A human-readable string representation of the Observation.
Defined in
packages/core/src/format.ts:433
parseHl7DateTime
▸ parseHl7DateTime(hl7DateTime, options?): string | undefined
Returns a formatted string representing the date in ISO-8601 format.
HL7-Definition V2 Specifies a point in time using a 24-hour clock notation.
Format: YYYY[MM[DD[HH[MM[SS[. S[S[S[S]]]]]]]]][+/-ZZZZ].
Parameters
| Name | Type | Description |
|---|---|---|
hl7DateTime | undefined | string | Date/time string. |
options? | Hl7DateParseOptions | Optional parsing options. |
Returns
string | undefined
The date in ISO-8601 format.
Defined in
packages/core/src/hl7.ts:410
formatHl7DateTime
▸ formatHl7DateTime(isoDate): string
Formats an ISO date/time string into an HL7 date/time string.
Parameters
| Name | Type | Description |
|---|---|---|
isoDate | string | Date | The ISO date/time string. |
Returns
string
The HL7 date/time string.
Defined in
packages/core/src/hl7.ts:486
isJwt
▸ isJwt(token): boolean
Returns true if the token is a JWT.
Parameters
| Name | Type | Description |
|---|---|---|
token | string | The potential JWT token. |
Returns
boolean
True if the token is a JWT.
Defined in
packages/core/src/jwt.ts:25
parseJWTPayload
▸ parseJWTPayload(token): Record<string, number | string>
Parses the JWT payload.
Parameters
| Name | Type | Description |
|---|---|---|
token | string | JWT token. |
Returns
Record<string, number | string>
Collection of key value claims in the JWT payload.
Defined in
packages/core/src/jwt.ts:34
isMedplumAccessToken
▸ isMedplumAccessToken(accessToken): boolean
Returns true if the access token was issued by a Medplum server.
Parameters
| Name | Type | Description |
|---|---|---|
accessToken | string | An access token of unknown origin. |
Returns
boolean
True if the access token was issued by a Medplum server.
Defined in
packages/core/src/jwt.ts:44
accepted
▸ accepted(location): OperationOutcome
Parameters
| Name | Type |
|---|---|
location | string |
Returns
OperationOutcome
Defined in
packages/core/src/outcomes.ts:126
badRequest
▸ badRequest(details, expression?): OperationOutcome
Parameters
| Name | Type |
|---|---|
details | string |
expression? | string |
Returns
OperationOutcome
Defined in
packages/core/src/outcomes.ts:143
validationError
▸ validationError(details): OperationOutcome
Parameters
| Name | Type |
|---|---|
details | string |
Returns
OperationOutcome
Defined in
packages/core/src/outcomes.ts:159
serverError
▸ serverError(err): OperationOutcome
Parameters
| Name | Type |
|---|---|
err | Error |
Returns
OperationOutcome
Defined in
packages/core/src/outcomes.ts:174
isOperationOutcome
▸ isOperationOutcome(value): value is OperationOutcome
Parameters
| Name | Type |
|---|---|
value | unknown |
Returns
value is OperationOutcome
Defined in
packages/core/src/outcomes.ts:190
isOk
▸ isOk(outcome): boolean
Parameters
| Name | Type |
|---|---|
outcome | OperationOutcome |
Returns
boolean
Defined in
packages/core/src/outcomes.ts:194
isCreated
▸ isCreated(outcome): boolean
Parameters
| Name | Type |
|---|---|
outcome | OperationOutcome |
Returns
boolean
Defined in
packages/core/src/outcomes.ts:200
isAccepted
▸ isAccepted(outcome): boolean
Parameters
| Name | Type |
|---|---|
outcome | OperationOutcome |
Returns
boolean
Defined in
packages/core/src/outcomes.ts:204
isNotFound
▸ isNotFound(outcome): boolean
Parameters
| Name | Type |
|---|---|
outcome | OperationOutcome |
Returns
boolean
Defined in
packages/core/src/outcomes.ts:208
isGone
▸ isGone(outcome): boolean
Parameters
| Name | Type |
|---|---|
outcome | OperationOutcome |
Returns
boolean
Defined in
packages/core/src/outcomes.ts:212
getStatus
▸ getStatus(outcome): number
Parameters
| Name | Type |
|---|---|
outcome | OperationOutcome |
Returns
number
Defined in
packages/core/src/outcomes.ts:216
assertOk
▸ assertOk<T>(outcome, resource): asserts resource is T
Asserts that the operation completed successfully and that the resource is defined.
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
outcome | OperationOutcome | The operation outcome. |
resource | undefined | T | The resource that may or may not have been returned. |
Returns
asserts resource is T
Defined in
packages/core/src/outcomes.ts:245
normalizeOperationOutcome
▸ normalizeOperationOutcome(error): OperationOutcome
Normalizes an error object into an OperationOutcome.
Parameters
| Name | Type | Description |
|---|---|---|
error | unknown | The error value which could be a string, Error, OperationOutcome, or other unknown type. |
Returns
OperationOutcome
The normalized OperationOutcome.
Defined in
packages/core/src/outcomes.ts:266
normalizeErrorString
▸ normalizeErrorString(error): string
Normalizes an error object into a displayable error string.
Parameters
| Name | Type | Description |
|---|---|---|
error | unknown | The error value which could be a string, Error, OperationOutcome, or other unknown type. |
Returns
string
A display string for the error.
Defined in
packages/core/src/outcomes.ts:281
operationOutcomeToString
▸ operationOutcomeToString(outcome): string
Returns a string represenation of the operation outcome.
Parameters
| Name | Type | Description |
|---|---|---|
outcome | OperationOutcome | The operation outcome. |
Returns
string
The string representation of the operation outcome.
Defined in
packages/core/src/outcomes.ts:305
operationOutcomeIssueToString
▸ operationOutcomeIssueToString(issue): string
Returns a string represenation of the operation outcome issue.
Parameters
| Name | Type | Description |
|---|---|---|
issue | OperationOutcomeIssue | The operation outcome issue. |
Returns
string
The string representation of the operation outcome issue.
Defined in
packages/core/src/outcomes.ts:315
createStructureIssue
▸ createStructureIssue(expression, details): OperationOutcomeIssue
Parameters
| Name | Type |
|---|---|
expression | string |
details | string |
Returns
OperationOutcomeIssue
Defined in
packages/core/src/outcomes.ts:351
createConstraintIssue
▸ createConstraintIssue(expression, constraint): OperationOutcomeIssue
Parameters
| Name | Type |
|---|---|
expression | string |
constraint | Constraint |
Returns
OperationOutcomeIssue
Defined in
packages/core/src/outcomes.ts:355
createProcessingIssue
▸ createProcessingIssue(expression, message, err, data?): OperationOutcomeIssue
Parameters
| Name | Type |
|---|---|
expression | string |
message | string |
err | Error |
data? | Record<string, any> |
Returns
OperationOutcomeIssue
Defined in
packages/core/src/outcomes.ts:361
validateResourceType
▸ validateResourceType(resourceType): void
Validates that the given string is a valid FHIR resource type. On success, silently returns void. On failure, throws an OperationOutcomeError.
validateResourceType('Patient'); // nothing
validateResourceType('XYZ'); // throws OperationOutcomeError
Note that this depends on globalSchema, which is populated by the StructureDefinition loader.
In a server context, you can load all schema definitions:
import { indexStructureDefinitionBundle } from '@medplum/core';
import { readJson } from '@medplum/definitions';
import { Bundle } from '@medplum/fhirtypes';
indexStructureDefinitionBundle(readJson('fhir/r4/profiles-resources.json') as Bundle);
In a client context, you can load the schema definitions using MedplumClient:
import { MedplumClient } from '@medplum/core';
const medplum = new MedplumClient();
await medplum.requestSchema('Patient');
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | string | The candidate resource type string. |
Returns
void
Defined in
packages/core/src/schema.ts:37
checkForNull
▸ checkForNull(value, path, issues): void
Recursively checks for null values in an object.
Note that "null" is a special value in JSON that is not allowed in FHIR.
Parameters
| Name | Type | Description |
|---|---|---|
value | unknown | Input value of any type. |
path | string | Path string to the value for OperationOutcome. |
issues | OperationOutcomeIssue[] | Output list of issues. |
Returns
void
Defined in
packages/core/src/schema.ts:54
getSearchParameterDetails
▸ getSearchParameterDetails(resourceType, searchParam): SearchParameterDetails
Returns the type details of a SearchParameter.
The SearchParameter resource has a "type" parameter, but that is missing some critical information.
For example: 1) The "date" type includes "date", "datetime", and "period". 2) The "token" type includes enums and booleans. 3) Arrays/multiple values are not reflected at all.
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | string | The root resource type. |
searchParam | SearchParameter | The search parameter. |
Returns
The search parameter type details.
Defined in
packages/core/src/search/details.ts:56
getExpressionsForResourceType
▸ getExpressionsForResourceType(resourceType, expression): Atom[]
Parameters
| Name | Type |
|---|---|
resourceType | string |
expression | string |
Returns
Atom[]
Defined in
packages/core/src/search/details.ts:224
getExpressionForResourceType
▸ getExpressionForResourceType(resourceType, expression): string | undefined
Parameters
| Name | Type |
|---|---|
resourceType | string |
expression | string |
Returns
string | undefined
Defined in
packages/core/src/search/details.ts:231
matchesSearchRequest
▸ matchesSearchRequest(resource, searchRequest): boolean
Determines if the resource matches the search request.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Resource | The resource that was created or updated. |
searchRequest | SearchRequest<Resource> | The subscription criteria as a search request. |
Returns
boolean
True if the resource satisfies the search request.
Defined in
packages/core/src/search/match.ts:13
parseSearchRequest
▸ parseSearchRequest<T>(resourceType, query): SearchRequest<T>
Parses a search URL into a search request.
Type parameters
| Name | Type |
|---|---|
T | extends Resource = Resource |
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | T["resourceType"] | The FHIR resource type. |
query | Record<string, undefined | string | string[]> | The collection of query string parameters. |
Returns
A parsed SearchRequest.
Defined in
packages/core/src/search/search.ts:127
parseSearchUrl
▸ parseSearchUrl<T>(url): SearchRequest<T>
Parses a search URL into a search request.
Type parameters
| Name | Type |
|---|---|
T | extends Resource = Resource |
Parameters
| Name | Type | Description |
|---|---|---|
url | URL | The search URL. |
Returns
A parsed SearchRequest.
Defined in
packages/core/src/search/search.ts:149
parseSearchDefinition
▸ parseSearchDefinition<T>(url): SearchRequest<T>
Parses a URL string into a SearchRequest.
Type parameters
| Name | Type |
|---|---|
T | extends Resource = Resource |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to parse. |
Returns
Parsed search definition.
Defined in
packages/core/src/search/search.ts:164
parseCriteriaAsSearchRequest
▸ parseCriteriaAsSearchRequest(criteria): SearchRequest
Parses a FHIR criteria string into a SearchRequest. FHIR criteria strings are found on resources such as Subscription.
Parameters
| Name | Type | Description |
|---|---|---|
criteria | string | The FHIR criteria string. |
Returns
Parsed search definition.
Defined in
packages/core/src/search/search.ts:174
parseParameter
▸ parseParameter(searchParam, modifier, value): Filter
Parameters
| Name | Type |
|---|---|
searchParam | SearchParameter |
modifier | string |
value | string |
Returns
Defined in
packages/core/src/search/search.ts:296
parseXFhirQuery
▸ parseXFhirQuery(query, variables): SearchRequest
Parses an extended FHIR search criteria string (i.e. application/x-fhir-query), evaluating
any embedded FHIRPath subexpressions (e.g. {{ %patient.id }}) with the provided variables.
Parameters
| Name | Type | Description |
|---|---|---|
query | string | The X-Fhir-Query string to parse |
variables | Record<string, TypedValue> | Values to pass into embedded FHIRPath expressions |
Returns
The parsed search request
See
https://hl7.org/fhir/fhir-xquery.html
Defined in
packages/core/src/search/search.ts:412
formatSearchQuery
▸ formatSearchQuery(definition): string
Formats a search definition object into a query string. Note: The return value does not include the resource type.
Parameters
| Name | Type | Description |
|---|---|---|
definition | SearchRequest<Resource> | The search definition. |
Returns
string
Formatted URL.
Defined in
packages/core/src/search/search.ts:429
streamToBuffer
▸ streamToBuffer(stream): Promise<Buffer>
Reads data from a Readable stream and returns a Promise that resolves with a Buffer containing all the data.
Parameters
| Name | Type | Description |
|---|---|---|
stream | Readable | The Readable stream to read from. |
Returns
Promise<Buffer>
A Promise that resolves with a Buffer containing all the data from the Readable stream.
Defined in
packages/core/src/sftp.ts:8
indexSearchParameterBundle
▸ indexSearchParameterBundle(bundle): void
Indexes a bundle of SearchParameter resources for faster lookup.
Parameters
| Name | Type | Description |
|---|---|---|
bundle | Bundle<SearchParameter> | A FHIR bundle SearchParameter resources. |
Returns
void
See
IndexedStructureDefinition for more details on indexed StructureDefinitions.
Defined in
packages/core/src/types.ts:146
indexSearchParameter
▸ indexSearchParameter(searchParam): void
Indexes a SearchParameter resource for fast lookup. Indexes by SearchParameter.code, which is the query string parameter name.
Parameters
| Name | Type | Description |
|---|---|---|
searchParam | SearchParameter | The SearchParameter resource. |
Returns
void
See
IndexedStructureDefinition for more details on indexed StructureDefinitions.
Defined in
packages/core/src/types.ts:161
getElementDefinitionTypeName
▸ getElementDefinitionTypeName(elementDefinition): string
Returns the type name for an ElementDefinition.
Parameters
| Name | Type | Description |
|---|---|---|
elementDefinition | ElementDefinition | The element definition. |
Returns
string
The Medplum type name.
Defined in
packages/core/src/types.ts:227
buildTypeName
▸ buildTypeName(components): string
Parameters
| Name | Type |
|---|---|
components | string[] |
Returns
string
Defined in
packages/core/src/types.ts:234
isResourceTypeSchema
▸ isResourceTypeSchema(typeSchema): boolean
Returns true if the type schema is a non-abstract FHIR resource.
Parameters
| Name | Type | Description |
|---|---|---|
typeSchema | InternalTypeSchema | The type schema to check. |
Returns
boolean
True if the type schema is a non-abstract FHIR resource.
Defined in
packages/core/src/types.ts:246
getResourceTypes
▸ getResourceTypes(): ResourceType[]
Returns an array of all resource types. Note that this is based on globalSchema, and will only return resource types that are currently in memory.
Returns
ResourceType[]
An array of all resource types.
Defined in
packages/core/src/types.ts:255
getSearchParameters
▸ getSearchParameters(resourceType): Record<string, SearchParameter> | undefined
Returns the search parameters for the resource type indexed by search code.
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | string | The resource type. |
Returns
Record<string, SearchParameter> | undefined
The search parameters for the resource type indexed by search code.
Defined in
packages/core/src/types.ts:266
getSearchParameter
▸ getSearchParameter(resourceType, code): SearchParameter | undefined
Returns a search parameter for a resource type by search code.
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | string | The FHIR resource type. |
code | string | The search parameter code. |
Returns
SearchParameter | undefined
The search parameter if found, otherwise undefined.
Defined in
packages/core/src/types.ts:276
getPropertyDisplayName
▸ getPropertyDisplayName(path): string
Returns a human friendly display name for a FHIR element definition path.
Parameters
| Name | Type | Description |
|---|---|---|
path | string | The FHIR element definition path. |
Returns
string
The best guess of the display name.
Defined in
packages/core/src/types.ts:285
getElementDefinition
▸ getElementDefinition(typeName, propertyName): InternalSchemaElement | undefined
Returns an element definition by type and property name. Handles content references.
Parameters
| Name | Type | Description |
|---|---|---|
typeName | string | The type name. |
propertyName | string | The property name. |
Returns
InternalSchemaElement | undefined
The element definition if found.
Defined in
packages/core/src/types.ts:322
isResource
▸ isResource(value): value is Resource
Typeguard to validate that an object is a FHIR resource
Parameters
| Name | Type | Description |
|---|---|---|
value | unknown | The object to check |
Returns
value is Resource
True if the input is of type 'object' and contains property 'resourceType'
Defined in
packages/core/src/types.ts:335
isReference
▸ isReference(value): value is Reference<Resource> & Object
Typeguard to validate that an object is a FHIR resource
Parameters
| Name | Type | Description |
|---|---|---|
value | unknown | The object to check |
Returns
value is Reference<Resource> & Object
True if the input is of type 'object' and contains property 'reference'
Defined in
packages/core/src/types.ts:344
stringifyTypedValue
▸ stringifyTypedValue(v): string
Output the string representation of a value, suitable for use as part of a search query.
Parameters
| Name | Type | Description |
|---|---|---|
v | TypedValue | The value to format as a string |
Returns
string
The stringified value
Defined in
packages/core/src/types.ts:358
crawlResource
▸ crawlResource(resource, visitor, schema?, initialPath?): void
Parameters
| Name | Type |
|---|---|
resource | Resource |
visitor | ResourceVisitor |
schema? | InternalTypeSchema |
initialPath? | string |
Returns
void
Defined in
packages/core/src/typeschema/crawler.ts:21
getNestedProperty
▸ getNestedProperty(value, key): (TypedValue | TypedValue[] | undefined)[]
Parameters
| Name | Type |
|---|---|
value | TypedValue |
key | string |
Returns
(TypedValue | TypedValue[] | undefined)[]
Defined in
packages/core/src/typeschema/crawler.ts:105
parseStructureDefinition
▸ parseStructureDefinition(sd): InternalTypeSchema
Parses a StructureDefinition resource into an internal schema better suited for programmatic validation and usage in internal systems
Parameters
| Name | Type | Description |
|---|---|---|
sd | StructureDefinition | The StructureDefinition resource to parse |
Returns
The parsed schema for the given resource type
Defined in
packages/core/src/typeschema/types.ts:86
indexStructureDefinitionBundle
▸ indexStructureDefinitionBundle(bundle): void
Parameters
| Name | Type |
|---|---|
bundle | Bundle<Resource> | StructureDefinition[] |
Returns
void
Defined in
packages/core/src/typeschema/types.ts:92
loadDataType
▸ loadDataType(sd): void
Parameters
| Name | Type |
|---|---|
sd | StructureDefinition |
Returns
void
Defined in
packages/core/src/typeschema/types.ts:99
getAllDataTypes
▸ getAllDataTypes(): Record<string, InternalTypeSchema>
Returns
Record<string, InternalTypeSchema>
Defined in
packages/core/src/typeschema/types.ts:114
isDataTypeLoaded
▸ isDataTypeLoaded(type): boolean
Parameters
| Name | Type |
|---|---|
type | string |
Returns
boolean
Defined in
packages/core/src/typeschema/types.ts:118
tryGetDataType
▸ tryGetDataType(type): InternalTypeSchema | undefined
Parameters
| Name | Type |
|---|---|
type | string |
Returns
InternalTypeSchema | undefined
Defined in
packages/core/src/typeschema/types.ts:122
getDataType
▸ getDataType(type): InternalTypeSchema
Parameters
| Name | Type |
|---|---|
type | string |
Returns
Defined in
packages/core/src/typeschema/types.ts:126
isResourceType
▸ isResourceType(resourceType): boolean
Returns true if the given string is a valid FHIR resource type.
isResourceType('Patient'); // true
isResourceType('XYZ'); // false
Parameters
| Name | Type | Description |
|---|---|---|
resourceType | string | The candidate resource type string. |
Returns
boolean
True if the resource type is a valid FHIR resource type.
Defined in
packages/core/src/typeschema/types.ts:145
subsetResource
▸ subsetResource<T>(resource, properties): T | undefined
Construct the subset of a resource containing a minimum set of fields. The returned resource is not guaranteed
to contain only the provided properties, and may contain others (e.g. resourceType and id)
Type parameters
| Name | Type |
|---|---|
T | extends Resource |
Parameters
| Name | Type | Description |
|---|---|---|
resource | undefined | T | The resource to subset |
properties | string[] | The minimum properties to include in the subset |
Returns
T | undefined
The modified resource, containing the listed properties and possibly other mandatory ones
Defined in
packages/core/src/typeschema/types.ts:422
validateResource
▸ validateResource(resource, profile?): void
Parameters
| Name | Type |
|---|---|
resource | Resource |
profile? | StructureDefinition |
Returns
void
Defined in
packages/core/src/typeschema/validation.ts:87
createReference
▸ createReference<T>(resource): Reference<T>
Creates a reference resource.
Type parameters
| Name | Type |
|---|---|
T | extends Resource |
Parameters
| Name | Type | Description |
|---|---|---|
resource | T | The FHIR reesource. |
Returns
Reference<T>
A reference resource.
Defined in
packages/core/src/utils.ts:41
getReferenceString
▸ getReferenceString(input): string
Returns a reference string for a resource.
Parameters
| Name | Type | Description |
|---|---|---|
input | Resource | Reference<Resource> | The FHIR resource or reference. |
Returns
string
A reference string of the form resourceType/id.
Defined in
packages/core/src/utils.ts:52
resolveId
▸ resolveId(input): string | undefined
Returns the ID portion of a reference.
Parameters
| Name | Type | Description |
|---|---|---|
input | undefined | Resource | Reference<Resource> | A FHIR reference or resource. |
Returns
string | undefined
The ID portion of a reference.
Defined in
packages/core/src/utils.ts:64
parseReference
▸ parseReference(reference): [ResourceType, string] | undefined
Parses a reference and returns a tuple of [ResourceType, ID].
Parameters
| Name | Type | Description |
|---|---|---|
reference | Reference<Resource> | A reference to a FHIR resource. |
Returns
[ResourceType, string] | undefined
A tuple containing the ResourceType and the ID of the resource or undefined when undefined or an invalid reference is passed.
Defined in
packages/core/src/utils.ts:79
▸ parseReference(reference): undefined
Parameters
| Name | Type |
|---|---|
reference | undefined |
Returns
undefined
Defined in
packages/core/src/utils.ts:80
isProfileResource
▸ isProfileResource(resource): resource is ProfileResource
Returns true if the resource is a "ProfileResource".
Parameters
| Name | Type | Description |
|---|---|---|
resource | Resource | The FHIR resource. |
Returns
resource is ProfileResource
True if the resource is a "ProfileResource".
Defined in
packages/core/src/utils.ts:97
getDisplayString
▸ getDisplayString(resource): string
Returns a display string for the resource.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Resource | The input resource. |
Returns
string
Human friendly display string.
Defined in
packages/core/src/utils.ts:110
getImageSrc
▸ getImageSrc(resource): string | undefined
Returns an image URL for the resource, if one is available.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Resource | The input resource. |
Returns
string | undefined
The image URL for the resource or undefined.
Defined in
packages/core/src/utils.ts:170
getDateProperty
▸ getDateProperty(date): Date | undefined
Returns a Date property as a Date. When working with JSON objects, Dates are often serialized as ISO-8601 strings. When that happens, we need to safely convert to a proper Date object.
Parameters
| Name | Type | Description |
|---|---|---|
date | undefined | string | The date property value, which could be a string or a Date object. |
Returns
Date | undefined
A Date object.
Defined in
packages/core/src/utils.ts:208
calculateAge
▸ calculateAge(birthDateStr, endDateStr?): Object
Calculates the age in years from the birth date.
Parameters
| Name | Type | Description |
|---|---|---|
birthDateStr | string | The birth date or start date in ISO-8601 format YYYY-MM-DD. |
endDateStr? | string | Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today. |
Returns
Object
The age in years, months, and days.
| Name | Type |
|---|---|
years | number |
months | number |
days | number |
Defined in
packages/core/src/utils.ts:218
calculateAgeString
▸ calculateAgeString(birthDateStr, endDateStr?): string | undefined
Calculates the age string for display using the age appropriate units. If the age is greater than or equal to 2 years, then the age is displayed in years. If the age is greater than or equal to 1 month, then the age is displayed in months. Otherwise, the age is displayed in days.
Parameters
| Name | Type | Description |
|---|---|---|
birthDateStr | string | The birth date or start date in ISO-8601 format YYYY-MM-DD. |
endDateStr? | string | Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today. |
Returns
string | undefined
The age string.
Defined in
packages/core/src/utils.ts:260
getQuestionnaireAnswers
▸ getQuestionnaireAnswers(response): Record<string, QuestionnaireResponseItemAnswer>
Returns all questionnaire answers as a map by link ID.
Parameters
| Name | Type | Description |
|---|---|---|
response | QuestionnaireResponse | The questionnaire response resource. |
Returns
Record<string, QuestionnaireResponseItemAnswer>
Questionnaire answers mapped by link ID.
Defined in
packages/core/src/utils.ts:276
getAllQuestionnaireAnswers
▸ getAllQuestionnaireAnswers(response): Record<string, QuestionnaireResponseItemAnswer[]>
Returns an array of questionnaire answers as a map by link ID.
Parameters
| Name | Type | Description |
|---|---|---|
response | QuestionnaireResponse | The questionnaire response resource. |
Returns
Record<string, QuestionnaireResponseItemAnswer[]>
Questionnaire answer arrays mapped by link ID.
Defined in
packages/core/src/utils.ts:303
getIdentifier
▸ getIdentifier(resource, system): string | undefined
Returns the resource identifier for the given system.
If multiple identifiers exist with the same system, the first one is returned.
If the system is not found, then returns undefined.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Resource | The resource to check. |
system | string | The identifier system. |
Returns
string | undefined
The identifier value if found; otherwise undefined.
Defined in
packages/core/src/utils.ts:340
setIdentifier
▸ setIdentifier(resource, system, value): void
Sets a resource identifier for the given system.
Note that this method is only available on resources that have an "identifier" property, and that property must be an array of Identifier objects, which is not true for all FHIR resources.
If the identifier already exists, then the value is updated.
Otherwise a new identifier is added.
Parameters
| Name | Type | Description |
|---|---|---|
resource | Object | The resource to add the identifier to. |
system | string | The identifier system. |
value | string | The identifier value. |
Returns
void
Defined in
packages/core/src/utils.ts:369
getExtensionValue
▸ getExtensionValue(resource, ...urls): string | undefined
Returns an extension value by extension URLs.
Parameters
| Name | Type | Description |
|---|---|---|
resource | any | The base resource. |
...urls | string[] | Array of extension URLs. Each entry represents a nested extension. |
Returns
string | undefined
The extension value if found; undefined otherwise.
Defined in
packages/core/src/utils.ts:390
getExtension
▸ getExtension(resource, ...urls): Extension | undefined
Returns an extension by extension URLs.
Parameters
| Name | Type | Description |
|---|---|---|
resource | any | The base resource. |
...urls | string[] | Array of extension URLs. Each entry represents a nested extension. |
Returns
Extension | undefined
The extension object if found; undefined otherwise.
Defined in
packages/core/src/utils.ts:408
stringify
▸ stringify(value, pretty?): string
FHIR JSON stringify. Removes properties with empty string values. Removes objects with zero properties. See: https://www.hl7.org/fhir/json.html
Parameters
| Name | Type | Description |
|---|---|---|
value | any | The input value. |
pretty? | boolean | Optional flag to pretty-print the JSON. |
Returns
string
The resulting JSON string.
Defined in
packages/core/src/utils.ts:429
isEmpty
▸ isEmpty(v): boolean
Returns true if the value is empty (null, undefined, empty string, or empty object).
Parameters
| Name | Type | Description |
|---|---|---|
v | any | Any value. |
Returns
boolean
True if the value is an empty string or an empty object.
Defined in
packages/core/src/utils.ts:459
deepEquals
▸ deepEquals(object1, object2, path?): boolean
Resource equality. Ignores meta.versionId and meta.lastUpdated.
Parameters
| Name | Type | Description |
|---|---|---|
object1 | unknown | The first object. |
object2 | unknown | The second object. |
path? | string | Optional path string. |
Returns
boolean
True if the objects are equal.
Defined in
packages/core/src/utils.ts:475
deepIncludes
▸ deepIncludes(value, pattern): boolean
Checks if object2 includes all fields and values of object1. It doesn't matter if object2 has extra fields.
Parameters
| Name | Type | Description |
|---|---|---|
value | any | The object to test if contained in pattern. |
pattern | any | The object to test against. |
Returns
boolean
True if pattern includes all fields and values of value.
Defined in
packages/core/src/utils.ts:542
deepClone
▸ deepClone<T>(input): T
Creates a deep clone of the input value.
Limitations:
- Only supports JSON primitives and arrays.
- Does not support Functions, lambdas, etc.
- Does not support circular references.
See: https://web.dev/structured-clone/ See: https://stackoverflow.com/questions/40488190/how-is-structured-clone-algorithm-different-from-deep-copy
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
input | T | The input to clone. |
Returns
T
A deep clone of the input.
Defined in
packages/core/src/utils.ts:584
isUUID
▸ isUUID(input): input is `${string}-${string}-${string}-${string}-${string}`
Returns true if the input string is a UUID.
Parameters
| Name | Type | Description |
|---|---|---|
input | string | The input string. |
Returns
input is `${string}-${string}-${string}-${string}-${string}`
True if the input string matches the UUID format.
Defined in
packages/core/src/utils.ts:593
isObject
▸ isObject(obj): obj is Record<string, unknown>
Returns true if the input is an object.
Parameters
| Name | Type | Description |
|---|---|---|
obj | unknown | The candidate object. |
Returns
obj is Record<string, unknown>
True if the input is a non-null non-undefined object.
Defined in
packages/core/src/utils.ts:602
isStringArray
▸ isStringArray(arr): arr is string[]
Returns true if the input array is an array of strings.
Parameters
| Name | Type | Description |
|---|---|---|
arr | any[] | Input array. |
Returns
arr is string[]
True if the input array is an array of strings.
Defined in
packages/core/src/utils.ts:611
arrayBufferToHex
▸ arrayBufferToHex(arrayBuffer): string
Converts an ArrayBuffer to hex string. See: https://stackoverflow.com/a/55200387
Parameters
| Name | Type | Description |
|---|---|---|
arrayBuffer | ArrayBuffer | The input array buffer. |
Returns
string
The resulting hex string.
Defined in
packages/core/src/utils.ts:628
arrayBufferToBase64
▸ arrayBufferToBase64(arrayBuffer): string
Converts an ArrayBuffer to a base-64 encoded string.
Parameters
| Name | Type | Description |
|---|---|---|
arrayBuffer | ArrayBuffer | The input array buffer. |
Returns
string
The base-64 encoded string.
Defined in
packages/core/src/utils.ts:642
capitalize
▸ capitalize(word): string
Parameters
| Name | Type |
|---|---|
word | string |
Returns
string
Defined in
packages/core/src/utils.ts:651
isLowerCase
▸ isLowerCase(c): boolean
Parameters
| Name | Type |
|---|---|
c | string |
Returns
boolean
Defined in
packages/core/src/utils.ts:655
getCodeBySystem
▸ getCodeBySystem(concept, system): string | undefined
Tries to find a code string for a given system within a given codeable concept.
Parameters
| Name | Type | Description |
|---|---|---|
concept | CodeableConcept | The codeable concept. |
system | string | The system string. |
Returns
string | undefined
The code if found; otherwise undefined.
Defined in
packages/core/src/utils.ts:665
setCodeBySystem
▸ setCodeBySystem(concept, system, code): void
Sets a code for a given system within a given codeable concept.
Parameters
| Name | Type | Description |
|---|---|---|
concept | CodeableConcept | The codeable concept. |
system | string | The system string. |
code | string | The code value. |
Returns
void
Defined in
packages/core/src/utils.ts:675
findObservationInterval
▸ findObservationInterval(definition, patient, value, category?): ObservationDefinitionQualifiedInterval | undefined
Tries to find an observation interval for the given patient and value.
Parameters
| Name | Type | Description |
|---|---|---|
definition | ObservationDefinition | The observation definition. |
patient | Patient | The patient. |
value | number | The observation value. |
category? | "reference" | "critical" | "absolute" | Optional interval category restriction. |
Returns
ObservationDefinitionQualifiedInterval | undefined
The observation interval if found; otherwise undefined.
Defined in
packages/core/src/utils.ts:695
findObservationReferenceRange
▸ findObservationReferenceRange(definition, patient, names): ObservationDefinitionQualifiedInterval | undefined
Tries to find an observation reference range for the given patient and condition names.
Parameters
| Name | Type | Description |
|---|---|---|
definition | ObservationDefinition | The observation definition. |
patient | Patient | The patient. |
names | string[] | The condition names. |
Returns
ObservationDefinitionQualifiedInterval | undefined
The observation interval if found; otherwise undefined.
Defined in
packages/core/src/utils.ts:716
matchesRange
▸ matchesRange(value, range, precision?): boolean
Returns true if the value is in the range accounting for precision.
Parameters
| Name | Type | Description |
|---|---|---|
value | number | The numeric value. |
range | Range | The numeric range. |
precision? | number | Optional precision in number of digits. |
Returns
boolean
True if the value is within the range.
Defined in
packages/core/src/utils.ts:781
preciseRound
▸ preciseRound(a, precision): number
Returns the input number rounded to the specified number of digits.
Parameters
| Name | Type | Description |
|---|---|---|
a | number | The input number. |
precision | number | The precision in number of digits. |
Returns
number
The number rounded to the specified number of digits.
Defined in
packages/core/src/utils.ts:794
preciseEquals
▸ preciseEquals(a, b, precision?): boolean
Returns true if the two numbers are equal to the given precision.
Parameters
| Name | Type | Description |
|---|---|---|
a | number | The first number. |
b | number | The second number. |
precision? | number | Optional precision in number of digits. |
Returns
boolean
True if the two numbers are equal to the given precision.
Defined in
packages/core/src/utils.ts:805
preciseLessThan
▸ preciseLessThan(a, b, precision?): boolean
Returns true if the first number is less than the second number to the given precision.
Parameters
| Name | Type | Description |
|---|---|---|
a | number | The first number. |
b | number | The second number. |
precision? | number | Optional precision in number of digits. |
Returns
boolean
True if the first number is less than the second number to the given precision.
Defined in
packages/core/src/utils.ts:816
preciseGreaterThan
▸ preciseGreaterThan(a, b, precision?): boolean
Returns true if the first number is greater than the second number to the given precision.
Parameters
| Name | Type | Description |
|---|---|---|
a | number | The first number. |
b | number | The second number. |
precision? | number | Optional precision in number of digits. |
Returns
boolean
True if the first number is greater than the second number to the given precision.
Defined in
packages/core/src/utils.ts:827
preciseLessThanOrEquals
▸ preciseLessThanOrEquals(a, b, precision?): boolean
Returns true if the first number is less than or equal to the second number to the given precision.
Parameters
| Name | Type | Description |
|---|---|---|
a | number | The first number. |
b | number | The second number. |
precision? | number | Optional precision in number of digits. |
Returns
boolean
True if the first number is less than or equal to the second number to the given precision.
Defined in
packages/core/src/utils.ts:838
preciseGreaterThanOrEquals
▸ preciseGreaterThanOrEquals(a, b, precision?): boolean
Returns true if the first number is greater than or equal to the second number to the given precision.
Parameters
| Name | Type | Description |
|---|---|---|
a | number | The first number. |
b | number | The second number. |
precision? | number | Optional precision in number of digits. |
Returns
boolean
True if the first number is greater than or equal to the second number to the given precision.
Defined in
packages/core/src/utils.ts:849
findResourceByCode
▸ findResourceByCode(resources, code, system): ResourceWithCode | undefined
Finds the first resource in the input array that matches the specified code and system.
Parameters
| Name | Type | Description |
|---|---|---|
resources | ResourceWithCode[] | The array of resources to search. |
code | string | CodeableConcept | The code to search for. |
system | string | The system to search for. |
Returns
ResourceWithCode | undefined
The first resource in the input array that matches the specified code and system, or undefined if no such resource is found.
Defined in
packages/core/src/utils.ts:874
arrayify
▸ arrayify<T>(value): T[] | undefined
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
value | undefined | T | T[] |
Returns
T[] | undefined
Defined in
packages/core/src/utils.ts:886
sleep
▸ sleep(ms): Promise<void>
Sleeps for the specified number of milliseconds.
Parameters
| Name | Type | Description |
|---|---|---|
ms | number | Time delay in milliseconds |
Returns
Promise<void>
A promise that resolves after the specified number of milliseconds.
Defined in
packages/core/src/utils.ts:901
splitN
▸ splitN(str, delim, n): string[]
Parameters
| Name | Type |
|---|---|
str | string |
delim | string |
n | number |
Returns
string[]
Defined in
packages/core/src/utils.ts:906