Identifies a person and their functional role within the context of a message, such as attending physician, referring provider, or consulting physician. Its positional placement after PID, PV2, or other segments indicates whether the role is patient-level, visit-level, or insurance-level. It appears in ADT, finance, and order messages, though as of v2.9 the PRT (Participation) segment is recommended in its place.
from zato.hl7v2.v2_9 import ROL
from zato.hl7v2.v2_9 import XCN, DIN
rol = ROL()
rol.role_instance_id = '1'
rol.action_code = 'ADD'
rol.rol_role = 'HP'
rol.rol_person = XCN(
person_identifier_type='NPI',
id_number='1234567890',
family_name='Johnson',
given_name='Sarah'
)
rol.rol_begin_date_time = DIN('20260115')
rol.rol_end_date_time = DIN('20261231')How to construct and work with real-world ROL segments.
Primary health coach managing preventive care program
from zato.hl7v2.v2_9 import ROL
from zato.hl7v2.v2_9 import XCN, XON, XTN, DIN
rol = ROL()
rol.role_instance_id = '1'
rol.action_code = 'ADD'
rol.rol_role = {
'role': 'HP',
'description': 'Health professional',
'coding_system': 'HL70443'
}
rol.rol_begin_date_time = DIN('20240115')
rol.rol_end_date_time = DIN('20241231')
rol.rol_person = XCN(
person_identifier_type='NPI',
id_number='1234567890',
family_name='Johnson',
given_name='Sarah',
name_type_code='D',
effective_date='20240115'
)
rol.rol_organization = XON(
organization_name=
'River Valley Wellness'
)
rol.rol_phone = XTN(
telecommunication_use_code='PRN',
telecommunication_equipment_type='PH',
country_code='1',
area_city_code='303',
local_number='5550100',
unformatted_telephone_number='555-0100'
)
rol.rol_email = XTN(
telecommunication_use_code='NET',
telecommunication_equipment_type='Internet',
email_address='sarah.johnson@example.com'
)Exercise physiologist leading group fitness programs
from zato.hl7v2.v2_9 import ROL
from zato.hl7v2.v2_9 import XCN, XON, XTN, DIN
rol = ROL()
rol.role_instance_id = '2'
rol.action_code = 'ADD'
rol.rol_role = {
'role': 'HP',
'description': 'Health professional',
'coding_system': 'HL70443'
}
rol.rol_begin_date_time = DIN('20240201')
rol.rol_end_date_time = DIN('20241231')
rol.rol_person = XCN(
person_identifier_type='NPI',
id_number='9876543210',
family_name='Miller',
given_name='Michael',
name_type_code='D',
effective_date='20240201'
)
rol.rol_organization = XON(
organization_name=
'Active Life Wellness'
)
rol.rol_phone = XTN(
telecommunication_use_code='WPN',
telecommunication_equipment_type='PH',
country_code='1',
area_city_code='303',
local_number='5550200',
unformatted_telephone_number='555-0200'
)Registered dietitian providing wellness nutrition counseling
from zato.hl7v2.v2_9 import ROL
from zato.hl7v2.v2_9 import XCN, XON, XTN, DIN
rol = ROL()
rol.role_instance_id = '3'
rol.action_code = 'ADD'
rol.rol_role = {
'role': 'RD',
'description': 'Registered dietitian',
'coding_system': 'HL70443'
}
rol.rol_begin_date_time = DIN('20240301')
rol.rol_end_date_time = DIN('20241231')
rol.rol_person = XCN(
person_identifier_type='NPI',
id_number='5551112222',
family_name='Chen',
given_name='Lisa',
name_type_code='D',
effective_date='20240301'
)
rol.rol_organization = XON(
organization_name=
'Harmony Health Center'
)
rol.rol_phone = XTN(
telecommunication_use_code='WPN',
telecommunication_equipment_type='PH',
country_code='1',
area_city_code='303',
local_number='5550300',
unformatted_telephone_number='555-0300'
)
rol.rol_email = XTN(
telecommunication_use_code='NET',
telecommunication_equipment_type='Internet',
email_address='lisa.chen@example.com'
)Step-by-step guides for working with HL7 v2 in Zato.
ADD adds a new role, UPDATE modifies an existing role, DELETE removes a role, and UNDO cancels a previous action. These codes track changes to provider relationships throughout the wellness program.
Use HL70443 table values like HP (health professional), RD (registered dietitian), or custom role codes:
rol.rol_role = {
'role': 'HP',
'description': 'Health professional',
'coding_system': 'HL70443'
}The role_instance_id uniquely identifies each role instance within a message, allowing multiple roles for the same person or organization with different time periods and responsibilities.
Use DIN datatype for begin and end dates, or combine them in a single field:
from zato.hl7v2.v2_9 import DIN
rol.rol_begin_date_time = DIN('20240115')
rol.rol_end_date_time = DIN('20241231')
# or
rol.rol_begin_date_time = '20240115-20241231'Yes, ROL can represent both individual providers and organizational roles. For organizational roles, populate rol_organization and leave rol_person empty, or use rol_person with organizational identifiers.
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.
Complete list of fields in the ROL segment, HL7 v2.9.
| # | Python name | Datatype | Usage | Repeatable | Table |
|---|
Get started with Zato and connect your systems in minutes.