Schedule a demo
Segment

Master file entry

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.

7fields
3required
v2.9HL7 version
mfe.py
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_by

Build MFE segments in Python

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

1

Add wellness service row

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',
)
2

Nutrition menu item update

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']
3

Fitness class capacity change

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',
)

Learn by building

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

Frequently asked questions

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.

MFE field reference

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

#Python nameDatatypeUsageRepeatableTable
1record_level_event_codeIDRequiredNoHL70180
2mfn_control_idSTOptionalNo-
3effective_date_timeDTMOptionalNo-
4primary_key_value_mfeVariesRequiredYesHL70608
5primary_key_value_typeIDRequiredYesHL70355
6entered_date_timeDTMOptionalNo-
7entered_byXCNOptionalNo-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python