Schedule a demo
Segment

Timing/quantity

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.

14fields
0required
v2.9HL7 version
tq1.py
from zato.hl7v2 import TQ1, CQ, CWE

tq1 = TQ1()
tq1.quantity = CQ(
    quantity='1',
    units=CWE(identifier='TAB'),
)

Build TQ1 segments in Python

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

1

Daily vitamin schedule with start and end dates

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'
2

Weekly lab draw with repeat pattern and priority

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'
)
3

Monthly wellness check with duration and total occurrences

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'

Learn by building

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

Frequently asked questions

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_datetime

Field 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.

TQ1 field reference

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

#Python nameDatatypeUsageRepeatableTable
1set_id_tq1SIOptionalNo-
2quantityCQOptionalNo-
3repeat_patternRPTOptionalYes-
4explicit_timeTMOptionalYes-
5relative_time_and_unitsCQOptionalYes-
6service_durationCQOptionalNo-
7start_datetimeDTMOptionalNo-
8end_datetimeDTMOptionalNo-
9priorityCWEOptionalYesHL70485
10condition_textTXOptionalNo-
11text_instructionTXOptionalNo-
12conjunctionIDOptionalNoHL70472
13occurrence_durationCQOptionalNo-
14total_occurrencesNMOptionalNo-

Ready to build integrations?

Get started with Zato and connect your systems in minutes.

Open source In Python