Schedule a demo
Segment

Location identification

Serves as the primary location master file segment, identifying a patient care location with its key identifier, name, location type (nursing unit, room, bed, clinic, or department), address, and phone number. It is the anchor segment in MFN (Location Master File) messages sent by ADT or facility management systems to synchronize location master data with bed management, scheduling, and clinical systems.

9fields
2required
v2.9HL7 version
loc.py
from zato.hl7v2.v2_9 import LOC
from zato.hl7v2.v2_9 import CWE, PL, XON

loc = LOC()
loc.primary_key_value_loc = PL(
    point_of_care='WELLCTR',
    room='GYM-2A',
    location_status='A',
)
loc.location_type_loc = CWE(
    identifier='FIT',
    text='Fitness floor',
    name_of_coding_system='HL70260'
)
organization = XON(organization_name='River Valley Wellness')
loc.organization_name_loc = organization

Build LOC segments in Python

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

1

Fitness assessment bay

Primary PL key, description, type CWE, org XON, address, phone, license, equipment, service code

from zato.hl7v2.v2_9 import LOC
from zato.hl7v2.v2_9 import CWE, PL, XAD, XON, XTN

loc = LOC()
loc.primary_key_value_loc = PL(
    point_of_care='WELLCTR',
    room='GYM-2A',
    location_status='A',
    building='Main',
    floor='2',
)
loc.location_description = 'Fitness assessment bay'
loc.location_type_loc = CWE(
    identifier='FIT',
    text='Fitness floor',
    name_of_coding_system='HL70260'
)
loc.organization_name_loc = XON(organization_name='River Valley Wellness')
loc.location_address = XAD(
    street_address='123 Wellness Way',
    city='Denver',
    state_or_province='CO',
    zip_or_postal_code='80202'
)
loc.location_phone = XTN(
    telecommunication_use_code='PRN',
    telecommunication_equipment_type='PH',
    country_code='1',
    area_city_code='303',
    local_number='5550100'
)
loc.license_number = CWE(
    identifier='LIC',
    text='State facility license',
    name_of_coding_system='HL70461'
)
loc.location_equipment = CWE(
    identifier='BIA',
    text='Body composition analyzer',
    name_of_coding_system='HL70261'
)
loc.location_service_code = CWE(
    identifier='FITGRP',
    text='Group fitness',
    name_of_coding_system='HL70442',
)
2

Nutrition counseling suite

Minimal LOC with required PL and single location type CWE

from zato.hl7v2.v2_9 import LOC
from zato.hl7v2.v2_9 import CWE, PL

loc = LOC()
loc.primary_key_value_loc = PL(
    point_of_care='SUNRISE',
    room='NUT-3',
    location_status='O',
    building='East',
    floor='1',
)
loc.location_type_loc = CWE(
    identifier='NUT',
    text='Nutrition suite',
    name_of_coding_system='HL70260'
)
3

Dual-purpose studio deck

Repeating location_type_loc entries for pool and open gym areas

from zato.hl7v2.v2_9 import LOC
from zato.hl7v2.v2_9 import CWE, PL

loc = LOC()
loc.primary_key_value_loc = PL(
    point_of_care='COAST',
    room='POOL-1',
    location_status='A',
    building='South',
    floor='G',
)
loc.location_description = 'Aquatics and gym deck'
loc.location_type_loc = [
    CWE(
        identifier='POOL',
        text='Pool deck',
        name_of_coding_system='HL70260',
    ),
    CWE(
        identifier='GYM',
        text='Open gym',
        name_of_coding_system='HL70260',
    ),
]

Learn by building

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

Frequently asked questions

PL combines site, room, building, and floor in one key so master-file rows reference the same wellness space across LOC, LCH, and LDP children.

HL7 separates repetitions with tilde; build a Python list of CWE rows in the same order as the wire string.

Use a list of XON rows for legal or marketing names:

from zato.hl7v2.v2_9 import LOC
from zato.hl7v2.v2_9 import PL, XON

loc = LOC()
loc.primary_key_value_loc = PL(
    point_of_care='WELLCTR',
    room='GYM-2A',
)
loc.organization_name_loc = XON(organization_name='River Valley Wellness')

Add license CWE rows for regulated studios and equipment CWE rows when the room advertises specific fitness or measurement devices.

Field 9 (HL70442) classifies the wellness service offered at the site, such as group fitness versus nutrition counseling.

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.

LOC field reference

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

#Python nameDatatypeUsageRepeatableTable
1primary_key_value_locPLRequiredNo-
2location_descriptionSTOptionalNo-
3location_type_locCWERequiredYesHL70260
4organization_name_locXONOptionalYes-
5location_addressXADOptionalYes-
6location_phoneXTNOptionalYes-
7license_numberCWEOptionalYesHL70461
8location_equipmentCWEOptionalYesHL70261
9location_service_codeCWEOptionalNoHL70442

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python