Schedule a demo
Segment

Patient allergy information

Carries patient allergy data including the allergen type (drug, food, or environmental), allergen code or description, severity, and reaction. It repeats for each allergy and appears in ADT, pharmacy, and order messages. EHR and registration systems send AL1 to pharmacy systems, CPOE systems, and clinical alerting engines for allergy checking.

5fields
1required
v2.9HL7 version
al1.py
from zato.hl7v2 import AL1

al1 = AL1()
al1.set_id_al1 = '1'
al1.allergen_type_code = 'DA'
al1.allergy_severity_code = 'MI'

Build AL1 segments in Python

How to construct and work with real-world AL1 segments.

1

Food sensitivity

Pollen allergy noted during a routine wellness visit with mild severity

from zato.hl7v2.v2_9 import AL1
from zato.hl7v2.v2_9 import CWE

al1 = AL1()
al1.set_id_al1 = '1'
al1.allergen_type_code = CWE(identifier='EA')
al1.allergen_code_mnemonic_description = CWE(
    text='Pollen',
    alternate_identifier='L'
)
al1.allergy_severity_code = CWE(identifier='MI')
al1.allergy_reaction_code = 'Sneezing'
al1.identification_date = '20240315'
2

Medication note

Drug allergen type recorded with moderate severity during a routine check-up

from zato.hl7v2.v2_9 import AL1
from zato.hl7v2.v2_9 import CWE

al1 = AL1()
al1.set_id_al1 = '1'
al1.allergen_type_code = CWE(identifier='DA')
al1.allergen_code_mnemonic_description = CWE(text='Aspirin')
al1.allergy_severity_code = CWE(identifier='MO')
al1.allergy_reaction_code = 'Hives'
al1.identification_date = '20240601'
3

Environmental note

Environmental allergen with mild severity noted during annual wellness screening

from zato.hl7v2.v2_9 import AL1
from zato.hl7v2.v2_9 import CWE

al1 = AL1()
al1.set_id_al1 = '2'
al1.allergen_type_code = CWE(identifier='EA')
al1.allergen_code_mnemonic_description = CWE(text='Dust Mites')
al1.allergy_severity_code = CWE(identifier='MI')
al1.allergy_reaction_code = 'Congestion'
al1.identification_date = '20240110'

Learn by building

Step-by-step guides for working with HL7 v2 in Zato.

Frequently asked questions

AL1 carries patient allergy information - the type of allergen (drug, food, environmental), a description or code for the specific allergen, severity level, reaction details, and when the allergy was identified. It appears in ADT, ORM, and ORU messages.

Create an AL1 segment and read its fields directly:

from zato.hl7v2.v2_9 import AL1, CWE

al1 = AL1()
al1.set_id_al1 = '1'
al1.allergen_code_mnemonic_description = CWE(
    text='Pollen')
al1.allergy_severity_code = CWE(
    identifier='MI')
al1.allergy_reaction_code = 'Sneezing'

allergen = al1.allergen_code_mnemonic_description
severity = al1.allergy_severity_code
reaction = al1.allergy_reaction_code

Create separate AL1 instances, each with its own set_id_al1:

from zato.hl7v2.v2_9 import AL1, CWE

al1_drug = AL1()
al1_drug.set_id_al1 = '1'
al1_drug.allergen_type_code = CWE(
    identifier='DA')
al1_drug.allergen_code_mnemonic_description = CWE(
    text='Aspirin')

al1_env = AL1()
al1_env.set_id_al1 = '2'
al1_env.allergen_type_code = CWE(
    identifier='EA')
al1_env.allergen_code_mnemonic_description = CWE(
    text='Pollen')

The allergen_type_code field uses HL7 table 0127. Common values include:

from zato.hl7v2.v2_9 import AL1, CWE

al1 = AL1()

# DA = Drug allergy
al1.allergen_type_code = CWE(identifier='DA')

# FA = Food allergy
al1.allergen_type_code = CWE(identifier='FA')

# EA = Environmental allergy
al1.allergen_type_code = CWE(identifier='EA')

The allergy_severity_code field uses the CWE datatype with HL7 table 0128 codes:

from zato.hl7v2.v2_9 import AL1, CWE

al1 = AL1()

# MI = Mild
al1.allergy_severity_code = CWE(identifier='MI')

# MO = Moderate
al1.allergy_severity_code = CWE(identifier='MO')

# SV = Severe
al1.allergy_severity_code = CWE(identifier='SV')

Zato connects to any system that speaks HL7v2 over MLLP or FHIR over REST. This includes Epic, Cerner, Meditech, Allscripts, and other EHR platforms.

Yes, Zato has built-in MLLP support for sending and receiving HL7v2 messages. MLLP channels handle the framing protocol automatically.

Zato supports HL7 v2.9, which is backward compatible with earlier versions including v2.3, v2.5, and v2.7. Standard segments and datatypes are available as typed Python classes.

Yes. Zato handles both HL7v2 and FHIR natively, so you can parse v2 messages and build FHIR resources with IG-specific extensions in the same service. Typed Python classes are available for both protocols, including extensions from US Core, UK Core, Da Vinci, and other Implementation Guides.

AL1 field reference

Complete list of fields in the AL1 segment, HL7 v2.9.

#Python nameDatatypeUsageRepeatableTable
1set_id_al1SIRequiredNo-
2allergen_type_codeCWEOptionalNoHL70127
3allergen_code_mnemonic_descriptionCWEOptionalNo-
4allergy_severity_codeCWEOptionalNoHL70128
5allergy_reaction_codeSTOptionalYes-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python