Immunizations

Retrieving Immunization Groups

Overview

The getImmunizationGroups method in the b.well SDK allows for fetching a list of ImmunizationGroup resources. This method uses the ImmunizationGroupsRequest object to define specific search criteria.

Method Signature

suspend fun getImmunizationGroups(request: ImmunizationGroupsRequest?): BWellResult<ImmunizationGroup>
  • request: Defines the search criteria for retrieving ImmunizationGroup resources.
  • BWellResult<ImmunizationGroup>: Represents the list of Immunization Groups retrieved.

Example Usage

if (selectedList.category.toString() == resources.getString(R.string.immunizations)) {
    val immunizationGroupsRequest = ImmunizationGroupsRequest.Builder()
        .page() // Specify the page number
        .pageSize() // Specify the number of results per page
        .build()

    val immunizationGroupsResult = BWellSdk.health.getImmunizationGroups(immunizationGroupsRequest)
    // Handle the retrieved Immunization Groups
}

This code snippet demonstrates how to create an ImmunizationGroupsRequest and fetch immunization groups based on the specified criteria.

Best Practices

  • Appropriately set page and pageSize in the request to manage the volume of results.
  • Handle the response to process the list of Immunization Groups effectively.

Retrieving Immunization Resources

Overview

The getImmunizations method in the b.well SDK retrieves a list of immunization records from the FHIR server. These records provide detailed information about patient vaccinations, including vaccine type, administration date, and dosage.

Method Signature

suspend fun getImmunizations(request: ImmunizationRequest?): BWellResult<Immunization>
  • request: An optional ImmunizationRequest object to customize retrieval. If not provided, all available records are fetched.
  • BWellResult<Immunization>: Represents the list of immunization records retrieved.

Example Usage

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

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

GlobalScope.launch {
    val immunizations = BWellSdk.health.getImmunizations(immunizationRequest) as BWellResult.ResourceCollection
    // Handle the retrieved immunization records
}

Best Practices

  • Utilize ImmunizationRequest for targeted searches.
  • Handle the response to process and utilize the fetched immunization records effectively.