imaging_api.services_external.data_access
Attributes
Classes
Request model for the Data Access API to fetch a cohort's accession IDs. |
Functions
|
Calls the data-access-api |
Module Contents
- imaging_api.services_external.data_access.DATA_ACCESS_API_URL = 'http://data-access-api:8000'
- class imaging_api.services_external.data_access.AccessionIdsRequest
Bases:
pydantic.BaseModelRequest model for the Data Access API to fetch a cohort’s accession IDs.
- encrypted_project_id: str
- query: str
- async imaging_api.services_external.data_access.get_accession_ids(encrypted_project_id: str, query: str) list[str]
Calls the data-access-api
/cohort/accession-idsendpoint and returns the list of accession IDs for the cohort.The endpoint projects the cohort query to the
accession_idcolumn server-side, so no other patient attributes leave the trust’s data store.- Parameters:
encrypted_project_id (str) – The encrypted project ID.
query (str) – The SQL query to execute.
- Returns:
The accession IDs returned by the cohort query, in query order.
- Return type:
list[str]
- Raises:
RuntimeError – If the HTTP call to the Data Access API fails (network error or non-2xx response).