Skip to main content

dataset_scans

Which of a trial's stored scans the file inventory holds under given datasets.

Every dataset of one type on a pod writes the same scan_eligibility partition of a trial, and the file inventory (file_metadata) records which dataset indexed each file. Joining the two on the stored scan_id finds a dataset's scans in a partition without loading the partition's rows.

Module​

Functions​

scans_indexed_under​

def scans_indexed_under(    cache: CacheProtocol,    task_hash: str,    project_id: str,    datasource_task_hashes: Collection[str],) ‑> list[IndexedScan]:

Return a partition's stored scans whose inventory row is one of the datasets'.

A scan matches only when its scan_id is the inventory key exactly; a scan stored under another spelling of its file (a mapped drive against its UNC path, a symlinked root) is not found, since finding it would mean resolving every stored path on disk.

Arguments

  • cache: The cache backend.
  • task_hash: The scan_eligibility partition's task hash.
  • project_id: The trial (project) ID.
  • datasource_task_hashes: The datasets to look for. Expected to be few, so they are bound in one list; empty finds nothing.

Returns One entry per matching stored scan row.

Classes​

IndexedScan​

class IndexedScan(    scan_id: ForwardRef('str'),    file_path: ForwardRef('str'),    bitfount_patient_id: ForwardRef('str'),    datasource_task_hash: ForwardRef('str'),):

A stored scan, with the dataset the file inventory holds it under.

Attributes

  • scan_id: The stored scan's id, which is also its inventory key.
  • file_path: The stored scan's file_path.
  • bitfount_patient_id: The patient the scan is stored under.
  • datasource_task_hash: The dataset whose index wrote the file's row.

Variables​

  • bitfount_patient_id : str - Alias for field number 2
  • datasource_task_hash : str - Alias for field number 3
  • file_path : str - Alias for field number 1
  • scan_id : str - Alias for field number 0