Skip to main content

identity

How a scan is named in a log line.

Its own module because both the service and the overlay builder log about the same scan and must name it the same way, and neither imports the other.

Module

Functions

scan_digest

def scan_digest(file_id: str)> str:

Return a short, stable, non-identifying handle for a scan.

A scan's file_id is the path ingest recorded, which on a clinical share carries patient and study folder identifiers — so it cannot go in a line logged once per request. A digest of it is stable across requests and across restarts, so every line about one scan correlates, while naming nobody. Twelve hex characters is far past collision range for one pod's file count and short enough to read in a log line.

To go from a digest back to a scan, hash the candidate file_id and compare — the mapping is deliberately one-way from the log's side.

Arguments

  • file_id: The scan's raw ingested path.

Returns The first 12 characters of its hex sha256.