Schedule a demo
Message type

Collaborative care referral

Supports collaborative care coordination between providers. Key segments include MSH, RF1, ORC, OBX. Care coordination platforms and clinical systems exchange this to share patient care information across organizational boundaries.

65segments
30required
17groups
v2.9HL7 version
ccr-i16.py
# Zato
from zato.hl7v2 import HL7Message

# An incoming message ..
raw = 'MSH|^~\&|SENDER|FAC|RCV|DEST|20260701||' \
      'CCR^I16^CCR_I16|MSG001|P|2.9\r' \
      'PID|1||MRN-10045||SMITH^JOHN||19850315|M\r' \
      'PV1|1|I|MED^201^A'

# .. parsed into a Python object ..
msg = HL7Message.parse(raw)

# .. whose fields we can now access.
name = msg.pid.patient_name
dob = msg.pid.date_time_of_birth
patient_class = msg.pv1.patient_class
location = msg.pv1.assigned_patient_location

Build and parse CCR^I16 messages in Python

How to construct, send, receive, and extract fields from real-world CCR^I16 messages.

1

Parse an incoming CCR^I16 message

Demonstrates receiving and extracting key fields from a collaborative care referral transaction

# Zato
from zato.hl7v2 import HL7Message

# An incoming message ..
raw = 'MSH|^~\&|SENDER|FAC|RCV|DEST|20260701||' \
      'CCR^I16^CCR_I16|MSG001|P|2.9\r' \
      'PID|1||MRN-10045||SMITH^JOHN||19850315|M\r' \
      'PV1|1|I|MED^201^A'

# .. parsed into a Python object ..
msg = HL7Message.parse(raw)

# .. whose fields we can now access.
name = msg.pid.patient_name
dob = msg.pid.date_time_of_birth
patient_class = msg.pv1.patient_class
location = msg.pv1.assigned_patient_location

Learn by building

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

Frequently asked questions

Use the HL7v2 message parser to extract the typed structure. The parsed message gives you direct access to every segment and field by name.

from zato.hl7v2 import HL7Message

raw = 'MSH|^~\&|SENDER|FACILITY|RECEIVER|DEST|20260401120000||CCR^I16^CCR_I16|MSG00001|P|2.9\rRF1||ROUTINE^Routine^HL70283||20260401|20260430\rNK1|1|JOHNSON^MICHAEL|SPO^Spouse|100 Oak Lane^^Portland^OR^97201|5035551234\rREL|1||HAS^Has^HL70948'
msg = HL7Message.parse(raw)

name = msg.pid.patient_name
dob = msg.pid.date_time_of_birth

Beyond the mandatory MSH header, the required segments are: RF1, PRD, ORC, TQ1, OBX, PID, IN1, SCH. Optional segments provide additional detail when available.

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.

CCR^I16 segment composition

Segments that make up the CCR^I16 message, in order. Groups are shown with their child segments.

#SegmentUsageRepeatsDescriptionGroup
1MSHRequiredNoMessage header-
2ARVOptionalYesAccess restriction-
3SFTOptionalYesSoftware segment-
4UACOptionalNoUser authentication credential-
5RF1RequiredYesReferral information-
6PRDRequiredNoProvider dataPROVIDER_CONTACT
7CTDOptionalYesContact dataPROVIDER_CONTACT
8ORCRequiredNoCommon orderCLINICAL_ORDER
9TQ1RequiredNoTiming / quantityCLINICAL_ORDER
10TQ2OptionalYesTiming / quantity relationshipCLINICAL_ORDER
11OBXRequiredNoObservation resultCLINICAL_ORDER_OBSERVATION
12PRTOptionalYesParticipation informationCLINICAL_ORDER_OBSERVATION
13CTIOptionalYesClinical trial identificationCLINICAL_ORDER
14PIDRequiredNoPatient identificationPATIENT
15PD1OptionalNoPatient additional demographicPATIENT
16NK1OptionalYesNext of kin / associated parties-
17IN1RequiredNoInsuranceINSURANCE
18IN2OptionalNoInsurance additional infoINSURANCE
19IN3OptionalNoInsurance additional info - certificationINSURANCE
20SCHRequiredNoScheduling activity informationAPPOINTMENT_HISTORY
21RGSRequiredNoResource groupAPPOINTMENT_HISTORY
22OBXRequiredNoObservation resultRESOURCE_DETAIL
23PRTOptionalYesParticipation informationRESOURCE_DETAIL
24ORCRequiredNoCommon orderCLINICAL_HISTORY
25OBXRequiredNoObservation resultCLINICAL_HISTORY_OBSERVATION
26PRTOptionalYesParticipation informationCLINICAL_HISTORY_OBSERVATION
27VAROptionalYesVarianceCLINICAL_HISTORY
28CTIOptionalYesClinical trial identificationCLINICAL_HISTORY
29PV1RequiredNoPatient visitPATIENT_VISITS
30PV2OptionalNoPatient visit - additional infoPATIENT_VISITS
31ORCRequiredNoCommon orderMEDICATION_HISTORY
32RXORequiredNoPharmacy / treatment orderMEDICATION_HISTORY
33PRTOptionalYesParticipation informationMEDICATION_HISTORY
34RXRRequiredYesPharmacy / treatment routeMEDICATION_HISTORY
35RXCOptionalYesPharmacy / treatment component orderMEDICATION_HISTORY
36OBXRequiredNoObservation resultMEDICATION_ORDER_OBSERVATION
37PRTOptionalYesParticipation informationMEDICATION_ORDER_OBSERVATION
38RXERequiredNoPharmacy / treatment encoded orderMEDICATION_HISTORY
39PRTOptionalYesParticipation informationMEDICATION_HISTORY
40RXRRequiredYesPharmacy / treatment routeMEDICATION_HISTORY
41RXCOptionalYesPharmacy / treatment component orderMEDICATION_HISTORY
42OBXRequiredNoObservation resultMEDICATION_ENCODING_OBSERVATION
43PRTOptionalYesParticipation informationMEDICATION_ENCODING_OBSERVATION
44RXARequiredNoPharmacy / treatment administrationMEDICATION_HISTORY
45PRTOptionalYesParticipation informationMEDICATION_HISTORY
46RXRRequiredNoPharmacy / treatment routeMEDICATION_HISTORY
47OBXRequiredNoObservation resultMEDICATION_ADMINISTRATION_OBSERVATION
48PRTOptionalYesParticipation informationMEDICATION_ADMINISTRATION_OBSERVATION
49CTIOptionalYesClinical trial identificationMEDICATION_HISTORY
50PRBRequiredNoProblem detailPROBLEM
51VAROptionalYesVariancePROBLEM
52VAROptionalYesVariancePROBLEM
53OBXRequiredNoObservation resultPROBLEM
54PRTOptionalYesParticipation informationPROBLEM
55GOLRequiredNoGoal detailGOAL
56VAROptionalYesVarianceGOAL
57VAROptionalYesVarianceGOAL
58OBXRequiredNoObservation resultGOAL
59PRTOptionalYesParticipation informationGOAL
60PTHRequiredNoPathwayPATHWAY
61VAROptionalYesVariancePATHWAY
62VAROptionalYesVariancePATHWAY
63OBXRequiredNoObservation resultPATHWAY
64PRTOptionalYesParticipation informationPATHWAY
65RELOptionalYesClinical relationship segment-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python