Schedule a demo
Segment

Equipment command response

Returns the result of a previously issued equipment command, carrying a coded response status and the date/time the command completed. It is sent by laboratory instruments and automated devices back to the controlling system to confirm execution, report errors, or indicate that a command was rejected.

3fields
2required
v2.9HL7 version
ecr.py
from zato.hl7v2 import ECR

ecr = ECR()
ecr.command_response = 'OK'
ecr.date_time_completed = '20260515'

Build ECR segments in Python

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

1

Successful completion

Equipment confirms a command completed successfully with timestamp

from zato.hl7v2.v2_9 import ECR
from zato.hl7v2.v2_9 import CWE

ecr = ECR()
ecr.command_response = CWE(
    identifier='OK',
    text='Command completed',
    name_of_coding_system=
        'HL70387'
)
ecr.date_time_completed = '20240515103000'
2

Command error

Equipment reports an error while executing a command

from zato.hl7v2.v2_9 import ECR
from zato.hl7v2.v2_9 import CWE

ecr = ECR()
ecr.command_response = CWE(
    identifier='ER',
    text=
        'Command cannot be '
        'completed',
    name_of_coding_system=
        'HL70387'
)
ecr.date_time_completed = '20240515110000'
3

Timed out

Equipment reports that a command timed out before finishing

from zato.hl7v2.v2_9 import ECR
from zato.hl7v2.v2_9 import CWE

ecr = ECR()
ecr.command_response = CWE(
    identifier='TI',
    text='Command timed out',
    name_of_coding_system=
        'HL70387'
)
ecr.date_time_completed = '20240515120000'

Learn by building

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

Frequently asked questions

ECR carries the response from a laboratory instrument or automated device after executing a remote command. It reports whether the command succeeded, failed, or timed out, along with the completion timestamp.

The command_response field uses CWE with HL7 table 0387:

from zato.hl7v2.v2_9 import ECR, CWE

ecr = ECR()
ecr.command_response = CWE(
    identifier='OK',
    text='Command completed',
    name_of_coding_system=
        'HL70387'
)

HL7 table 0387 defines command response codes:

from zato.hl7v2.v2_9 import ECR, CWE

ecr = ECR()

# OK = Completed
ecr.command_response = CWE(identifier='OK')

# ER = Error
ecr.command_response = CWE(identifier='ER')

# TI = Timed out
ecr.command_response = CWE(identifier='TI')

The date_time_completed field uses DTM format:

from zato.hl7v2.v2_9 import ECR

ecr = ECR()
ecr.command_response = 'OK'
ecr.date_time_completed = '20240515103000'

Access the fields directly after creating the segment:

from zato.hl7v2.v2_9 import ECR

ecr = ECR()
ecr.command_response = 'OK'
ecr.date_time_completed = '20240515103000'

response = ecr.command_response
completed = ecr.date_time_completed

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.

ECR field reference

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

#Python nameDatatypeUsageRepeatableTable
1command_responseCWERequiredNoHL70387
2date_time_completedDTMRequiredNo-
3command_response_parametersTXOptionalYes-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python