Labs

Retrieving Lab Group Resources

Overview

The getLabGroups method in the b.well SDK is designed to fetch a list of LabGroup resources, providing a simplified interface for accessing lab group data.

Method Signature

suspend fun getLabGroups(request: LabGroupsRequest?): BWellResult<LabGroup>
  • request: A LabGroupsRequest object for specifying search criteria.
  • BWellResult<LabGroup>: Represents the list of Lab Groups retrieved.

Data Class: LabGroup

  • id: Unique identifier for the Lab Group.
  • name: Human readable name of the Lab Group.
  • source: Array of Strings representing the source of the data.
  • sourceDisplay: Array of Strings representing the source of the data.
  • category: A structured set of codes including a text representation.
  • coding: Coding representing the kind of Lab in this ResourceGroup.
  • effectiveDateTime: The single point in time when the observation was made.
  • interpretation: The interpretation of the observation results.
  • value: The value of the lab. At most, one value type will be returned per Observation.
  • referenceRange: Reference ranges for interpreting the observation value.
  • component: Component observations as part of this observation.
  • references: Array of laboratory id references in the ResourceGroup.

Example Usage

The following example retrieves base lab observation resources based on groupCode while also setting the .lastUpdated parameter.

val request = LabGroupsRequest.Builder()
		.groupCode(listOf(Coding(code = groupCode, system = groupSystem)))
		.lastUpdated(lastUpdatedSearchDate)
		.build()

labsViewModel.getLabGroups(request)

Best Practices

  • Set appropriate filters in the LabGroupsRequest.
  • Handle the response to effectively use the fetched Lab Group data.

Retrieving Lab Observation Resources

Overview

The getLabs method in the b.well SDK simplifies the process of retrieving a summary of laboratory test results. It returns a list of unique laboratory measurements for a patient, sorted by the most recent.

Method Signature

suspend fun getLabs(request: LabsRequest?): BWellResult<Observation>
  • request: A LabsRequest object for specifying search criteria.
  • BWellResult<Observation>: Contains a list of laboratory observations.

Data Class: ObservationResource

  • id: Unique identifier for the Observation resource.
  • meta: Metadata about the Observation resource.
  • category: Classification of the type of observation.
  • code: The code that categorizes the observation.
  • value: Various types of values that an Observation can have, only one of these would typically be populated.
  • referenceRange: Reference ranges for interpreting the observation value.
  • interpretation: The interpretation of the observation results.
  • component: Component observations as part of this observation.
  • effectiveDateTime: The single point in time when the observation was made.
  • effectivePeriod: The period of time over which the observation was made.
  • hasMember: Related resource that belongs to the Observation group.
  • note: Annotations or notes about the observation.
  • encounter: The encounter associated with this observation.
  • performer: Who is responsible for the observation.
  • specimen: The specimen associated with this observation.
  • display: Consumer friendly name for labs.
  • dataAbsentReason: Why the result is missing. (0.63% population likelihood).
  • status: The status of the result value.

Data Class: Component

  • code: The code that categorizes the observation.
  • value: Various types of values that an Observation can have, only one of these would typically be populated.
  • referenceRange: Reference ranges for interpreting the observation value. (0.11% population likelihood).
  • interpretation: The interpretation of the observation results. (0.11% population likelihood).
  • dataAbsentReason: Why the result is missing. (0.06% population likelihood)

Example Usage

val request = LabsRequest.Builder()
    .groupCode(listOf(Coding(code = "groupCodeCode", system = "groupCodeSystem")))
    .lastUpdated(SearchDate) //see Filtering Base Resources by Date for more info
    .page(page) // Specify the page number
    .pageSize(pageSize) // Specify the number of results per page
    .build()

labsViewModel.getLabs(request)

Best Practices

  • Utilize LabsRequest for targeted lab observation searches.
  • Handle the response to effectively use the fetched lab data.