MedicalResourceId


@ExperimentalPersonalHealthRecordApi
class MedicalResourceId


A class to represent a unique identifier of a medical resource.

This class contains a set of properties that together represent a unique identifier of a MedicalResource.

The medical resource data representation follows the Fast Healthcare Interoperability Resources (FHIR) standard.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call HealthConnectFeatures.getFeatureStatus and pass HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD as an argument. An UnsupportedOperationException would be thrown if the feature is not available.

Summary

Public companion functions

MedicalResourceId
fromFhirReference(dataSourceId: String, fhirReference: String)

Creates a MedicalResourceId instance from dataSourceId and fhirReference.

Public constructors

MedicalResourceId(
    dataSourceId: String,
    fhirResourceType: Int,
    fhirResourceId: String
)

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

String

The ID of the MedicalDataSource where the data comes from.

String

The ID of the FHIR resource.

Int

The type of the FHIR resource.

Public companion functions

fromFhirReference

Added in 1.1.0-beta02
fun fromFhirReference(dataSourceId: String, fhirReference: String): MedicalResourceId

Creates a MedicalResourceId instance from dataSourceId and fhirReference.

This method is dependent on the version of HealthConnect installed on the device. To check if it's available call HealthConnectFeatures.getFeatureStatus and pass HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD as an argument.

Parameters
dataSourceId: String

Represents ID of a MedicalDataSource where the data comes from.

fhirReference: String

The FHIR reference string typically extracted from the "reference" field in one FHIR resource (source), pointing to another FHIR resource (target) within the same data source, for example "Patient/034AB16".

Throws
kotlin.IllegalArgumentException

if the provided dataSourceId is not a valid ID, the referenced resource type is not a valid FhirResource type supported by Health Connect, or fhirReference does not match with the pattern of $fhir_resource_type/$fhir_resource_id, where the FHIR resource type should align with the resource list in the official FHIR website, and the FHIR resource ID should also follow the pattern described in the official FHIR datatypes.

Public constructors

MedicalResourceId

Added in 1.1.0-beta02
MedicalResourceId(
    dataSourceId: String,
    fhirResourceType: Int,
    fhirResourceId: String
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

dataSourceId

Added in 1.1.0-beta02
val dataSourceIdString

The ID of the MedicalDataSource where the data comes from.

fhirResourceId

Added in 1.1.0-beta02
val fhirResourceIdString

The ID of the FHIR resource. This must be unique per MedicalDataSource.

fhirResourceType

Added in 1.1.0-beta02
val fhirResourceTypeInt

The type of the FHIR resource. It should be one of the values in FhirResourceType.