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 retrievingImmunizationGroupresources.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
pageandpageSizein 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 optionalImmunizationRequestobject 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
ImmunizationRequestfor targeted searches. - Handle the response to process and utilize the fetched immunization records effectively.
Updated about 2 months ago
