Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
DigitalMammographyXRayImageStorageForProcessing, # type: ignore[attr-defined]
ModalityPerformedProcedureStep, # type: ignore[attr-defined]
ModalityWorklistInformationFind, # type: ignore[attr-defined]
Verification, # type: ignore[attr-defined]

@steventux steventux Jun 4, 2026

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.

Not an omission in this PR but are we missing this in the PACS echo?
https://github.com/NHSDigital/manage-breast-screening-gateway/blob/main/src/server.py#L70-L77

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we are. have included the fix in this PR.

)

from services.dicom.c_echo import CEcho
Expand Down Expand Up @@ -68,6 +69,7 @@ def start(self):
dicom_uid.JPEG2000Lossless,
]
self.ae = AE(ae_title=self.ae_title)
self.ae.add_supported_context(Verification)
self.ae.add_supported_context(DigitalMammographyXRayImageStorageForPresentation, transfer_syntaxes)
self.ae.add_supported_context(DigitalMammographyXRayImageStorageForProcessing, transfer_syntaxes)

Expand Down Expand Up @@ -120,10 +122,12 @@ def start(self):
logger.info(f"Starting MWL server: {self.ae_title} on port {self.port}")

self.ae = AE(ae_title=self.ae_title)
self.ae.add_supported_context(Verification)
self.ae.add_supported_context(ModalityWorklistInformationFind)
self.ae.add_supported_context(ModalityPerformedProcedureStep)

handlers = [
(evt.EVT_C_ECHO, CEcho().call),
(evt.EVT_C_FIND, CFind(self.storage).call),
(evt.EVT_N_CREATE, NCreate(self.storage).call),
(evt.EVT_N_SET, NSet(self.storage).call),
Expand Down
9 changes: 7 additions & 2 deletions tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
DigitalMammographyXRayImageStorageForProcessing,
ModalityPerformedProcedureStep,
ModalityWorklistInformationFind,
Verification,
)

from server import MWLServer, PACSServer
Expand Down Expand Up @@ -54,6 +55,7 @@ def test_start(self, mock_c_store, mock_c_echo, mock_ae, _mock_pacs_storage, _mo

mock_ae.assert_called_once_with(ae_title="SCREENING_PACS")
add_context_calls = [call.args[0] for call in mock_ae.return_value.add_supported_context.call_args_list]
assert Verification in add_context_calls
assert DigitalMammographyXRayImageStorageForPresentation in add_context_calls
assert DigitalMammographyXRayImageStorageForProcessing in add_context_calls
mock_ae.return_value.start_server.assert_called_once_with(
Expand Down Expand Up @@ -100,7 +102,8 @@ def test_init_defaults(self, mock_storage):
mock_storage.assert_called_once_with("/var/lib/pacs/worklist.db")

@patch(f"{MWLServer.__module__}.AE")
def test_start(self, mock_ae, _):
@patch(f"{MWLServer.__module__}.CEcho")
def test_start(self, mock_c_echo, mock_ae, _):
subject = MWLServer()
mock_ae_instance = MagicMock()
mock_ae.return_value = mock_ae_instance
Expand All @@ -110,6 +113,7 @@ def test_start(self, mock_ae, _):
assert subject.ae == mock_ae_instance

mock_ae.assert_called_once_with(ae_title="MWL_SCP")
mock_ae_instance.add_supported_context.assert_any_call(Verification)
mock_ae_instance.add_supported_context.assert_any_call(
ModalityWorklistInformationFind,
)
Expand All @@ -121,7 +125,8 @@ def test_start(self, mock_ae, _):
assert args[0] == ("0.0.0.0", 4243)
assert kwargs["block"] is True
assert "evt_handlers" in kwargs
assert len(kwargs["evt_handlers"]) == 3
assert (evt.EVT_C_ECHO, mock_c_echo.return_value.call) in kwargs["evt_handlers"]
assert len(kwargs["evt_handlers"]) == 4

@patch(f"{MWLServer.__module__}.AE")
def test_stop(self, *_):
Expand Down
Loading