Allergy Intolerances

Retrieving Allergy Intolerance Groups

Overview

The getAllergyIntoleranceGroups method in the b.well SDK is used to fetch a list of AllergyIntoleranceGroup resources. It utilizes the AllergyIntoleranceGroupsRequest object to define search criteria.

Method Signature

suspend fun getAllergyIntoleranceGroups(request: AllergyIntoleranceGroupsRequest?): BWellResult<AllergyIntoleranceGroup>
  • request: Specifies search criteria for retrieving AllergyIntoleranceGroup resources.
  • BWellResult<AllergyIntoleranceGroup>: Represents the list of Allergy Intolerance Groups retrieved.

Return Type

BwellResult<AllergyIntoleranceGroup> containing list of AllergyIntoleranceGroup. The type of AllergyIntoleranceGroup is described below.

data class AllergyIntoleranceGroup (
    val id: String?,
    val name: String?,
    val coding: Coding?,
    val references: List<String>?,
    val criticality: AllergyIntoleranceCriticalityCode?,
    val source: List<String>?,
    val sourceDisplay: List<String>?,
    val recordedDate: Date?,
)

data class AllergyIntoleranceCriticalityCode(
    val code: Code?,
    val display: String?,
)

enum class AllergyIntoleranceCriticalityCode {
  LOW,
  HIGH,
  UNABLE-TO-ASSESS
}
  • id : id of the underlying Groupname : Human-readable name of the allergy intolerance
  • coding : Coding representing the kind of allergy intolerances in this ResourceGroup
  • references : Array of AllergyIntolerance id references in the ResourceGroup
  • criticality : The most recent recorded Allergy criticality code
  • source : Array of Strings representing the source of the data
  • sourceDisplay : Array of Strings representing the (Presentable) source of the data.
  • recordedDate : Date first version of the resource instance was recorded

Parameters

The method takes an optional AllergyIntoleranceGroupsRequest object, allowing users to specify pagination details like page number and page size.

  • page : Is an integer that can be used to specify which page of results to return. The first value should be 0
  • pageSize : Is an integer that can be used to specify the number of results to return in a page.

Example Usage

val request = AllergyIntoleranceGroupsRequest.Builder()
	.page(0)
	.pageSize(10)
	.build()

val result = BWellSdk.health.getAllergyIntoleranceGroups(request)

This code snippet demonstrates how to create an AllergyIntoleranceGroupsRequest and use it to fetch allergy intolerance groups.

Best Practices

  • Ensure the page and pageSize parameters are set appropriately to manage the volume of results.
  • Handle the result by checking the status and processing the list of allergy intolerance groups.

Retrieving Allergy Intolerance Resources

Overview

The getAllergyIntolerances method in the b.well SDK fetches a list of AllergyIntolerance resources from the FHIR server, utilizing the AllergyIntoleranceRequest object to define specific search criteria.

Method Signature

suspend fun getAllergyIntolerances(request: AllergyIntoleranceRequest?): BWellResult<AllergyIntolerance>
  • request: Specifies criteria for retrieving Allergy Intolerance resources.
  • BWellResult<AllergyIntolerance>: Represents the list of Allergy Intolerances retrieved.

Return Type

BwellResult<AllergyIntolerance> containing list of AllergyIntolerance. The type of AllergyIntolerance is described below.

data class AllergyIntolerance {
    val id: String,
    val meta: Meta?,
    val category: List<AllergyIntoleranceCategoryCode>?,
    val code: CodeableConcept?,
    val criticality: AllergyIntoleranceCriticalityCode?,
    val onsetDateTime: Date?,
    val onsetPeriod: Period?,
    val lastOccurrence: Date?, 
    val reaction: List<Reaction>?,
    val recordedDate: Date?,
    val note: List<Annotation>?,
    val verificationStatus: CodeableConcept?,
    val clinicalStatus: CodeableConcept?
}

enum class AllergyIntoleranceCategoryCode {
  FOOD,
  MEDICATION,
  BIOLOGIC
}
  • id : The id of the AllergyIntolerance
  • meta : Metadata about the resource (e.g., tags, security)
  • category : Category of the event (e.g., FOOD, MEDICATION)
  • code : Code that identifies the substance
  • criticality : Estimate of the potential clinical harm, or seriousness, of a reaction to an identified substance
  • onsetDateTime : Date and time of the onset
  • onsetPeriod : Period over which the AllergyIntolerance was observed
  • lastOccurrence : Date and time of the last occurrence
  • reaction : Details about each adverse reaction event
  • recordedDate : Date first version of the resource instance was recorded
  • note : Notes about the allergy intolerance that aren't captured in other fields
  • verificationStatus : Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance
  • clinicalStatus : The clinical status of the allergy or intolerance. (active , inactive , resolved)

Parameters

The method takes an optional AllergyIntoleranceRequest object, allowing users to specify filtering and pagination.

  • ids : List of allergy intolerance ids
  • groupCode : The SearchToken which contains the code/system for the provided AllergyIntolerance
  • lastUpdated : Filters based on the lastUpdated date of the resource
  • page : Is an integer that can be used to specify which page of results to return. The first value should be 0
  • pageSize : Is an integer that can be used to specify the number of results to return in a page.

Example Usage

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

val request = AllergyIntoleranceRequest.Builder()
    .groupCode(
        listOf(
            Coding(
                code = "code-value",
                system = "system-value"
            )
        )
    )
    .lastUpdated(
        SearchDate.Builder()
        .greaterThan(SimpleDateFormat("yyyy-MM-dd").parse("2020-01-12"))
            .build()
    )
    .ids(listOf("id-1", "id-2"))
    .page(0)
    .pageSize(10)
    .build()

val result = BWellSdk.health.getDocumentReferences(request)

Best Practices

  • Set ids, groupCode, page, and pageSize appropriately to target the desired resources.
  • Handle the response, checking the status and processing the list of retrieved resources.
  • Display Priority for Allergy Names: When displaying allergy name, prioritize CodeableConcept.text over CodeableConcept.coding.display.