PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
ups_workitem.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
19#pragma once
20
21#include <chrono>
22#include <optional>
23#include <string>
24#include <vector>
25
26namespace kcenon::pacs::storage {
27
34enum class ups_state {
35 scheduled,
37 completed,
39};
40
47[[nodiscard]] inline auto to_string(ups_state state) -> std::string {
48 switch (state) {
50 return "SCHEDULED";
52 return "IN PROGRESS";
54 return "COMPLETED";
56 return "CANCELED";
57 default:
58 return "SCHEDULED";
59 }
60}
61
68[[nodiscard]] inline auto parse_ups_state(std::string_view str)
69 -> std::optional<ups_state> {
70 if (str == "SCHEDULED") {
72 }
73 if (str == "IN PROGRESS") {
75 }
76 if (str == "COMPLETED") {
78 }
79 if (str == "CANCELED") {
81 }
82 return std::nullopt;
83}
84
90enum class ups_priority {
91 low,
92 medium,
93 high
94};
95
102[[nodiscard]] inline auto to_string(ups_priority priority) -> std::string {
103 switch (priority) {
105 return "LOW";
107 return "MEDIUM";
109 return "HIGH";
110 default:
111 return "MEDIUM";
112 }
113}
114
121[[nodiscard]] inline auto parse_ups_priority(std::string_view str)
122 -> std::optional<ups_priority> {
123 if (str == "LOW") {
124 return ups_priority::low;
125 }
126 if (str == "MEDIUM") {
128 }
129 if (str == "HIGH") {
130 return ups_priority::high;
131 }
132 return std::nullopt;
133}
134
177 int64_t pk{0};
178
180 std::string workitem_uid;
181
183 std::string state;
184
187
189 std::string worklist_label;
190
192 std::string priority;
193
196
199
202
205
208
211
213 std::string input_information;
214
216 std::string performing_ae;
217
220
223
226
228 std::string transaction_uid;
229
231 std::chrono::system_clock::time_point created_at;
232
234 std::chrono::system_clock::time_point updated_at;
235
241 [[nodiscard]] auto is_valid() const noexcept -> bool {
242 return !workitem_uid.empty();
243 }
244
250 [[nodiscard]] auto is_final() const noexcept -> bool {
251 return state == "COMPLETED" || state == "CANCELED";
252 }
253
259 [[nodiscard]] auto get_state() const -> std::optional<ups_state> {
260 return parse_ups_state(state);
261 }
262
268 [[nodiscard]] auto get_priority() const -> std::optional<ups_priority> {
270 }
271};
272
287 int64_t pk{0};
288
290 std::string subscriber_ae;
291
293 std::string workitem_uid;
294
296 bool deletion_lock{false};
297
299 std::string filter_criteria;
300
302 std::chrono::system_clock::time_point created_at;
303
311 [[nodiscard]] auto is_global() const noexcept -> bool {
312 return workitem_uid.empty() && filter_criteria.empty();
313 }
314
320 [[nodiscard]] auto is_workitem_specific() const noexcept -> bool {
321 return !workitem_uid.empty();
322 }
323};
324
341 std::optional<std::string> workitem_uid;
342
344 std::optional<std::string> state;
345
347 std::optional<std::string> priority;
348
350 std::optional<std::string> procedure_step_label;
351
353 std::optional<std::string> worklist_label;
354
356 std::optional<std::string> performing_ae;
357
359 std::optional<std::string> scheduled_date_from;
360
362 std::optional<std::string> scheduled_date_to;
363
365 size_t limit{0};
366
368 size_t offset{0};
369
375 [[nodiscard]] auto has_criteria() const noexcept -> bool {
376 return workitem_uid.has_value() || state.has_value() ||
377 priority.has_value() || procedure_step_label.has_value() ||
378 worklist_label.has_value() || performing_ae.has_value() ||
379 scheduled_date_from.has_value() || scheduled_date_to.has_value();
380 }
381};
382
383} // namespace kcenon::pacs::storage
@ completed
Procedure completed successfully.
@ in_progress
Procedure is currently being performed.
ups_priority
UPS workitem priority values.
@ medium
Medium priority (default)
auto parse_ups_priority(std::string_view str) -> std::optional< ups_priority >
Parse string to ups_priority enum.
ups_state
UPS workitem state values.
@ scheduled
Workitem is scheduled (initial state)
@ completed
Workitem completed successfully (final)
@ canceled
Workitem was canceled (final)
@ in_progress
Workitem is being performed.
auto parse_ups_state(std::string_view str) -> std::optional< ups_state >
Parse string to ups_state enum.
auto to_string(annotation_type type) -> std::string
Convert annotation_type to string.
UPS subscription record from the database.
std::string subscriber_ae
Subscriber AE Title (required)
auto is_workitem_specific() const noexcept -> bool
Check if this is a workitem-specific subscription.
std::chrono::system_clock::time_point created_at
Record creation timestamp.
std::string filter_criteria
Filter criteria for worklist subscriptions (JSON serialized)
int64_t pk
Primary key (auto-generated)
auto is_global() const noexcept -> bool
Check if this is a global subscription.
std::string workitem_uid
Specific workitem UID (empty for worklist/global subscriptions)
bool deletion_lock
Whether deletion is locked for this subscriber.
std::optional< std::string > procedure_step_label
Procedure Step Label filter (supports wildcards with '*')
size_t limit
Maximum number of results to return (0 = unlimited)
std::optional< std::string > workitem_uid
Workitem SOP Instance UID (exact match)
std::optional< std::string > priority
Priority filter (exact match)
auto has_criteria() const noexcept -> bool
Check if any filter criteria is set.
std::optional< std::string > state
State filter (exact match)
std::optional< std::string > worklist_label
Worklist Label filter (supports wildcards with '*')
std::optional< std::string > scheduled_date_from
Scheduled start date range begin (inclusive, format: YYYYMMDD)
std::optional< std::string > performing_ae
Performing AE filter (exact match)
size_t offset
Offset for pagination.
std::optional< std::string > scheduled_date_to
Scheduled start date range end (inclusive, format: YYYYMMDD)
UPS workitem record from the database.
std::string workitem_uid
UPS SOP Instance UID - unique identifier for this workitem.
std::string scheduled_human_performers
Scheduled Human Performers Sequence (JSON serialized)
std::string input_information
Input Information Sequence (JSON serialized references to input data)
std::string performing_ae
Performing AE Title (set when claimed)
std::string expected_completion_datetime
Expected Completion DateTime (DICOM DT format)
std::string scheduled_station_name
Scheduled Station Name Code Sequence (JSON serialized)
std::string state
Current state of the workitem.
std::string transaction_uid
Transaction UID (set when state changes to IN PROGRESS)
std::chrono::system_clock::time_point updated_at
Record last update timestamp.
std::string output_information
Output Information Sequence (JSON serialized references to output data)
int64_t pk
Primary key (auto-generated)
std::chrono::system_clock::time_point created_at
Record creation timestamp.
std::string progress_description
Procedure Step State (progress description text)
std::string scheduled_station_geographic
Scheduled Station Geographic Location Code Sequence (JSON serialized)
std::string scheduled_start_datetime
Scheduled Procedure Step Start DateTime (DICOM DT format)
int progress_percent
Procedure Step Progress (0-100 percentage)
auto is_final() const noexcept -> bool
Check if this workitem is in a final state.
auto get_priority() const -> std::optional< ups_priority >
Get the priority as enum.
auto get_state() const -> std::optional< ups_state >
Get the state as enum.
std::string priority
Priority (LOW, MEDIUM, HIGH)
std::string worklist_label
Worklist Label (for grouping workitems)
std::string procedure_step_label
Procedure Step Label (human-readable description)
std::string scheduled_station_class
Scheduled Station Class Code Sequence (JSON serialized)
auto is_valid() const noexcept -> bool
Check if this record has valid data.