# FhirResource

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/FhirResource.kt+class:androidx.health.connect.client.records.FhirResource) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
@ExperimentalPersonalHealthRecordApi
class FhirResource
```

<br />

*** ** * ** ***

A class to capture the FHIR resource data. This is the class used for all supported FHIR resource types, which is a subset of the resource list on [the official FHIR website](https://build.fhir.org/resourcelist.html) and might expand in the future.

FHIR stands for the [Fast Healthcare Interoperability Resources](https://hl7.org/fhir/).

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/FhirResource#FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE() = 2` FHIR resource type for [AllergyIntolerance](https://www.hl7.org/fhir/allergyintolerance.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_CONDITION() = 4` FHIR resource type for a [FHIR Condition](https://www.hl7.org/fhir/condition.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_ENCOUNTER() = 12` FHIR resource type for a [FHIR Encounter](https://www.hl7.org/fhir/encounter.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_IMMUNIZATION() = 1` FHIR resource type for [Immunization](https://www.hl7.org/fhir/immunization.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_LOCATION() = 13` FHIR resource type for a [FHIR Location](https://www.hl7.org/fhir/location.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_MEDICATION() = 6` FHIR resource type for a [FHIR Medication](https://www.hl7.org/fhir/medication.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_MEDICATION_REQUEST() = 7` FHIR resource type for a [FHIR MedicationRequest](https://www.hl7.org/fhir/medicationrequest.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT() = 8` FHIR resource type for a [FHIR MedicationStatement](https://www.hl7.org/fhir/medicationstatement.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_OBSERVATION() = 3` FHIR resource type for a [FHIR Observation](https://www.hl7.org/fhir/observation.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_ORGANIZATION() = 14` FHIR resource type for a [FHIR Organization](https://www.hl7.org/fhir/organization.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_PATIENT() = 9` FHIR resource type for a [FHIR Patient](https://www.hl7.org/fhir/patient.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_PRACTITIONER() = 10` FHIR resource type for a [FHIR Practitioner](https://www.hl7.org/fhir/practitioner.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE() = 11` FHIR resource type for a [FHIR PractitionerRole](https://www.hl7.org/fhir/practitionerrole.html). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_PROCEDURE() = 5` FHIR resource type for a [FHIR Procedure](https://www.hl7.org/fhir/procedure.html). |

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

| ### 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/FhirResource#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/FhirResource#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#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/FhirResource#data()` The FHIR resource data in JSON representation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#id()` The FHIR resource ID. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#type()` The type of this FHIR resource. |

## Constants

### FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE

```
const val FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE = 2: Int
```

FHIR resource type for [AllergyIntolerance](https://www.hl7.org/fhir/allergyintolerance.html).

### FHIR_RESOURCE_TYPE_CONDITION

```
const val FHIR_RESOURCE_TYPE_CONDITION = 4: Int
```

FHIR resource type for a [FHIR Condition](https://www.hl7.org/fhir/condition.html).

### FHIR_RESOURCE_TYPE_ENCOUNTER

```
const val FHIR_RESOURCE_TYPE_ENCOUNTER = 12: Int
```

FHIR resource type for a [FHIR Encounter](https://www.hl7.org/fhir/encounter.html).

### FHIR_RESOURCE_TYPE_IMMUNIZATION

```
const val FHIR_RESOURCE_TYPE_IMMUNIZATION = 1: Int
```

FHIR resource type for [Immunization](https://www.hl7.org/fhir/immunization.html).

### FHIR_RESOURCE_TYPE_LOCATION

```
const val FHIR_RESOURCE_TYPE_LOCATION = 13: Int
```

FHIR resource type for a [FHIR Location](https://www.hl7.org/fhir/location.html).

### FHIR_RESOURCE_TYPE_MEDICATION

```
const val FHIR_RESOURCE_TYPE_MEDICATION = 6: Int
```

FHIR resource type for a [FHIR Medication](https://www.hl7.org/fhir/medication.html).

### FHIR_RESOURCE_TYPE_MEDICATION_REQUEST

```
const val FHIR_RESOURCE_TYPE_MEDICATION_REQUEST = 7: Int
```

FHIR resource type for a [FHIR MedicationRequest](https://www.hl7.org/fhir/medicationrequest.html).

### FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT

```
const val FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT = 8: Int
```

FHIR resource type for a [FHIR MedicationStatement](https://www.hl7.org/fhir/medicationstatement.html).

### FHIR_RESOURCE_TYPE_OBSERVATION

```
const val FHIR_RESOURCE_TYPE_OBSERVATION = 3: Int
```

FHIR resource type for a [FHIR Observation](https://www.hl7.org/fhir/observation.html).

### FHIR_RESOURCE_TYPE_ORGANIZATION

```
const val FHIR_RESOURCE_TYPE_ORGANIZATION = 14: Int
```

FHIR resource type for a [FHIR Organization](https://www.hl7.org/fhir/organization.html).

### FHIR_RESOURCE_TYPE_PATIENT

```
const val FHIR_RESOURCE_TYPE_PATIENT = 9: Int
```

FHIR resource type for a [FHIR Patient](https://www.hl7.org/fhir/patient.html).

### FHIR_RESOURCE_TYPE_PRACTITIONER

```
const val FHIR_RESOURCE_TYPE_PRACTITIONER = 10: Int
```

FHIR resource type for a [FHIR Practitioner](https://www.hl7.org/fhir/practitioner.html).

### FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE

```
const val FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE = 11: Int
```

FHIR resource type for a [FHIR PractitionerRole](https://www.hl7.org/fhir/practitionerrole.html).

### FHIR_RESOURCE_TYPE_PROCEDURE

```
const val FHIR_RESOURCE_TYPE_PROCEDURE = 5: Int
```

FHIR resource type for a [FHIR Procedure](https://www.hl7.org/fhir/procedure.html).

## Public constructors

### FhirResource

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

```
FhirResource(type: Int, id: String, data: String)
```

## Public functions

### equals

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

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### data

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

```
val data: String
```

The FHIR resource data in JSON representation.

### id

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

```
val id: String
```

The FHIR resource ID. This is extracted from the `id` field in `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#data()`. More about FHIR resource ID in <https://www.hl7.org/fhir/resource.html#id>.

### type

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

```
val type: Int
```

The type of this FHIR resource. This is extracted from the `resourceType` field in `https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirResource#data()`. The list of supported types is a subset of the resource list on [the official FHIR website](https://build.fhir.org/resourcelist.html) and might expand in the future.

Value is one of the following:

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

<br />