.. _service_ups:

Unified Procedure Step Service Class
====================================
The :dcm:`Unified Procedure Step Service Class<part04/chapter_CC.html>`
defines a service that uses the DIMSE C-FIND, N-CREATE, N-SET, N-ACTION,
N-EVENT-REPORT and N-GET services to
facilitate management of simple worklists, including creation of new worklist
items, querying worklists and communicating progress and results.

.. _ups_sops:

Supported SOP Classes
---------------------

+----------------------------+------------------------------------------------+
| UID                        | SOP Class                                      |
+============================+================================================+
| 1.2.840.10008.5.1.4.34.6.1 | UnifiedProcedureStepPushSOPClass               |
+----------------------------+------------------------------------------------+
| 1.2.840.10008.5.1.4.34.6.2 | UnifiedProcedureStepWatchSOPClass              |
+----------------------------+------------------------------------------------+
| 1.2.840.10008.5.1.4.34.6.3 | UnifiedProcedureStepPullSOPClass               |
+----------------------------+------------------------------------------------+
| 1.2.840.10008.5.1.4.34.6.4 | UnifiedProcedureStepEventSOPClass              |
+----------------------------+------------------------------------------------+
| 1.2.840.10008.5.1.4.34.6.5 | UnifiedProcedureStepQuerySOPClass              |
+----------------------------+------------------------------------------------+


DIMSE Services
--------------

+---------------------------+-------------------------------+
| DIMSE Service             | Usage SCU/SCP                 |
+===========================+===============================+
| *Unified Procedure Step Push SOP Class*                   |
+---------------------------+-------------------------------+
| N-CREATE                  | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| N-ACTION - Request cancel | Optional/Mandatory            |
+---------------------------+-------------------------------+
| N-GET                     | Optional/Mandatory            |
+---------------------------+-------------------------------+
| *Unified Procedure Step Pull SOP Class*                   |
+---------------------------+-------------------------------+
| C-FIND                    | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| N-GET                     | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| N-SET                     | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| N-ACTION                  | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| *Unified Procedure Step Watch SOP Class*                  |
+---------------------------+-------------------------------+
| N-ACTION - Un/subscribe   | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| N-GET                     | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| C-FIND                    | Optional/Mandatory            |
+---------------------------+-------------------------------+
| N-ACTION - Request cancel | Optional/Mandatory            |
+---------------------------+-------------------------------+
| *Unified Procedure Step Event SOP Class*                  |
+---------------------------+-------------------------------+
| N-EVENT-REPORT            | Mandatory/Mandatory           |
+---------------------------+-------------------------------+
| *Unified Procedure Step Query SOP Class*                  |
+---------------------------+-------------------------------+
| C-FIND                    | Mandatory/Mandatory           |
+---------------------------+-------------------------------+


.. _ups_statuses:

Statuses
--------

C-FIND Statuses
~~~~~~~~~~~~~~~~

+------------+----------+----------------------------------+
| Code (hex) | Category | Description                      |
+============+==========+==================================+
| 0x0000     | Success  | Success                          |
+------------+----------+----------------------------------+
| 0x0122     | Failure  | SOP Class not supported          |
+------------+----------+----------------------------------+
| 0xFE00     | Cancel   | Processing has been terminated   |
+------------+----------+----------------------------------+

UPS C-FIND Service Statuses
~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+----------------------------------------------+
| Code (hex)       | Category | Description                                  |
+==================+==========+==============================================+
| 0xA700           | Failure  | Out of resources                             |
+------------------+----------+----------------------------------------------+
| 0xA900           | Failure  | Dataset does not match SOP Class             |
+------------------+----------+----------------------------------------------+
| 0xC000 to 0xCFFF | Failure  | Unable to process                            |
+------------------+----------+----------------------------------------------+
| 0xFF00           | Pending  | Matches are continuing                       |
+------------------+----------+----------------------------------------------+
| 0xFF01           | Pending  | Matches are continuing; one or more Optional |
|                  |          | keys was not supported                       |
+------------------+----------+----------------------------------------------+

pynetdicom C-FIND Statuses
~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0xC001           | Failure  | Handler bound to ``evt.EVT_C_FIND`` yielded a |
|                  |          | status Dataset with no (0000,0900) *Status*   |
|                  |          | element                                       |
+------------------+----------+-----------------------------------------------+
| 0xC002           | Failure  | Handler bound to ``evt.EVT_C_FIND`` yielded an|
|                  |          | invalid status object (not a pydicom Dataset  |
|                  |          | or an int)                                    |
+------------------+----------+-----------------------------------------------+
| 0xC310           | Failure  | Failed to decode the dataset received from    |
|                  |          | the peer                                      |
+------------------+----------+-----------------------------------------------+
| 0xC311           | Failure  | Unhandled exception raised by the handler     |
|                  |          | bound to ``evt.EVT_C_FIND``                   |
+------------------+----------+-----------------------------------------------+
| 0xC312           | Failure  | Failed to encode the dataset received from    |
|                  |          | the handler bound to ``evt.EVT_C_FIND``       |
+------------------+----------+-----------------------------------------------+

N-ACTION Statuses
~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0x0000           | Success  | Success                                       |
+------------------+----------+-----------------------------------------------+
| 0x0112           | Failure  | No such SOP Instance                          |
+------------------+----------+-----------------------------------------------+
| 0x0114           | Failure  | No such argument                              |
+------------------+----------+-----------------------------------------------+
| 0x0115           | Failure  | Invalid argument value                        |
+------------------+----------+-----------------------------------------------+
| 0x0117           | Failure  | Invalid object instance                       |
+------------------+----------+-----------------------------------------------+
| 0x0118           | Failure  | No such SOP Class                             |
+------------------+----------+-----------------------------------------------+
| 0x0119           | Failure  | Class-Instance conflict                       |
+------------------+----------+-----------------------------------------------+
| 0x0123           | Failure  | No such action                                |
+------------------+----------+-----------------------------------------------+
| 0x0124           | Failure  | Refused: not authorised                       |
+------------------+----------+-----------------------------------------------+
| 0x0210           | Failure  | Duplicate invocation                          |
+------------------+----------+-----------------------------------------------+
| 0x0211           | Failure  | Unrecognised operation                        |
+------------------+----------+-----------------------------------------------+
| 0x0212           | Failure  | Mistyped argument                             |
+------------------+----------+-----------------------------------------------+
| 0x0213           | Failure  | Resource limitation                           |
+------------------+----------+-----------------------------------------------+

UPS N-ACTION Service Statuses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0xB301           | Warning  | Deletion Lock not granted                     |
+------------------+----------+-----------------------------------------------+
| 0xB304           | Warning  | The UPS is already in the requested state of  |
|                  |          | CANCELED                                      |
+------------------+----------+-----------------------------------------------+
| 0xB306           | Warning  | The UPS is already in the requested state of  |
|                  |          | COMPLETED                                     |
+------------------+----------+-----------------------------------------------+
| 0xC300           | Failure  | The UPS may not longer be updated             |
+------------------+----------+-----------------------------------------------+
| 0xC301           | Failure  | The correct Transaction UID was not provided  |
+------------------+----------+-----------------------------------------------+
| 0xC302           | Failure  | The UPS is already IN PROGRESS                |
+------------------+----------+-----------------------------------------------+
| 0xC303           | Failure  | The UPS may only become SCHEDULED via         |
|                  |          | N-CREATE, not N-SET or N-ACTION               |
+------------------+----------+-----------------------------------------------+
| 0xC304           | Failure  | The UPS has not met final state requirements  |
|                  |          | for the requested state change                |
+------------------+----------+-----------------------------------------------+
| 0xC307           | Failure  | Specified SOP Instance UID does not exist or  |
|                  |          | is not a UPS Instance managed by this SCP     |
+------------------+----------+-----------------------------------------------+
| 0xC308           | Failure  | Receiving AE-TITLE is Unknown to this SCP     |
+------------------+----------+-----------------------------------------------+
| 0xC310           | Failure  | The UPS is not yet in the IN PROGRESS state   |
+------------------+----------+-----------------------------------------------+
| 0xC311           | Failure  | The UPS is already COMPLETED                  |
+------------------+----------+-----------------------------------------------+
| 0xC312           | Failure  | The performer cannot be contacted             |
+------------------+----------+-----------------------------------------------+
| 0xC313           | Failure  | Performer chooses not to cancel               |
+------------------+----------+-----------------------------------------------+
| 0xC314           | Failure  | Specified action is not appropriate for       |
|                  |          | specified instance                            |
+------------------+----------+-----------------------------------------------+
| 0xC315           | Failure  | SCP does not support Event Reports            |
+------------------+----------+-----------------------------------------------+



N-CREATE Statuses
~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0x0000           | Success  | Success                                       |
+------------------+----------+-----------------------------------------------+
| 0x0105           | Success  | No such attribute                             |
+------------------+----------+-----------------------------------------------+
| 0x0106           | Success  | Invalid attribute value                       |
+------------------+----------+-----------------------------------------------+
| 0x0107           | Success  | Attribute list error                          |
+------------------+----------+-----------------------------------------------+
| 0x0110           | Success  | Processing failure                            |
+------------------+----------+-----------------------------------------------+
| 0x0111           | Success  | Duplicate SOP Instance                        |
+------------------+----------+-----------------------------------------------+
| 0x0116           | Success  | Attribute value out of range                  |
+------------------+----------+-----------------------------------------------+
| 0x0117           | Success  | Invalid object instance                       |
+------------------+----------+-----------------------------------------------+
| 0x0118           | Success  | No such SOP Class                             |
+------------------+----------+-----------------------------------------------+
| 0x0120           | Success  | Missing attribute                             |
+------------------+----------+-----------------------------------------------+
| 0x0121           | Success  | Missing attribute value                       |
+------------------+----------+-----------------------------------------------+
| 0x0124           | Success  | Refused: not authorised                       |
+------------------+----------+-----------------------------------------------+
| 0x0210           | Success  | Duplicate invocation                          |
+------------------+----------+-----------------------------------------------+
| 0x0211           | Success  | Unrecognised operation                        |
+------------------+----------+-----------------------------------------------+
| 0x0212           | Success  | Mistyped argument                             |
+------------------+----------+-----------------------------------------------+
| 0x0213           | Success  | Resource limitation                           |
+------------------+----------+-----------------------------------------------+

UPS N-CREATE Service Statuses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0xB300           | Warning  | The UPS was created with modifications        |
+------------------+----------+-----------------------------------------------+
| 0xC309           | Failure  | The provided value of UPS State was not       |
|                  |          | SCHEDULED                                     |
+------------------+----------+-----------------------------------------------+

N-EVENT-REPORT Statuses
~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+----------------------------------+
| Code (hex)       | Category | Description                      |
+==================+==========+==================================+
| 0x0000           | Success  | Success                          |
+------------------+----------+----------------------------------+
| 0x0110           | Failure  | Processing failure               |
+------------------+----------+----------------------------------+
| 0x0112           | Failure  | No such SOP Instance             |
+------------------+----------+----------------------------------+
| 0x0113           | Failure  | No such event type               |
+------------------+----------+----------------------------------+
| 0x0114           | Failure  | No such argument                 |
+------------------+----------+----------------------------------+
| 0x0115           | Failure  | Invalid argument value           |
+------------------+----------+----------------------------------+
| 0x0117           | Failure  | Invalid object Instance          |
+------------------+----------+----------------------------------+
| 0x0118           | Failure  | No such SOP Class                |
+------------------+----------+----------------------------------+
| 0x0119           | Failure  | Class-Instance conflict          |
+------------------+----------+----------------------------------+
| 0x0210           | Failure  | Duplicate invocation             |
+------------------+----------+----------------------------------+
| 0x0211           | Failure  | Unrecognised operation           |
+------------------+----------+----------------------------------+
| 0x0212           | Failure  | Mistyped argument                |
+------------------+----------+----------------------------------+
| 0x0213           | Failure  | Resource limitation              |
+------------------+----------+----------------------------------+


N-GET Statuses
~~~~~~~~~~~~~~~

+------------+----------+----------------------------------+
| Code (hex) | Category | Description                      |
+============+==========+==================================+
| 0x0000     | Success  | Success                          |
+------------+----------+----------------------------------+
| 0x0107     | Warning  | SOP Class not supported          |
+------------+----------+----------------------------------+
| 0x0110     | Failure  | Processing failure               |
+------------+----------+----------------------------------+
| 0x0112     | Failure  | No such SOP Instance             |
+------------+----------+----------------------------------+
| 0x0117     | Failure  | Invalid object instance          |
+------------+----------+----------------------------------+
| 0x0118     | Failure  | No such SOP Class                |
+------------+----------+----------------------------------+
| 0x0119     | Failure  | Class-Instance conflict          |
+------------+----------+----------------------------------+
| 0x0122     | Failure  | SOP class not supported          |
+------------+----------+----------------------------------+
| 0x0124     | Failure  | Not authorised                   |
+------------+----------+----------------------------------+
| 0x0210     | Failure  | Duplicate invocation             |
+------------+----------+----------------------------------+
| 0x0211     | Failure  | Unrecognised operation           |
+------------+----------+----------------------------------+
| 0x0212     | Failure  | Mistyped argument                |
+------------+----------+----------------------------------+
| 0x0213     | Failure  | Resource limitation              |
+------------+----------+----------------------------------+

UPS N-SET Service Statuses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0x0001           | Warning  | Requested optional Attributes not supported   |
+------------------+----------+-----------------------------------------------+
| 0xC307           | Failure  | Specified SOP Instance UID does not exist or  |
|                  |          | is not a UPS Instance managed by this SCP     |
+------------------+----------+-----------------------------------------------+

N-SET Statuses
~~~~~~~~~~~~~~~

+------------------+----------+----------------------------------+
| Code (hex)       | Category | Description                      |
+==================+==========+==================================+
| 0x0000           | Success  | Success                          |
+------------------+----------+----------------------------------+
| 0x0105           | Failure  | No such attribute                |
+------------------+----------+----------------------------------+
| 0x0106           | Failure  | Invalid attribute value          |
+------------------+----------+----------------------------------+
| 0x0110           | Failure  | Processing failure               |
+------------------+----------+----------------------------------+
| 0x0112           | Failure  | SOP Instance not recognised      |
+------------------+----------+----------------------------------+
| 0x0116           | Failure  | Attribute value out of range     |
+------------------+----------+----------------------------------+
| 0x0117           | Failure  | Invalid object instance          |
+------------------+----------+----------------------------------+
| 0x0118           | Failure  | No such SOP Class                |
+------------------+----------+----------------------------------+
| 0x0119           | Failure  | Class-Instance conflict          |
+------------------+----------+----------------------------------+
| 0x0121           | Failure  | Missing attribute value          |
+------------------+----------+----------------------------------+
| 0x0124           | Failure  | Refused: not authorised          |
+------------------+----------+----------------------------------+
| 0x0210           | Failure  | Duplicate invocation             |
+------------------+----------+----------------------------------+
| 0x0211           | Failure  | Unrecognised operation           |
+------------------+----------+----------------------------------+
| 0x0212           | Failure  | Mistyped argument                |
+------------------+----------+----------------------------------+
| 0x0213           | Failure  | Resource limitation              |
+------------------+----------+----------------------------------+

UPS N-SET Service Statuses
~~~~~~~~~~~~~~~~~~~~~~~~~~

+------------------+----------+-----------------------------------------------+
| Code (hex)       | Category | Description                                   |
+==================+==========+===============================================+
| 0x0001           | Warning  | Requested optional Attributes not supported   |
+------------------+----------+-----------------------------------------------+
| 0xB305           | Warning  | Coerced invalid values to valid values        |
+------------------+----------+-----------------------------------------------+
| 0xC300           | Failure  | The UPS may not longer be updated             |
+------------------+----------+-----------------------------------------------+
| 0xC301           | Failure  | The correct Transaction UID was not provided  |
+------------------+----------+-----------------------------------------------+
| 0xC307           | Failure  | Specified SOP Instance UID does not exist or  |
|                  |          | is not a UPS Instance managed by this SCP     |
+------------------+----------+-----------------------------------------------+
| 0xC310           | Failure  | The UPS is not in the IN PROGRESS state       |
+------------------+----------+-----------------------------------------------+
