# 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)

*** ** * ** ***

<br />

```
@ExperimentalPersonalHealthRecordApi
public final 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/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/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 |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE() = 2` FHIR resource type for [AllergyIntolerance](https://www.hl7.org/fhir/allergyintolerance.html). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#FHIR_RESOURCE_TYPE_IMMUNIZATION() = 1` FHIR resource type for [Immunization](https://www.hl7.org/fhir/immunization.html). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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). |
| `static final int` | `https://developer.android.com/reference/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/androidx/health/connect/client/records/FhirResource#FhirResource(kotlin.Int,kotlin.String,kotlin.String)(int type, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html data)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#getData()()` The FHIR resource data in JSON representation. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#getId()()` The FHIR resource ID. |
| `final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#getType()()` The type of this FHIR resource. |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirResource#toString()()` |

## Constants

### FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE

```
public static final int FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE = 2
```

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

### FHIR_RESOURCE_TYPE_CONDITION

```
public static final int FHIR_RESOURCE_TYPE_CONDITION = 4
```

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

### FHIR_RESOURCE_TYPE_ENCOUNTER

```
public static final int FHIR_RESOURCE_TYPE_ENCOUNTER = 12
```

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

### FHIR_RESOURCE_TYPE_IMMUNIZATION

```
public static final int FHIR_RESOURCE_TYPE_IMMUNIZATION = 1
```

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

### FHIR_RESOURCE_TYPE_LOCATION

```
public static final int FHIR_RESOURCE_TYPE_LOCATION = 13
```

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

### FHIR_RESOURCE_TYPE_MEDICATION

```
public static final int FHIR_RESOURCE_TYPE_MEDICATION = 6
```

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

### FHIR_RESOURCE_TYPE_MEDICATION_REQUEST

```
public static final int FHIR_RESOURCE_TYPE_MEDICATION_REQUEST = 7
```

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

### FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT

```
public static final int FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT = 8
```

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

### FHIR_RESOURCE_TYPE_OBSERVATION

```
public static final int FHIR_RESOURCE_TYPE_OBSERVATION = 3
```

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

### FHIR_RESOURCE_TYPE_ORGANIZATION

```
public static final int FHIR_RESOURCE_TYPE_ORGANIZATION = 14
```

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

### FHIR_RESOURCE_TYPE_PATIENT

```
public static final int FHIR_RESOURCE_TYPE_PATIENT = 9
```

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

### FHIR_RESOURCE_TYPE_PRACTITIONER

```
public static final int FHIR_RESOURCE_TYPE_PRACTITIONER = 10
```

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

### FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE

```
public static final int FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE = 11
```

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

### FHIR_RESOURCE_TYPE_PROCEDURE

```
public static final int FHIR_RESOURCE_TYPE_PROCEDURE = 5
```

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)

```
public FhirResource(int type, @NonNull String id, @NonNull String data)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getData

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

```
public final @NonNull String getData()
```

The FHIR resource data in JSON representation.

### getId

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

```
public final @NonNull String getId()
```

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

### getType

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

```
public final int getType()
```

The type of this FHIR resource. This is extracted from the `resourceType` field in `https://developer.android.com/reference/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.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```