# MedicalResource

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/records/MedicalResource.kt+class:androidx.health.connect.client.records.MedicalResource) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
@ExperimentalPersonalHealthRecordApi
class MedicalResource
```

<br />

*** ** * ** ***

A class to hold medical resource data.

Unlike FHIR resource which is represented in Health Connect with `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource`, `MedicalResource` is a Health Connect specific concept. A `MedicalResource` contains more than just a `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource`, notably, it also contains:

- A `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#dataSourceId()` representing ID of a `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource` where data of this `MedicalResource` come from.

- A `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource.Companion.MedicalResourceType` indicating how HealthConnect categorizes the `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource`. Each `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource.Companion.MedicalResourceType` is tied to a read permission. For example, a client can only read `MedicalResource`s with `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_VACCINES()` if it holds `https://developer.android.com/reference/kotlin/androidx/health/connect/client/permission/HealthPermission#PERMISSION_READ_MEDICAL_DATA_VACCINES()`.

The data representation follows the [Fast Healthcare Interoperability Resources (FHIR)](https://hl7.org/fhir/) standard.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/kotlin/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/kotlin/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. An `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` would be thrown if the feature is not available.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_ALLERGIES_INTOLERANCES() = 2` Medical resource type that labels data as allergies or intolerances. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_CONDITIONS() = 7` Medical resource type that labels data as medical conditions (clinical condition, problem, diagnosis etc). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_LABORATORY_RESULTS() = 6` Medical resource type that labels data as results (Laboratory or pathology). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_MEDICATIONS() = 9` Medical resource type that labels data as medication related. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_PERSONAL_DETAILS() = 10` Medical resource type that labels data as related to personal details, including demographic information such as name, date of birth, and contact details such as address or telephone numbers. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_PRACTITIONER_DETAILS() = 11` Medical resource type that labels data as related to practitioners. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_PREGNANCY() = 3` Medical resource type that labels data as to do with pregnancy. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_PROCEDURES() = 8` Medical resource type that labels data as procedures (actions taken on or for a patient). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_SOCIAL_HISTORY() = 4` Medical resource type that labels data as social history. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_VACCINES() = 1` Medical resource type that labels data as vaccines. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_VISITS() = 12` Medical resource type that labels data as related to an encounter with a practitioner. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MEDICAL_RESOURCE_TYPE_VITAL_SIGNS() = 5` Medical resource type that labels data as vital signs. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#MedicalResource(kotlin.Int,androidx.health.connect.client.records.MedicalResourceId,kotlin.String,androidx.health.connect.client.records.FhirVersion,androidx.health.connect.client.records.FhirResource)( type: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, id: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResourceId, dataSourceId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, fhirVersion: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirVersion, fhirResource: https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#toString()()` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#dataSourceId()` The ID of the `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource` where this `MedicalResource` comes from. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#fhirResource()` The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource` that this `MedicalResource` represents. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirVersion` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#fhirVersion()` The FHIR version of `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#fhirResource()`. |
| `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResourceId` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#id()` The unique ID of this `MedicalResource` represented by a `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResourceId`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#type()` The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource.Companion.MedicalResourceType` of this `MedicalResource`, this is assigned by Health Connect at insertion time. |

## Constants

### MEDICAL_RESOURCE_TYPE_ALLERGIES_INTOLERANCES

```
const val MEDICAL_RESOURCE_TYPE_ALLERGIES_INTOLERANCES = 2: Int
```

Medical resource type that labels data as allergies or intolerances.

### MEDICAL_RESOURCE_TYPE_CONDITIONS

```
const val MEDICAL_RESOURCE_TYPE_CONDITIONS = 7: Int
```

Medical resource type that labels data as medical conditions (clinical condition, problem, diagnosis etc).

### MEDICAL_RESOURCE_TYPE_LABORATORY_RESULTS

```
const val MEDICAL_RESOURCE_TYPE_LABORATORY_RESULTS = 6: Int
```

Medical resource type that labels data as results (Laboratory or pathology).

### MEDICAL_RESOURCE_TYPE_MEDICATIONS

```
const val MEDICAL_RESOURCE_TYPE_MEDICATIONS = 9: Int
```

Medical resource type that labels data as medication related.

### MEDICAL_RESOURCE_TYPE_PERSONAL_DETAILS

```
const val MEDICAL_RESOURCE_TYPE_PERSONAL_DETAILS = 10: Int
```

Medical resource type that labels data as related to personal details, including demographic information such as name, date of birth, and contact details such as address or telephone numbers.

### MEDICAL_RESOURCE_TYPE_PRACTITIONER_DETAILS

```
const val MEDICAL_RESOURCE_TYPE_PRACTITIONER_DETAILS = 11: Int
```

Medical resource type that labels data as related to practitioners. This is information about the doctors, nurses, masseurs, physios, etc who have been involved with the user.

### MEDICAL_RESOURCE_TYPE_PREGNANCY

```
const val MEDICAL_RESOURCE_TYPE_PREGNANCY = 3: Int
```

Medical resource type that labels data as to do with pregnancy.

### MEDICAL_RESOURCE_TYPE_PROCEDURES

```
const val MEDICAL_RESOURCE_TYPE_PROCEDURES = 8: Int
```

Medical resource type that labels data as procedures (actions taken on or for a patient).

### MEDICAL_RESOURCE_TYPE_SOCIAL_HISTORY

```
const val MEDICAL_RESOURCE_TYPE_SOCIAL_HISTORY = 4: Int
```

Medical resource type that labels data as social history.

### MEDICAL_RESOURCE_TYPE_VACCINES

```
const val MEDICAL_RESOURCE_TYPE_VACCINES = 1: Int
```

Medical resource type that labels data as vaccines.

### MEDICAL_RESOURCE_TYPE_VISITS

```
const val MEDICAL_RESOURCE_TYPE_VISITS = 12: Int
```

Medical resource type that labels data as related to an encounter with a practitioner. This includes visits to healthcare providers and remote encounters such as telephone and videoconference appointments, and information about the time, location and organization who is being met.

### MEDICAL_RESOURCE_TYPE_VITAL_SIGNS

```
const val MEDICAL_RESOURCE_TYPE_VITAL_SIGNS = 5: Int
```

Medical resource type that labels data as vital signs.

## Public constructors

### MedicalResource

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
MedicalResource(
    type: Int,
    id: MedicalResourceId,
    dataSourceId: String,
    fhirVersion: FhirVersion,
    fhirResource: FhirResource
)
```

## 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](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val dataSourceId: String
```

The ID of the `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource` where this `MedicalResource` comes from.

### fhirResource

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val fhirResource: FhirResource
```

The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource` that this `MedicalResource` represents.

### fhirVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val fhirVersion: FhirVersion
```

The FHIR version of `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource#fhirResource()`.

### id

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val id: MedicalResourceId
```

The unique ID of this `MedicalResource` represented by a `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResourceId`.

### type

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
val type: Int
```

The `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource.Companion.MedicalResourceType` of this `MedicalResource`, this is assigned by Health Connect at insertion time. Clients should be aware that this list is non exhaustive and may increase in future releases when additional types will need to be handled.

Value is one of the following:

- `2`
- `7`
- `6`
- `9`
- `10`
- `11`
- `3`
- `8`
- `4`
- `1`
- `12`
- `5`

<br />