Defines the action to be taken on a single entry within the master file, carrying the record-level event code (insert, update, delete, or deactivate), the effective date, and the primary key value identifying the specific record. One MFE segment appears before each master file data segment (such as CDM, LOC, or STF) and is used by the receiving system to determine how to process each record.
from zato.hl7v2.v2_9 import MFE
from zato.hl7v2.v2_9 import CX, XCN
mfe = MFE()
mfe.record_level_event_code = 'MAD'
key = CX(id_number='SRV001', assigning_authority='WELL')
mfe.primary_key_value_mfe = key
mfe.primary_key_value_type = 'CX'
entered_by = XCN(person_identifier='COACH01', family_name='Rivera', given_name='Maria')
mfe.entered_by = entered_byHow to construct and work with real-world MFE segments.
MAD event with CX primary key, type CX, and coach XCN on the same row
from zato.hl7v2.v2_9 import MFE
from zato.hl7v2.v2_9 import CX, XCN
mfe = MFE()
mfe.record_level_event_code = 'MAD'
mfe.mfn_control_id = 'MFN-CTRL-88'
mfe.effective_date_time = '20260405120000'
mfe.primary_key_value_mfe = [
CX(
id_number='SRV001',
assigning_authority='WELL',
),
]
mfe.primary_key_value_type = ['CX']
mfe.entered_date_time = '20260405121500'
mfe.entered_by = XCN(
person_identifier='COACH01',
family_name='Rivera',
given_name='Maria',
)MUP event with compact control id and optional timestamps omitted
from zato.hl7v2.v2_9 import MFE
from zato.hl7v2.v2_9 import CX
mfe = MFE()
mfe.record_level_event_code = 'MUP'
mfe.mfn_control_id = 'NUT-ITEM-42'
mfe.primary_key_value_mfe = [
CX(
id_number='MEAL88',
assigning_authority='MENU',
),
]
mfe.primary_key_value_type = ['CWE']Repeating primary key values with parallel type repetitions
from zato.hl7v2.v2_9 import MFE
from zato.hl7v2.v2_9 import CX, XCN
mfe = MFE()
mfe.record_level_event_code = 'MAD'
mfe.mfn_control_id = 'FIT-CLASS-9'
mfe.effective_date_time = '20260405140000'
mfe.primary_key_value_mfe = [
CX(
id_number='CLS01',
assigning_authority='FIT',
),
CX(
id_number='CLS02',
assigning_authority='FIT',
),
]
mfe.primary_key_value_type = ['CX', 'CX']
mfe.entered_date_time = '20260405140500'
mfe.entered_by = XCN(
person_identifier='STAFF02',
family_name='Nguyen',
given_name='Lee',
)Step-by-step guides for working with HL7 v2 in Zato.
Some master files bundle several identifiers on one logical change. Each repetition lines up with the same-index repetition in primary_key_value_type so keys stay paired for wellness or fitness catalog rows.
MFI names the file and event; MFE lists concrete inserts or updates. Think of MFI as the chapter title and MFE as the bullet rows underneath.
Use CX for composite identifiers and store one list element per repetition:
from zato.hl7v2.v2_9 import MFE
from zato.hl7v2.v2_9 import CX
mfe = MFE()
mfe.primary_key_value_mfe = [
CX(
id_number='SRV001',
assigning_authority='WELL',
),
]
mfe.primary_key_value_type = ['CX']The optional ST ties an MFE row to a sender reference so MFA replies can echo the same token when confirming preventive-care catalog updates.
Populate XCN when stewardship matters, for example a coach or registrar who owns the change, leaving it empty for automated feeds that lack a person row.
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 MFE segment, HL7 v2.9.
| # | Python name | Datatype | Usage | Repeatable | Table |
|---|---|---|---|---|---|
| 1 | record_level_event_code | ID | Required | No | HL70180 |
| 2 | mfn_control_id | ST | Optional | No | - |
| 3 | effective_date_time | DTM | Optional | No | - |
| 4 | primary_key_value_mfe | Varies | Required | Yes | HL70608 |
| 5 | primary_key_value_type | ID | Required | Yes | HL70355 |
| 6 | entered_date_time | DTM | Optional | No | - |
| 7 | entered_by | XCN | Optional | No | - |
Get started with Zato and connect your systems in minutes.