MedicalResourceId


@ExperimentalPersonalHealthRecordApi
public final 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 constructors

MedicalResourceId(
    @NonNull String dataSourceId,
    int fhirResourceType,
    @NonNull String fhirResourceId
)

Public methods

boolean
equals(Object other)
static final @NonNull MedicalResourceId
fromFhirReference(
    @NonNull String dataSourceId,
    @NonNull String fhirReference
)

Creates a MedicalResourceId instance from dataSourceId and fhirReference.

final @NonNull String

The ID of the MedicalDataSource where the data comes from.

final @NonNull String

The ID of the FHIR resource.

final int

The type of the FHIR resource.

int
@NonNull String

Public constructors

MedicalResourceId

Added in 1.1.0-beta02
public MedicalResourceId(
    @NonNull String dataSourceId,
    int fhirResourceType,
    @NonNull String fhirResourceId
)

Public methods

equals

public boolean equals(Object other)

fromFhirReference

Added in 1.1.0-beta02
public static final @NonNull MedicalResourceId fromFhirReference(
    @NonNull String dataSourceId,
    @NonNull String fhirReference
)

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
@NonNull String dataSourceId

Represents ID of a MedicalDataSource where the data comes from.

@NonNull String fhirReference

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.

getDataSourceId

Added in 1.1.0-beta02
public final @NonNull String getDataSourceId()

The ID of the MedicalDataSource where the data comes from.

getFhirResourceId

Added in 1.1.0-beta02
public final @NonNull String getFhirResourceId()

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

getFhirResourceType

Added in 1.1.0-beta02
public final int getFhirResourceType()

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

hashCode

public int hashCode()

toString

public @NonNull String toString()