healthconnectonfhir

The HealthConnectOnFHIR library provides a mapper that converts supported Android Health Connect Records to corresponding HL7® FHIR® R4 Observations with standardized codes (e.g. LOINC).

For more information, please refer to the API documentation.

Mapping Table

ActiveCaloriesBurnedRecordActivity41981-2kcalCalories burned
BloodGlucoseRecord41653-7mg/dLGlucose Glucometer (BldC) Mass/Vol
BloodPressureRecordVital Signs85354-9mmHgBlood pressure panel with all children optional
BodyFatRecord41982-0%Percentage of body fat Measured
BodyTemperatureRecordVital Signs8310-5CelBody temperature
HeartRateRecordVital Signs8867-4/minHeart rate
HeightRecordVital Signs8302-2mBody height
OxygenSaturationRecordVital Signs59408-5%Oxygen saturation in Arterial blood by Pulse oximetry
RespiratoryRateRecordVital Signs9279-1/minRespiratory rate
StepsRecordActivity55423-8stepsNumber of steps
WeightRecordVital Signs29463-7kgBody weight

Installation

HealthConnectOnFHIR can be installed into your Android Studio project via Jitpack.

Usage

// Initialize the mapper
val mapper = RecordToObservationMapperImpl()

// Query a `Record` from Health Connect
val record = // ..

// Map the record to an HL7 FHIR Observation
val observation = mapper.map(record)

Example

First, you will need to configure your application to use Android Health Connect. For more information, please see the official documentation.

// Initialize a `HealthConnectClient` (see Health Connect docs for full details)
val healthConnectClient = HealthConnectClient.getOrCreate(context)

// Define a time range for the query
val startTime = Instant.parse("2023-05-01T00:00:00Z")
val endTime = Instant.parse("2023-06-01T00:00:00Z")

// Query a list of `WeightRecord`s from Health Connect
val result = healthConnectClient.readRecords(
ReadRecordsRequest(
recordType = WeightRecord::class,
timeRangeFilter = TimeRangeFilter.between(startTime, endTime)
)
).records

// Initialize the mapper
val mapper = RecordToObservationMapperImpl()

// Convert each weight record to a FHIR Observation
result.forEach { weightRecord ->
val observations = mapper.map(weightRecord)
observations.forEach { observation ->
// Do something with the observation
}
}

License

This project is licensed under the MIT license.

Contributors

This project is developed as a part of the Stanford Biodesign for Digital Health projects at Stanford. See CONTRIBUTORS.md for a full list of all HealthConnectOnFHIR contributors.

Notices

Health Connect is a registered trademark of Google. FHIR is a registered trademark of Health Level Seven International.

Packages

Link copied to clipboard
Link copied to clipboard