Schedule a demo
Segment

Contract

Carries contract details used in supply chain and procurement workflows, including the contract identifier, effective and expiration dates, supplier type, contract type, pricing terms, and the group purchasing organization. It appears in supply chain messages to communicate negotiated pricing agreements between healthcare providers, distributors, and manufacturers.

21fields
4required
v2.9HL7 version
ctr.py
from zato.hl7v2 import CTR

ctr = CTR()
ctr.effective_date = '20260101'
ctr.expiration_date = '20261231'
ctr.contract_priority = 'HIGH'

Build CTR segments in Python

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

1

Distributor contract

Active contract with a distributor including effective dates and pricing tier

from zato.hl7v2.v2_9 import CTR
from zato.hl7v2.v2_9 import EI, CWE

ctr = CTR()
ctr.contract_identifier = EI(
    entity_identifier='CTR001',
    namespace_id='HOSP'
)
ctr.contract_description = (
    'Annual supply agreement'
)
ctr.contract_status = CWE(
    identifier='ACT',
    text='Active',
    name_of_coding_system='HL70536'
)
ctr.effective_date = '20240101'
ctr.expiration_date = '20241231'
ctr.supplier_type = CWE(
    identifier='DIST',
    text='Distributor',
    name_of_coding_system='HL70946'
)
ctr.contract_type = CWE(
    identifier='GPO',
    text='Group purchase',
    name_of_coding_system='HL70965'
)
ctr.pricing_tier_level = CWE(
    identifier='TIER1',
    text='Tier 1',
    name_of_coding_system='HL70966'
)
ctr.contract_priority = 'HIGH'
2

Fixed-price agreement

Fixed-price contract with a GPO and price protection date for supply chain purchasing

from zato.hl7v2.v2_9 import CTR
from zato.hl7v2.v2_9 import EI, CWE, XON

ctr = CTR()
ctr.contract_identifier = EI(
    entity_identifier='CTR002',
    namespace_id='HOSP'
)
ctr.contract_description = (
    'Fixed price pharma'
)
ctr.effective_date = '20240601'
ctr.expiration_date = '20250531'
ctr.supplier_type = CWE(
    identifier='MFG',
    text='Manufacturer',
    name_of_coding_system='HL70946'
)
ctr.price_protection_date = '20250101'
ctr.fixed_price_contract_indicator = 'Y'
ctr.group_purchasing_organization = XON(organization_name='HealthGPO')
3

Linked contract

Sub-contract linked to a parent contract with owner and originator names

from zato.hl7v2.v2_9 import CTR
from zato.hl7v2.v2_9 import EI, CWE, XPN

ctr = CTR()
ctr.contract_identifier = EI(
    entity_identifier='CTR003',
    namespace_id='HOSP'
)
ctr.contract_description = (
    'Sub-contract for supplies'
)
ctr.contract_status = CWE(
    identifier='ACT',
    text='Active',
    name_of_coding_system='HL70536'
)
ctr.effective_date = '20240301'
ctr.expiration_date = '20240901'
ctr.contract_owner_name = XPN(
    family_name='OWNER',
    given_name='JAMES'
)
ctr.supplier_type = CWE(
    identifier='DIST',
    text='Distributor',
    name_of_coding_system='HL70946'
)
ctr.associated_contract_id = EI(
    entity_identifier='CTR001',
    namespace_id='HOSP'
)

Learn by building

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

Frequently asked questions

CTR carries contract information for healthcare supply chain procurement. It specifies the contract identifier, dates, supplier type, pricing tier, markup limits, and links to group purchasing organizations, enabling systems to apply negotiated pricing to purchase orders.

The contract_status field uses the CWE datatype with HL7 table 0536:

from zato.hl7v2.v2_9 import CTR, CWE

ctr = CTR()
ctr.contract_status = CWE(
    identifier='ACT',
    text='Active',
    name_of_coding_system='HL70536'
)

The supplier_type field uses CWE with HL7 table 0946:

from zato.hl7v2.v2_9 import CTR, CWE

ctr = CTR()
ctr.supplier_type = CWE(
    identifier='DIST',
    text='Distributor',
    name_of_coding_system='HL70946'
)

Use the associated_contract_id field with the EI datatype:

from zato.hl7v2.v2_9 import CTR, EI

ctr = CTR()
ctr.associated_contract_id = EI(
    entity_identifier='CTR001',
    namespace_id='HOSP'
)

The group_purchasing_organization field uses the XON datatype:

from zato.hl7v2.v2_9 import CTR, XON

ctr = CTR()
ctr.group_purchasing_organization = XON(organization_name='HealthGPO')

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.

CTR field reference

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

#Python nameDatatypeUsageRepeatableTable
1contract_identifierEIRequiredNo-
2contract_descriptionSTOptionalNo-
3contract_statusCWEOptionalNoHL70536
4effective_dateDTMRequiredNo-
5expiration_dateDTMRequiredNo-
6contract_owner_nameXPNOptionalNo-
7contract_originator_nameXPNOptionalNo-
8supplier_typeCWERequiredNoHL70946
9contract_typeCWEOptionalNoHL70965
10free_on_board_freight_termsCNEOptionalNoHL70532
11price_protection_dateDTMOptionalNo-
12fixed_price_contract_indicatorCNEOptionalNoHL70532
13group_purchasing_organizationXONOptionalNo-
14maximum_markupMOPOptionalNo-
15actual_markupMOPOptionalNo-
16corporationXONOptionalYes-
17parent_of_corporationXONOptionalNo-
18pricing_tier_levelCWEOptionalNoHL70966
19contract_prioritySTOptionalNo-
20class_of_tradeCWEOptionalNoHL70947
21associated_contract_idEIOptionalNo-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python