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 Resources 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:

General Clinical Data:

  • allergyIntolerances - Allergies and intolerances
  • carePlans - Care plans and treatment plans
  • careTeams - Care team members and roles
  • conditions - Diagnoses and health conditions
  • encounters` - Healthcare visits and appointments
  • immunizations - Vaccination records
  • procedures - Medical procedures and interventions
  • documentReferences - Clinical documents and notes

Labs & Vital Signs:

  • observations - Laboratory results, vital signs, and clinical observations

Medications:

  • medicationAdministration - Medication administration records
  • medicationDispenses - Pharmacy dispensing records
  • medicationRequests - Medication prescriptions and orders
  • medicationStatements - Patient-reported or clinician-documented medications

Example: Query Allergy Intolerances

All FHIR resource queries follow the same pattern. This example retrieves a user's allergy and intolerance records:

GraphQL Query:

query getAllergyIntolerances {
  allergyIntolerances {
    entry {
      resource {
        resourceType
        id
        meta {
          lastUpdated
        }
        clinicalStatus {
          coding {
            system
            code
            display
          }
        }
        verificationStatus {
          coding {
            system
            code
            display
          }
        }
        category
        criticality
        code {
          coding {
            system
            code
            display
          }
        }
        patient {
          reference
        }
        onsetDateTime
        onsetPeriod {
          start
          end
        }
        recordedDate
        reaction {
          substance {
            coding {
              system
              code
              display
            }
          }
          manifestation {
            coding {
              system
              code
              display
            }
            text
          }
          severity
          exposureRoute {
            coding {
              system
              code
              display
            }
          }
        }
      }
    }
  }
}

Replace allergyIntolerances with any other FHIR resource query name from the list above to retrieve different health data categories. Each query returns resources in the same FHIR bundle structure with an entry 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.