Conditions
Retrieving Condition Groups
Overview
The getConditionGroups method in the b.well SDK enables the retrieval of ConditionGroup resources. It uses the ConditionGroupsRequest object for specifying search criteria tailored to condition groups.
Method Signature
suspend fun getConditionGroups(request: ConditionGroupsRequest?): BWellResult<ConditionGroup>request: An object defining the search criteria forConditionGroupresources.BWellResult<ConditionGroup>: Represents the list of Condition Groups retrieved.
Example Usage
if (selectedList.category.toString() == resources.getString(R.string.conditions)) {
val conditionGroupsRequest = ConditionGroupsRequest.Builder()
.page() // Specify the page number
.pageSize() // Specify the number of results per page
.build()
val conditionGroupsResult = BWellSdk.health.getConditionGroups(conditionGroupsRequest)
// Handle the retrieved Condition Groups
}This code demonstrates building a ConditionGroupsRequest and fetching condition 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 Condition Groups.
Retrieving Condition Resources
Overview
The getConditions method in the b.well SDK is designed to retrieve a comprehensive list of medical conditions and diagnoses, adhering to the FHIR standard. This method provides access to clinical data about various health issues, ailments, or diseases.
Method Signature
suspend fun getConditions(request: ConditionRequest?): BWellResult<Condition>request: An optional instance ofConditionRequestto set specific search parameters and filters.BWellResult<Condition>: Represents the list of medical conditions retrieved.
Example Usage
The following example retrieves base condition resources based on groupCode while also setting the .lastUpdated parameter.
val conditionsRequest = ConditionRequest.Builder()
.groupCode(listOf(Coding(code = groupCode, system = groupSystem)))
.lastUpdated(lastUpdatedSearchDate)
.build()
GlobalScope.launch {
val conditions = BWellSdk.health.getConditions(conditionsRequest) as BWellResult.ResourceCollection
// Handle the retrieved medical conditions
}Best Practices
- Set appropriate filters and pagination in
ConditionRequest. - Handle the response to process and utilize the fetched medical conditions effectively.
Updated about 2 months ago
