NEWFree ROI Calculators — quantify what prior auth and siloed data are costing your organization.Prior Auth ROI Siloed Data ROI
HL7 v2Message13 min read

HL7 SQR Messages: Schedule Query Response

HL7 SQR messages return the appointments, services, and resources that a scheduling system found in answer to an SQM schedule query. Where the SQM asks the question, the SQR carries the answer — the matching appointments described segment by segment, each with its resources. The core of the SQR is the SCH segment, which holds the scheduling activity detail for a returned appointment: the filler and placer identifiers, the reason and type, the duration, and the actual start and end date-times. This page explains what an SQR message represents, the trigger event that carries it, every segment the message can contain and what each one holds, and how a schedule query response relates to FHIR. Sample content is constructed for illustration with fictional identifiers.

What an SQR message represents

An SQR message — SQR stands for Schedule Query Response — is the scheduling system's reply to an SQM schedule query. It carries the appointment data that matched the query's criteria — zero or more appointments, each with its full resource detail — along with an acknowledgement confirming that the query was processed and a query-acknowledgement segment that tells the requester how many results were found.

The sender is the scheduling system that owns the calendar; the receiver is the application that issued the SQM query. Because SQR is a response and not an unsolicited notification, it is never broadcast — it travels only to the system that asked, correlated through the message control id and query id. Each appointment in the response is represented by a repeating SCHEDULE group, anchored by the SCH scheduling activity segment and expanded by the patient identification and the resource sub-groups that describe which services, equipment, personnel, and locations are committed to that appointment.

When an SQR message is sent

An SQR message is sent by the scheduling system immediately after it processes an SQM query. Each SQM produces exactly one SQR in return. The SQR may contain no SCHEDULE groups if no appointments matched the criteria, or it may contain many, each group representing one matched appointment. When the result set is larger than the requester's limit, a continuation pointer in DSC allows the requester to page through additional results with follow-on queries.

Trigger event

The SQR message type carries a single trigger event:

  • SQR^S25 – Schedule query response. Sent in reply to an SQM^S25.

Because SQR has one trigger event, the receiver's handling turns on the content of the QAK query acknowledgement and the repeating SCHEDULE groups rather than on the trigger code in MSH-9. An SQR^S25 with no SCHEDULE groups and a QAK indicating no results found is a valid and complete response.

Integration topology

The diagram shows the scheduling system returning appointment data through the integration engine to the querying application that issued the SQM.

{{diagram: scheduling system → SQR^S25 response → integration engine → querying application (EHR / portal)}}

Typical senders: the scheduling system that owns the appointment calendar and resource book.

Typical receivers: EHR, referral or order-entry system, patient-access or scheduling portal — whichever application originated the SQM query.

Direction: response — the SQR travels only to the system that issued the SQM; it is not broadcast to other subscribers.

Segments in an SQR message

The SQR_S25 message opens with a fixed header block — MSH, MSA, optional repeating ERR, and QAK — followed by an optional repeating SCHEDULE group that returns one matched appointment per iteration. Each SCHEDULE group opens with SCH, carries optional timing, notes, and role segments, includes the patient in a PID, and then contains a required repeating RESOURCES group. Each RESOURCES group opens with RGS and holds optional repeating sub-groups for services, general resources, locations, and personnel. The message closes with an optional DSC continuation pointer. Cardinality follows HL7 notation: [X] optional, {X} repeating, [{X}] optional and repeating; a bare code is required. Each segment code links to its canonical field-by-field reference.

SegmentDescription
MSHMessage Header. Opens every SQR message. It names the sending and receiving applications and facilities, stamps the creation time, declares the trigger event in MSH-9 (SQR^S25), and carries the message control id in MSH-10. The receiving application correlates this response back to its originating SQM by matching MSH-10 against the query id echoed in QAK.
MSAMessage Acknowledgement. Required. Echoes the message control id of the originating SQM in MSA-2 and carries the acknowledgement code in MSA-1AA for an accepted application acknowledgement, AE for an application error, AR for a reject — confirming whether the query was processed successfully.
[{ERR}]Error. Optional and repeating. Present when the query could not be processed — for example when the criteria in the SQM were malformed. Each ERR segment carries an error code, a location pointer, and a human-readable message.
QAKQuery Acknowledgement. Required. Echoes the query tag from the originating SQM in QAK-1, carries the query response status in QAK-2OK for results found, NF for no results found, AE for application error — and in QAK-4 and QAK-5 reports the hit count and the number of results in this response, enabling the requester to know whether paging is needed.
[{ SCHEDULE }]Schedule group (optional, repeating). One iteration per matched appointment. Absent when the query returned no results. Each group carries the full detail of one returned appointment: the scheduling activity, patient, and all committed resources.
SCHScheduling Activity Information. Required within each SCHEDULE group and the key segment of the SQR message. SCH-1 carries the placer appointment id, SCH-2 the filler appointment id assigned by the scheduling system. SCH-7 holds the appointment reason (the clinical purpose of the appointment) as a coded element. SCH-8 carries the appointment type (routine, urgent, walkin, and so on). SCH-9 specifies the appointment duration as a quantity with units. SCH-11 holds the appointment timing — the start and end date-times of the appointment — as a repeating timing/quantity field. Together, SCH-1 through SCH-11 give the requester everything needed to identify, classify, and time-stamp the returned appointment.
[{TQ1}]Timing/Quantity. Optional and repeating. Carries additional timing detail for the appointment in v2.5.1's preferred timing model.
[{NTE}]Notes and Comments. Optional and repeating. Appointment-level notes following the SCH.
[{ROL}]Role. Optional and repeating. Identifies providers in specific roles — for example the ordering provider or the consulting provider — associated with the returned appointment.
PIDPatient Identification. Required within each SCHEDULE group. Identifies the patient the appointment belongs to — the identifier list in PID-3, the patient name in PID-5, and date of birth and sex in PID-7 and PID-8.
{ RESOURCES }Resources group (repeating). Required within each SCHEDULE group. One or more resource groups, each opening with RGS, describe the services, equipment, personnel, and locations committed to this appointment. The group repeats so one appointment can span multiple resource sets.
RGSResource Group. Required at the head of each RESOURCES group. Groups the resource sub-groups belonging to this portion of the appointment.
[{ SERVICE }]Service sub-group (optional, repeating). Each opens with AIS. Describes a scheduled service committed to this appointment.
AISAppointment Information – Service. Required within a SERVICE sub-group. Identifies the universal service, its start date-time offset, duration, and status for this appointment.
[{NTE}]Notes and Comments. Optional and repeating notes attached to a service sub-group.
[{ GENERAL_RESOURCE }]General-resource sub-group (optional, repeating). Each opens with AIG. Describes a general resource — equipment or other non-personnel, non-location resource — committed to this appointment.
AIGAppointment Information – General Resource. Required within a GENERAL_RESOURCE sub-group. Identifies the resource, its start date-time offset, duration, and status.
[{NTE}]Notes and Comments. Optional and repeating notes attached to a general-resource sub-group.
[{ LOCATION_RESOURCE }]Location-resource sub-group (optional, repeating). Each opens with AIL. Describes a location — a room, suite, or clinic — committed to this appointment.
AILAppointment Information – Location Resource. Required within a LOCATION_RESOURCE sub-group. Identifies the location, its start date-time offset, duration, and status.
[{NTE}]Notes and Comments. Optional and repeating notes attached to a location-resource sub-group.
[{ PERSONNEL_RESOURCE }]Personnel-resource sub-group (optional, repeating). Each opens with AIP. Describes a personnel resource — a provider or staff member — committed to this appointment.
AIPAppointment Information – Personnel Resource. Required within a PERSONNEL_RESOURCE sub-group. Identifies the person, their start date-time offset, duration, and status.
[{NTE}]Notes and Comments. Optional and repeating notes attached to a personnel-resource sub-group.
[DSC]Continuation Pointer. Optional. When the full result set exceeds the result limit requested in the originating SQM, DSC carries a pointer the requester echoes in a follow-on query to retrieve the next page of results.

[ ] = optional, { } = repeating

The SCHEDULE group repeats once per matched appointment, and within it the RESOURCES group repeats; each resource group can in turn carry repeating SERVICE, GENERAL_RESOURCE, LOCATION_RESOURCE, and PERSONNEL_RESOURCE sub-groups. The canonical segment pages carry the full field-by-field detail.

Sample SQR message

Note. Constructed for illustration. Patient identifiers, appointment ids, dates, and names are fictional.

MSH|^~&|SCHED|MERCYGEN|EHR|MERCYGEN|202006031001||SQR^S25^SQR_S25|MSG00046|P|2.5.1
MSA|AA|MSG00045
QAK|Q0045|OK||1|1
SCH|APPT0001^EHR|FLAPPT9901^SCHED|||||CARDIO^Cardiology consult^L|ROUTINE^Routine^HL70276|30^MIN|1|^^^20200614090000^20200614093000
NTE|1||Patient requires interpreter
PID|1||MR12345^^^MERCYGEN^MR||DOE^JOHN^Q||19800101|M
RGS|1|A
AIS|1|A|CARDIO_CONS^Cardiology Consultation^L|20200614090000|||30^MIN|A
NTE|1||Standard new-patient consultation
AIP|1|A|1234^SMITH^JANE^A^^^MD^^^CARDIOLOGY|20200614090000|||30^MIN|A
AIL|1|A|ROOM204^Cardiology Suite 204^L|20200614090000|||30^MIN|A

What this sample shows

The SQR^S25 in MSH-9 marks a schedule query response. The MSA echoes the originating SQM's control id MSG00045 in MSA-2 with acknowledgement code AA, confirming the query was accepted. The QAK echoes query id Q0045, reports status OK, and indicates one result found and one returned — no paging is needed.

The SCHEDULE group begins with SCH: placer appointment id APPT0001 (SCH-1), filler appointment id FLAPPT9901 (SCH-2), appointment reason CARDIO — Cardiology consult in SCH-7, type ROUTINE in SCH-8, duration 30 minutes in SCH-9, and the appointment window 14 June 09:00–09:30 in SCH-11. The optional NTE flags an interpreter need. PID identifies patient MR12345. The RESOURCES group (RGS) holds three resource sub-groups: AIS commits the cardiology consultation service, AIP commits provider 1234 (Dr Jane Smith), and AIL commits Cardiology Suite 204 — all starting at 09:00 for 30 minutes.

Working with SQR messages

Correlate on QAK and MSA, not just MSH-10

The primary correlation keys for an SQR are the query id in QAK-1 — which echoes the query tag from the originating SQM — and the message control id echoed in MSA-2. Check both. A mismatch between MSA-2 and the SQM's MSH-10 signals a routing error; a mismatch between QAK-1 and the SQM's query id indicates the wrong response was correlated.

Read the appointment from SCH, not from the resource segments

The appointment identity, reason, type, duration, and timing live in SCH. The resource sub-groups — AIS, AIG, AIL, AIP — describe what is committed to the appointment, not the appointment itself. Build the appointment record from SCH first, then associate each resource to it rather than deriving appointment timing from the resource offsets.

Handle an empty result set explicitly

A QAK-2 value of NF (no records found) is a valid and complete response. Do not treat an SQR with no SCHEDULE groups as an error — it means the query succeeded but the scheduling system found nothing matching the criteria. Surface this to the requester rather than logging it silently.

Page through large result sets using DSC

When QAK-4 (hit count) exceeds QAK-5 (results in this response), a DSC continuation pointer is present. Issue a follow-on SQM echoing the DSC value to retrieve the next page. Do not assume a single SQR contains the full result set when QAK-4 and QAK-5 differ.

Vendor variance. The resource sub-groups within each RESOURCES group — SERVICE, GENERAL_RESOURCE, LOCATION_RESOURCE, and PERSONNEL_RESOURCE — are all optional, so some scheduling systems populate only the personnel resource while others populate all four. Confirm a partner's field usage against their interface specification rather than assuming the base standard.

FHIR equivalent

A schedule query response corresponds conceptually to a set of FHIR Appointment, Schedule, and Slot resources — the returned appointments with their committed times and resources. An SQR delivering matched appointments is analogous to the results of a FHIR search on Appointment or Slot.

There is, however, no published mapping to lean on. The HL7 v2-to-FHIR Implementation Guide publishes official message maps for a subset of messages — including SIU_S12, which has an official Bundle map — but SQR_S25 is not among them. The IG also publishes no ConceptMap for the SCH scheduling activity segment. Any FHIR representation of a schedule query response is therefore derived manually, mapping the appointment identity, reason, type, and timing from SCH to an Appointment resource, the committed services to Appointment.serviceType, the committed personnel to Appointment.participant references, and the committed location to an Appointment.participant of type Location — with no standard ConceptMap to follow.

Common pitfalls

Pitfall. Treating a no-results SQR as an error. A QAK-2 of NF means the query succeeded with zero matches, not that something failed. Only QAK-2 of AE or an MSA-1 of AE/AR signals a processing problem; route the no-results case back to the requester as a valid, empty result set.

Pitfall. Deriving appointment timing from resource sub-group offsets instead of SCH. The start date-time in AIS, AIG, AIL, and AIP is an offset or absolute time for that specific resource, not the canonical appointment start. The authoritative appointment window is in SCH-11; read it there.

Pitfall. Assuming a fixed date-time precision. Some scheduling systems express SCH-11 date-times as YYYYMMDD and others as a full timestamp with a timezone offset; do not assume a timezone — normalize on ingest.

Pitfall. Ignoring the continuation pointer. When QAK-4 and QAK-5 differ, the result set is paginated. Discarding the DSC value and not issuing a follow-on query means returning an incomplete result set to the requester.

How Vorro handles SQR messages

Vorro receives the SQR response over MLLP or another transport, correlates it to the originating SQM through the query id in QAK-1 and the message control id in MSA-2, and routes the matched appointments to the querying application. Vorro reads the appointment identity, reason, type, duration, and timing from SCH, associates each committed resource from the SERVICE, GENERAL_RESOURCE, LOCATION_RESOURCE, and PERSONNEL_RESOURCE sub-groups, and surfaces QAK-2 to distinguish a successful empty result from an error. When the result set is paginated, Vorro manages the DSC continuation loop automatically. Where a FHIR destination is configured, Vorro maps each returned appointment to an Appointment resource — composed manually, since the v2-to-FHIR Implementation Guide publishes no map for this message.

  • SQM — the schedule query message that an SQR answers.
  • SIU — the unsolicited scheduling notification that informs subscribers of a booking event.
  • SRM — the schedule request message that asks to create, modify, or cancel an appointment.

Sources

← Back to HL7 v2 Guide

Ready to Integrate This Into Your Workflow?

Talk to a Vorro expert about implementing HL7 v2 in your specific environment.

Browse HL7 v2 Guides
HL7 SQR Messages: Schedule Query Response | Vorro Academy | Vorro