Allergy History Element Documentation
Overview
Section titled “Overview”Allergy History elements document allergic reactions, intolerances, and adverse reactions to substances including medications, foods, and environmental factors. This information is critical for patient safety.
Function
Section titled “Function”builder.add_allergy_history( code: CodeInput, category: Optional[str] = None, clinical_status: str = "active", criticality: Optional[str] = None, reaction: Optional[str] = None, notes: Optional[str] = None, id: Optional[str] = None,) -> AllergyIntoleranceParameters
Section titled “Parameters”Required Parameters
Section titled “Required Parameters”- code: The allergen (substance causing the reaction)
Optional Parameters
Section titled “Optional Parameters”- category: Type of allergen (food, medication, environment, biologic)
- clinical_status: Current status of the allergy (default: “active”)
- criticality: Severity potential (low, high)
- reaction: Description of the allergic reaction
- notes: Additional information about the allergy
- id: Custom resource ID
Basic Usage
Section titled “Basic Usage”Simple Allergy (Preferred with CodeableConcept)
Section titled “Simple Allergy (Preferred with CodeableConcept)”from fhir_sdk import FHIRDocumentBuilder, AllergyCategoryfrom fhir_sdk.types import create_codeable_concept
builder = FHIRDocumentBuilder()builder.add_patient(name="John Doe", age=30)
# Add medication allergyallergy = builder.add_allergy_history( code=create_codeable_concept( text="Penicillin", code="387207008", system="http://snomed.info/sct", display="Penicillin" ), category=AllergyCategory.MEDICATION)Using String (Alternative)
Section titled “Using String (Alternative)”allergy = builder.add_allergy_history( code="Penicillin", category="medication")Detailed Allergy with Reaction
Section titled “Detailed Allergy with Reaction”from fhir_sdk import AllergyClinicalStatus, AllergyCriticality
allergy = builder.add_allergy_history( code=create_codeable_concept( text="Peanuts", code="256349002", system="http://snomed.info/sct" ), category=AllergyCategory.FOOD, clinical_status=AllergyClinicalStatus.ACTIVE, criticality=AllergyCriticality.HIGH, reaction="Anaphylaxis with difficulty breathing", notes="Carries epinephrine auto-injector, avoid all tree nuts")Allergy Categories
Section titled “Allergy Categories”from fhir_sdk import AllergyCategory
# Medication allergiesallergy = builder.add_allergy_history( code="Sulfonamides", category=AllergyCategory.MEDICATION, reaction="Skin rash and hives")
# Food allergiesallergy = builder.add_allergy_history( code="Shellfish", category=AllergyCategory.FOOD, criticality="high")
# Environmental allergiesallergy = builder.add_allergy_history( code="Pollen", category=AllergyCategory.ENVIRONMENT, reaction="Seasonal rhinitis and sneezing")
# Biologic allergiesallergy = builder.add_allergy_history( code="Latex", category=AllergyCategory.BIOLOGIC, reaction="Contact dermatitis")Clinical Status Options
Section titled “Clinical Status Options”from fhir_sdk import AllergyClinicalStatus
# Active allergyallergy = builder.add_allergy_history( code="Iodine contrast", clinical_status=AllergyClinicalStatus.ACTIVE)
# Resolved allergyallergy = builder.add_allergy_history( code="Milk protein", clinical_status=AllergyClinicalStatus.RESOLVED, notes="Childhood allergy, outgrew by age 5")
# Inactive allergyallergy = builder.add_allergy_history( code="Eggs", clinical_status=AllergyClinicalStatus.INACTIVE, notes="Had reaction as child, now tolerates well")Criticality Levels
Section titled “Criticality Levels”from fhir_sdk import AllergyCriticality
# High criticalityallergy = builder.add_allergy_history( code="Bee venom", criticality=AllergyCriticality.HIGH, reaction="Anaphylaxis", notes="Requires immediate epinephrine if exposed")
# Low criticalityallergy = builder.add_allergy_history( code="Adhesive tape", criticality=AllergyCriticality.LOW, reaction="Mild skin irritation")Common Medication Allergies
Section titled “Common Medication Allergies”# Penicillin allergyallergy = builder.add_allergy_history( code=create_codeable_concept( text="Penicillin", code="387207008", system="http://snomed.info/sct" ), category=AllergyCategory.MEDICATION, reaction="Skin rash and urticaria", notes="Avoid all penicillin derivatives")
# Sulfa allergyallergy = builder.add_allergy_history( code=create_codeable_concept( text="Sulfonamide", code="387406002", system="http://snomed.info/sct" ), category=AllergyCategory.MEDICATION, reaction="Stevens-Johnson syndrome", criticality=AllergyCriticality.HIGH)
# Codeine allergyallergy = builder.add_allergy_history( code="Codeine", category=AllergyCategory.MEDICATION, reaction="Nausea and vomiting", notes="Avoid opioid combinations containing codeine")
# NSAIDsallergy = builder.add_allergy_history( code="Ibuprofen", category=AllergyCategory.MEDICATION, reaction="Gastric upset and bleeding", notes="History of GI bleeding with NSAIDs")Common Food Allergies
Section titled “Common Food Allergies”# Tree nutsallergy = builder.add_allergy_history( code=create_codeable_concept( text="Tree nut", code="91935009", system="http://snomed.info/sct" ), category=AllergyCategory.FOOD, criticality=AllergyCriticality.HIGH, reaction="Throat swelling and difficulty breathing")
# Dairy allergyallergy = builder.add_allergy_history( code="Cow's milk protein", category=AllergyCategory.FOOD, reaction="Digestive upset and diarrhea", notes="Can tolerate lactose-free products")
# Shellfishallergy = builder.add_allergy_history( code="Shellfish", category=AllergyCategory.FOOD, reaction="Hives and facial swelling", criticality=AllergyCriticality.HIGH)
# Gluten sensitivityallergy = builder.add_allergy_history( code="Gluten", category=AllergyCategory.FOOD, reaction="Abdominal pain and bloating", notes="Non-celiac gluten sensitivity")Environmental Allergies
Section titled “Environmental Allergies”# Pollen allergiesallergy = builder.add_allergy_history( code=create_codeable_concept( text="Tree pollen", code="256277009", system="http://snomed.info/sct" ), category=AllergyCategory.ENVIRONMENT, reaction="Seasonal rhinitis, watery eyes, sneezing", notes="Worse in spring months (March-May)")
# Dust mitesallergy = builder.add_allergy_history( code="House dust mite", category=AllergyCategory.ENVIRONMENT, reaction="Asthma exacerbation and congestion", notes="Uses allergen-proof bedding")
# Pet danderallergy = builder.add_allergy_history( code="Cat dander", category=AllergyCategory.ENVIRONMENT, reaction="Asthma and itchy eyes", notes="Symptoms within minutes of exposure")
# Moldallergy = builder.add_allergy_history( code="Mold spores", category=AllergyCategory.ENVIRONMENT, reaction="Respiratory symptoms", notes="Worse in damp weather or basements")Contact Allergies
Section titled “Contact Allergies”# Latexallergy = builder.add_allergy_history( code=create_codeable_concept( text="Natural rubber latex", code="111088007", system="http://snomed.info/sct" ), category=AllergyCategory.BIOLOGIC, reaction="Contact dermatitis and itching", notes="Use latex-free medical supplies")
# Nickelallergy = builder.add_allergy_history( code="Nickel", category=AllergyCategory.ENVIRONMENT, reaction="Contact dermatitis", notes="Avoid jewelry containing nickel")Contrast and Dye Allergies
Section titled “Contrast and Dye Allergies”# Iodine contrastallergy = builder.add_allergy_history( code=create_codeable_concept( text="Iodinated contrast media", code="293586001", system="http://snomed.info/sct" ), category=AllergyCategory.MEDICATION, criticality=AllergyCriticality.HIGH, reaction="Anaphylactic reaction", notes="Premedication required if contrast studies needed")
# Gadoliniumallergy = builder.add_allergy_history( code="Gadolinium contrast", category=AllergyCategory.MEDICATION, reaction="Nausea and flushing", notes="Use alternative contrast agents for MRI")Drug Class Allergies
Section titled “Drug Class Allergies”# Entire drug classallergy = builder.add_allergy_history( code="Beta-lactam antibiotics", category=AllergyCategory.MEDICATION, reaction="Urticaria and angioedema", notes="Includes penicillins and cephalosporins")
# ACE inhibitorsallergy = builder.add_allergy_history( code="ACE inhibitors", category=AllergyCategory.MEDICATION, reaction="Dry cough", notes="Switch to ARB if antihypertensive needed")Intolerance vs True Allergy
Section titled “Intolerance vs True Allergy”# Drug intolerance (not immune-mediated)allergy = builder.add_allergy_history( code="Metformin", category=AllergyCategory.MEDICATION, reaction="Gastrointestinal upset", notes="Intolerance - GI symptoms, not true allergic reaction")
# True allergic reactionallergy = builder.add_allergy_history( code="Amoxicillin", category=AllergyCategory.MEDICATION, reaction="IgE-mediated urticaria", criticality=AllergyCriticality.HIGH, notes="Confirmed allergic reaction with eosinophilia")Best Practices
Section titled “Best Practices”- Use create_codeable_concept with SNOMED CT codes for allergens when available
- Distinguish between allergies, intolerances, and side effects
- Document specific reactions for clinical decision-making
- Set appropriate criticality levels for risk assessment
- Include avoidance strategies and alternative options
- Update allergy status if reactions change over time
- Document negative allergies (NKDA) when confirmed
- Include drug class allergies to prevent cross-reactions
Critical Allergy Information
Section titled “Critical Allergy Information”Always document:
- Specific allergen and substance details
- Type of reaction and symptoms experienced
- Severity and criticality level
- Alternative options and cross-reactivity risks
- Emergency treatment requirements (epinephrine, etc.)
- Allergy information is critical for medication safety
- Multiple allergies can be documented for comprehensive safety profiles
- Clinical status tracking helps manage resolved or inactive allergies
- Integration with prescribing systems helps prevent adverse reactions
- Regular review ensures allergy information stays current and accurate