# MedicalDataSource

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/health/connect/client/records/MedicalDataSource "View this page in Java")

<br />

```
@ExperimentalPersonalHealthRecordApi
class MedicalDataSource
```

<br />

*** ** * ** ***

A class to hold the data source information of medical data. Each[MedicalResource](https://developer.android.com/reference/kotlin/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[HealthConnectFeatures.getFeatureStatus](https://developer.android.com/reference/kotlin/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int))and pass[HealthConnectFeatures.FEATURE_PERSONAL_HEALTH_RECORD](https://developer.android.com/reference/kotlin/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD())as an argument. An[UnsupportedOperationException](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                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MedicalDataSource](https://developer.android.com/reference/kotlin/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))`(` ` id: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` packageName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` fhirBaseUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`,` ` displayName: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` fhirVersion: `[FhirVersion](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirVersion)`,` ` lastDataUpdateTime: `[Instant](https://developer.android.com/reference/java/time/Instant.html)`?` `)` |

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

|                                              ### Public properties                                               |
|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                | [displayName](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#displayName()) The display name that describes this`MedicalDataSource`.                                                                                                                                                                                                                                                          |
| [Uri](https://developer.android.com/reference/android/net/Uri.html)                                              | [fhirBaseUri](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#fhirBaseUri()) The FHIR base URI of this`MedicalDataSource`.                                                                                                                                                                                                                                                                     |
| [FhirVersion](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/FhirVersion) | [fhirVersion](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#fhirVersion()) The FHIR version of this`MedicalDataSource`.                                                                                                                                                                                                                                                                      |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                | [id](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#id()) The unique identifier of this`MedicalDataSource`, generated by HealthConnect at creation time.                                                                                                                                                                                                                                      |
| [Instant](https://developer.android.com/reference/java/time/Instant.html)`?`                                     | [lastDataUpdateTime](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#lastDataUpdateTime()) An[Instant](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[MedicalResource](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource). |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                | [packageName](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalDataSource#packageName()) The package name of the app that created this`MedicalDataSource`.                                                                                                                                                                                                                                                 |

## Public constructors

### MedicalDataSource

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

```
MedicalDataSource(
    id: String,
    packageName: String,
    fhirBaseUri: Uri,
    displayName: String,
    fhirVersion: FhirVersion,
    lastDataUpdateTime: Instant?
)
```  

## Public functions

### equals

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

### hashCode

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

### toString

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

## Public properties

### displayName

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

```
val displayName: String
```

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

### fhirBaseUri

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

```
val fhirBaseUri: Uri
```

The FHIR base URI of this`MedicalDataSource`.  

### 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 this`MedicalDataSource`. All[MedicalResource](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource)s inserted under this`MedicalDataSource`must have the same FHIR version.  

### id

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

```
val id: String
```

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

### lastDataUpdateTime

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

```
val lastDataUpdateTime: Instant?
```

An[Instant](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[MedicalResource](https://developer.android.com/reference/kotlin/androidx/health/connect/client/records/MedicalResource).`null`if that has never happened or no data is linked to this`MedicalDataSource`.  

### packageName

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

```
val packageName: String
```

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