Skip to content

[DTOSS 12685] Emulate modality workflow - #112

Merged
steventux merged 10 commits into
mainfrom
DTOSS-12685-emulate-modality-workflow
Jun 4, 2026
Merged

[DTOSS 12685] Emulate modality workflow#112
steventux merged 10 commits into
mainfrom
DTOSS-12685-emulate-modality-workflow

Conversation

@steventux

@steventux steventux commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a standalone automated modality emulator python process which can also be run as a docker container.

The emulator retrieves recent worklist items from the gateway's MWL server via the C-FIND query class.
The query is scoped to MG modality worklist items scheduled today.

It creates dicom datasets using patient data from the worklist items for each laterality + view position and includes sample images for pixel data.

It then calls the gateway's C-STORE implementation to store the dicom datasets on the gateway PACS storage.
The existing compression and upload services then send the dicom files back to Manage.

Deploy scripts ensure that the emulator is not started in preprod or production environments.

emulator-demo-2026-05-14_17.18.32.mp4

Jira link

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12685

Review notes

Review checklist

  • Check database queries are correctly scoped to current_provider

@steventux steventux changed the title Dtoss 12685 emulate modality workflow [DTOSS 12685] Emulate modality workflow May 14, 2026
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 77f5080 to f6d4ff4 Compare May 18, 2026 13:43
Comment thread src/modality_emulator.py Fixed
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch 3 times, most recently from 1a8b888 to 4ccc345 Compare May 18, 2026 15:42
@steventux
steventux marked this pull request as ready for review May 18, 2026 15:42
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 4ccc345 to 80a4e1a Compare May 18, 2026 15:46
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from f74c30f to 065f784 Compare May 19, 2026 13:59
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 065f784 to afb3ba7 Compare May 19, 2026 14:06
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from afb3ba7 to c346dd7 Compare May 19, 2026 14:23
Comment thread tests/test_modality_emulator.py Outdated
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from c346dd7 to cefa9be Compare May 20, 2026 09:55
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 7216da1 to 512fcfd Compare May 20, 2026 11:44
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 1572d87 to 2888bfe Compare May 28, 2026 13:28
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 2888bfe to b9ad112 Compare May 29, 2026 09:02
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 66376c0 to 24e6e1a Compare May 29, 2026 15:11
@steventux
steventux force-pushed the DTOSS-12685-emulate-modality-workflow branch from 24e6e1a to a23d5ff Compare June 1, 2026 08:23
steventux added 7 commits June 4, 2026 10:09
There's no point in returning worklist items for a C-FIND query when they have been completed or discontinued.
This standalone python script polls the worklist database every 5 seconds for new worklist items scheduled for today.
It creates a DICOM dataset with the standard 4 images and the worklist patient info and then performs a C-STORE.
The C-STORE will then be picked up by the dicom uploader and the sample images sent back to Manage.
Package the 2 required sample images we use to send to Manage from the modality emulator
Comment thread docs/adr/ADR-006_Modality_emulator.md Outdated
@@ -0,0 +1,36 @@
# ADR-006: Use a modality emulator for non-production environments

Date: 2026-06-15

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date in the future seems arbitrary?

Comment thread src/modality_emulator.py
Comment thread src/modality_emulator.py
try:
time.sleep(EMULATED_PROCEDURE_DURATION_SECONDS)
emulator.process_worklist_items(ae)
except KeyboardInterrupt:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worth catching Exception as well, to recover from network blip or whatever?

carlosmartinez
carlosmartinez previously approved these changes Jun 4, 2026

@carlosmartinez carlosmartinez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comments. good to go.

@carlosmartinez carlosmartinez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants