core | Medplum
We value your privacy
We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.
CustomiseReject AllAccept All
Powered by Visit CookieYes website
Customise Consent Preferences
We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.
The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more
NecessaryAlways Active
Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.
No cookies to display.
Functional
Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.
- Cookie
_octo
- Duration
1 year
- Description
No description available.
- Cookie
logged_in
- Duration
1 year
- Description
No description available.
- Cookie
VISITOR_PRIVACY_METADATA
- Duration
6 months
- Description
YouTube sets this cookie to store the user's cookie consent state for the current domain.
- Cookie
__Secure-YNID
- Duration
6 months
- Description
YouTube cookie used to protect user security and prevent fraud, especially during the login process.
- Cookie
__Secure-ROLLOUT_TOKEN
- Duration
6 months
- Description
YouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.
- Cookie
__Secure-YEC
- Duration
past
- Description
Description is currently not available.
- Cookie
_gh_sess
- Duration
session
- Description
GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.
- Cookie
YSC
- Duration
session
- Description
YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.
- Cookie
VISITOR_INFO1_LIVE
- Duration
6 months
- Description
A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.
- Cookie
ytidb::LAST_RESULT_ENTRY_KEY
- Duration
Never Expires
- Description
The cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.
- Cookie
_ga
- Duration
1 year 1 month 4 days
- Description
Google Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.
- Cookie
_ga_*
- Duration
1 year 1 month 4 days
- Description
Google Analytics sets this cookie to store and count page views.
Performance
Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.
No cookies to display.
Advertisement
Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.
No cookies to display.
Uncategorised
Other uncategorised cookies are those that are being analysed and have not been classified into a category as yet.
No cookies to display.
Reject AllSave My PreferencesAccept All
Powered by Visit CookieYes website
On this page
core package [](/content/docs/sdk/core#core-package "Direct link to core package"/index.html)
Classes [](/content/docs/sdk/core#classes "Direct link to Classes"/index.html)
| Class | Description |
|---|---|
| AndAtom | 6.5.1. and Returns true if both operands evaluate to true, false if either operand evaluates to false, and the empty collection otherwise. |
| ArithmeticOperatorAtom | |
| AsAtom | |
| ClientStorage | The ClientStorage class is a utility class for storing strings and objects. When using MedplumClient in the browser, it will be backed by browser localStorage. When Using MedplumClient in the server, it will be backed by the MemoryStorage class. For example, the Medplum CLI uses FileSystemStorage. |
| ConcatAtom | |
| ContainsAtom | |
| DataSampler | |
| DotAtom | |
| EmptySetAtom | |
| EqualsAtom | |
| EquivalentAtom | |
| EventTarget_2 | |
| FhircastConnection | A class representing a FHIRcast connection.FhircastConnection extends EventTarget and emits 3 lifecycle events: 1. connect - An event to signal when a WebSocket connection has been opened. Fired as soon as a WebSocket emits open. 2. message - Contains a payload field containing a FHIRcast message payload exactly as it comes in over WebSockets. 3. disconnect - An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emits close.To close the connection, call connection.disconnect() and listen to the disconnect event to know when the connection has been disconnected. |
| FhirFilterComparison | The FhirFilterComparison class represents a comparison expression. |
| FhirFilterConnective | The FhirFilterConnective class represents a connective expression. It contains a list of child expressions. |
| FhirFilterNegation | The FhirFilterNegation class represents a negation expression. It contains a single child expression. |
| FhirPathAtom | |
| FileBuilder | |
| FunctionAtom | |
| Hl7Context | The Hl7Context class represents the parsing context for an HL7 message. |
| Hl7Field | The Hl7Field class represents one HL7 field. A field is a collection of components. |
| Hl7Message | The Hl7Message class represents one HL7 message. A message is a collection of segments. |
| Hl7Segment | The Hl7Segment class represents one HL7 segment. A segment is a collection of fields. The name field is the first field. |
| ImpliesAtom | 6.5.5. implies Returns true if left is true and right is true, true left is false and right true, false or empty true left is empty |
| InAtom | |
| IndexerAtom | |
| InvalidOperationError | |
| IsAtom | |
| LiteralAtom | |
| Logger | |
| LRUCache | LRU cache (least recently used) Source: https://stackoverflow.com/a/46432113 |
| MedplumClient | The MedplumClient class provides a client for the Medplum FHIR server. The client can be used in the browser, in a Node.js application, or in a Medplum Bot. The client provides helpful methods for common operations such as: 1. Authenticating 2. Creating resources 3. Reading resources 4. Updating resources 5. Deleting resources 6. Searching 7. Making GraphQL queries The client can also be used to integrate with other FHIR servers. For an example, see the Epic Connection Demo Bot. |
| MedplumKeyValueClient | |
| MemoryStorage | The MemoryStorage class is a minimal in-memory implementation of the Storage interface. |
| MissingError | |
| MockAsyncClientStorage | The MockAsyncClientStorage class is a mock implementation of the ClientStorage class. This can be used for testing async initialization of the MedplumClient. |
| NotEqualsAtom | |
| NotEquivalentAtom | |
| OperationOutcomeError | |
| OrAtom | 6.5.2. or Returns false if both operands evaluate to false, true if either operand evaluates to true, and empty ({ }) otherwise: |
| Parser | |
| ParserBuilder | |
| Pointer | JSON Pointer representation |
| ReadablePromise | The ReadablePromise class wraps a request promise suitable for React Suspense. See: https://blog.logrocket.com/react-suspense-data-fetching/\#wrappromise-js See: https://github.com/ovieokeh/suspense-data-fetching/blob/master/lib/api/wrapPromise.js |
| ReconnectingWebSocket | |
| SubscriptionEmitter | An EventTarget that emits events when new subscription notifications come in over WebSockets.----- ### Events emitted: - connect - A new subscription is connected to the SubscriptionManager and message events for this subscription can be expected. - disconnect - The specified subscription is no longer being monitored by the SubscriptionManager. - error - An error has occurred. - message - A message containing a notification Bundle has been received. - open - The WebSocket has been opened. - close - The WebSocket has been closed. - heartbeat - A heartbeat message has been received. |
| SubscriptionManager | |
| SymbolAtom | |
| TestError | |
| Tokenizer | |
| TransformMapCollection | The TransformMapCollection class is a collection of StructureMap and ConceptMap resources. It is used to store and retrieve imported StructureMaps and ConceptMaps by URL. |
| TypedEventTarget | |
| UnaryOperatorAtom | |
| UnionAtom | |
| XorAtom | 6.5.4. xor Returns true if exactly one of the operands evaluates to true, false if either both operands evaluate to true or both operands evaluate to false, and the empty collection otherwise. |
Abstract Classes [](/content/docs/sdk/core#abstract-classes "Direct link to Abstract Classes"/index.html)
| Abstract Class | Description |
|---|---|
| InfixOperatorAtom | |
| PrefixOperatorAtom |
Functions [](/content/docs/sdk/core#functions "Direct link to Functions"/index.html)
| Function | Description |
|---|---|
| accepted(location) | |
| accessPolicySupportsInteraction(accessPolicy, interaction, resourceType) | Shallow check that an interaction is permitted by the AccessPolicy on a given resource type, at least for some resources. A more in-depth check for the specific resource(s) being accessed is required in addition to this one. |
| add(object, operation, options) | o If the target location specifies an array index, a new value is inserted into the array at the specified index. o If the target location specifies an object member that does not already exist, a new member is added to the object. o If the target location specifies an object member that does exist, that member's value is replaced. |
| addPreferredPharmacyToPatient(patient, orgRef, isPrimary, preferenceTypeSystem) | Adds or updates a preferred pharmacy extension on a Patient. If the pharmacy already exists, updates its type. Otherwise, adds a new extension. If isPrimary is true, other pharmacies are set to 'preferred'. |
| addProfileToResource(resource, profileUrl) | Adds the supplied profileUrl to the resource.meta.profile if it is not already specified |
| append(array, value) | |
| apply(object, operation, options) | Switch on operation.op, applying the corresponding patch function for each case to object. |
| applyDefaultValuesToElement(existingValue, elements, key) | Adds default values to existingValue for the given key and its children. If key is undefined, default values are added to all elements in elements. Default values consist of all fixed and pattern values defined in the relevant elements. |
| applyDefaultValuesToResource(resource, schema) | Adds default values to resource based on the supplied schema. Default values includes all required fixed and pattern values specified on elements in the schema. If an element has a fixed/pattern value but is optional, i.e. element.min === 0, the default value is not added. |
| applyFixedOrPatternValue(inputValue, key, element, elements) | |
| applyPatch(object, patch, options) | Apply a 'application/json-patch+json'-type patch to an object.patch *must* be an array of operations.Operation objects MUST have exactly one "op" member, whose value indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. This method mutates the target object in-place. |
| arrayBufferToBase64(arrayBuffer) | Converts an ArrayBuffer to a base-64 encoded string. |
| arrayBufferToHex(arrayBuffer) | Converts an ArrayBuffer to hex string. See: https://stackoverflow.com/a/55200387 |
| arrayify(value) | |
| arrayify(value) | |
| assert_2(condition, msg) | |
| assertContextVersionOptional(event) | |
| assertNever(value) | Checks that a value has type never. Useful for ensuring exhaustive matches. |
| assertOk(outcome, resource) | Asserts that the operation completed successfully and that the resource is defined. |
| assertReleaseManifest(candidate) | Asserts that a given candidate is a ReleaseManifest. |
| assertValidMedplumSemver(version) | |
| badRequest(details, expression) | |
| booleanToTypedValue(value) | Returns a single element array with a typed boolean value. |
| buildCdsRequest(medplum, user, service, context) | Builds a CDS request. |
| buildElementsContext({ parentContext, path, elements, profileUrl, debugMode, accessPolicyResource, }, input) | |
| buildMedicationRequestResponseLostStatusReason() | Builds the statusReason CodeableConcept used when soft-deleting a draft MedicationRequest whose vendor-side outcome is unknown (see MEDICATION_REQUEST_STATUS_REASON_RESPONSE_NOT_RECEIVED).Paired with status: 'unknown' (a valid FHIR R4 MedicationRequest status), this is the standard shape every order-medication caller should write when orderMedication(...) throws after the draft MR has been created. |
| buildTypeName(components) | |
| businessRule(key, message) | |
| calculateAge(birthDateStr, endDateStr) | Calculates the age in years from the birth date. |
| calculateAgeString(birthDateStr, endDateStr) | 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. |
| canReadResourceType(accessPolicy, resourceType) | Determines if the current user can read the specified resource type. |
| canWriteResource(accessPolicy, resource) | 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. |
| canWriteResourceType(accessPolicy, resourceType) | 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. |
| capitalize(word) | |
| checkForNull(value, path, issues) | Recursively checks for null values in an object. Note that "null" is a special value in JSON that is not allowed in FHIR. |
| checkIfValidMedplumVersion(appName, version) | Tests that a given version string is a valid existing Medplum release version. |
| clearReleaseCache() | Clears the locally-cached ReleaseManifests for all versions. |
| clearScheduleParameter(schedule, service, url) | Immutably clears one scheduling parameter a Schedule sets for a HealthcareService, dropping that calendar back to the service-level parameter of the same name. Pairs with setScheduleParameter and getScheduleParameters. |
| codeableConceptMatchesToken(codeableConcept, token) | Checks if a CodeableConcept matches a token search string https://build.fhir.org/search.html\#token |
| codingMatchesToken(coding, token) | Checks if a Coding matches a token search string https://build.fhir.org/search.html\#token |
| compareVersions(a, b) | Compares two Medplum semver version strings, ignoring any trailing commit-hash suffix. |
| compressElement(element) | |
| concatUrls(baseUrl, path) | Concatenates the given base URL and URL. If the URL is absolute, it is returned as-is. |
| conceptMapTranslate(map, params) | |
| conflict(details, code) | |
| contentTooLarge(text) | |
| convertContainedResourcesToBundle(resource) | 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. |
| convertToSearchableDates(typedValues) | |
| convertToSearchableNumbers(typedValues) | |
| convertToSearchableQuantities(typedValues) | |
| convertToSearchableReferences(typedValues) | |
| convertToSearchableStrings(typedValues) | |
| convertToSearchableTokens(typedValues, context) | |
| convertToSearchableUris(typedValues) | |
| convertToTransactionBundle(bundle) | Takes a bundle and creates a Transaction Type bundle |
| copy(object, operation, _options) | The "copy" operation copies the value at a specified location to the target location. The operation object MUST contain a "from" member, which is a string containing a JSON Pointer value that references the location in the target document to copy the value from. The "from" location MUST exist for the operation to be successful. This operation is functionally identical to an "add" operation at the target location using the value specified in the "from" member. Alternatively, it's like 'move' without the 'remove'. |
| countBy(items, keyFn) | Counts iterable elements by a key function, returning a sparse map of key to count. Matches Lodash countBy semantics (no zero-fill for missing keys). |
| countWhere(items, fn) | |
| crawlTypedValue(typedValue, visitor, options) | Crawls the typed value synchronously. |
| crawlTypedValueAsync(typedValue, visitor, options) | Crawls the typed value asynchronously. |
| createConstraintIssue(expression, constraint) | |
| createFhircastMessagePayload(topic, event, context, versionId) | Creates a serializable JSON payload for the FHIRcast protocol |
| createOperationOutcomeIssue(severity, code, message, path, data) | |
| createPatch(input, output, diff) | Produce a 'application/json-patch+json'-type patch to get from one object to another. This does not alter input or output unless they have a property getter with side-effects (which is not a good idea anyway).diff is called on each pair of comparable non-primitive nodes in the input/output object trees, producing nested patches. Return undefined to fall back to default behaviour.Returns list of operations to perform on input to produce output. |
| createPreferredPharmacyExtension(orgRef, isPrimary, preferenceTypeSystem) | Creates a preferredPharmacy extension object. |
| createProcessingIssue(expression, message, err, data) | |
| createReference(resource) | Creates a reference resource. |
| createStructureIssue(expression, details) | |
| createTests(input, patch) | Produce an 'application/json-patch+json'-type list of tests, to verify that existing values in an object are identical to the those captured at some checkpoint (whenever this function is called). This does not alter input or output unless they have a property getter with side-effects (which is not a good idea anyway).Returns list of test operations. |
| decodeBase64(data) | Decodes a base64 string. Handles both browser and Node environments. Supports Unicode characters. |
| decodeBase64Url(data) | Decodes a string from Base64URL format. |
| deepClone(input) | 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 |
| deepEquals(object1, object2, path) | Resource equality. Ignores meta.versionId and meta.lastUpdated. |
| deepIncludes(value, pattern) | Checks if value includes all fields and values of pattern. It doesn't matter if value has extra fields, values, etc. |
| deriveIdentifierSearchParameter(inputParam) | Derives an "identifier" search parameter from a reference search parameter. FHIR references can have an "identifier" property. Any FHIR reference search parameter can be used to search for resources with an identifier. However, the FHIR specification does not define an "identifier" search parameter for every resource type. This function derives an "identifier" search parameter from a reference search parameter. |
| diffAny(input, output, ptr, diff) | diffAny() returns an empty array if input and output are materially equal (i.e., would produce equivalent JSON); otherwise it produces an array of patches that would transform input into output.Here, "equal" means that the value at the target location and the value conveyed by "value" are of the same JSON type, and that they are considered equal by the following rules for that type: o strings: are considered equal if they contain the same number of Unicode characters and their code points are byte-by-byte equal. o numbers: are considered equal if their values are numerically equal. o arrays: are considered equal if they contain the same number of values, and if each value can be considered equal to the value at the corresponding position in the other array, using this list of type-specific rules. o objects: are considered equal if they contain the same number of members, and if each member can be considered equal to a member in the other object, by comparing their keys (as strings) and their values (using this list of type-specific rules). o literals (false, true, and null): are considered equal if they are the same. |
| diffArrays(input, output, ptr, diff) | Calculate the shortest sequence of operations to get from input to output, using a dynamic programming implementation of the Levenshtein distance algorithm.To get from the input ABC to the output AZ we could just delete all the input and say "insert A, insert Z" and be done with it. That's what we do if the input is empty. But we can be smarter. output A Z - - [0] 1 2 input A | 1 [0] 1 B | 2 [1] 1 C | 3 2 [2] 1. start at 0,0 (+0) 2) keep A (+0) 3) remove B (+1) 4) replace C with Z (+1) If the input (source) is empty, they'll all be in the top row, resulting in an array of 'add' operations. If the output (target) is empty, everything will be in the left column, resulting in an array of 'remove' operations. |
| diffObjects(input, output, ptr, diff) | |
| encodeBase64(data) | Encodes a base64 string. Handles both browser and Node environments. Supports Unicode characters. |
| encodeBase64Url(data) | Encodes a string into Base64URL format. This is the encoding required for JWT parts. |
| encodeSmartHealthLink(payload) | |
| encryptSHA256(str) | Encrypts a string with SHA256 encryption. |
| ensureNoLeadingSlash(url) | Ensures the given URL has no leading slash. |
| ensureTrailingSlash(url) | Ensures the given URL has a trailing slash. |
| escapeHtml(unsafe) | Returns the escaped HTML string of the input string. |
| escapeToken(token) | Escape token part of a JSON Pointer string ' This is the exact inverse of unescapeToken(), so the reverse replacements must take place in reverse order. |
| evalFhirPath(expression, input, variables, cache) | Evaluates a FHIRPath expression against a resource or other object. |
| evalFhirPathTyped(expression, input, variables, cache) | Evaluates a FHIRPath expression against a resource or other object. |
| evalSqlOnFhir(view, resources) | Evaluates a SQL-on-FHIR view on a set of FHIR resources. |
| expandSampledData(sample) | |
| expandSampledObservation(obs) | |
| extractAccountReferences(meta) | Normalizes Medplum's meta.account and meta.accounts into a singular array of FHIR references. |
| extractServiceTypeReferences(serviceType) | Extracts HealthcareService references from serviceType concepts. |
| fetchAllVersionStrings(appName, params) | Fetches the version strings for all published Medplum releases. |
| fetchLatestVersionString(appName) | Fetches the latest Medplum release version string. |
| fetchVersionManifest(appName, version, params) | Fetches the manifest for a given Medplum release version. |
| fhirPathArrayEquals(x, y) | Determines if two arrays are equal according to FHIRPath equality rules. |
| fhirPathArrayEquivalent(x, y) | Determines if two arrays are equivalent according to FHIRPath equality rules. |
| fhirPathArrayNotEquals(x, y) | Determines if two arrays are not equal according to FHIRPath equality rules. |
| fhirPathEquals(x, y) | Determines if two values are equal according to FHIRPath equality rules. |
| fhirPathEquivalent(x, y) | Determines if two values are equivalent according to FHIRPath equality rules. |
| fhirPathIs(typedValue, desiredType) | Determines if the typed value is the desired type. |
| fhirPathNot(input) | Returns a negated FHIRPath boolean expression. |
| fhirpathPatchTypedValue(original, patch) | |
| findCodeBySystem(categories, system) | Finds the code for a specific system in a list of CodeableConcepts. |
| findObservationInterval(definition, patient, value, category) | Tries to find an observation interval for the given patient and value. |
| findObservationReferenceRange(definition, patient, names) | Tries to find an observation reference range for the given patient and condition names. |
| findObservationReferenceRanges(definition, patient, names) | Returns all matching observation reference range for the given patient and condition names. |
| findResourceByCode(resources, code, system) | Finds the first resource in the input array that matches the specified code and system. |
| findResourceInBundle(bundle, resourceType, id) | |
| flatMapFilter(arr, fn) | |
| formatAddress(address, options) | Formats a FHIR Address as a string. |
| formatCodeableConcept(codeableConcept) | Formats a CodeableConcept element as a string. |
| formatCoding(coding, includeCode) | Formats a Coding element as a string. |
| formatDate(date, locales, options) | Formats a FHIR date string as a human readable string. Handles missing values and invalid dates. |
| formatDateTime(dateTime, locales, options) | Formats a FHIR dateTime string as a human readable string. Handles missing values and invalid dates. |
| formatFamilyName(name) | Formats the family name portion of a FHIR HumanName element. |
| formatGivenName(name) | Formats the given name portion of a FHIR HumanName element. |
| formatHl7DateTime(isoDate) | Formats an ISO date/time string into an HL7 date/time string. |
| formatHumanName(name, options) | Formats a FHIR HumanName as a string. |
| formatMoney(money) | |
| formatObservationValue(obs) | Formats a FHIR Observation resource value as a string. |
| formatPeriod(period, locales, options) | Formats a FHIR Period as a human readable string. |
| formatQuantity(quantity, precision) | Returns a human-readable string for a FHIR Quantity datatype, taking into account units and comparators |
| formatRange(range, precision, exclusive) | Returns a human-readable string for a FHIR Range datatype, taking into account one-sided ranges |
| formatReferenceString(value) | Formats a FHIR Reference as a string. |
| formatSearchQuery(definition) | Formats a search definition object into a query string. Note: The return value does not include the resource type. |
| formatTime(time, locales, options) | Formats a FHIR time string as a human readable string. Handles missing values and invalid dates. |
| formatTiming(timing) | Formats a FHIR Timing as a human readable string. |
| formatWallTime(time, locales, options) | Formats a FHIR time string as a human readable string. The viewer's timezone does not affect the display. |
| generateId() | Cross platform random UUID generator |
| getAllDataTypes() | |
| getAllQuestionnaireAnswers(response) | Returns an array of questionnaire answers as a map by link ID. |
| getBuffer() | Returns the global Buffer constructor if available. |
| getCodeBySystem(concept, system) | Tries to find a code string for a given system within a given codeable concept. |
| getDataType(type, profileUrl) | |
| getDateProperty(date) | 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. |
| getDefaultValuesForNewSliceEntry(key, slice, slicing, schema) | |
| getDisplayString(resource) | Returns a display string for the resource. |
| getElementDefinition(typeName, propertyName, profileUrl) | Returns an element definition by type and property name. |
| getElementDefinitionForPath(typeName, path, profileUrl) | |
| getElementDefinitionFromElements(elements, propertyName) | Returns an element definition from mapping of elements by property name. |
| getElementDefinitionTypeName(elementDefinition) | Returns the type name for an ElementDefinition. |
| getExpressionForResourceType(resourceType, expression) | |
| getExpressionsForResourceType(resourceType, expression) | |
| getExtension(resource, urls) | Returns an extension by extension URLs. |
| getExtensions(extensible, urlOrUrls) | Returns every extension reachable by the given extension URLs. Like getExtension, but does not stop at the first match: extensions that repeat under one URL are all returned, at every level. Use it for extensions defined with a cardinality above one, where getExtension would silently read only the first. |
| getExtensionValue(resource, urls) | Returns an extension value by extension URLs. |
| getIdentifier(resource, system) | 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. |
| getImageSrc(resource) | Returns an image URL for the resource, if one is available. |
| getInnerDerivedIdentifierExpression(expression) | |
| getMedicationOrderIframeUrl(medicationRequest, ext) | Reads the medication-order iframe launch URL from MedicationRequest extensions. |
| getNestedProperty(value, key, options) | |
| getNestedProperty(value, key, options) | |
| getOutcomeRedirectUrl(outcome) | |
| getParsedDerivedIdentifierExpression(originalExpression, atom) | |
| getParsedExpressionForResourceType(resourceType, expression) | |
| getPathDifference(parentPath, path) | Returns the difference between two paths which is often suitable to use as a key in a Record<string, InternalSchemaElement> |
| getPathDisplayName(path) | Returns a human friendly display name for a FHIR element definition path. |
| getPendingMedicationOrderId(medicationRequest, ext) | Reads the pending medication-order id from MedicationRequest identifiers. |
| getPendingMedicationOrderStatus(medicationRequest, ext) | Reads the pending medication-order status code from MedicationRequest extensions. |
| getPreferredPharmaciesFromPatient(patient, preferenceTypeSystem) | Extracts preferred pharmacies from a Patient resource's extensions. |
| getPropertyDisplayName(propertyName) | Returns a human friendly display name for a FHIR element property or slice name |
| getQueryString(query) | Converts the given query to a string. |
| getQuestionnaireAnswers(response) | Returns all questionnaire answers as a map by link ID. |
| getRandomString() | Returns a cryptographically secure random string. |
| getReferenceString(input) | Returns a reference string for a resource. |
| getReferenceString(input) | |
| getResourceTypes() | 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. |
| getScheduleParameters(schedule, service, url) | Reads one scheduling parameter a Schedule sets for a HealthcareService, taking precedence over the service-level parameter of the same name. Pairs with setScheduleParameter and clearScheduleParameter.The result is a list rather than a single extension because a Schedule may carry more than one SchedulingParameters extension matching the service, and because a parameter may legitimately repeat. |
| getSchedulingTimezone(service, schedule, actor) | Resolves the timezone used by scheduling in server priority order: the Schedule's parameters for the service, then the service's own parameters, then the actor's standard FHIR timezone extension. |
| getSearchParameter(resourceType, code) | Returns a search parameter for a resource type by search code. |
| getSearchParameterDetails(resourceType, searchParam) | 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. |
| getSearchParameters(resourceType) | Returns the search parameters for the resource type indexed by search code. |
| getSearchResourceTypes(searchRequest) | |
| getSmartHealthLinkId(manifestUrl) | |
| getStatus(outcome) | |
| getTypedPropertyValue(input, path, options) | Returns the value of the property and the property type. Some property definitions support multiple types. For example, "Observation.value[x]" can be "valueString", "valueInteger", "valueQuantity", etc. According to the spec, there can only be one property for a given element definition. This function returns the value and the type. |
| getTypedPropertyValueWithoutSchema(typedValue, path) | Returns the value of the property and the property type using a type schema. Note that because the type schema is not available, this function may be inaccurate. In some cases, that is the desired behavior. |
| getTypedPropertyValueWithPath(input, path, options) | |
| getTypedPropertyValueWithSchema(typedValue, path, element) | Returns the value of the property and the property type using a type schema. |
| getValueSliceName(value, slices, discriminators, profileUrl) | |
| getWebSocketUrl(baseUrl, path) | Concatenates a given base URL and path, ensuring the URL has the appropriate ws:// or wss:// protocol instead of http:// or https://. |
| getWindow() | Returns the global window object if available. |
| hasSchedulingParameters(resource) | Returns whether a Schedule or HealthcareService has a SchedulingParameters extension. Unscoped: on a Schedule, where the extension repeats once per service, this reports that some service is configured rather than any particular one. Ask getScheduleParameters about a service. |
| indexConceptMapCodings(params) | |
| indexDefaultSearchParameters(bundle) | |
| indexSearchParameter(searchParam) | Indexes a SearchParameter resource for fast lookup. Indexes by SearchParameter.code, which is the query string parameter name. |
| indexSearchParameterBundle(bundle) | Indexes a bundle of SearchParameter resources for faster lookup. |
| indexStructureDefinitionBundle(bundle) | Parses and indexes structure definitions |
| inflateBaseSchema(base) | |
| inflateElement(path, partial) | |
| initFhirPathParserBuilder() | |
| intersection(objects) | List the keys that shared by all objects.The semantics of what constitutes a "key" is described in subtract(). |
| invalidSearchOperator(operator, searchParameterCodeOrId) | |
| isAccepted(outcome) | |
| isAckCode(value) | Type guard for a valid HL7 acknowledgment code (MSA-1). |
| isAddPharmacyResponse(value) | Type guard to validate an add pharmacy bot response. |
| isBrowserEnvironment() | Returns true if running in a browser environment with window available. |
| isCodeableConcept(value) | Returns true if the input value is a CodeableConcept object. This is a heuristic check based on the presence of the "coding" property. |
| isCoding(value) | Returns true if the input value is a Coding object. This is a heuristic check based on the presence of the "code" property. |
| isCompletedSubscriptionRequest(subscriptionRequest) | |
| isComplexTypeCode(code) | |
| isConflict(outcome) | |
| isContextVersionRequired(event) | |
| isCreated(outcome) | |
| isDataTypeLoaded(type) | |
| isDateString(input) | Returns true if the input value is a YYYY-MM-DD date string. |
| isDateTimeString(input) | Returns true if the input value is a YYYY-MM-DDThh:mm:ss.sssZ date/time string. |
| isDayOfWeek(value) | |
| isDefined(value) | Helper function to narrow a type by excluding undefined/null values. |
| isDestructive({ op }, input) | |
| isEmpty(v) | Returns true if the value is empty (null, undefined, empty string, or empty object). |
| isError(value) | Returns true if the input is an Error object. This should be replaced with Error.isError when it is more widely supported. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Error/isError |
| isFhircastResourceType(resourceType) | Checks if a ResourceType can be used in a FHIRcast context. |
| isFhirCriteriaMet(subscription, currentResource, getPreviousResource) | |
| isGone(outcome) | |
| isJwt(token) | Returns true if the token is a JWT. |
| isLowerCase(c) | |
| isMedicationArray(value) | Type guard: validates an array of Medication resources (drug search bot output). Walks every entry rather than spot-checking the first so a tuple-shaped payload like [Medication, MedicationRequest] is rejected (see PR [#8999]( https://github.com/medplum/medplum/pull/8999\#discussion\_r3276251617)). |
| isMedicationCartManageResponse(value) | Type guard: validates a cart-management bot response. |
| isMedicationCheckoutResponse(value) | Type guard: validates a checkout-medications bot response. |
| isMedicationOrderResponse(value) | Type guard: validates an order-medication bot response. |
| isMedicationOrderSetResponse(value) | Type guard: validates an order-set widget-URL bot response. |
| isMedplumAccessToken(accessToken) | Returns true if the access token was issued by a Medplum server. |
| isNodeEnvironment() | Returns true if running in Node.js environment with Buffer available. |
| isNotFound(outcome) | |
| isObject(obj) | Returns true if the input is an object. |
| isOk(outcome) | |
| isOperationOutcome(value) | |
| isOrganizationArray(value) | Type guard to validate that a value is an array of Organization resources. |
| isPeriod(input) | Determines if the input is a Period object. This is heuristic based, as we do not have strong typing at runtime. |
| isPopulated(arg) | Returns true if the value is a non-empty string, an object with a length property greater than zero, or a non-empty object |
| isPrimitiveType(code) | Returns true if the type code is a primitive type. |
| isProfileLoaded(profileUrl) | |
| isProfileResource(resource) | Returns true if the resource is a "ProfileResource". |
| isQuantity(input) | Determines if the input is a Quantity object. This is heuristic based, as we do not have strong typing at runtime. |
| isQuantityEquivalent(x, y) | |
| isRedirect(outcome) | |
| isReference(value, resourceType) | Type guard to validate that an object is a FHIR reference |
| isResource(value, resourceType) | Type guard to validate that an object is a FHIR resource |
| isResourceType(resourceType) | Returns true if the given string is a valid FHIR resource type. |
| isResourceTypeSchema(typeSchema) | Returns true if the type schema is a non-abstract FHIR resource. |
| isResourceWithId(resource, resourceType) | |
| isSliceDefinitionWithTypes(slice) | |
| isString(value) | Returns true if the input value is a string. |
| isStringArray(arr) | Returns true if the input array is an array of strings. |
| isTextObject(value) | Returns true if the input value is an object with a string text property. This is a heuristic check based on the presence of the "text" property. |
| isTypedValue(value) | Returns true if the value is a TypedValue. |
| isUnauthenticated(outcome) | |
| isUUID(input) | Returns true if the input string is a UUID. |
| isValidDate(date) | Returns true if the given date object is a valid date. Dates can be invalid if created by parsing an invalid string. |
| isValidHostname(input) | Tests whether a given input is a valid hostname. __NOTE: Does not validate that the input is a valid domain name, only a valid hostname.__ |
| isValidMedplumSemver(version) | Tests that a given version string follows the basic semver pattern of <int>.<int>.<int>, which is used for Medplum versions. |
| lazy(fn) | Memoizes the result of a parameterless function |
| loadDataType(sd) | |
| mapByIdentifier(resourceBundle, identifierSystem) | Returns a Map of resources from a bundle, using the specified identifier system as the key. |
| matchDiscriminant(value, discriminator, slice, elements) | |
| matchesRange(value, range, precision) | Returns true if the value is in the range accounting for precision. |
| matchesSearchRequest(resource, searchRequest) | Determines if the resource matches the search request. |
| medicationCartClearRequestToParameters(req) | Encodes a MedicationCartClearRequest as a FHIR Parameters body for the $clear-cart custom operation. Emits the action: 'clear' discriminator. |
| medicationCartRemoveRequestToParameters(req) | Encodes a MedicationCartRemoveRequest as a FHIR Parameters body for the $remove-cart-medication custom operation. Emits the action: 'remove' discriminator the shared cart-management bot dispatches on. |
| medicationCheckoutRequestToParameters(req) | Encodes a MedicationCheckoutRequest as a FHIR Parameters body for the vendor-neutral $checkout-medications custom operation (POST /fhir/R4/MedicationRequest/$checkout-medications).medicationRequestIds is emitted as one parameter entry per id so the OperationDefinition's max: '*' cardinality round-trips. Optional fields are omitted entirely. |
| medicationOrderRequestToParameters(req) | Encodes a MedicationOrderRequest as a FHIR Parameters body for the vendor-neutral $order-medication custom operation.Nested arrays ( drugs, compoundSigs, diagnoses) are emitted as one parameter entry per element so the OperationDefinition's max: '*' cardinality round-trips; primitive arrays (conditionIds) likewise emit one entry per id. Optional fields are omitted entirely. |
| medicationOrderSetRequestToParameters(req) | Encodes a MedicationOrderSetRequest as a FHIR Parameters body for the vendor-neutral $order-set-url custom operation (POST /fhir/R4/PlanDefinition/$order-set-url). Optional fields are omitted entirely so the wire payload mirrors the legacy executeBot plain-JSON shape the bot's parseInput helper would otherwise have to coerce.vendorOrderSetId is encoded as valueInteger when numeric and valueString otherwise — keeping the operation usable by future vendors whose order-set ids are not numeric. |
| medicationSearchParamsToParameters(params) | Encodes a MedicationSearchParams as a FHIR Parameters body for the vendor-neutral $drug-search (and $drug-quantity-qualifiers) custom operations. Optional fields are omitted entirely so the wire payload stays minimal and mirrors the legacy executeBot plain-JSON shape that the bot's parseInput helper would otherwise have to coerce. |
| move(object, operation, _options) | The "move" operation removes the value at a specified location and adds it to the target location. The operation object MUST contain a "from" member, which is a string containing a JSON Pointer value that references the location in the target document to move the value from. This operation is functionally identical to a "remove" operation on the "from" location, followed immediately by an "add" operation at the target location with the value that was just removed. The "from" location MUST NOT be a proper prefix of the "path" location; i.e., a location cannot be moved into one of its children. TODO: throw if the check described in the previous paragraph fails. |
| NOOP() | No operation function. |
| normalizeArrayBufferView(typedArrayOrBuffer) | Normalizes an ArrayBufferLike (eg. an ArrayBuffer) to a raw ArrayBufferLike (without a view). If the passed buffer is a view, it gives the raw ArrayBufferLike.This is useful in cases where you need to operate on the raw bytes of an ArrayBuffer where a TypedArray (eg. Uint32Array) might be passed in. This ensures that you will always operate on the raw bytes rather than accidentally truncating the input by operating on the elements of the view. |
| normalizeCreateBinaryOptions(arg1, arg2, arg3, arg4) | |
| normalizeCreatePdfOptions(arg1, arg2, arg3, arg4) | |
| normalizeErrorEvent(event, target) | Normalizes the various error event shapes dispatched by different WebSocket implementations into a single ErrorEvent carrying a real Error, so downstream listeners always get message and error regardless of the underlying implementation:- Browsers dispatch a plain Event with no error details (per the WHATWG WebSocket spec). - Node's ws library and Node's built-in (undici) WebSocket dispatch an ErrorEvent with both message and error. - Bun dispatches a plain Event with a message string but no error. |
| normalizeErrorString(error) | Normalizes an error object into a displayable error string. |
| normalizeOperationOutcome(error) | Normalizes an error object into an OperationOutcome. |
| operationOutcomeIssueToString(issue) | Returns a string representation of the operation outcome issue. |
| operationOutcomeToString(outcome) | Returns a string representation of the operation outcome. |
| parametersToMedicationCartManageResponse(params) | Decodes the Parameters response from the $remove-cart-medication / $clear-cart custom operations into a typed MedicationCartManageResponse. Throws INVALID_MEDICATION_CART_RESPONSE when required top-level fields are missing. |
| parametersToMedicationCheckoutResponse(params) | Decodes the Parameters response from the $checkout-medications custom operation into a typed MedicationCheckoutResponse. Throws INVALID_MEDICATION_CHECKOUT_RESPONSE when required top-level fields are missing.The repeating items parameter is collected across every occurrence (each is one queued/failed line); the scalar approvalUrl / vendorPatientId are read once. |
| parametersToMedicationOrderResponse(params) | Decodes the Parameters response from the $order-medication custom operation into a typed MedicationOrderResponse. Throws INVALID_MEDICATION_ORDER_RESPONSE when required fields are missing. |
| parametersToMedicationOrderSetResponse(params) | Decodes the Parameters response from the $order-set-url custom operation into a typed MedicationOrderSetResponse. Throws INVALID_MEDICATION_ORDER_SET_RESPONSE when launchUrl is missing or empty.Echoed vendor ids ( vendorPatientId, vendorOrderSetId) are preserved as the wire type — number when sent as valueInteger, string when sent as valueString — so downstream code can read either without conversion. |
| parametersToOrderSetSyncResponse(params) | Decodes the Parameters response from the $sync-orderset custom operation into a typed OrderSetSyncResponse, including the repeating per-action results rows the server previously dropped. |
| parseFhirPath(input) | Parses a FHIRPath expression into an AST. The result can be used to evaluate the expression against a resource or other object. This method is useful if you know that you will evaluate the same expression many times against different resources. |
| parseFhirPathPatchParameters(parameters) | Parses a FHIRPath Patch Parameters resource into the array of operations consumed by fhirpathPatchTypedValue(). Each repeating operation parameter is decoded from its part entries (type, path, name, value, index, source, destination), where the polymorphic value[x] part becomes a TypedValue. |
| parseFilterParameter(input) | Parses a FHIR _filter parameter expression into an AST. |
| parseHl7DateTime(hl7DateTime, options) | 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]. |
| parseJWTPayload(token) | Parses the JWT payload. |
| parseLogLevel(level) | |
| parseMappingLanguage(input) | Parses a FHIR Mapping Language document into an AST. |
| parseParameter(searchParam, operator, modifier, value) | |
| parseReference(reference) | Parses a reference and returns a tuple of [ResourceType, ID]. |
| parseSearchRequest(url, query) | Parses a search URL into a search request. |
| parseSmartHealthLink(input) | |
| parseStructureDefinition(sd) | Parses a StructureDefinition resource into an internal schema better suited for programmatic validation and usage in internal systems |
| parseXFhirQuery(query, variables, context) | Parses an extended FHIR search criteria string (i.e. application/x-fhir-query). |
| pathToJSONPointer(path) | Translates a path emitted by this crawler into an RFC6902 JSON Patch pointer |
| preciseEquals(a, b, precision) | Returns true if the two numbers are equal to the given precision. |
| preciseGreaterThan(a, b, precision) | Returns true if the first number is greater than the second number to the given precision. |
| preciseGreaterThanOrEquals(a, b, precision) | Returns true if the first number is greater than or equal to the second number to the given precision. |
| preciseLessThan(a, b, precision) | Returns true if the first number is less than the second number to the given precision. |
| preciseLessThanOrEquals(a, b, precision) | Returns true if the first number is less than or equal to the second number to the given precision. |
| preciseRound(a, precision) | Returns the input number rounded to the specified number of digits. |
| redirect(url) | |
| redirectOk(url) | |
| remove(object, operation, _options) | The "remove" operation removes the value at the target location. The target location MUST exist for the operation to be successful. |
| removeDuplicates(arr) | Removes duplicates in array using FHIRPath equality rules. |
| removePreferredPharmacyFromPatient(patient, orgRef) | Removes a preferred pharmacy extension from a Patient. |
| removeProfileFromResource(resource, profileUrl) | Removes the supplied profileUrl from the resource.meta.profile if it is present |
| reorderBundle(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 |
| replace(object, operation, _options) | The "replace" operation replaces the value at the target location with a new value. The operation object MUST contain a "value" member whose content specifies the replacement value. The target location MUST exist for the operation to be successful. This operation is functionally identical to a "remove" operation for a value, followed immediately by an "add" operation at the same location with the replacement value. Even more simply, it's like the add operation with an existence check. |
| replaceQueryVariables(user, context, query) | Replaces prefetch query variables with values from the context or user profile. A prefetch token is a placeholder in a prefetch template that is *replaced by information from the hook's context* to construct the FHIR URL used to request the prefetch data. Prefetch tokens MUST be delimited by {{ and }}, and MUST contain only the qualified path to a hook context field or one of the following user identifiers: userPractitionerId, userPractitionerRoleId, userPatientId, or userRelatedPersonId.Note that the spec says: Individual hooks specify which of their context fields can be used as prefetch tokens. Only root-level fields with a primitive value within the context object are eligible to be used as prefetch tokens. For example, {{context.medication.id}} is not a valid prefetch token because it attempts to access the id field of the medication field.Unfortunately, many CDS Hooks services do not follow this rule. Therefore, this implementation allows access to nested fields. |
| resolveId(input) | Returns the ID portion of a reference. |
| resourceMatchesSubscriptionCriteria({ resource, subscription, context, getPreviousResource, logger, }, input) | |
| satisfiedAccessPolicy(resource, interaction, accessPolicy) | Checks that there is an access policy permitting the given resource interaction, returning the matching policy object. |
| schedulingDurationToMinutes(duration) | Converts a SchedulingParameters duration to minutes. |
| serializeError(error, depth, maxDepth) | Serializes an Error object into a plain object, including nested causes and custom properties. |
| serializeFhircastSubscriptionRequest(subscriptionRequest) | 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. |
| serverError(err) | |
| serverTimeout(msg) | |
| serviceTypeIncludesService(serviceType, service) | Returns whether any serviceType concept refers to the given HealthcareService. |
| setCodeBySystem(concept, system, code) | Sets a code for a given system within a given codeable concept. |
| setIdentifier(resource, system, value, options) | 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. |
| setScheduleParameter(schedule, service, subextension) | Immutably sets one scheduling parameter on a Schedule for a HealthcareService, so that calendar keeps it in place of the service-level parameter of the same name. Whatever the Schedule already holds at the sub-extension's url is replaced, and the SchedulingParameters extension is created if the Schedule has none for the service yet. Untyped by design, taking any sub-extension of the shape the parameter calls for, for example { url: 'bufferBefore', valueDuration: { value: 10, unit: 'min' } }. A parameter whose value is a nested structure rather than a single value[x] is worth a typed wrapper over this; availability has one in @medplum/react-scheduling. Pairs with clearScheduleParameter and getScheduleParameters. |
| singleton(collection, type) | |
| singularize(value) | |
| sleep(ms, options) | Sleeps for the specified number of milliseconds. |
| sortStringArray(array) | Sorts an array of strings in place using the localeCompare method. This method will mutate the input array. |
| splitN(str, delim, n) | Splits a string into an array of strings using the specified delimiter. Unlike the built-in split function, this function will split the string into a maximum of exactly n parts. Trailing empty strings are included in the result. |
| splitSearchOnComma(input) | Splits a FHIR search value on commas. Respects backslash escape. See: https://hl7.org/fhir/r4/search.html\#escaping |
| streamToBuffer(stream) | Reads data from a Readable stream and returns a Promise that resolves with a Buffer containing all the data. |
| stringify(value, pretty) | Returns the FHIR JSON string representation of the input value. Removes properties with empty string values. Removes objects with zero properties. Does not modify the input value. If the input value does not contain any empty properties, then the original value is returned. Otherwise, a new value is returned with the empty properties removed. See: https://www.hl7.org/fhir/json.html |
| stringifyTypedValue(v) | Output the string representation of a value, suitable for use as part of a search query. |
| structureMapTransform(structureMap, input, transformMaps) | Transforms input values using a FHIR StructureMap. See: https://www.hl7.org/fhir/mapping-language.html |
| subsetResource(resource, properties) | 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) |
| subtract(minuend, subtrahend) | List the keys in minuend that are not in subtrahend.A key is only considered if it is both 1) an own-property (o.hasOwnProperty(k)) of the object, and 2) has a value that is not undefined. This is to match JSON semantics, where JSON object serialization drops keys with undefined values. |
| sumBy(items, fn) | |
| summarizeObservations(observations, summaryCode, summarizeFn) | Summarizes a group of Observations into a single computed summary value, with the individual values preserved in Observation.component.valueSampledData. |
| test_2(object, operation, _options) | The "test" operation tests that a value at the target location is equal to a specified value. The operation object MUST contain a "value" member that conveys the value to be compared to the target location's value. The target location MUST be equal to the "value" value for the operation to be considered successful. |
| toJsBoolean(obj) | Converts unknown object into a JavaScript boolean. Note that this is different than the FHIRPath "toBoolean", which has particular semantics around arrays, empty arrays, and type conversions. |
| toPeriod(input) | Tries to convert an unknown input value to a Period object. |
| toServiceTypeCodeableConcepts(service) | Converts a HealthcareService into the CodeableConcept values used by Schedule.serviceType and Appointment.serviceType, which encode an R4 approximation of CodeableReference<HealthcareService>. |
| toTypedValue(value) | Returns a "best guess" TypedValue for a given value. |
| trimTrailingEmptyElements(arr) | Returns an array with trailing empty elements removed. For example, [1, 2, 3, null, undefined, ''] becomes [1, 2, 3]. This is useful for FHIR arrays, which by default must maintain the same length, but while editing we may want to trim trailing empty elements. |
| tryGetDataType(type, profileUrl) | |
| tryGetJwtExpiration(token) | Returns the JWT expiration time in number of milliseconds elapsed since the epoch. |
| tryGetProfile(profileUrl) | |
| typedValueToString(typedValue) | Converts a typed value to a string. |
| unescapeToken(token) | Unescape token part of a JSON Pointer stringtoken should *not* contain any '/' characters.Evaluation of each reference token begins by decoding any escaped character sequence. This is performed by first transforming any occurrence of the sequence ' Here's my take: |
| validateFhircastSubscriptionRequest(subscriptionRequest) | Validates that a SubscriptionRequest. |
| validateResource(resource, options) | |
| validateResourceType(resourceType) | Validates that the given string is a valid FHIR resource type. On success, silently returns void. On failure, throws an OperationOutcomeError. |
| validateTypedValue(typedValue, options) | |
| validationError(details, expressions, code, diagnostics) | |
| warnIfNewerVersionAvailable(appName, params) | Checks if a newer version of Medplum is available and logs a warning if so. |
| wordWrap(text, maxLength) | Returns a word-wrapped string. Based on: https://stackoverflow.com/a/38709683 |
Interfaces [](/content/docs/sdk/core#interfaces "Direct link to Interfaces"/index.html)
| Interface | Description |
|---|---|
| AddFavoriteParams | Parameters for adding a pharmacy to a patient's favorites. |
| AddOperation | |
| AddPharmacyResponse | Response from adding a pharmacy to a patient's favorites. |
| AddressFormatOptions | |
| AgentConnectRequest | |
| AgentConnectResponse | |
| AgentError | |
| AgentHeartbeatRequest | |
| AgentHeartbeatResponse | |
| AgentLogsRequest | |
| AgentLogsResponse | |
| AgentReloadConfigRequest | |
| AgentReloadConfigResponse | |
| AgentStats | Statistics about the running agent. Known fields are typed; additional fields may be present and are preserved as unknown values. |
| AgentStatsRequest | |
| AgentStatsResponse | |
| AgentTransmitRequest | |
| AgentTransmitResponse | |
| AgentUpgradeRequest | |
| AgentUpgradeResponse | |
| AsyncCrawlerVisitor | |
| Atom | |
| AtomContext | |
| BackgroundJobContext | |
| BaseAgentMessage | |
| BaseAgentRequestMessage | |
| BaseLoginRequest | |
| BotEvent | |
| BotResponseStream | Response stream interface for bot streaming responses. Compatible with both VMContext and AWS Lambda runtimes. |
| CdsCard | CDS Card definition. See CDS Cards for full details. |
| CdsCreateAction | CDS Create Action. See CDS Actions for full details. |
| CdsDeleteAction | CDS Delete Action. See CDS Actions for full details. |
| CdsDiscoveryResponse | CDS Discovery Response definition. See CDS Hooks Discovery for full details. |
| CdsFhirAuthorization | CDS FHIR Authorization definition. |
| CdsLink | CDS Link definition. See CDS Link for full details. |
| CdsRequest | CDS Request definition. See Calling a CDS Service for full details. |
| CdsRequestWithAuth | CDS Request with FHIR authorization. |
| CdsResponse | CDS Response definition. See CDS Service Response for full details. |
| CdsService | CDS Service definition. See CDS Hooks Discovery for full details. |
| CdsSource | CDS Source definition. See CDS Source for full details. |
| CdsSuggestion | CDS Suggestion definition. See CDS Suggestions for full details. |
| CdsUpdateAction | CDS Update Action. See CDS Actions for full details. |
| CloseEvent_2 | |
| Code | |
| ConceptMapTranslateMatch | |
| ConceptMapTranslateMatchAttribute | |
| ConceptMapTranslateOutput | |
| ConceptMapTranslateParameters | |
| Constraint | |
| CopyOperation | |
| CrawlerOptions | |
| CrawlerVisitor | |
| CreateBinaryOptions | Binary upload options. |
| CreateDocumentReferenceOptions | |
| CreateMediaOptions | |
| CreatePdfFunction | |
| CreatePdfOptions | PDF upload options. |
| DataSampleOptions | |
| ElementType | |
| EmailPasswordLoginRequest | |
| ErrorEvent_2 | |
| Event_2 | |
| ExtendedInternalSchemaElement | |
| Extensible | Anything that can carry FHIR extensions: resources such as Patient, data types such as CodeableConcept, and extensions themselves. Structural, so any of those is accepted, while a type that cannot hold extensions, Binary being the notable example, is rejected. |
| Filter | |
| GenerateSmartHealthLinkParams | |
| GetTypedPropertyValueOptions | |
| GoogleCredentialResponse | |
| GoogleLoginRequest | |
| Hl7AckOptions | |
| Hl7DateParseOptions | |
| HumanNameFormatOptions | |
| IClientStorage | |
| ILogger | |
| ILoggerConfig | |
| IncludeTarget | |
| IndexedStructureDefinition | An IndexedStructureDefinition is a lookup-optimized version of a StructureDefinition. StructureDefinition resources contain schema information for other resource types. These schemas can be used to automatically generate user interface elements for resources. However, a StructureDefinition resource is not optimized for realtime lookups. All resource types, sub types, and property definitions are stored in a flat array of ElementDefinition objects. Therefore, to lookup the schema for a property (i.e., "Patient.name") requires a linear scan of all ElementDefinition objects A StructureDefinition resource contains information about one or more types. For example, the "Patient" StructureDefinition includes "Patient", "Patient_Contact", "Patient_Communication", and "Patient_Link". This is inefficient. Instead, we create an indexed version of the StructureDefinition, called IndexedStructureDefinition. In an IndexedStructureDefinition, retrieving a property definition is a hashtable lookup. The hierarchy is: IndexedStructureDefinition - top level for one resource type TypeSchema - one per resource type and all contained BackboneElements PropertySchema - one per property/field |
| InfixParselet | |
| InternalSchemaElement | |
| InternalTypeSchema | Internal representation of a non-primitive FHIR type, suitable for use in resource validation |
| InviteRequest | |
| IReconnectingWebSocket | |
| IReconnectingWebSocketCtor | |
| IWebSocket | Generic interface that an implementation of WebSocket must satisfy to be used with ReconnectingWebSocket. This is a slightly modified fork of the WebSocket global type used in Node, narrowed to exactly the members ReconnectingWebSocket actually depends on.addEventListener/removeEventListener declare a typed overload against IWebSocketEventMap (the global event interfaces, used here rather than the local WebSocketEventMap since they are generic enough to describe the events ReconnectingWebSocket attaches to). They also declare the permissive string overload that the real WebSocket types carry, which is what lets conformant implementations whose event types do not structurally match the global ones (e.g. the ws library, whose events are a minimal subset and use target: WebSocket) still satisfy this interface.The onopen/onclose/onmessage/onerror handler properties are intentionally omitted: ReconnectingWebSocket never assigns to them (it uses addEventListener), and because they are function-valued properties their parameters are checked contravariantly, which no single precise event type can satisfy across implementations (e.g. ws's events use target: WebSocket while the DOM's use `target: EventTarget |
| JWTPayload | Recognized JWT Claims Set members, any other members may also be present. |
| LoggerConfig | |
| LoggerOptions | |
| LoginAuthenticationResponse | |
| LoginProfileResponse | |
| LoginScopeResponse | |
| LoginState | |
| LogMessage | |
| MailAddress | Email address definition. Compatible with nodemailer Mail.Address. |
| MailAttachment | Email attachment definition. Compatible with nodemailer Mail.Options. |
| MailOptions | Email message definition. Compatible with nodemailer Mail.Options. |
| Marker | |
| MedicationCartClearRequest | Vendor-neutral input to clear the patient's whole vendor cart ($clear-cart). |
| MedicationCartItemResult | Per-item outcome from a cart remove/clear. removed = the vendor cart item was deleted; not-in-cart = the draft was not staged (nothing to remove); failed = the vendor delete failed (see error). |
| MedicationCartManageResponse | Vendor-neutral output from a cart remove/clear: the vendor patient id, the number of cart items actually removed, and the per-line outcomes (one for a remove, N for a clear). |
| MedicationCartRemoveRequest | Vendor-neutral input to remove a single draft MedicationRequest from the patient's vendor cart ($remove-cart-medication). |
| MedicationCheckoutItemResult | Per-line outcome from a cart checkout. A single bad line is reported here as failed rather than rolling back the lines that already queued. |
| MedicationCheckoutRequest | Vendor-neutral input for a cart-checkout bot: submit a set of draft MedicationRequests (the cart) to the vendor's electronic approval queue. |
| MedicationCheckoutResponse | Vendor-neutral output from a cart-checkout bot: a single embeddable approval widget URL (the vendor's batch sign-off surface) plus per-line results. |
| MedicationOrderDrugInput | Vendor-neutral drug line for MedicationOrderRequest. |
| MedicationOrderExtensions | Vendor-neutral mapping of the extension URLs / identifier systems used to read pending medication-order state stamped on a MedicationRequest. |
| MedicationOrderRequest | Vendor-neutral input for an order-medication bot (matches the ScriptSure bot shape). |
| MedicationOrderResponse | Vendor-neutral output from an order-medication bot. |
| MedicationOrderSetRequest | Vendor-neutral input for an order-set widget-URL bot. One of planDefinitionId (Medplum reverse-lookup to the vendor's orderset id via a cross-system identifier) or vendorOrderSetId (escape hatch when no synced PD exists) is required. Bots reject input where both are set so the intent is unambiguous on the wire. |
| MedicationOrderSetResponse | Vendor-neutral output from an order-set widget-URL bot. The bot itself does not create FHIR resources — it just resolves the vendor ids and returns an iframe URL the prescriber loads to review/sign the whole order set in one pass. Optional echoes ( vendorPatientId, vendorOrderSetId, planDefinitionId) are surfaced for diagnostics and audit logging. |
| MedicationSearchParams | Parameters for a drug search bot used by MedicationOrderRequest flows. |
| MedplumClientOptions | The MedplumClientOptions interface defines configuration options for MedplumClient. All configuration settings are optional. |
| MedplumInfraConfig | |
| MedplumRequestOptions | |
| MedplumSourceInfraConfig | |
| MoveOperation | |
| NewPatientRequest | |
| NewProjectRequest | |
| NewUserRequest | |
| OrderSetSyncResponse | Vendor-neutral decoded response from the $sync-orderset custom operation (POST /fhir/R4/PlanDefinition/$sync-orderset). failedCount > 0 means the synced vendor order set carries fewer meds than the PlanDefinition. |
| OrderSetSyncSequenceResult | Per-action outcome from the vendor-neutral $sync-orderset operation. A 'failed' row carries error and was NOT added to the vendor order set, so a later apply/signing session would open with fewer meds than the PlanDefinition requested — callers must surface these. |
| PatchOperation | JSONPatch patch operation. Compatible with fast-json-patch and rfc6902 Operation. |
| PatchOptions | |
| PharmacySearchParams | Parameters for searching pharmacies. |
| PointerEvaluation | |
| PreferredPharmacy | |
| PrefixParselet | |
| PushToAgentOptions | |
| ReadHistoryOptions | |
| RemoveOperation | |
| ReplaceOperation | |
| RequestCacheEntry | |
| RequestProfileSchemaOptions | |
| ResolveSmartHealthLinkParams | |
| ResourceModifiedEvent | Payload of the resourceModified event, emitted after this client instance successfully creates, updates, patches, or deletes a FHIR resource.Emitted by createResource, createResourceIfNoneExist, updateResource, upsertResource, patchResource, deleteResource, and by notifyResourceModified. Conditional methods (createResourceIfNoneExist, upsertResource) emit even when the server made no change, except on HTTP 304 "Not Modified".T - The type of the modified resource. Defaults to Resource; narrow it (e.g. via useResourceModified('Slot', ...)) to get a typed resource payload without extra guards. |
| SearchableToken | |
| SearchParameterDetails | |
| SearchRequest | |
| SelectionStructure | Represents a "selection structure" in the SQL-on-FHIR specification. In practice, this can be a ViewDefinition or ViewDefinitionSelect. TypeScript does not like checks for properties that are not part of the type, so we use this interface instead. |
| SetIdentifierOptions | |
| SleepOptions | Sleep options. |
| SliceDefinition | |
| SliceDiscriminator | |
| SlicingRules | |
| SmartHealthLinkManifestFile | |
| SmartHealthLinkPayload | |
| SortRule | |
| SubManagerOptions | |
| TestOperation | |
| Token | |
| TokenizerOptions | |
| TokenResponse | |
| TokensContext | |
| TypedValue | |
| TypeInfo | An indexed TypeSchema. Example: The IndexedStructureDefinition for "Patient" would include the following TypeSchemas: 1) Patient 2) Patient_Contact 3) Patient_Communication 4) Patient_Link |
| ValidatorOptions | |
| ValueSetExpandParams | ValueSet $expand operation parameters. See FHIR ValueSet $expand Operation Parameters for full details. |
Variables [](/content/docs/sdk/core#variables "Direct link to Variables"/index.html)
| Variable | Description |
|---|---|
| AccessPolicyInteraction | Interactions with a resource that can be controlled via an access policy. Codes taken from http://hl7.org/fhir/codesystem-restful-interaction.html |
| AckCode | |
| allOk | |
| ContentType | Content type constants. |
| CPT | |
| created | |
| DAYS_OF_WEEK | |
| DEFAULT_ACCEPT | |
| DEFAULT_MAX_SEARCH_COUNT | |
| DEFAULT_SEARCH_COUNT | |
| EMPTY | Constant empty array. |
| ExternalSecretSystems | |
| FHIRCAST_EVENT_NAMES | |
| FHIRCAST_EVENT_RESOURCES | |
| FHIRCAST_EVENT_VERSION_REQUIRED | |
| FHIRCAST_RESOURCE_TYPES | |
| fhirTypeToJsType | |
| forbidden | |
| globalSchema | Global schema singleton. |
| gone | |
| HTTP_HL7_ORG | |
| HTTP_TERMINOLOGY_HL7_ORG | |
| ICD10 | |
| INVALID_MEDICATION_CART_RESPONSE | Stable error when a cart-management bot response does not match MedicationCartManageResponse. |
| INVALID_MEDICATION_CHECKOUT_RESPONSE | Stable error when a checkout-medications bot response does not match MedicationCheckoutResponse. |
| INVALID_MEDICATION_ORDER_RESPONSE | Stable error when a bot response does not match MedicationOrderResponse. |
| INVALID_MEDICATION_ORDER_SET_RESPONSE | Stable error when an order-set widget-url response is missing launchUrl. |
| INVALID_MEDICATION_SEARCH_RESPONSE | Stable error when a bot response is not a Medication array. |
| locationUtils | Location helpers that can be mocked alongside the rest of this module. Centralizes location access to work around JSDOM 23+ behavior in test environments. |
| LogLevel | Logging level, with greater values representing more detailed logs emitted. The zero value means no server logs will be emitted. |
| LogLevelNames | |
| LOINC | |
| MEDICATION_REQUEST_STATUS_REASON_RESPONSE_NOT_RECEIVED | Code stamped on MedicationRequest.statusReason when an order-medication operation never returned a verifiable response — the vendor side may have created (and sent) the prescription, or it may have rejected the request, and we cannot tell from the client. Used in place of a hard DELETE so the record stays addressable for later reconciliation against vendor webhooks. |
| MEDICATION_REQUEST_STATUS_REASON_SYSTEM | Canonical CodeSystem URL for MedicationRequest.statusReason values stamped by Medplum-managed order flows when a draft MR has to be retired without a confirmed vendor outcome.Downstream reconciliation (vendor webhook bots, audit reports) should match statusReason.coding[?(@.system==MEDICATION_REQUEST_STATUS_REASON_SYSTEM)] to recognize records that originated from this soft-delete path rather than a clinician decision. |
| MEDPLUM_CLI_CLIENT_ID | |
| MEDPLUM_RELEASES_URL | |
| MEDPLUM_SEMVER_REGEX | |
| MEDPLUM_VERSION | |
| multipleMatches | |
| NDC | |
| notFound | |
| notModified | |
| OAuthClientAssertionType | OAuth 2.0 Client Authentication Methods See RFC 7523 Section 2.2 for full details. |
| OAuthGrantType | OAuth 2.0 Grant Type Identifiers Standard identifiers: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-07#name-grant-types JWT bearer extension: https://datatracker.ietf.org/doc/html/rfc7523 Token exchange extension: https://datatracker.ietf.org/doc/html/rfc8693 Pre-authorized code: https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-urnietfparamsoauthgrant-typ |
| OAuthSigningAlgorithm | OAuth Signing Algorithms See RFC 7519 for full details. |
| OAuthTokenAuthMethod | OAuth 2.0 Client Authentication Methods See: https://openid.net/specs/openid-connect-core-1\_0.html\#ClientAuthentication |
| OAuthTokenType | OAuth 2.0 Token Type Identifiers See RFC 8693 Section 3.1 for full details. |
| Operator | Search operators. These operators represent "modifiers" and "prefixes" in FHIR search. See: https://www.hl7.org/fhir/search.html |
| OperatorPrecedence | Operator precedence See: https://hl7.org/fhirpath/\#operator-precedence |
| PATIENT_PREFERRED_PHARMACY_URL | |
| PHARMACY_PREFERENCE_TYPE_SYSTEM | Default pharmacy preference type system URL. Vendors may define their own system URL and pass it to the pharmacy functions. |
| PHARMACY_TYPE_PREFERRED | |
| PHARMACY_TYPE_PRIMARY | |
| preconditionFailed | |
| projectAdminResourceTypes | Project admin resource types are special resources that are only accessible to project administrators. |
| PropertyType | List of property types. http://www.hl7.org/fhir/R4/valueset-defined-types.html The list here includes additions found from StructureDefinition resources. |
| protectedResourceTypes | Protected resource types are in the "medplum" project. Reading and writing is limited to the system account. |
| readInteractions | |
| ReturnAckCategory | |
| RXNORM | |
| SchedulingEncounterCodingURI | |
| SchedulingParametersURI | |
| SchedulingPlanDefinitionURI | |
| SearchParameterType | |
| ServiceTypeReferenceURI | Extension URI holding a Reference<HealthcareService> on a serviceType CodeableConcept.In R5/R6, serviceType attributes change from CodeableConcept[] to CodeableReference<HealthcareService>. We approximate that in R4 with this extension.Example: a Schedule whose serviceType refers to a HealthcareService: json<br>{<br> "resourceType": "Schedule",<br> "actor": [{ "reference": "Practitioner/abc" }],<br> "serviceType": [<br> {<br> "extension": [<br> {<br> "url": "https://medplum.com/fhir/service-type-reference",<br> "valueReference": { "reference": "HealthcareService/123" }<br> }<br> ]<br> }<br> ]<br>}<br> |
| SNOMED | |
| TimezoneExtensionURI | |
| tooManyRequests | |
| UCUM | |
| unauthorized | |
| unauthorizedTokenAudience | |
| unauthorizedTokenExpired | |
| unsupportedMediaType | |
| VALID_HOSTNAME_REGEX | |
| validationRegexes |