# MedicalDataSource

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

*** ** * ** ***


```
@ExperimentalPersonalHealthRecordApi
public final class MedicalDataSource
```

<br />

*** ** * ** ***

A class to hold the data source information of medical data. Each `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalResource` is associated with a `MedicalDataSource`.

The medical data is represented using 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/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

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource#MedicalDataSource(kotlin.String,kotlin.String,android.net.Uri,kotlin.String,androidx.health.connect.client.records.FhirVersion,java.time.Instant)( @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 packageName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html fhirBaseUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html displayName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion fhirVersion, https://developer.android.com/reference/java/time/Instant.html lastDataUpdateTime )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource#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/MedicalDataSource#getDisplayName()()` The display name that describes this `MedicalDataSource`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource#getFhirBaseUri()()` The FHIR base URI of this `MedicalDataSource`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion` | `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource#getFhirVersion()()` The FHIR version of this `MedicalDataSource`. |
| `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/MedicalDataSource#getId()()` The unique identifier of this `MedicalDataSource`, generated by HealthConnect at creation time. |
| `final https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource#getLastDataUpdateTime()()` An `https://developer.android.com/reference/java/time/Instant.html` indicating a point in time when this `MedicalDataSource` was **last** used to update or insert any `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalResource`. |
| `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/MedicalDataSource#getPackageName()()` The package name of the app that created this `MedicalDataSource`. |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource#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/MedicalDataSource#toString()()` |

## Public constructors

### MedicalDataSource

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

```
public MedicalDataSource(
    @NonNull String id,
    @NonNull String packageName,
    @NonNull Uri fhirBaseUri,
    @NonNull String displayName,
    @NonNull FhirVersion fhirVersion,
    Instant lastDataUpdateTime
)
```

## Public methods

### equals

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

### getDisplayName

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

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

The display name that describes this `MedicalDataSource`. This must be be unique per app.

### getFhirBaseUri

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

```
public final @NonNull Uri getFhirBaseUri()
```

The FHIR base URI of this `MedicalDataSource`.

### getFhirVersion

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

```
public final @NonNull FhirVersion getFhirVersion()
```

The FHIR version of this `MedicalDataSource`. All `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalResource`s inserted under this `MedicalDataSource` must have the same FHIR version.

### getId

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

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

The unique identifier of this `MedicalDataSource`, generated by HealthConnect at creation time.

### getLastDataUpdateTime

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

```
public final Instant getLastDataUpdateTime()
```

An `https://developer.android.com/reference/java/time/Instant.html` indicating a point in time when this `MedicalDataSource` was **last** used to update or insert any `https://developer.android.com/reference/androidx/health/connect/client/records/MedicalResource`. `null` if that has never happened or no data is linked to this `MedicalDataSource`.

### getPackageName

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

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

The package name of the app that created this `MedicalDataSource`.

### hashCode

```
public int hashCode()
```

### toString

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