Skip to content

Query Attribute Mapping ​

Query attributes do two jobs:

  1. Build the DICOM C-FIND request or the manual matching context.
  2. Decide which values from a selected result are copied back into the active job dataset.

This page is the mapping reference. For general syntax and workflow examples, see Query Actions.

Query Type Matrix ​

Query typeDICOM modellevel supportConnection parametersSpecial behavior
WorklistModality WorklistNot usedRequiredBuilds a Scheduled Procedure Step sequence, accepts root-level SPS aliases, and maps selected worklist values back to normal job tags.
StudyStudy Root Query/RetrieveSTUDY, SERIES, IMAGERequiredSets QueryRetrieveLevel from level.
PatientPatient Root Query/RetrievePATIENT, STUDY, SERIES, IMAGERequiredSets QueryRetrieveLevel from level.
ManualManual worklist matchingNot usedOptionalBuilds the same worklist query context, parks the job in the manual queue, and lets the DICOM Printer Console complete the match.

Use only the valid level values for the selected query type. PATIENT is not a valid Study Root level.

Request Value Selection ​

For each configured <DcmTag> in a network query, DP2 chooses the outgoing value in this order:

  1. A non-empty value in the config wins. Placeholders are expanded before sending.
  2. If the config tag is empty, DP2 uses the current job dataset value for that tag when one exists.
  3. If neither config nor job has a value, DP2 sends an empty return key.
xml
<Query name="FindStudy" type="Study" level="STUDY">
  <DcmTag tag="PatientID">#{PatientID}</DcmTag>
  <DcmTag tag="StudyInstanceUID" />
  <DcmTag tag="StudyDescription" />
</Query>

In this example, PatientID is a match key. StudyInstanceUID and StudyDescription are return keys unless the current job already has values for those tags.

Tag placeholders such as #{PatientID} and #{0010,0020} replace the whole configured value. Date placeholders such as #{Date} can appear inside larger strings.

Date Placeholders ​

#{Date} expands from the current date.

PlaceholderMeaning
#{Date}Today as YYYYMMDD.
#{Date,-7}Exactly seven days before today.
#{Date,7}Exactly seven days after today.
#{Date,-7,7}A date range from 14 days before today through today.
#{Date,0,7}A date range from seven days before today through seven days after today.

The third argument is a symmetric range around the offset date. It is not an end offset.

Local Filtering ​

DP2 can avoid sending some configured patterns as PACS match keys. For these cases, DP2 sends an empty return key and filters the returned datasets locally:

PatternWire requestLocal filter
match="local"Empty return keyRequired match.
!CTEmpty return keyRejects returned values matching CT.
MR|CTEmpty return keyMatches a returned value that is MR or CT (regular-expression alternation).
^US.*Empty return keyMatches returned values through regular expression syntax.
SR*Empty return keyMatches returned values through wildcard syntax.

Local filters are applied after C-FIND returns and before order-by and select.

xml
<Query name="FindNonNuclearStudy" type="Study" level="STUDY">
  <DcmTag tag="PatientID">#{PatientID}</DcmTag>
  <DcmTag tag="ModalitiesInStudy">!NM</DcmTag>
  <DcmTag tag="StudyDate">#{Date,-7,7}</DcmTag>
</Query>

Scalar matching is case-insensitive. Multi-value DICOM fields are split on backslash and match if any component satisfies the filter.

match="local" is valid on <DcmTag> only. It is not valid on <DcmSequence>.

Sequence Syntax ​

Use <DcmSequence> with one or more <DcmItem> children. Do not wrap a sequence in a <DcmTag>.

xml
<Query name="FindWorklistEntry" type="Worklist">
  <DcmSequence tag="ScheduledProcedureStepSequence">
    <DcmItem>
      <DcmTag tag="ScheduledProcedureStepStartDate">#{Date}</DcmTag>
      <DcmTag tag="ScheduledProcedureStepStartTime" />
      <DcmTag tag="Modality">US</DcmTag>
    </DcmItem>
  </DcmSequence>
</Query>

Sequence values are used as query constraints. Returned sequences are copied back into the job only when the configured sequence has persist="true".

xml
<DcmSequence tag="ScheduledProcedureStepSequence" persist="true">
  <DcmItem>
    <DcmTag tag="ScheduledProcedureStepDescription" />
  </DcmItem>
</DcmSequence>

Sequence Local Matching ​

When a configured <DcmSequence> contains constrained values, local filtering matches the configured item structure against the returned sequence:

Configured sequence itemReturned result must contain
Empty item or item with only empty tagsNothing; the item does not constrain filtering.
One item with constrained tagsAt least one returned item in that sequence whose constrained tags all match.
Multiple constrained itemsA returned item match for each constrained configured item. The same returned item can satisfy more than one configured item if the values match.
Nested constrained sequenceA matching nested sequence item, evaluated recursively.

Scalar sequence tag values use the same local matching syntax as root <DcmTag> filters: exact value, * wildcard, low-high range, or regular expression syntax. Matching is case-insensitive. A returned item that is missing a constrained tag does not match that configured item.

For Worklist root aliases such as StudyDate and Modality, DP2 builds an internal Scheduled Procedure Step Sequence constraint and applies these same rules to returned SPS items. A returned worklist entry with several SPS items is accepted when any SPS item satisfies the alias constraint.

Result Selection and Assignment ​

The result pipeline is:

  1. Send the C-FIND request.
  2. Apply local filters.
  3. Apply order-by, when configured.
  4. Pick a result, when the filtered result count allows assignment.
  5. Copy values from the selected result into the job dataset.

Assignment rules:

Filtered result countAssignment behavior
0No values are copied. QUERY_FOUND is false. The action still succeeds.
1Values from the single result are copied.
More than 1 and select="first"Values from the first result after ordering are copied.
More than 1 and select="last"Values from the last result after ordering are copied.
More than 1 and no selectNo values are copied. QUERY_FOUND is true and partial.

force-assignment="true" is an older spelling for select="first". Prefer select.

Copy-Back Rules ​

When a result is selected:

  • QueryRetrieveLevel is ignored.
  • Non-sequence result elements are copied into the job dataset using the same tag.
  • Returned empty elements can overwrite an existing job value with an empty value.
  • Tags omitted from the selected result are not copied.
  • Returned sequences are ignored unless the matching configured <DcmSequence> has persist="true".
  • If ModalitiesInStudy contains exactly one modality and the job has no root Modality, DP2 derives root Modality from it. If it contains multiple modalities, DP2 leaves root Modality unchanged.

Worklist Request Mapping ​

Worklist queries always contain a Scheduled Procedure Step Sequence. DP2 accepts common root-level tags as aliases and moves them into the SPS item for the wire query.

Root-level config tagSent in SPS as
StudyDateScheduledProcedureStepStartDate
ModalityModality
ScheduledStationAETitleScheduledStationAETitle
StationNameScheduledStationName
PerformingPhysicianNameScheduledPerformingPhysicianName
ScheduledProcedureStepStartDateScheduledProcedureStepStartDate
ScheduledProcedureStepStartTimeScheduledProcedureStepStartTime
ScheduledProcedureStepDescriptionScheduledProcedureStepDescription

An explicit tag inside ScheduledProcedureStepSequence wins over the root-level alias for the same SPS field.

If no worklist date is configured, DP2 uses the job StudyDate as ScheduledProcedureStepStartDate. If the job has no StudyDate, network Worklist queries use a default #{Date,-7,7} date range. Manual queries clear that generated range when the job has no single StudyDate, so the operator starts with a broader manual search.

forcePeerAe="1" copies the job's Scheduled Station AE Title into SPS ScheduledStationAETitle as a match key when the config did not set that SPS value. With the default forcePeerAe="0", DP2 sends SPS ScheduledStationAETitle as an empty return key when the config did not set it.

Worklist also ensures root PatientName, PatientID, and AccessionNumber are present when those tags were not already supplied by the config. If the job already has a value, that value is sent as a match key; otherwise DP2 sends an empty return key.

Worklist Result Mapping ​

After normal selected-result copy-back, Worklist applies additional mappings from the selected worklist result:

Source in selected worklist resultTarget job tagCondition
SPS ScheduledProcedureStepStartDateStudyDateSource value is present.
SPS ScheduledProcedureStepStartTimeStudyTimeSource value is present.
SPS ModalityModalitySource value is present.
SPS ScheduledPerformingPhysicianNamePerformingPhysicianNameSource value is present and the job does not already have PerformingPhysicianName.
SPS ScheduledProcedureStepDescriptionStudyDescriptionSource value is present and the job does not already have StudyDescription.
RequestedProcedureDescriptionStudyDescriptionUsed when no SPS description was assigned; this fallback writes StudyDescription even if the job already had one.
AccessionNumberAccessionNumberUsed when the job still has no accession number.

Because normal copy-back runs first, root values returned by the worklist server can already be present before these worklist-specific fallback mappings run.

Practical Examples ​

Worklist With Root Aliases ​

xml
<Query name="FindWorklistEntry" type="Worklist" select="first">
  <ConnectionParameters>
    <PeerAeTitle>RIS</PeerAeTitle>
    <MyAeTitle>PRINTER</MyAeTitle>
    <Host>192.168.1.200</Host>
    <Port>104</Port>
  </ConnectionParameters>
  <DcmTag tag="PatientID">#{PatientID}</DcmTag>
  <DcmTag tag="AccessionNumber">#{AccessionNumber}</DcmTag>
  <DcmTag tag="StudyDate">#{Date,-7,7}</DcmTag>
  <DcmTag tag="Modality">US|SR</DcmTag>
</Query>

StudyDate is sent as SPS Start Date. Modality is sent as an empty SPS return key and enforced locally because US|SR is a regular expression pattern.

Worklist With Explicit SPS Sequence ​

xml
<Query name="FindTodayWorklistEntry" type="Worklist" select="first">
  <ConnectionParameters>
    <PeerAeTitle>RIS</PeerAeTitle>
    <MyAeTitle>PRINTER</MyAeTitle>
    <Host>192.168.1.200</Host>
    <Port>104</Port>
  </ConnectionParameters>
  <DcmTag tag="PatientID">#{PatientID}</DcmTag>
  <DcmSequence tag="ScheduledProcedureStepSequence" persist="true">
    <DcmItem>
      <DcmTag tag="ScheduledProcedureStepStartDate">#{Date}</DcmTag>
      <DcmTag tag="ScheduledProcedureStepStartTime" />
      <DcmTag tag="ScheduledProcedureStepDescription" />
    </DcmItem>
  </DcmSequence>
</Query>

The explicit sequence date wins over any root StudyDate alias. Because the sequence has persist="true", the returned SPS sequence is also copied into the job dataset.

Deterministic Study Assignment ​

xml
<Query name="FindNewestStudy" type="Study" level="STUDY"
       select="first" order-by="StudyDate desc, StudyTime desc">
  <ConnectionParameters>
    <PeerAeTitle>PACS</PeerAeTitle>
    <MyAeTitle>PRINTER</MyAeTitle>
    <Host>192.168.1.100</Host>
    <Port>104</Port>
  </ConnectionParameters>
  <DcmTag tag="PatientID">#{PatientID}</DcmTag>
  <DcmTag tag="StudyDate">#{Date,-30,30}</DcmTag>
  <DcmTag tag="StudyTime" />
  <DcmTag tag="StudyInstanceUID" />
</Query>

order-by runs after local filtering. select="first" then copies values from the newest returned study.

Patient Root Query ​

xml
<Query name="FindPatientStudies" type="Patient" level="STUDY"
       select="last" order-by="StudyDate asc">
  <ConnectionParameters>
    <PeerAeTitle>PACS</PeerAeTitle>
    <MyAeTitle>PRINTER</MyAeTitle>
    <Host>192.168.1.100</Host>
    <Port>104</Port>
  </ConnectionParameters>
  <DcmTag tag="PatientID">#{PatientID}</DcmTag>
  <DcmTag tag="StudyDate">#{Date,-30,30}</DcmTag>
  <DcmTag tag="StudyInstanceUID" />
</Query>

Patient Root supports PATIENT, STUDY, SERIES, and IMAGE levels. Study Root supports STUDY, SERIES, and IMAGE.