@medplum/core 2.0.24 → 2.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +28 -14114
- package/dist/cjs/index.cjs.map +7 -1
- package/dist/esm/index.mjs +31 -29
- package/dist/esm/index.mjs.map +7 -1
- package/dist/types/client.d.ts +42 -10
- package/dist/types/fhirpath/atoms.d.ts +25 -11
- package/dist/types/fhirpath/parse.d.ts +33 -33
- package/dist/types/index.d.ts +1 -1
- package/dist/types/jwt.d.ts +6 -0
- package/dist/types/schema.d.ts +1 -0
- package/dist/types/search/details.d.ts +3 -1
- package/dist/types/types.d.ts +2 -2
- package/dist/types/typeschema/validation.d.ts +1 -1
- package/dist/types/utils.d.ts +15 -0
- package/package.json +5 -2
- package/dist/cjs/index.min.cjs +0 -1
- package/dist/esm/access.mjs +0 -142
- package/dist/esm/access.mjs.map +0 -1
- package/dist/esm/base-schema.json.mjs +0 -4408
- package/dist/esm/base-schema.json.mjs.map +0 -1
- package/dist/esm/base64.mjs +0 -33
- package/dist/esm/base64.mjs.map +0 -1
- package/dist/esm/bundle.mjs +0 -36
- package/dist/esm/bundle.mjs.map +0 -1
- package/dist/esm/cache.mjs +0 -64
- package/dist/esm/cache.mjs.map +0 -1
- package/dist/esm/client.mjs +0 -2168
- package/dist/esm/client.mjs.map +0 -1
- package/dist/esm/crypto.mjs +0 -22
- package/dist/esm/crypto.mjs.map +0 -1
- package/dist/esm/eventtarget.mjs +0 -36
- package/dist/esm/eventtarget.mjs.map +0 -1
- package/dist/esm/fhirlexer/parse.mjs +0 -122
- package/dist/esm/fhirlexer/parse.mjs.map +0 -1
- package/dist/esm/fhirlexer/tokenize.mjs +0 -231
- package/dist/esm/fhirlexer/tokenize.mjs.map +0 -1
- package/dist/esm/fhirmapper/parse.mjs +0 -329
- package/dist/esm/fhirmapper/parse.mjs.map +0 -1
- package/dist/esm/fhirmapper/tokenize.mjs +0 -13
- package/dist/esm/fhirmapper/tokenize.mjs.map +0 -1
- package/dist/esm/fhirpath/atoms.mjs +0 -347
- package/dist/esm/fhirpath/atoms.mjs.map +0 -1
- package/dist/esm/fhirpath/date.mjs +0 -24
- package/dist/esm/fhirpath/date.mjs.map +0 -1
- package/dist/esm/fhirpath/functions.mjs +0 -1626
- package/dist/esm/fhirpath/functions.mjs.map +0 -1
- package/dist/esm/fhirpath/parse.mjs +0 -145
- package/dist/esm/fhirpath/parse.mjs.map +0 -1
- package/dist/esm/fhirpath/tokenize.mjs +0 -10
- package/dist/esm/fhirpath/tokenize.mjs.map +0 -1
- package/dist/esm/fhirpath/utils.mjs +0 -377
- package/dist/esm/fhirpath/utils.mjs.map +0 -1
- package/dist/esm/filter/parse.mjs +0 -101
- package/dist/esm/filter/parse.mjs.map +0 -1
- package/dist/esm/filter/tokenize.mjs +0 -16
- package/dist/esm/filter/tokenize.mjs.map +0 -1
- package/dist/esm/filter/types.mjs +0 -34
- package/dist/esm/filter/types.mjs.map +0 -1
- package/dist/esm/format.mjs +0 -390
- package/dist/esm/format.mjs.map +0 -1
- package/dist/esm/hl7.mjs +0 -242
- package/dist/esm/hl7.mjs.map +0 -1
- package/dist/esm/index.min.mjs +0 -1
- package/dist/esm/jwt.mjs +0 -30
- package/dist/esm/jwt.mjs.map +0 -1
- package/dist/esm/node_modules/tslib/package.json +0 -1
- package/dist/esm/outcomes.mjs +0 -295
- package/dist/esm/outcomes.mjs.map +0 -1
- package/dist/esm/readablepromise.mjs +0 -82
- package/dist/esm/readablepromise.mjs.map +0 -1
- package/dist/esm/schema.mjs +0 -417
- package/dist/esm/schema.mjs.map +0 -1
- package/dist/esm/search/details.mjs +0 -162
- package/dist/esm/search/details.mjs.map +0 -1
- package/dist/esm/search/match.mjs +0 -166
- package/dist/esm/search/match.mjs.map +0 -1
- package/dist/esm/search/search.mjs +0 -378
- package/dist/esm/search/search.mjs.map +0 -1
- package/dist/esm/sftp.mjs +0 -24
- package/dist/esm/sftp.mjs.map +0 -1
- package/dist/esm/storage.mjs +0 -95
- package/dist/esm/storage.mjs.map +0 -1
- package/dist/esm/types.mjs +0 -370
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/typeschema/types.mjs +0 -278
- package/dist/esm/typeschema/types.mjs.map +0 -1
- package/dist/esm/typeschema/validation.mjs +0 -262
- package/dist/esm/typeschema/validation.mjs.map +0 -1
- package/dist/esm/utils.mjs +0 -632
- package/dist/esm/utils.mjs.map +0 -1
package/dist/esm/utils.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/utils.ts"],"sourcesContent":["import {\n Attachment,\n CodeableConcept,\n Device,\n Extension,\n Identifier,\n ObservationDefinition,\n ObservationDefinitionQualifiedInterval,\n Patient,\n Practitioner,\n QuestionnaireResponse,\n QuestionnaireResponseItem,\n QuestionnaireResponseItemAnswer,\n Range,\n Reference,\n RelatedPerson,\n Resource,\n} from '@medplum/fhirtypes';\nimport { formatHumanName } from './format';\n\n/**\n * @internal\n */\nexport type ProfileResource = Patient | Practitioner | RelatedPerson;\n\ninterface Code {\n code?: CodeableConcept;\n}\n/**\n * @internal\n */\nexport type ResourceWithCode = Resource & Code;\n\n/**\n * Creates a reference resource.\n * @param resource The FHIR reesource.\n * @returns A reference resource.\n */\nexport function createReference<T extends Resource>(resource: T): Reference<T> {\n const reference = getReferenceString(resource);\n const display = getDisplayString(resource);\n return display === reference ? { reference } : { reference, display };\n}\n\n/**\n * Returns a reference string for a resource.\n * @param resource The FHIR resource.\n * @returns A reference string of the form resourceType/id.\n */\nexport function getReferenceString(resource: Resource): string {\n return resource.resourceType + '/' + resource.id;\n}\n\n/**\n * Returns the ID portion of a reference.\n * @param reference A FHIR reference.\n * @returns The ID portion of a reference.\n */\nexport function resolveId(reference: Reference | undefined): string | undefined {\n return reference?.reference?.split('/')[1];\n}\n\n/**\n * Returns true if the resource is a \"ProfileResource\".\n * @param resource The FHIR resource.\n * @returns True if the resource is a \"ProfileResource\".\n */\nexport function isProfileResource(resource: Resource): resource is ProfileResource {\n return (\n resource.resourceType === 'Patient' ||\n resource.resourceType === 'Practitioner' ||\n resource.resourceType === 'RelatedPerson'\n );\n}\n\n/**\n * Returns a display string for the resource.\n * @param resource The input resource.\n * @returns Human friendly display string.\n */\nexport function getDisplayString(resource: Resource): string {\n if (isProfileResource(resource)) {\n const profileName = getProfileResourceDisplayString(resource);\n if (profileName) {\n return profileName;\n }\n }\n if (resource.resourceType === 'Device') {\n const deviceName = getDeviceDisplayString(resource);\n if (deviceName) {\n return deviceName;\n }\n }\n if (resource.resourceType === 'Observation') {\n if ('code' in resource && resource.code?.text) {\n return resource.code.text;\n }\n }\n if (resource.resourceType === 'User') {\n if (resource.email) {\n return resource.email;\n }\n }\n if ('name' in resource && resource.name && typeof resource.name === 'string') {\n return resource.name;\n }\n return getReferenceString(resource);\n}\n\n/**\n * Returns a display string for a profile resource if one is found.\n * @param resource The profile resource.\n * @returns The display name if one is found.\n */\nfunction getProfileResourceDisplayString(resource: ProfileResource): string | undefined {\n const names = resource.name;\n if (names && names.length > 0) {\n return formatHumanName(names[0]);\n }\n return undefined;\n}\n\n/**\n * Returns a display string for a device resource if one is found.\n * @param device The device resource.\n * @returns The display name if one is found.\n */\nfunction getDeviceDisplayString(device: Device): string | undefined {\n const names = device.deviceName;\n if (names && names.length > 0) {\n return names[0].name;\n }\n return undefined;\n}\n\n/**\n * Returns an image URL for the resource, if one is available.\n * @param resource The input resource.\n * @returns The image URL for the resource or undefined.\n */\nexport function getImageSrc(resource: Resource): string | undefined {\n if (!('photo' in resource)) {\n return undefined;\n }\n\n const photo = resource.photo;\n if (!photo) {\n return undefined;\n }\n\n if (Array.isArray(photo)) {\n for (const p of photo) {\n const url = getPhotoImageSrc(p);\n if (url) {\n return url;\n }\n }\n } else {\n return getPhotoImageSrc(photo);\n }\n\n return undefined;\n}\n\nfunction getPhotoImageSrc(photo: Attachment): string | undefined {\n if (photo.url && photo.contentType && photo.contentType.startsWith('image/')) {\n return photo.url;\n }\n return undefined;\n}\n\n/**\n * Returns a Date property as a Date.\n * When working with JSON objects, Dates are often serialized as ISO-8601 strings.\n * When that happens, we need to safely convert to a proper Date object.\n * @param date The date property value, which could be a string or a Date object.\n * @returns A Date object.\n */\nexport function getDateProperty(date: string | undefined): Date | undefined {\n return date ? new Date(date) : undefined;\n}\n\n/**\n * Calculates the age in years from the birth date.\n * @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.\n * @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.\n * @returns The age in years, months, and days.\n */\nexport function calculateAge(\n birthDateStr: string,\n endDateStr?: string\n): { years: number; months: number; days: number } {\n const startDate = new Date(birthDateStr);\n startDate.setUTCHours(0, 0, 0, 0);\n\n const endDate = endDateStr ? new Date(endDateStr) : new Date();\n endDate.setUTCHours(0, 0, 0, 0);\n\n const startYear = startDate.getUTCFullYear();\n const startMonth = startDate.getUTCMonth();\n const startDay = startDate.getUTCDate();\n\n const endYear = endDate.getUTCFullYear();\n const endMonth = endDate.getUTCMonth();\n const endDay = endDate.getUTCDate();\n\n let years = endYear - startYear;\n if (endMonth < startMonth || (endMonth === startMonth && endDay < startDay)) {\n years--;\n }\n\n let months = endYear * 12 + endMonth - (startYear * 12 + startMonth);\n if (endDay < startDay) {\n months--;\n }\n\n const days = Math.floor((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));\n\n return { years, months, days };\n}\n\n/**\n * Calculates the age string for display using the age appropriate units.\n * If the age is greater than or equal to 2 years, then the age is displayed in years.\n * If the age is greater than or equal to 1 month, then the age is displayed in months.\n * Otherwise, the age is displayed in days.\n * @param birthDateStr The birth date or start date in ISO-8601 format YYYY-MM-DD.\n * @param endDateStr Optional end date in ISO-8601 format YYYY-MM-DD. Default value is today.\n * @returns The age string.\n */\nexport function calculateAgeString(birthDateStr: string, endDateStr?: string): string | undefined {\n const { years, months, days } = calculateAge(birthDateStr, endDateStr);\n if (years >= 2) {\n return years.toString().padStart(3, '0') + 'Y';\n } else if (months >= 1) {\n return months.toString().padStart(3, '0') + 'M';\n } else {\n return days.toString().padStart(3, '0') + 'D';\n }\n}\n\n/**\n * Returns all questionnaire answers as a map by link ID.\n * @param response The questionnaire response resource.\n * @returns Questionnaire answers mapped by link ID.\n */\nexport function getQuestionnaireAnswers(\n response: QuestionnaireResponse\n): Record<string, QuestionnaireResponseItemAnswer> {\n const result: Record<string, QuestionnaireResponseItemAnswer> = {};\n buildQuestionnaireAnswerItems(response.item, result);\n return result;\n}\n\n/**\n * Recursively builds the questionnaire answer items map.\n * @param items The current questionnaire response items.\n * @param result The cumulative result map.\n */\nfunction buildQuestionnaireAnswerItems(\n items: QuestionnaireResponseItem[] | undefined,\n result: Record<string, QuestionnaireResponseItemAnswer>\n): void {\n if (items) {\n for (const item of items) {\n if (item.linkId && item.answer && item.answer.length > 0) {\n result[item.linkId] = item.answer[0];\n }\n buildQuestionnaireAnswerItems(item.item, result);\n }\n }\n}\n\n/**\n * Returns the resource identifier for the given system.\n *\n * If multiple identifiers exist with the same system, the first one is returned.\n *\n * If the system is not found, then returns undefined.\n * @param resource The resource to check.\n * @param system The identifier system.\n * @returns The identifier value if found; otherwise undefined.\n */\nexport function getIdentifier(resource: Resource, system: string): string | undefined {\n const identifiers = (resource as any).identifier as Identifier[] | Identifier | undefined;\n if (!identifiers) {\n return undefined;\n }\n const array = Array.isArray(identifiers) ? identifiers : [identifiers];\n for (const identifier of array) {\n if (identifier.system === system) {\n return identifier.value;\n }\n }\n return undefined;\n}\n\n/**\n * Returns an extension value by extension URLs.\n * @param resource The base resource.\n * @param urls Array of extension URLs. Each entry represents a nested extension.\n * @returns The extension value if found; undefined otherwise.\n */\nexport function getExtensionValue(resource: any, ...urls: string[]): string | undefined {\n // Let curr be the current resource or extension. Extensions can be nested.\n let curr: any = resource;\n\n // For each of the urls, try to find a matching nested extension.\n for (let i = 0; i < urls.length && curr; i++) {\n curr = (curr?.extension as Extension[] | undefined)?.find((e) => e.url === urls[i]);\n }\n\n return curr?.valueString as string | undefined;\n}\n\n/**\n * Returns an extension by extension URLs.\n * @param resource The base resource.\n * @param urls Array of extension URLs. Each entry represents a nested extension.\n * @returns The extension object if found; undefined otherwise.\n */\nexport function getExtension(resource: any, ...urls: string[]): Extension | undefined {\n // Let curr be the current resource or extension. Extensions can be nested.\n let curr: any = resource;\n\n // For each of the urls, try to find a matching nested extension.\n for (let i = 0; i < urls.length && curr; i++) {\n curr = (curr?.extension as Extension[] | undefined)?.find((e) => e.url === urls[i]);\n }\n\n return curr as Extension | undefined;\n}\n\n/**\n * FHIR JSON stringify.\n * Removes properties with empty string values.\n * Removes objects with zero properties.\n * See: https://www.hl7.org/fhir/json.html\n * @param value The input value.\n * @param pretty Optional flag to pretty-print the JSON.\n * @returns The resulting JSON string.\n */\nexport function stringify(value: any, pretty?: boolean): string {\n return JSON.stringify(value, stringifyReplacer, pretty ? 2 : undefined);\n}\n\n/**\n * Evaluates JSON key/value pairs for FHIR JSON stringify.\n * Removes properties with empty string values.\n * Removes objects with zero properties.\n * @param k Property key.\n * @param v Property value.\n * @returns The replaced value.\n */\nfunction stringifyReplacer(k: string, v: any): any {\n return !isArrayKey(k) && isEmpty(v) ? undefined : v;\n}\n\n/**\n * Returns true if the key is an array key.\n * @param k The property key.\n * @returns True if the key is an array key.\n */\nfunction isArrayKey(k: string): boolean {\n return !!k.match(/\\d+$/);\n}\n\n/**\n * Returns true if the value is empty (null, undefined, empty string, or empty object).\n * @param v Any value.\n * @returns True if the value is an empty string or an empty object.\n */\nexport function isEmpty(v: any): boolean {\n if (v === null || v === undefined) {\n return true;\n }\n const t = typeof v;\n return (t === 'string' && v === '') || (t === 'object' && Object.keys(v).length === 0);\n}\n\n/**\n * Resource equality.\n * Ignores meta.versionId and meta.lastUpdated.\n * @param object1 The first object.\n * @param object2 The second object.\n * @param path Optional path string.\n * @returns True if the objects are equal.\n */\nexport function deepEquals(object1: unknown, object2: unknown, path?: string): boolean {\n if (object1 === object2) {\n return true;\n }\n if (isEmpty(object1) && isEmpty(object2)) {\n return true;\n }\n if (isEmpty(object1) || isEmpty(object2)) {\n return false;\n }\n if (Array.isArray(object1) && Array.isArray(object2)) {\n return deepEqualsArray(object1, object2);\n }\n if (Array.isArray(object1) || Array.isArray(object2)) {\n return false;\n }\n if (isObject(object1) && isObject(object2)) {\n return deepEqualsObject(object1, object2, path);\n }\n if (isObject(object1) || isObject(object2)) {\n return false;\n }\n return false;\n}\n\nfunction deepEqualsArray(array1: unknown[], array2: unknown[]): boolean {\n if (array1.length !== array2.length) {\n return false;\n }\n for (let i = 0; i < array1.length; i++) {\n if (!deepEquals(array1[i], array2[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction deepEqualsObject(\n object1: Record<string, unknown>,\n object2: Record<string, unknown>,\n path: string | undefined\n): boolean {\n const keySet = new Set<string>();\n Object.keys(object1).forEach((k) => keySet.add(k));\n Object.keys(object2).forEach((k) => keySet.add(k));\n if (path === 'meta') {\n keySet.delete('versionId');\n keySet.delete('lastUpdated');\n keySet.delete('author');\n }\n for (const key of keySet) {\n const val1 = object1[key];\n const val2 = object2[key];\n if (!deepEquals(val1, val2, key)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Creates a deep clone of the input value.\n *\n * Limitations:\n * - Only supports JSON primitives and arrays.\n * - Does not support Functions, lambdas, etc.\n * - Does not support circular references.\n *\n * See: https://web.dev/structured-clone/\n * See: https://stackoverflow.com/questions/40488190/how-is-structured-clone-algorithm-different-from-deep-copy\n * @param input The input to clone.\n * @returns A deep clone of the input.\n */\nexport function deepClone<T>(input: T): T {\n return JSON.parse(JSON.stringify(input)) as T;\n}\n\n/**\n * Returns true if the input string is a UUID.\n * @param input The input string.\n * @returns True if the input string matches the UUID format.\n */\nexport function isUUID(input: string): boolean {\n return !!input.match(/^\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$/i);\n}\n\n/**\n * Returns true if the input is an object.\n * @param obj The candidate object.\n * @returns True if the input is a non-null non-undefined object.\n */\nexport function isObject(obj: unknown): obj is Record<string, unknown> {\n return obj !== null && typeof obj === 'object';\n}\n\n/**\n * Returns true if the input array is an array of strings.\n * @param arr Input array.\n * @returns True if the input array is an array of strings.\n */\nexport function isStringArray(arr: any[]): arr is string[] {\n return arr.every((e) => typeof e === 'string');\n}\n\n// Precompute hex octets\n// See: https://stackoverflow.com/a/55200387\nconst byteToHex: string[] = [];\nfor (let n = 0; n < 256; n++) {\n byteToHex.push(n.toString(16).padStart(2, '0'));\n}\n\n/**\n * Converts an ArrayBuffer to hex string.\n * See: https://stackoverflow.com/a/55200387\n * @param arrayBuffer The input array buffer.\n * @returns The resulting hex string.\n */\nexport function arrayBufferToHex(arrayBuffer: ArrayBuffer): string {\n const bytes = new Uint8Array(arrayBuffer);\n const result: string[] = new Array(bytes.length);\n for (let i = 0; i < bytes.length; i++) {\n result[i] = byteToHex[bytes[i]];\n }\n return result.join('');\n}\n\n/**\n * Converts an ArrayBuffer to a base-64 encoded string.\n * @param arrayBuffer The input array buffer.\n * @returns The base-64 encoded string.\n */\nexport function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string {\n const bytes = new Uint8Array(arrayBuffer);\n const result: string[] = [];\n for (let i = 0; i < bytes.length; i++) {\n result[i] = String.fromCharCode(bytes[i]);\n }\n return window.btoa(result.join(''));\n}\n\nexport function capitalize(word: string): string {\n return word.charAt(0).toUpperCase() + word.substring(1);\n}\n\nexport function isLowerCase(c: string): boolean {\n return c === c.toLowerCase() && c !== c.toUpperCase();\n}\n\n/**\n * Tries to find a code string for a given system within a given codeable concept.\n * @param concept The codeable concept.\n * @param system The system string.\n * @returns The code if found; otherwise undefined.\n */\nexport function getCodeBySystem(concept: CodeableConcept, system: string): string | undefined {\n return concept.coding?.find((coding) => coding.system === system)?.code;\n}\n\n/**\n * Sets a code for a given system within a given codeable concept.\n * @param concept The codeable concept.\n * @param system The system string.\n * @param code The code value.\n */\nexport function setCodeBySystem(concept: CodeableConcept, system: string, code: string): void {\n if (!concept.coding) {\n concept.coding = [];\n }\n const coding = concept.coding.find((c) => c.system === system);\n if (coding) {\n coding.code = code;\n } else {\n concept.coding.push({ system, code });\n }\n}\n\n/**\n * Tries to find an observation interval for the given patient and value.\n * @param definition The observation definition.\n * @param patient The patient.\n * @param value The observation value.\n * @param category Optional interval category restriction.\n * @returns The observation interval if found; otherwise undefined.\n */\nexport function findObservationInterval(\n definition: ObservationDefinition,\n patient: Patient,\n value: number,\n category?: 'reference' | 'critical' | 'absolute'\n): ObservationDefinitionQualifiedInterval | undefined {\n return definition.qualifiedInterval?.find(\n (interval) =>\n observationIntervalMatchesPatient(interval, patient) &&\n observationIntervalMatchesValue(interval, value, definition.quantitativeDetails?.decimalPrecision) &&\n (category === undefined || interval.category === category)\n );\n}\n\n/**\n * Tries to find an observation reference range for the given patient and condition names.\n * @param definition The observation definition.\n * @param patient The patient.\n * @param names The condition names.\n * @returns The observation interval if found; otherwise undefined.\n */\nexport function findObservationReferenceRange(\n definition: ObservationDefinition,\n patient: Patient,\n names: string[]\n): ObservationDefinitionQualifiedInterval | undefined {\n return definition.qualifiedInterval?.find(\n (interval) => observationIntervalMatchesPatient(interval, patient) && names.includes(interval.condition as string)\n );\n}\n\n/**\n * Returns true if the patient matches the observation interval.\n * @param interval The observation interval.\n * @param patient The patient.\n * @returns True if the patient matches the observation interval.\n */\nfunction observationIntervalMatchesPatient(\n interval: ObservationDefinitionQualifiedInterval,\n patient: Patient\n): boolean {\n return observationIntervalMatchesGender(interval, patient) && observationIntervalMatchesAge(interval, patient);\n}\n\n/**\n * Returns true if the patient gender matches the observation interval.\n * @param interval The observation interval.\n * @param patient The patient.\n * @returns True if the patient gender matches the observation interval.\n */\nfunction observationIntervalMatchesGender(interval: ObservationDefinitionQualifiedInterval, patient: Patient): boolean {\n return !interval.gender || interval.gender === patient.gender;\n}\n\n/**\n * Returns true if the patient age matches the observation interval.\n * @param interval The observation interval.\n * @param patient The patient.\n * @returns True if the patient age matches the observation interval.\n */\nfunction observationIntervalMatchesAge(interval: ObservationDefinitionQualifiedInterval, patient: Patient): boolean {\n return !interval.age || matchesRange(calculateAge(patient.birthDate as string).years, interval.age);\n}\n\n/**\n * Returns true if the value matches the observation interval.\n * @param interval The observation interval.\n * @param value The observation value.\n * @param precision Optional precision in number of digits.\n * @returns True if the value matches the observation interval.\n */\nfunction observationIntervalMatchesValue(\n interval: ObservationDefinitionQualifiedInterval,\n value: number,\n precision?: number\n): boolean {\n return !!interval.range && matchesRange(value, interval.range, precision);\n}\n\n/**\n * Returns true if the value is in the range accounting for precision.\n * @param value The numeric value.\n * @param range The numeric range.\n * @param precision Optional precision in number of digits.\n * @returns True if the value is within the range.\n */\nexport function matchesRange(value: number, range: Range, precision?: number): boolean {\n return (\n (range.low?.value === undefined || preciseGreaterThanOrEquals(value, range.low.value, precision)) &&\n (range.high?.value === undefined || preciseLessThanOrEquals(value, range.high.value, precision))\n );\n}\n\n/**\n * Returns the input number rounded to the specified number of digits.\n * @param a The input number.\n * @param precision The precision in number of digits.\n * @returns The number rounded to the specified number of digits.\n */\nexport function preciseRound(a: number, precision: number): number {\n return parseFloat(a.toFixed(precision));\n}\n\n/**\n * Returns true if the two numbers are equal to the given precision.\n * @param a The first number.\n * @param b The second number.\n * @param precision Optional precision in number of digits.\n * @returns True if the two numbers are equal to the given precision.\n */\nexport function preciseEquals(a: number, b: number, precision?: number): boolean {\n return toPreciseInteger(a, precision) === toPreciseInteger(b, precision);\n}\n\n/**\n * Returns true if the first number is less than the second number to the given precision.\n * @param a The first number.\n * @param b The second number.\n * @param precision Optional precision in number of digits.\n * @returns True if the first number is less than the second number to the given precision.\n */\nexport function preciseLessThan(a: number, b: number, precision?: number): boolean {\n return toPreciseInteger(a, precision) < toPreciseInteger(b, precision);\n}\n\n/**\n * Returns true if the first number is greater than the second number to the given precision.\n * @param a The first number.\n * @param b The second number.\n * @param precision Optional precision in number of digits.\n * @returns True if the first number is greater than the second number to the given precision.\n */\nexport function preciseGreaterThan(a: number, b: number, precision?: number): boolean {\n return toPreciseInteger(a, precision) > toPreciseInteger(b, precision);\n}\n\n/**\n * Returns true if the first number is less than or equal to the second number to the given precision.\n * @param a The first number.\n * @param b The second number.\n * @param precision Optional precision in number of digits.\n * @returns True if the first number is less than or equal to the second number to the given precision.\n */\nexport function preciseLessThanOrEquals(a: number, b: number, precision?: number): boolean {\n return toPreciseInteger(a, precision) <= toPreciseInteger(b, precision);\n}\n\n/**\n * Returns true if the first number is greater than or equal to the second number to the given precision.\n * @param a The first number.\n * @param b The second number.\n * @param precision Optional precision in number of digits.\n * @returns True if the first number is greater than or equal to the second number to the given precision.\n */\nexport function preciseGreaterThanOrEquals(a: number, b: number, precision?: number): boolean {\n return toPreciseInteger(a, precision) >= toPreciseInteger(b, precision);\n}\n\n/**\n * Returns an integer representation of the number with the given precision.\n * For example, if precision is 2, then 1.2345 will be returned as 123.\n * @param a The number.\n * @param precision Optional precision in number of digits.\n * @returns The integer with the given precision.\n */\nfunction toPreciseInteger(a: number, precision?: number): number {\n if (precision === undefined) {\n return a;\n }\n return Math.round(a * Math.pow(10, precision));\n}\n\n/**\n * Finds the first resource in the input array that matches the specified code and system.\n * @param resources - The array of resources to search.\n * @param code - The code to search for.\n * @param system - The system to search for.\n * @returns The first resource in the input array that matches the specified code and system, or undefined if no such resource is found.\n */\nexport function findResourceByCode(\n resources: ResourceWithCode[],\n code: CodeableConcept | string,\n system: string\n): ResourceWithCode | undefined {\n return resources.find((r) =>\n typeof code === 'string'\n ? getCodeBySystem(r.code || {}, system) === code\n : getCodeBySystem(r.code || {}, system) === getCodeBySystem(code, system)\n );\n}\n"],"names":[],"mappings":";;AAiCA;;;;AAIG;AACG,SAAU,eAAe,CAAqB,QAAW,EAAA;AAC7D,IAAA,MAAM,SAAS,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAC/C,IAAA,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AAC3C,IAAA,OAAO,OAAO,KAAK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