Retrieve a Data Source

Retrieving a Specific DataSource

Overview

The getDataSource method in the b.well SDK is designed to retrieve a specific Data Source based on its unique identifier. This function is crucial for accessing detailed information about individual Data Sources that will then help determine the Data Source category: BASIC or OAUTH.

Method Signature

suspend fun getDataSource(id: String): BWellResult<DataSource>
  • id: The unique identifier of the DataSource to be retrieved.
  • BWellResult<DataSource>: Returns an object holding the Data Source and a FHIR OperationOutcome.
  • The DataSource object includes:
    id: string
    name: string
    type: DataConnectionType (PRACTITIONER, CLINICAL, INSURANCE, LAB, PHARMACY)
    category: ConnectionCategory (BASIC, OAUTH)
    isDirect: boolean

Usage

To fetch a Data Source, provide the unique identifier of the DataSource you wish to retrieve. This ID is typically known from the results emitted through the searchProviders or searchConnections methods.

Best Practices

  • Validating ID: Ensure the id provided is valid and corresponds to an existing Data Source.
  • Error Handling: Implement error handling for scenarios where the Data Source may not be found or the id is invalid.
  • Understanding OperationOutcome: Familiarize yourself with the FHIR OperationOutcome to interpret any operational results or errors effectively.

Before proceeding, please review the Data Connection Sequence diagram to understand the intended call sequence once a data source is retrieved.