|
3 | 3 | import os |
4 | 4 | import sqlite3 |
5 | 5 | from contextlib import contextmanager |
6 | | -from dataclasses import dataclass, field |
7 | 6 | from pathlib import Path |
8 | 7 | from typing import Dict, List, Optional |
9 | 8 |
|
10 | | -from services.mwl import MWLStatus |
| 9 | +from models import WorklistItem |
11 | 10 |
|
12 | 11 | logger = logging.getLogger(__name__) |
13 | 12 |
|
@@ -279,61 +278,6 @@ def mark_upload_failed(self, sop_instance_uid: str, error: str, permanent: bool |
279 | 278 | conn.commit() |
280 | 279 |
|
281 | 280 |
|
282 | | -@dataclass |
283 | | -class WorklistItem: |
284 | | - accession_number: str = field( |
285 | | - doc="A departmental Information System generated number that identifies the Imaging Service Request.", |
286 | | - ) |
287 | | - modality: str = field(doc="Code for type of equipment that will perform the procedure.") |
288 | | - patient_birth_date: str = field(doc="Date of Birth of the Patient.") |
289 | | - patient_id: str = field(doc="Patient NHS Number", hash=True) |
290 | | - patient_name: str = field(doc="Name of the patient. Lastname^Firstname.") |
291 | | - scheduled_date: str = field(doc="Date the procedure is scheduled for.") |
292 | | - scheduled_time: str = field(doc="Time the procedure is scheduled for.") |
293 | | - status: str = field(doc="Status of the worklist item", default=MWLStatus.SCHEDULED.value) |
294 | | - |
295 | | - source_message_id: Optional[str] = field( |
296 | | - default=None, doc="Message ID from system which created this worklist item", hash=True |
297 | | - ) |
298 | | - study_instance_uid: Optional[str] = field(default=None, doc="Instance UID for the study", hash=True) |
299 | | - procedure_code: Optional[str] = field(default=None, doc="Code that identifies the requested procedure.") |
300 | | - patient_sex: Optional[str] = field(default=None, doc="Sex of the patient.") |
301 | | - study_description: Optional[str] = field(default=None, doc="Description of the study.") |
302 | | - mpps_instance_uid: Optional[str] = field( |
303 | | - default=None, doc="Modality Performed Procedure Step (MPPS) instance UID if available." |
304 | | - ) |
305 | | - |
306 | | - patient_age: Optional[str] = field(default=None, doc="Age of the patient at the time of scheduling.") |
307 | | - patient_weight: Optional[str] = field(default=None, doc="Weight of the patient at the time of scheduling.") |
308 | | - patient_address: Optional[str] = field(default=None, doc="Address of the patient.") |
309 | | - patient_comments: Optional[str] = field(default=None, doc="Additional comments about the patient.") |
310 | | - |
311 | | - procedure_coding_scheme_designator: Optional[str] = field( |
312 | | - default=None, doc="Coding scheme designator for the procedure code." |
313 | | - ) |
314 | | - procedure_code_meaning: Optional[str] = field(default=None, doc="Code meaning for the procedure code.") |
315 | | - |
316 | | - reason_code_value: Optional[str] = field(default=None, doc="Code value for the reason for requested procedure.") |
317 | | - reason_coding_scheme_designator: Optional[str] = field( |
318 | | - default=None, doc="Coding scheme designator for the reason for requested procedure." |
319 | | - ) |
320 | | - reason_code_meaning: Optional[str] = field(default=None, doc="Code meaning for the reason for requested procedure.") |
321 | | - |
322 | | - scheduled_performing_physician_name: Optional[str] = field( |
323 | | - default=None, doc="Name of the scheduled performing physician." |
324 | | - ) |
325 | | - scheduled_procedure_step_location: Optional[str] = field( |
326 | | - default=None, doc="Location of the scheduled procedure step." |
327 | | - ) |
328 | | - scheduled_station_aet: Optional[str] = field(default=None, doc="AE Title of the scheduled station.") |
329 | | - scheduled_station_name: Optional[str] = field(default=None, doc="Name of the scheduled station.") |
330 | | - scheduled_protocol_code_value: Optional[str] = field(default=None, doc="Code value for the scheduled protocol.") |
331 | | - scheduled_protocol_coding_scheme_designator: Optional[str] = field( |
332 | | - default=None, doc="Coding scheme designator for the scheduled protocol." |
333 | | - ) |
334 | | - scheduled_protocol_code_meaning: Optional[str] = field(default=None, doc="Code meaning for the scheduled protocol.") |
335 | | - |
336 | | - |
337 | 281 | class WorklistItemNotFoundError(Exception): |
338 | 282 | """Raised when a worklist item is not found in storage.""" |
339 | 283 |
|
|
0 commit comments