Procedures

Retrieving Procedure Groups

Overview

The getProcedureGroups method in the b.well SDK is designed to fetch a list of ProcedureGroup resources, utilizing the ProcedureGroupsRequest object to define search criteria.

Method Signature

suspend fun getProcedureGroups(request: ProcedureGroupsRequest?): BWellResult<ProcedureGroup>
  • request: An object that specifies the criteria for retrieving ProcedureGroup resources.
  • BWellResult<ProcedureGroup>: Represents the list of Procedure Groups retrieved.

Example Usage

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

    val procedureGroupsResult = BWellSdk.health.getProcedureGroups(procedureGroupsRequest)
    // Handle the retrieved Procedure Groups
}

This code snippet demonstrates how to create a ProcedureGroupsRequest and fetch procedure groups based on the specified criteria.

Best Practices

  • Set page and pageSize appropriately in the request to manage the volume of results.
  • Handle the response to process the list of Procedure Groups effectively.

Retrieving Procedure Resources

Overview

The getProcedures method in the b.well SDK provides access to resources related to medical procedures. This method is essential for working with clinical data related to various interventions or actions performed on patients.

Method Signature

suspend fun getProcedures(request: ProcedureRequest?): BWellResult<Procedure>
  • request: An optional ProcedureRequest object for customizing the retrieval of procedures.
  • BWellResult<Procedure>: Represents the list of medical procedures retrieved.

Example Usage

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

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

GlobalScope.launch {
    val procedures = BWellSdk.health.getProcedures(proceduresRequest) as BWellResult.ResourceCollection
    // Handle the retrieved medical procedures
}

Best Practices

  • Utilize ProcedureRequest for targeted searches.
  • Handle the response to process and utilize the fetched medical procedures effectively.