Common CQL Artifacts for FHIR (US-Based)
2.0.0-cibuild - Informative 2 - CI Build
Common CQL Artifacts for FHIR (US-Based), published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 2.0.0-cibuild built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/us-cql-ig/ and changes regularly. See the Directory of published versions
| Official URL: http://hl7.org/fhir/us/cql/Library/USCoreElements | Version: 2.0.0-cibuild | ||||
| Standards status: Informative | Maturity Level: 3 | Computable Name: USCoreElements | |||
A library of expressions, functions, and terminology declarations for use with FHIR in the US Realm.
Exception generating Narrative: Unable to Parse HTML - node 'code' has unexpected content '"' (last text = 'library USCoreElements version '2.0.0-cibuild' using FHIR version '4.0.1' using USCore version '6.1.0-derived' include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' include hl7.fhir.uv.cql.FHIRCommon version '2.0.0' include USCoreCommon version '2.0.0-cibuild' called UC codesystem "LOINC": 'http://loinc.org' codesystem "Identifier Type": 'http://terminology.hl7.org/CodeSystem/v2-0203' codesystem "Verification Status": 'http://terminology.hl7.org/CodeSystem/condition-ver-status' codesystem "Condition Clinical": 'http://terminology.hl7.org/CodeSystem/condition-clinical' valueset "Common allergy substances": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1186.8' code "No known allergy (situation)": '716186003' from FHIRCommon.SNOMEDCT code "Member Number": 'MB' from "Identifier Type" code "Subscriber Number": 'SN' from "Identifier Type" code "Body surface area": '8277-6' from "LOINC" display 'Body surface area' code "Confirmed": 'confirmed' from "Verification Status" code "Active": 'active' from "Condition Clinical" context Patient // Patient Patterns /* @description: Returns the age in days of the patient as of the given date, using birth time if known @comment: This function returns the number of whole days between the patient birth date and the asOf date. If the patient has a birthTime, the calculation is performed using the birthDateTime, and the time component of the asOf parameter is considered. Note that when the birth time is known, timezone offset normalization will be used. */ define fluent function ageInDaysAt(patient Patient, asOf DateTime): if patient.birthTime() is not null then CalculateAgeInDaysAt(patient.birthDateTime(), asOf) else CalculateAgeInDaysAt(patient.birthDate, date from asOf) /* @description: Returns the current age in days of the patient, using birth time if known @comment: This function returns the number of whole days between the patient birth date and the current date. If the patient has a birthTime, the calculation is performed using the birthDateTime and Now(), otherwise the calculation is performed using Today(). Note that when the birth time is known, timezone offset normalization will be used. */ define fluent function ageInDays(patient Patient): if patient.birthTime() is not null then CalculateAgeInDaysAt(patient.birthDateTime(), Now()) else CalculateAgeInDaysAt(patient.birthDate, Today()) /* @description: Returns the age in months of the patient as of the given date, using birth time if known @comment: This function returns the number of whole calendar months between the patient birth date and the asOf date. If the patient has a birthTime, the calculation is performed using the birthDateTime, and the time component of the asOf parameter is considered. Note that when the birth time is known, timezone offset normalization will be used. */ define fluent function ageInMonthsAt(patient Patient, asOf DateTime): if patient.birthTime() is not null then CalculateAgeInMonthsAt(patient.birthDateTime(), asOf) else CalculateAgeInMonthsAt(patient.birthDate, date from asOf) /* @description: Returns the current age in months of the patient, using birth time if known @comment: This function returns the number of whole calendar months between the patient birth date and the current date. If the patient has a birthTime, the calculation is performed using the birthDateTime and Now(), otherwise the calculation is performed using Today(). Note that when the birth time is known, timezone offset normalization will be used. */ define fluent function ageInMonths(patient Patient): if patient.birthTime() is not null then CalculateAgeInMonthsAt(patient.birthDateTime(), Now()) else CalculateAgeInMonthsAt(patient.birthDate, Today()) /* @description: Returns the age in years of the patient, as of the given date @comment: This function returns the number of whole calendar years between the patient birth date and the given date. Regardless of whether the patient has a birthTime, the calculation is performed using only the birth date. If the given date has a time component, it is ignored, on the grounds that birth time is almost universally not considered when determining age in years. */ define fluent function ageInYearsAt(patient Patient, asOf DateTime): CalculateAgeInYearsAt(patient.birthDate, date from asOf) /* @description: Returns the current age in years of the patient @comment: This function returns the number of whole calendar years between the patient birth date and the current date. Regardless of whether the patient has a birthTime, the calculation is performed using only the birth date and Today(), on the grounds that birth time is almost universally not considered when determining age in years. */ define fluent function ageInYears(patient Patient): CalculateAgeInYearsAt(patient.birthDate, Today()) /* @description: Returns the first official, usual, or other name @comment: This function returns the first _official_ name if present, otherwise the first _usual_ name, otherwise the first non-official, non-usual name. In each case, the function returns the most recent name that either has no period specified, or has a period overlapping today. */ define fluent function name(patient Patient): Coalesce(patient.officialName(), patient.usualName(), patient.firstNonOfficialNonUsualName()) /* @description: Returns the first usual name @comment: This function returns the first _usual_ name for a patient. The most recent name entry is return that either has no period specified, or has a period overlapping today. */ define fluent function usualName(patient Patient): First( patient.name patientName where patientName.use ~ 'usual' and patientName.period is not null implies patientName.period includes Today() sort by start of period desc ) /* @description: Returns the first officiel name @comment: This function returns the first _official_ name for a patient. The most recent name entry is return that either has no period specified, or has a period overlapping today. */ define fluent function officialName(patient Patient): First( patient.name patientName where patientName.use ~ 'official' and patientName.period is not null implies patientName.period includes Today() sort by start of period desc ) /* @description: Returns the first non-official, non-usual name @comment: This function returns the first non-official, non-usual name for a patient. The most recent name entry is return that either has no period specified, or has a period overlapping today. */ define fluent function firstNonOfficialNonUsualName(patient Patient): First( patient.name patientName where not(patientName.use ~ 'official') and not(patientName.use ~ 'usual') and patientName.period is not null implies patientName.period includes Today() sort by start of period desc ) define fluent function memberID(coverage FHIR.Coverage): coverage.identifier.where(type ~ "Member Number").single().value define fluent function policyNumber(coverage FHIR.Coverage): singleton from ( coverage.identifier I where I.type ~ "Subscriber Number" ).value define fluent function medicalRecordNumber(patient Patient): patient.identifier.where(type ~ UC.MedicalRecordNumber).single().value /* @description: Returns the first official, usual, or other name @comment: This function returns the first _official_ name if present, otherwise the first _usual_ name, otherwise the first non-official, non-usual name. In each case, the function returns the most recent name that either has no period specified, or has a period overlapping today. */ define fluent function name(practitioner Practitioner): Coalesce(practitioner.officialName(), practitioner.usualName(), practitioner.firstNonOfficialNonUsualName()) /* @description: Returns the first usual name @comment: This function returns the first _usual_ name for a practitioner. The most recent name entry is return that either has no period specified, or has a period overlapping today. */ define fluent function usualName(practitioner Practitioner): First( practitioner.name practitionerName where practitionerName.use ~ 'usual' and practitionerName.period is not null implies practitionerName.period includes Today() sort by start of period desc ) /* @description: Returns the first officiel name @comment: This function returns the first _official_ name for a practitioner. The most recent name entry is return that either has no period specified, or has a period overlapping today. */ define fluent function officialName(practitioner Practitioner): First( practitioner.name practitionerName where practitionerName.use ~ 'official' and practitionerName.period is not null implies practitionerName.period includes Today() sort by start of period desc ) /* @description: Returns the first non-official, non-usual name @comment: This function returns the first non-official, non-usual name for a practitioner. The most recent name entry is return that either has no period specified, or has a period overlapping today. */ define fluent function firstNonOfficialNonUsualName(practitioner Practitioner): First( practitioner.name practitionerName where not(practitionerName.use ~ 'official') and not(practitionerName.use ~ 'usual') and practitionerName.period is not null implies practitionerName.period includes Today() sort by start of period desc ) define fluent function mobile(patient Patient): First( patient.telecom telecom where telecom.use = 'mobile' and telecom.period is not null implies telecom.period includes Today() sort by start of period desc ) define fluent function mobile(practitioner Practitioner): First( practitioner.telecom telecom where telecom.use = 'mobile' and telecom.period is not null implies telecom.period includes Today() sort by start of period desc ) define fluent function work(organization Organization): First( organization.telecom telecom where telecom.use = 'work' and telecom.period is not null implies telecom.period includes Today() sort by start of period desc ) define fluent function firstName(name HumanName): name.given.first() define fluent function middleNames(name HumanName): Combine(Skip(name.given, 1), ' ') define fluent function lastName(name HumanName): name.family define fluent function firstMiddleLast(name HumanName): Combine(name.given, ' ') + ' ' + name.family define fluent function lastFirstMiddle(name HumanName): name.family + ', ' + Combine(name.given, ' ') // Allergy/Intolerance /* @description: Returns all allergies and intolerances @comment: This definition returns all allergies and intolerances conforming to the US Core 7.0.0 [AllergyIntolerance](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-allergyintolerance.html) profile. Allergies and intolerances returned by this definition include records with any clinical status (including none) and any verification status (including none). @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance */ define "All Allergies and Intolerances": [USCore."AllergyIntolerance"] define "Active Confirmed Allergies and Intolerances": "All Allergies and Intolerances".active().confirmed() define "Common Allergies and Intolerances": "All Allergies and Intolerances" A where A.code in "Common allergy substances" define "Active Confirmed Common Allergies and Intolerances": "Common Allergies and Intolerances".active().confirmed() // No Known Allergies (Not Asked) define "No Known Allergies (Not Asked)": "All Allergies and Intolerances" A where A.code ~ "No known allergy (situation)" and A.isActive() and A.isUnconfirmed() // No Known Allergies (Confirmed) define "No Known Allergies (Confirmed)": "All Allergies and Intolerances" A where A.code ~ "No known allergy (situation)" and A.isActive() and A.isConfirmed() // Condition /* @description: Returns all problem list items, encounter diagnoses, and health concerns @comment: This definition returns all conditions of any category. [Condition Encounter Diagnosis](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-condition-encounter-diagnosis.html) [Condition Problems and Health Concerns](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-condition-problems-health-concerns.html) Conditions returned by this definition include records with any clinical status (including none) and any verification status (including none). @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition */ define "All Conditions": [FHIR."Condition"] define "All Problem List Items": "All Conditions" C where C.isProblemListItem() define "Active Confirmed Problem List Items": "All Problem List Items".active().confirmed() define "All Encounter Diagnoses": "All Conditions" C where C.isEncounterDiagnosis() define "All Health Concerns": "All Conditions" C where C.isHealthConcern() // Laboratory Diagnostic Report /* @comment: [Diagnostic Report for Laboratory Results](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-diagnosticreport-lab.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab */ define "All Diagnostic Reports for Laboratory Results": ["DiagnosticReportProfileLaboratoryReporting"] // Diagnostic Report /* @comment: [Diagnostic Report Note](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-diagnosticreport-note.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-note */ define "All Diagnostic Report Notes": ["DiagnosticReportProfileNoteExchange"] // Encounter /* @comment: [Encounter](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-encounter.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter */ define "All Encounters": ["EncounterProfile"] define "All Performed Encounters": "All Encounters" E where E.status = 'finished' // Immunization /* @comment: [Immunization](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-immunization.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization */ define "All Immunizations": ["ImmunizationProfile"] define "All Completed Immunizations": "All Immunizations" I where I.status = 'completed' // Implantable Device /* @comment: [Implantable Device](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-implantable-device.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-implantable-device */ define "All Implantable Devices": ["ImplantableDeviceProfile"] // Laboratory Result /* @description: Returns all laboratory results @comment: [Laboratory Result](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-observation-lab.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab */ define "All Laboratory Results": ["LaboratoryResultObservationProfile"] define "Resulted Laboratory Results": "All Laboratory Results" L where L.status in { 'preliminary', 'final', 'amended', 'corrected' } // Medication Request /* @description: Returns all medication requests @comment: [Medication Request](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-medicationrequest.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest */ define "Most Recent Medication Request": "All Medication Requests".mostRecent() define "All Medication Requests": ["MedicationRequestProfile"] define "Active Medication Orders": "All Medication Requests" M where M.status = 'active' and M.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' } define "All Medications": ["MedicationProfile"] // Pediatric BMI for Age /* @comment: [Pediatric BMI for Age](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-pediatric-bmi-for-age.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age */ define "Pediatric BMI for Age": (("Pediatric BMI for Age All Statuses").resulted()) O return O as "PediatricBMIforAgeObservationProfile" /* @comment: [Pediatric BMI for Age](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-pediatric-bmi-for-age.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/pediatric-bmi-for-age */ define "Pediatric BMI for Age All Statuses": ["PediatricBMIforAgeObservationProfile"] // Pediatric Head Circumference Percentile /* @comment: [Pediatric Head Circumference Percentile](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-head-occipital-frontal-circumference-percentile.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile */ define "Pediatric Head Circumference Percentile": (("Pediatric Head Circumference Percentile All Statuses").resulted()) O return O as "PediatricHeadOccipitalFrontalCircumferencePercentileProfile" /* @comment: [Pediatric Head Circumference Percentile](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-head-occipital-frontal-circumference-percentile.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/head-occipital-frontal-circumference-percentile */ define "Pediatric Head Circumference Percentile All Statuses": ["PediatricHeadOccipitalFrontalCircumferencePercentileProfile"] // Pediatric Weight for Height /* @comment: [Pediatric Weight for Height](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-pediatric-weight-for-height.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height */ define "Pediatric Weight for Height": (("Pediatric Weight for Height All Statuses").resulted()) O return O as "PediatricWeightForHeightObservationProfile" /* @comment: [Pediatric Weight for Height](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-pediatric-weight-for-height.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height */ define "Pediatric Weight for Height All Statuses": ["PediatricWeightForHeightObservationProfile"] // Procedure /* @comment: [Procedure](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-procedure.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure */ define "All Procedures": ["ProcedureProfile"] P where P.status in { 'preparation', 'in-progress', 'on-hold', 'completed' } define "All Performed Procedures": "All Procedures" P where P.status = 'completed' // Pulse Oximetry /* @comment: [Pulse Oximetry](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-pulse-oximetry.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry */ define "Pulse Oximetry": (("Pulse Oximetry All Statuses").resulted()) O return O as "PulseOximetryProfile" /* @comment: [Pulse Oximetry](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-pulse-oximetry.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry */ define "Pulse Oximetry All Statuses": ["PulseOximetryProfile"] // Smoking Status /* @description: Returns all resulted smoking status observations @comment: This definition returns all smoking status observations conforming to the US Core 6.1.0 [Smoking Status](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-smokingstatus.html) profile. @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus */ define "Smoking Status": (("Smoking Status All Statuses").resulted()) O return O as "SmokingStatusProfile" /* @description: Returns all smoking status observations @comment: This definition returns all smoking status observations conforming to the US Core 6.1.0 [Smoking Status](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-smokingstatus.html) profile. @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus */ define "Smoking Status All Statuses": ["SmokingStatusProfile"] /* @description: Returns the most recent smoking status @comment: This definition returns the most recent (by issued time) smoking status observation conforming to the US Core [Smoking Status](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-smokingstatus.html) profile. */ define "Most Recent Smoking Status": Last( "Smoking Status" SS where SS.status = 'final' sort by issued ) // Vital Signs /* @comment: [Vital Signs Panel](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-vital-signs.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-vital-signs */ define "All Vital Signs": (("All Vital Signs All Statuses").resulted()) O return O as "Vital Signs Profile" /* @comment: [Vital Signs Panel](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-vital-signs.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-vital-signs */ define "All Vital Signs All Statuses": ["Vital Signs Profile"] // Respiratory Rate /* @comment: [Respiratory Rate](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-respiratory-rate.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate */ define "All Respiratory Rate Measurements": (("All Respiratory Rate Measurements All Statuses").resulted()) O return O as "Respiratory Rate Profile" /* @comment: [Respiratory Rate](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-respiratory-rate.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate */ define "All Respiratory Rate Measurements All Statuses": ["Respiratory Rate Profile"] // Heart Rate /* @comment: [Heart Rate](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-heart-rate.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate */ define "All Heart Rate Measurements": (("All Heart Rate Measurements All Statuses").resulted()) O return O as "Heart Rate Profile" /* @comment: [Heart Rate](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-heart-rate.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate */ define "All Heart Rate Measurements All Statuses": ["Heart Rate Profile"] // Body Temperature /* @comment: [Body Temperature](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-body-temperature.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature */ define "All Body Temperature Measurements": (("All Body Temperature Measurements All Statuses").resulted()) O return O as "Body Temperature Profile" /* @comment: [Body Temperature](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-body-temperature.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature */ define "All Body Temperature Measurements All Statuses": ["Body Temperature Profile"] // Body Height /* @comment: [Body Height](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-body-height.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-height */ define "All Body Height Measurements": (("All Body Height Measurements All Statuses").resulted()) O return O as "Body Height Profile" /* @comment: [Body Height](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-body-height.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-height */ define "All Body Height Measurements All Statuses": ["Body Height Profile"] // Head Circumference /* @comment: [Head Circumference](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-head-circumference.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-head-circumference */ define "All Head Circumference Measurements": (("All Head Circumference Measurements All Statuses").resulted()) O return O as "Head Circumference Profile" /* @comment: [Head Circumference](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-head-circumference.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-head-circumference */ define "All Head Circumference Measurements All Statuses": ["Head Circumference Profile"] // Body Weight /* @comment: [Body Weight](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-body-weight.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-weight */ define "All Body Weight Measurements": (("All Body Weight Measurements All Statuses").resulted()) O return O as "Body Weight Profile" /* @comment: [Body Weight](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-body-weight.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-weight */ define "All Body Weight Measurements All Statuses": ["Body Weight Profile"] // Body Mass Index /* @comment: [Body Mass Index](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-bmi.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi */ define "All Body Mass Index Measurements": (("All Body Mass Index Measurements All Statuses").resulted()) O return O as "BMI Profile" /* @comment: [Body Mass Index](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-bmi.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi */ define "All Body Mass Index Measurements All Statuses": ["BMI Profile"] // Blood Pressure /* @comment: [Blood Pressure](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-blood-pressure.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure */ define "All Blood Pressure Measurements": (("All Blood Pressure Measurements All Statuses").resulted()) O return O as "Blood Pressure Profile" /* @comment: [Blood Pressure](https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-blood-pressure.html) @profile: http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure */ define "All Blood Pressure Measurements All Statuses": ["Blood Pressure Profile"] // Systolic Blood Pressure define "Systolic Blood Pressure": "All Blood Pressure Measurements".mostRecent().systolic().value // Diastolic Blood Pressure define "Diastolic Blood Pressure": "All Blood Pressure Measurements".mostRecent().diastolic().value define "Most Recent BSA": convert (([FHIR.Observation: "Body surface area"]).resulted().mostRecent() as FHIR.Observation).value to 'm2' define function CalculateBSA(alg System.String, height System.Quantity, weight System.Quantity): System.Quantity { value: // Mosteller formula using lbs and inches if (alg = 'Mosteller') then ((((convert(height) to '[in_i]') * (convert(weight) to '[lb_av]'))/3131).value)^0.5 // DuBois and DuBois formula using cm and kg // NOTE: never to be used for newborn calculation else if (alg = 'DuBois and DuBois') then 0.007184 * ((convert(height) to 'cm').value^0.725) * ((convert(weight) to 'kg').value^0.425) // No matching algorithm found else null, unit: 'm2' } define "All ServiceRequests": [FHIR.ServiceRequest] define function MostRecentSR(serviceRequests List' at line 2239 column 51