Skip to main content

scan_metadata

Runtime for the scan_metadata cache table.

Mirrors runtimes/file_metadata: a Prefect flow (flow.py) triggered on dataset creation walks an ophthalmology datasource's files, extracts header-only per-scan metadata via _process_file(skip_non_tabular_data=True), normalizes it to one vendor-agnostic field set (functions.py), and persists one row per scan (tasks.py).

Re-exports the public API so callers can import directly from bitfount.runtimes.scan_metadata without knowing the internal module layout:

from bitfount.runtimes.scan_metadata import scan_metadata_runtime

Module

Submodules

Functions

scan_metadata_runtime

def scan_metadata_runtime(    pod_name: str,    datasource_name: str,    datasource_type: str,    cache_db_path: str,    path: str | None = None,    datasource_kwargs: dict[str, Any] | None = None,    only_paths: list[str] | None = None,)> int:

Collect and persist per-scan metadata for one ophthalmology datasource.

Arguments

  • pod_name: Name of the pod (used to derive task_hash).
  • datasource_name: Name of the datasource within the pod.
  • datasource_type: Datasource type string from the pod config.
  • cache_db_path: Path to the pod's background_cache.db SQLite file.
  • path: Directory the datasource walks (required for ophthalmology sources).
  • datasource_kwargs: Extra constructor kwargs for the datasource (e.g. HeidelbergE2ESource needs laterality and series_protocol).
  • only_paths: When set, extract scans for these inventory paths only. Forwarded by the file-metadata chain automation so a scoped index run produces a scoped extraction run. May name directories as well as files; any spelling is accepted, since each path is normalized before being looked up. A path with no inventory row is simply absent from the scope.

Returns The number of ScanMetadata rows written.