Schedule a demo
Segment

Inventory item master

Contains master-level detail about items held in a facility's inventory, including the item code, lot number, expiration date, manufacturer, storage location, received quantities, costs, and on-hand quantities. It is used in inventory-management and materials-management messages to synchronize stock records across supply-chain, pharmacy, and central-stores systems.

15fields
2required
v2.9HL7 version
iim.py
from zato.hl7v2 import IIM

iim = IIM()
iim.service_item_code = 'IV-SET-001'
iim.inventory_lot_number = 'LOT2024A'
iim.inventory_received_quantity = '50'

Build IIM segments in Python

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

1

Supply receipt

Recording a received shipment of IV sets with lot, manufacturer, and cost details

from zato.hl7v2.v2_9 import IIM
from zato.hl7v2.v2_9 import CWE, MO

iim = IIM()
iim.primary_key_value_iim = CWE(
    identifier='IV001',
    text='IV Set',
    name_of_coding_system='LOCAL'
)
iim.service_item_code = CWE(
    identifier='IV-SET-001',
    text='IV Set Standard',
    name_of_coding_system=
        'SUPPLIERCAT'
)
iim.inventory_lot_number = 'LOT2024A'
iim.inventory_expiration_date = '20261231'
iim.inventory_location = CWE(
    identifier='CENTRAL',
    text='Central stores',
    name_of_coding_system='LOCAL'
)
iim.inventory_received_date = '20240510'
iim.inventory_received_quantity = '50'
iim.inventory_received_quantity_unit = CWE(
    identifier='EA',
    text='Each',
    name_of_coding_system='UCUM'
)
iim.inventory_received_item_cost = MO(
    quantity='15.00',
    denomination='USD'
)
2

On-hand stock count

Tracking current on-hand inventory levels for a surgical supply item

from zato.hl7v2.v2_9 import IIM
from zato.hl7v2.v2_9 import CWE

iim = IIM()
iim.primary_key_value_iim = CWE(
    identifier='SRG050',
    text='Suture kit',
    name_of_coding_system='LOCAL'
)
iim.service_item_code = CWE(
    identifier='SRG-050',
    text='Suture Kit 3-0',
    name_of_coding_system=
        'SUPPLIERCAT'
)
iim.inventory_manufacturer_name = CWE(
    identifier='MFG',
    text='Acme Medical',
    name_of_coding_system='LOCAL'
)
iim.inventory_on_hand_date = '20240601'
iim.inventory_on_hand_quantity = '120'
iim.inventory_on_hand_quantity_unit = CWE(
    identifier='BX',
    text='Box',
    name_of_coding_system='UCUM'
)
3

Expiration tracking

Recording lot-level expiration and procedure code for a pharmacy item

from zato.hl7v2.v2_9 import IIM
from zato.hl7v2.v2_9 import CWE, CNE

iim = IIM()
iim.primary_key_value_iim = CWE(
    identifier='RX100',
    text='Amoxicillin',
    name_of_coding_system='LOCAL'
)
iim.service_item_code = CWE(
    identifier='RX-100',
    text='Amoxicillin 500mg',
    name_of_coding_system='NDC'
)
iim.inventory_lot_number = 'LOT9876'
iim.inventory_expiration_date = '20250315'
iim.inventory_manufacturer_name = CWE(
    identifier='PHARMA',
    text='PharmaCorp',
    name_of_coding_system='LOCAL'
)
iim.procedure_code = CNE(
    identifier='99213',
    text='Office visit',
    name_of_coding_system='CPT'
)

Learn by building

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

Frequently asked questions

IIM carries master-level inventory item data including item codes, lot numbers, expiration dates, manufacturer details, received and on-hand quantities, and associated costs. It is used to synchronize stock records between supply-chain, pharmacy, and materials-management systems.

The service_item_code field uses the CWE datatype to identify the catalogued item:

from zato.hl7v2.v2_9 import IIM, CWE

iim = IIM()
iim.service_item_code = CWE(
    identifier='IV-SET-001',
    text='IV Set Standard',
    name_of_coding_system=
        'SUPPLIERCAT'
)

Set the quantity, its unit via CWE, and the cost via MO:

from zato.hl7v2.v2_9 import IIM
from zato.hl7v2.v2_9 import CWE, MO

iim = IIM()
iim.inventory_received_quantity = '50'
iim.inventory_received_quantity_unit = CWE(
    identifier='EA',
    text='Each',
    name_of_coding_system='UCUM'
)
iim.inventory_received_item_cost = MO(
    quantity='15.00',
    denomination='USD'
)

Use the on-hand date, quantity, and quantity unit fields together:

from zato.hl7v2.v2_9 import IIM, CWE

iim = IIM()
iim.inventory_on_hand_date = '20240601'
iim.inventory_on_hand_quantity = '120'
iim.inventory_on_hand_quantity_unit = CWE(
    identifier='BX',
    text='Box',
    name_of_coding_system='UCUM'
)

The procedure_code field uses CNE with HL7 table 0088:

from zato.hl7v2.v2_9 import IIM, CNE

iim = IIM()
iim.procedure_code = CNE(
    identifier='99213',
    text='Office visit',
    name_of_coding_system='CPT'
)

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.

IIM field reference

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

#Python nameDatatypeUsageRepeatableTable
1primary_key_value_iimCWERequiredNo-
2service_item_codeCWERequiredNo-
3inventory_lot_numberSTOptionalNo-
4inventory_expiration_dateDTMOptionalNo-
5inventory_manufacturer_nameCWEOptionalNo-
6inventory_locationCWEOptionalNo-
7inventory_received_dateDTMOptionalNo-
8inventory_received_quantityNMOptionalNo-
9inventory_received_quantity_unitCWEOptionalNo-
10inventory_received_item_costMOOptionalNo-
11inventory_on_hand_dateDTMOptionalNo-
12inventory_on_hand_quantityNMOptionalNo-
13inventory_on_hand_quantity_unitCWEOptionalNo-
14procedure_codeCNEOptionalNoHL70088
15procedure_code_modifierCNEOptionalYesHL70340

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python