Specifies the scheduling and timing details for an order, including frequency, priority (stat or routine), start and end dates, quantity, and duration. Introduced in v2.5 to replace the deprecated ORC-7 quantity/timing field, it appears in order messages to tell the filler how and when the ordered service should be performed or administered. EHRs and pharmacy systems use TQ1 to communicate complex dosing schedules and order timing.
from zato.hl7v2 import TQ1, CQ, CWE
tq1 = TQ1()
tq1.quantity = CQ(
quantity='1',
units=CWE(identifier='TAB'),
)How to construct and work with real-world TQ1 segments.
Schedules a once-daily vitamin dose with quantity, repeat pattern, and a defined start and end window for the wellness program
from zato.hl7v2.v2_9 import TQ1
from zato.hl7v2.v2_9 import CQ, RPT
tq1 = TQ1()
tq1.set_id_tq1 = '1'
tq1.quantity = CQ(
quantity='1',
units='TAB'
)
tq1.repeat_pattern = RPT(repeat_pattern_code='QD')
tq1.start_datetime = '20240601080000'
tq1.end_datetime = '20241201080000'Orders a weekly blood draw for a nutrition panel with routine priority and a morning explicit time
from zato.hl7v2.v2_9 import TQ1
from zato.hl7v2.v2_9 import CQ, CWE, RPT
tq1 = TQ1()
tq1.set_id_tq1 = '2'
tq1.quantity = CQ(
quantity='1',
units='EA'
)
tq1.repeat_pattern = RPT(repeat_pattern_code='QW')
tq1.explicit_time = '080000'
tq1.start_datetime = '20240701'
tq1.end_datetime = '20241001'
tq1.priority = CWE(
identifier='R',
text='Routine',
name_of_coding_system='HL70485'
)Defines a monthly wellness check-in with occurrence duration, total occurrences, and a free-text instruction
from zato.hl7v2.v2_9 import TQ1
from zato.hl7v2.v2_9 import CQ, RPT
tq1 = TQ1()
tq1.set_id_tq1 = '3'
tq1.quantity = CQ(
quantity='1',
units='EA'
)
tq1.repeat_pattern = RPT(repeat_pattern_code='QM')
tq1.start_datetime = '20240101'
tq1.end_datetime = '20241231'
tq1.condition_text = '30 minutes per session'
tq1.text_instruction = 'Review wellness goals and progress'
tq1.occurrence_duration = CQ(
quantity='30',
units='MIN'
)
tq1.total_occurrences = '12'Step-by-step guides for working with HL7 v2 in Zato.
TQ1 carries timing and quantity details for orders: repeat pattern, explicit times, relative offsets, duration, start and end windows, priority, free-text instructions, and conjunction with other TQ1 rows. It appears with ORC, OBR, RXO, and RXE when scheduling wellness, fitness, nutrition, or preventive-care activities.
Create a TQ1 segment and read its attributes directly:
from zato.hl7v2.v2_9 import TQ1, CQ, CWE
tq1 = TQ1()
tq1.set_id_tq1 = '1'
tq1.quantity = CQ(quantity='1', units=CWE(identifier='TAB'))
tq1.start_datetime = '20240401080000'
qty = tq1.quantity
start = tq1.start_datetimeField 2 is a composite quantity with units. Use CQ with semantic components, often with CWE for coded units:
from zato.hl7v2.v2_9 import TQ1, CQ, CWE
tq1 = TQ1()
tq1.quantity = CQ(quantity='1', units=CWE(identifier='TAB'))Fields 3, 4, 5, and 9 may repeat in the message (separated by ~ in ER7). In Python, assign a list of RPT, TM, CQ, or CWE values. Single values can be wrapped in a one-element list for consistency with repeating fields.
Conjunction indicates how this TQ1 row combines with adjacent TQ1 rows (for example, AND versus OR). Values are drawn from HL70472; your interface specification should state which codes are in use.
from zato.hl7v2.v2_9 import TQ1
tq1 = TQ1()
tq1.conjunction = 'A'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.
Complete list of fields in the TQ1 segment, HL7 v2.9.
| # | Python name | Datatype | Usage | Repeatable | Table |
|---|---|---|---|---|---|
| 1 | set_id_tq1 | SI | Optional | No | - |
| 2 | quantity | CQ | Optional | No | - |
| 3 | repeat_pattern | RPT | Optional | Yes | - |
| 4 | explicit_time | TM | Optional | Yes | - |
| 5 | relative_time_and_units | CQ | Optional | Yes | - |
| 6 | service_duration | CQ | Optional | No | - |
| 7 | start_datetime | DTM | Optional | No | - |
| 8 | end_datetime | DTM | Optional | No | - |
| 9 | priority | CWE | Optional | Yes | HL70485 |
| 10 | condition_text | TX | Optional | No | - |
| 11 | text_instruction | TX | Optional | No | - |
| 12 | conjunction | ID | Optional | No | HL70472 |
| 13 | occurrence_duration | CQ | Optional | No | - |
| 14 | total_occurrences | NM | Optional | No | - |
Get started with Zato and connect your systems in minutes.