imaging_api.services.retrieval
Attributes
Functions
|
Queues an import request for the images associated with the given project. |
|
Returns information about the status of study imports: |
Queues an import request for the images which have failed to import. |
Module Contents
- imaging_api.services.retrieval.XNATAuthHeaders
- async imaging_api.services.retrieval.retrieve_images_for_project(project_id: str, query: str, headers: XNATAuthHeaders) bool
Queues an import request for the images associated with the given project.
Steps:
Encrypt project ID to send to the data access API
Fetch the cohort’s accession IDs from the data access API
Query PACS to find study for each accession ID -> put into a list
Make a ImportStudyRequest object with the list of studies
Check response gives all to QUEUED
- Parameters:
project_id (str) – The imaging project ID to retrieve the data about.
query (str) – The cohort query (raw SQL).
headers (XNATAuthHeaders) – The headers containing XNAT authentication details.
- Returns:
True if all studies were successfully queued, False otherwise.
- Return type:
bool
- Raises:
HTTPException – If the request cannot be processed.
- async imaging_api.services.retrieval.get_import_status(project_id: str, query: str, headers: XNATAuthHeaders) imaging_api.routers.schemas.ImportStatus
Returns information about the status of study imports:
Successful: Studies (i.e. accession numbers) successfully imported into XNAT
Processing: Studies currently being processed
Failed: Studies that failed to import
Queued: Studies waiting in the queue
QueueFailed: Studies that couldn’t be queued for import
Fetch the cohort’s accession IDs from the data access API
Get project experiments
Get project import status
- Parameters:
project_id (str) – The imaging project ID to retrieve the data about.
query (str) – The cohort query.
headers (XNATAuthHeaders) – The headers containing XNAT authentication details.
- Returns:
An object containing the status of study imports.
- Return type:
- Raises:
HTTPException – If the request cannot be processed.
- async imaging_api.services.retrieval.retry_retrieve_images_for_project(project_id: str, query: str, headers: XNATAuthHeaders) bool
Queues an import request for the images which have failed to import.
Steps:
Get import status
If none have status failed (Failed or QueueFailed), return
Create list of accession numbers that have failed.
Unencrypt the accession numbers
Use Pacs Query request to find study for each accession ID -> put into a list
Make a ImportStudyRequest object with the list of studies
Check response gives all to QUEUED
Return success or failure
- Parameters:
project_id (str) – The imaging project ID to retrieve the data about.
query (str) – The cohort query (raw SQL).
headers (XNATAuthHeaders) – The headers containing XNAT authentication details.
- Returns:
True if all studies were successfully queued, False otherwise.
- Return type:
bool
- Raises:
HTTPException – If the request cannot be processed.