pynetdicom._handlers.doc_handle_find

pynetdicom._handlers.doc_handle_find(event)

Documentation for handlers bound to evt.EVT_C_FIND.

User implementation of this event handler is required if one or more services that use C-FIND are to be supported. If a handler is not implemented and bound to evt.EVT_C_FIND then the C-FIND request will be responded to using a Status value of 0xC311 - Failure.

Yields (status, identifier) pairs, where status is either an int or pydicom Dataset containing a (0000,0900) Status element and identifier is a C-FIND Identifier Dataset.

Event

evt.EVT_C_FIND

Supported Service Classes

  • Query/Retrieve Service Class
  • Basic Worklist Management Service
  • Relevant Patient Information Query Service
  • Substance Administration Query Service
  • Hanging Protocol Query/Retrieve Service
  • Defined Procedure Protocol Query/Retrieve Service
  • Color Palette Query/Retrieve Service
  • Implant Template Query/Retrieve Service

Status

Success
0x0000 - Success
Failure
0xA700 - Out of resources
0xA900 - Identifier does not match SOP class
0xC000 to 0xCFFF - Unable to process
Cancel
0xFE00 - Matching terminated due to Cancel request
Pending
0xFF00 - Matches are continuing: current match is supplied and any Optional Keys were supported in the same manner as Required Keys
0xFF01 - Matches are continuing: warning that one or more Optional Keys were not supported for existence and/or matching for this Identifier
Parameters:

event (events.Event) –

The event representing a service class receiving a C-FIND request message. Event attributes are:

  • assoc : the association that is running the service that received the C-FIND request.
  • context : the presentation context the request was sent under as a presentation.PresentationContextTuple.
  • event : the event that occurred as namedtuple.
  • request : the received C-FIND request
  • timestamp : the date and time that the C-FIND request was processed by the service.

Event properties are:

  • identifier : the decoded Dataset contained within the C-FIND request’s Identifier parameter. Because pydicom uses a deferred read when decoding data, if the decode fails the returned Dataset will only raise an exception at the time of use.
  • is_cancelled : returns True if a C-CANCEL request has been received, False otherwise. If a C-CANCEL is received then the handler should yield (0xFE00, None) and return.

Yields:
  • status (pydicom.dataset.Dataset or int) – The status returned to the peer AE in the C-FIND response. Must be a valid C-FIND status vuale for the applicable Service Class as either an int or a Dataset object containing (at a minimum) a (0000,0900) Status element. If returning a Dataset object then it may also contain optional elements related to the Status (as in DICOM Standard Part 7, Annex C).

  • identifier (pydicom.dataset.Dataset or None) – If the status category is ‘Pending’ then the Identifier Dataset for a matching SOP Instance. The exact requirements for the C-FIND response Identifier are Service Class specific (see the DICOM Standard, Part 4).

    If the status category is ‘Failure’ or ‘Cancel’ then yield None.

    If the status category is ‘Success’ then yield None, however yielding a final ‘Success’ status is not required and will be ignored if necessary.

References