PHR - Android framework API

The Health Connect Jetpack SDK is typically used to simplify the integration by wrapping the Health Connect APIs, but PHR isn't available in Jetpack yet, so the underlying Android framework APIs must be used.

As these APIs are still under development, there are still some limitations and some components aren't fully available.

  • The Play Policy for PHR access is still being developed, and apps may need to meet additional requirements before they can be released on the Play Store.
  • Some features, such as changelogs-based APIs, have not been developed for PHR APIs yet.

If you prefer to integrate PHR into your app using Jetpack, we suggest waiting until PHR is available in Jetpack and learning about PHR using these materials in the meantime.

MedicalDataSource

Medical records stored in Health Connect are organized into a MedicalDataSource. This allows separation of medical records for the same individual that come from different sources such as APIs or healthcare systems.

If all records originate from the same source, a writing app need only create one MedicalDataSource. If records originate from multiple sources an app can still create a single MedicalDataSource if that data is reconciled and all records have a unique combination of FHIR resource type and FHIR resource ID. Otherwise, a MedicalDataSource should be created for each data source.

All medical records must be associated with a MedicalDataSource, so this must be created before writing the resources.

Properties of MedicalDataSource:

  • Display Name (required) - User facing display name for the data source, uniquely identified per writing app.
  • FHIR Base URI (required) - For data coming from a FHIR server this should be the FHIR base URL (for example, https://example.com/fhir/). If the data is generated by an app without an FHIR URL, this should be a unique and understandable URI defined by the app (for example, myapp://..) that points to the source of the data.

    As an example, if a client app supports an app deep linking, this deeplink could be used as the FHIR Base URI. The maximum length for the URI is 2000 characters.

  • Package name (populated automatically) - The app writing the data.

  • FHIR Version (required) - The FHIR version. Versions 4.0.1 and 4.3.0 are supported.

  • Multiple data sources can be associated with the same FHIR base URL.

  • Within a data source, all medical records should have a unique combination of FHIR resource type and FHIR resource ID.

MedicalResource

MedicalResource represents a FHIR resource stored in Health Connect.

Properties of MedicalResource:

  • DataSourceId (required) - Data source as described for a MedicalDataSource.
  • FHIR Version (required) - The FHIR version. Versions 4.0.1 and 4.3.0 are supported.
  • FHIR Resource (required) The JSON-encoded FHIR resource instance.
  • Medical Resource type (populated automatically) - The user-facing category of the resource, mapping to user facing permissions.
    • This is populated at insertion time, and derived automatically by Health Connect.
    • The initial set of types is described earlier.