Additional Health Record Retrieval Options

Application APIs

This workflow describes the process to query individual FHIR resources and supplemental Medication or Lab educational content. Instead of using the $everything operation to retrieve all health records at once, you can query individual FHIR resource types through GraphQL for more granular data retrieval.


Prerequisites

Environment URL:

  • Client-Sandbox: https://api.client-sandbox.icanbwell.com/v1/graphql


Retrieve Specific FHIR Resource Types via GraphQL

When to use this approach:

  • You only need specific resource types (e.g., only allergies or medications)
  • You want to reduce payload size and improve query performance
  • You're building targeted features (e.g., medication list view, conditions timeline)
  • You need to paginate or filter specific resource categories

Example FHIR Resource Queries

The following GraphQL queries can be used for retrieving specific health data categories processed through the b.well Data Refinery:

General Clinical Data:

  • getAllergyIntoleranceGroups - Allergies and intolerances
  • getCarePlanGroups - Care plans and treatment plans
  • getConditionGroups - Diagnoses and health conditions
  • getEncounterGroups - Healthcare visits and appointments
  • getImmunizationGroups - Vaccination records
  • getProcedureGroups - Medical procedures and interventions

Labs & Vital Signs:

  • getLabGroups - Laboratory results and clinical observations
  • getDiagnsoticReportLabGroups - Clinical observations and diagnostic notes
  • getVitalSignGroups - Vital signs

Medications:

  • getMedicationGroups - Medication records

Example: Query Vital Signs Groups

All FHIR resource queries follow a similar pattern. This example retrieves a user's vital signs records:

GraphQL Query:

query getVitalSignGroups($request: VitalSignGroupQueryRequest) {
  getVitalSignGroups(request: $request) {
    resources {
      id
      name
      source
      coding {
        system
        code
        display
      }
      effectiveDateTime
      value {
        valueQuantity {
          value
          unit
        } 
      }
      referenceRange {
        low {
          value
          unit
        }
        high {
          value
          unit
        }
      }
      component {
        code {
          coding {
            system
            code
            display
          }
        }
        value {
          valueQuantity {
            value
            unit
          }
        }
        referenceRange {
          low {
            value
            unit
          }
          high {
            value
            unit
          }
        }
      }
      references
    }
  }
}

Replace getVitalSignGroups with any other FHIR resource group query name from the list above to retrieve different health data categories. Each query returns resources in the same FHIR bundle structure with an resources array containing individual resources.

For complete query parameters, filtering options, and response schemas for each resource type, see b.well's GraphQL Playground.


Query Additional Medication and Lab Information (Optional)

Use the MedicationStatement and Observation IDs to retrieve additional detailed information through the getMedicationKnowledge and getLabKnowledge GraphQL queries.

Note: If the necessary code data is not available within the MedicationStatement or Observation resource, nothing will be returned in the content field of the response.

Example Query (getMedicationKnowledge):

query getMedicationKnowledge($request: MedicationKnowledgeRequest) {
  getMedicationKnowledge(request: $request) {
    resources {
      title
      content
    }
  }
}

Example Variables:

{
  "request": {
    "page": 0,
    "pageSize": 10,
    "medicationStatementId": "a69db751-8ec5-5882-b4a7-dd0b90e3d037"
  }
}

Example Response:

{
  "data": {
    "getMedicationKnowledge": {
      "resources": [
        {
          "title": "Active ingredient (in each tablet)",
          "content": "<div><div><p>Cetirizine hydrochloride USP 10 mg</p></div></div>"
        },
        {
          "title": "Purpose",
          "content": "<div><div><p>Antihistamine</p></div></div>"
        },
        {
          "title": "Uses",
          "content": "<div><div><p>temporarily relieves these symptoms due to hay fever or other upper respiratory allergies:</p> <ul><li>runny nose</li> <li>sneezing</li> <li>itchy, watery eyes</li> <li>itching of the nose or throat</li></ul></div></div>"
        }
      ]
    }
  }
}

Use the same pattern for getLabKnowledge with labId instead of medicationStatementId.