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

HL7 QRF Segment: Original-Style Query Filter

The QRF (Original-Style Query Filter) segment refines a legacy HL7 v2 query that has been opened by a QRD (Original-Style Query Definition) segment. Where QRD says what is being asked and how the answer should come back, QRF says under what conditions the data should be selected: which subject context applies, what date/time range bounds the data, and what additional qualifiers further filter the result. QRF always follows QRD and the two are designed to be read as a single logical request in the original-style query mechanism used throughout pre-2.4 HL7 messaging.

Purpose

QRF supplies the selection criteria that QRD intentionally leaves out. Its Where Subject Filter (QRF-1) names the context — for example a facility, department, or location — in which the subject identified by QRD should be evaluated. The When Data Start Date/Time (QRF-2) and When Data End Date/Time (QRF-3) bound the time window of interest, which is the single most common reason a QRF appears at all. The remaining fields (QRF-4 through QRF-10) carry optional, mostly repeating qualifiers covering user-defined criteria, other-system subject filters, date/time qualifiers and their status, selection rules, quantity/timing, and a search confidence threshold for probabilistic matching.

Because QRF only makes sense in the presence of a QRD, an engine should never process one without the other. The two together form the request side of the legacy query group.

Used in

QRF is one of the two original-style query segments used in legacy HL7 v2 query messages. It follows QRD inside QRY query messages to complete the request, and it also appears on the response side of the original query mechanism — in DSR (Display Response) and UDM (Unsolicited Display Message) responses — where the responding system echoes the filter criteria back to the requester.

See the QRY message page for the full message structure, and the companion QRD segment that opens the query QRF refines.

Field-by-field reference

Source: HAPI HL7v2 v2.5.1 javadocs (QRF) for sequence, name, data type, and repetition. Length is not published in the javadocs (); Required and Table # are filled from the HL7 v2.5.1 standard where well-established.

SeqNameData TypeLengthReqRepeatTable #Description
QRF-1Where Subject FilterstRYDepartment, system, or context to search
QRF-2When Data Start Date/TimetsOStart of the data time window
QRF-3When Data End Date/TimetsOEnd of the data time window
QRF-4What User QualifierstOYUser-defined selection qualifier
QRF-5Other QRY Subject FilterstOYSubject filter for another query system
QRF-6Which Date/Time QualifieridOYHL70156Which date/time the range applies to
QRF-7Which Date/Time Status QualifieridOYStatus the date/time qualifier targets
QRF-8Date/Time Selection QualifieridOYRule for selecting within the range
QRF-9When Quantity/Timing QualifiertqOQuantity and timing constraint
QRF-10Search Confidence ThresholdnmOMinimum confidence for probabilistic match

Note: in the HL7 v2.5.1 original query, QRF-1 Where Subject Filter is the well-established required field; the remaining fields are optional qualifiers, with the date/time window (QRF-2/QRF-3) being by far the most commonly populated.

Most-used fields

  • QRF-2 and QRF-3 (When Data Start/End Date/Time) define the time window and are the fields most QRF segments exist to carry. Almost every real-world legacy query bounds its data by date.
  • QRF-1 Where Subject Filter scopes the query to a facility, department, or location and is required, so it is always present.
  • QRF-6 Which Date/Time Qualifier (HL70156) tells the responder which timestamp the QRF-2/QRF-3 window applies to — for example collection time versus result time — and is essential when records carry several dates.
  • QRF-10 Search Confidence Threshold is used in probabilistic patient-matching scenarios to discard low-confidence candidates before they are returned.

Version differences (2.3 to 2.8.2)

QRF, like QRD, belongs to the original (pre-2.4) query mechanism. In v2.3 and v2.3.1 the QRD/QRF pair was the standard query expression inside QRY, answered by DSR/UDM responses. From v2.4 onward HL7 introduced the modern conformance-based query infrastructure built on QPD (Query Parameter Definition), RCP (Response Control Parameter), and the QBP/RSP message pair, and the original-style QRD/QRF mechanism became largely deprecated in favor of it. QRF's field structure is stable across v2.3 through v2.5.1 and is carried forward unchanged in later releases (through v2.8.2), though new development is steered toward QPD/RCP/QBP. The Query Response Instance segment, QRI, was added later for tabular responses and belongs to the newer mechanism, not to QRF.

Common mistakes

  • Sending a QRF without a preceding QRD. QRF is meaningless on its own and many parsers will reject the orphaned segment.
  • Populating QRF-2/QRF-3 without QRF-6 Which Date/Time Qualifier, leaving the responder to guess which timestamp the window applies to.
  • Reversing the window so QRF-2 (start) is later than QRF-3 (end), which yields an empty or undefined result.
  • Assuming QRF-1 is single-valued. It repeats, and a parser must handle multiple Where Subject Filter values.
  • Treating QRF-10 Search Confidence Threshold as a percentage when the trading partner expects a 0..1 fraction (or vice versa) without agreeing on units.
  • Dropping the optional qualifier fields during translation and thereby silently widening the query the requester intended to narrow.

Examples

Minimal valid segment (only the required Where Subject Filter populated):

QRF|LAB

Fully-populated segment:

QRF|LAB~RAD|20260101000000|20260610000000|RECENT|EXT001|CURRENT|FINAL|EXACT|1^^^20260601~20260610|0.85

Annotated breakdown:

QRF|LAB~RAD|20260101000000|20260610000000|RECENT|EXT001|CURRENT|FINAL|EXACT|1^^^...|0.85
    |       |              |              |      |      |       |     |     |       |
    |       |              |              |      |      |       |     |     |       +-> QRF-10 Search Confidence Threshold (0.85)
    |       |              |              |      |      |       |     |     +---------> QRF-9  When Quantity/Timing Qualifier
    |       |              |              |      |      |       |     +---------------> QRF-8  Date/Time Selection Qualifier (EXACT)
    |       |              |              |      |      |       +---------------------> QRF-7  Which Date/Time Status Qualifier (FINAL)
    |       |              |              |      |      +-----------------------------> QRF-6  Which Date/Time Qualifier (CURRENT)
    |       |              |              |      +------------------------------------> QRF-5  Other QRY Subject Filter (EXT001)
    |       |              |              +-------------------------------------------> QRF-4  What User Qualifier (RECENT)
    |       |              +----------------------------------> QRF-3 When Data End Date/Time
    |       +-----------------------------------------------> QRF-2 When Data Start Date/Time
    +-------------------------------------------------------> QRF-1 Where Subject Filter (LAB and RAD, repeating)

In-context excerpt 1 — QRD with its QRF filter inside a QRY^A19 patient query request:

MSH|^~&|REQAPP|REQFAC|RESPAPP|RESPFAC|20260610142530||QRY^A19^QRY_A19|MSG00031|P|2.5.1
QRD|20260610142530|R|I|Q0011|||10^records|PX0042^Sample^Patient^^^^^^HOSP^^^^MR|RES^Results^HL70048|LAB^Laboratory^HL70048
QRF|LAB|20260101000000|20260610000000|||CURRENT

In-context excerpt 2 — a QRF carrying a probabilistic search threshold for patient matching:

MSH|^~&|REQAPP|REQFAC|RESPAPP|RESPFAC|20260610153000||QRY^A19^QRY_A19|MSG00032|P|2.5.1
QRD|20260610153000|R|I|Q0012|||5^records|^Smith^Jamie^^^^^^HOSP^^^^MR|DEM^Demographics^HL70048|ADT^Admissions^HL70048
QRF|HOSP|||||||||0.90

FHIR mapping

There is no segment-level ConceptMap published in the v2-to-FHIR Implementation Guide for QRF. The original-style query mechanism is messaging infrastructure with no direct FHIR resource equivalent: FHIR expresses queries through RESTful search and returns matches as a searchset Bundle. Conceptually, the QRF-2/QRF-3 date window corresponds to FHIR date search parameters with ge/le prefixes (for example date=ge2026-01-01&date=le2026-06-10), QRF-1 Where Subject Filter corresponds to a contextual search parameter, and QRF-10 Search Confidence Threshold has a loose parallel in the _score element returned on Bundle matches. These are conceptual parallels for understanding only, not a normative mapping.

Engine considerations

  • Pairing: always process QRF together with the preceding QRD. Reject or quarantine an orphaned QRF rather than silently issuing an unfiltered query.
  • Date semantics: validate that QRF-2 is not later than QRF-3, and resolve QRF-6 Which Date/Time Qualifier so the engine knows which timestamp the window targets.
  • Repetition: QRF-1 and QRF-4 through QRF-8 may repeat. Parsers must handle the repetition separator and expand these into lists.
  • Confidence units: agree with the trading partner whether QRF-10 is a 0..1 fraction or a percentage, and normalize on ingest.
  • Preservation: when bridging to the modern model, carry every populated qualifier across; dropping qualifiers widens the query and can return more data than the requester is authorized to see.
  • Bridging: map the QRD/QRF pair onto QPD/RCP rather than a field-for-field passthrough when the endpoint speaks only the conformance-based query model.

How Vorro parses and produces QRF

When Vorro ingests a legacy QRY message it parses QRF alongside its QRD and holds the two as a single logical request. QRF-2 and QRF-3 are converted to normalized timestamps (internally the primary timestamp form) and validated as an ordered window; the repeating QRF-1 and qualifier fields are expanded into lists; and QRF-6 is resolved against HL70156 so the date/time window is unambiguously bound to a specific record timestamp.

When producing QRF, Vorro enforces the required QRF-1 Where Subject Filter, validates the coded qualifier fields (QRF-6, QRF-7, QRF-8) against their value sets, and guarantees a well-ordered date window. The search confidence threshold in QRF-10 is normalized to a 0..1 fraction on the wire. Where a downstream endpoint speaks only the modern query model, Vorro maps the parsed QRD/QRF pair onto QPD/RCP automatically, preserving every populated filter.

  • QRD segment — the original-style query definition that QRF refines
  • QID segment — query identification in the modern query model
  • QRY message — the legacy query message that carries QRD and QRF

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 QRF Segment: Original-Style Query Filter | Vorro Academy | Vorro