Clinical resources
AllergyIntolerance
Learn about recording patient allergies and intolerances.
Set up the SDK server client to run the examples using esus. The REST examples use a session token. To run them with the SDK’s API key, send X-API-Key instead of Authorization.
The AllergyIntolerance resource records allergies and adverse reactions to substances, medications, foods, and other agents. It is critical for patient safety.
API convention: the patient reference is sent as a flat string field (
patientId, notsubjectId).encounterIdis optional for recording context. All ids are raw UUIDs (v4).
Creating an Allergy Record
curl -X POST https://api.esus.health/fhir/AllergyIntolerance \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clinicalStatus": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code": "active",
"display": "Active"
}]
},
"verificationStatus": {
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code": "confirmed",
"display": "Confirmed"
}]
},
"type": "allergy",
"category": ["medication"],
"criticality": "high",
"code": {
"coding": [{
"system": "http://snomed.info/sct",
"code": "387458008",
"display": "Penicillin"
}]
},
"reaction": [
{
"manifestation": [
{ "coding": [{ "system": "http://snomed.info/sct", "code": "126485001", "display": "Urticaria" }] }
],
"severity": "severe"
}
]
}'
const created = await esus.fhir.create("AllergyIntolerance", {
"patientId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"clinicalStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
"code": "active",
"display": "Active"
}
]
},
"verificationStatus": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
"code": "confirmed",
"display": "Confirmed"
}
]
},
"type": "allergy",
"category": [
"medication"
],
"criticality": "high",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "387458008",
"display": "Penicillin"
}
]
},
"reaction": [
{
"manifestation": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "126485001",
"display": "Urticaria"
}
]
}
],
"severity": "severe"
}
]
});
The only required field is patientId. code is optional: for a verbal history without a coded substance you can record just the reactions. The patient and encounter must exist in your organization; otherwise the API answers 400. Other optional fields: onsetDateTime, recordedDate, lastOccurrence, recorder, asserter, note, and identifier (identifier can only be sent on create).
Clinical Status
| Code | Description |
|---|---|
active | Currently affects the patient |
inactive | No longer active |
resolved | Previously existed, now resolved |
Type and Criticality
type accepts allergy or intolerance. criticality is the potential risk of a future reaction:
| Level | Meaning |
|---|---|
low | Low risk if exposed |
high | High risk if exposed |
unable-to-assess | Cannot be determined |
Categories
category is a list with one or more of these values:
medication— medicationsfood— foodsenvironment— pollen, dust, animal danderbiologic— biologic products
Reaction Details
Each entry in reaction[] needs manifestation (a list of CodeableConcepts) and may include:
| Field | Description |
|---|---|
substance | The specific agent that triggered this reaction (CodeableConcept) |
exposureRoute | How the patient was exposed (oral, topical, etc.) |
severity | mild, moderate, or severe |
note | Free-text notes |
Searching Allergies
| Parameter | Behavior |
|---|---|
_id | Exact id |
patient | Patient id (<uuid> or Patient/<uuid>) |
encounter | Encounter id |
type, criticality | Exact |
clinical-status, verification-status, category | Partial text |
code | Exact system|code, or partial text |
date | Date of recordedDate, with optional prefix eq, gt, lt, ge, or le; repeat it for a range (date=ge2026-01-01&date=lt2026-02-01) |
onset | Date of onsetDateTime, with the same prefixes |
recorder, asserter | Reference, partial match |
Page with _count and _offset, and sort with _sort by _lastUpdated, date, onset, or criticality.
curl "https://api.esus.health/fhir/AllergyIntolerance?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&criticality=high" \
-H "Authorization: Bearer YOUR_TOKEN"
const { resources, total } = await esus.fhir.search("AllergyIntolerance", {
"patient": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"criticality": "high"
});
Read, update (PUT/PATCH), delete, and _history work the same as for Patient: see CRUD Operations.
Why It Matters
Allergy information must be available to everyone caring for the patient. Many medical errors happen when it is not communicated properly.