imaging_api.services.imaging

Attributes

PACS_ID

XNAT_URL

Functions

ping_pacs(→ imaging_api.routers.schemas.PacsStatus)

Pings the imaging provider (PACS) to check if it is reachable.

check_pacs(→ None)

Checks if the PACS system is reachable by pinging it.

query_by_accession_number(...)

Queries the imaging provider (PACS) to retrieve a list of studies associated with the provided accession number.

queue_image_import_request(...)

Queues an image import request via DQR for the provided XNAT project ID.

Module Contents

imaging_api.services.imaging.PACS_ID
imaging_api.services.imaging.XNAT_URL
imaging_api.services.imaging.ping_pacs(pacs_id: int, headers: dict[str, str]) imaging_api.routers.schemas.PacsStatus

Pings the imaging provider (PACS) to check if it is reachable.

Parameters:
  • pacs_id (int) – PACS ID to ping.

  • headers (dict[str, str]) – XNAT authentication headers.

Returns:

Status of the PACS system.

Return type:

PacsStatus

Raises:
imaging_api.services.imaging.check_pacs(headers: dict[str, str], pacs_id: int = PACS_ID) None

Checks if the PACS system is reachable by pinging it.

Parameters:
  • headers (dict[str, str]) – XNAT authentication headers.

  • pacs_id (int) – PACS ID to check. Default is the PACS_ID from settings.

Returns:

None

Raises:
imaging_api.services.imaging.query_by_accession_number(accession_number: str, headers: dict[str, str]) list[imaging_api.routers.schemas.Study]

Queries the imaging provider (PACS) to retrieve a list of studies associated with the provided accession number.

Parameters:
  • accession_number (str) – The accession number to query.

  • headers (dict[str, str]) – XNAT authentication headers.

Returns:

A list of Study objects that match the accession number.

Return type:

list[Study]

Raises:

Exception – If there is an error during the query request.

imaging_api.services.imaging.queue_image_import_request(import_request: imaging_api.routers.schemas.ImportStudyRequest, headers: dict[str, str]) list[imaging_api.routers.schemas.ImportStudyResponse]

Queues an image import request via DQR for the provided XNAT project ID. Handles duplicate studies by StudyInstanceUID and checks if all studies were successfully queued.

Note that trying to retrieve a study which is already contained in the project will still successfully queue the import, but will result in an error on XNAT.

Parameters:
  • import_request (ImportStudyRequest) – The import request containing project ID and study details.

  • headers (dict[str, str]) – XNAT authentication headers.

Returns:

A list of ImportStudyResponse objects representing the queued import requests.

Return type:

list[ImportStudyResponse]

Raises: