Skip to main content

deployment

The served Prefect flow that lists a pod's EHR patients into a snapshot.

Runs in a subprocess the pod's runner launches, for the same reason a background DAG does (bitfount.flows.dag.deployment): paging a whole EHR must not block the pod's event loop. It authenticates the same way too. Neither a credential nor ehr_config can travel as a deployment parameter, so the run redeems the grant the pod left in the cache under its listing key at the pod control server.

The flow re-checks freshness before listing. Runs of the deployment queue behind its concurrency limit, so a run submitted while another was listing starts after that listing completed, finds it fresh and stands down.

A run that lists is a preprocessing pass over the pod's EHR datasets, and reports its progress through the pod under the listing's grant (bitfount.progress_events.relay). A run that stands down reports nothing: the pass that listed the snapshot it found already reported completing.

Module​

Functions​

ehr_patient_listing_runtime​

def ehr_patient_listing_runtime(    pod_name: str,    pod_identifier: str,    hub_url: str,    listing_key: str,    username: str | None = None,    pod_key_path: str | None = None,    pod_control_url: str | None = None,    refresh: str | None = None,) ‑> EHRPatientListingOutcome:

List every patient in the pod's EHR into a new snapshot.

Arguments

  • pod_name: Pod whose background cache the listing writes to.
  • pod_identifier: username/pod_name, for telemetry.
  • hub_url: Hub base URL.
  • listing_key: The listing to refresh. Checked against the EHR the pod serves, so a run submitted before the pod was repointed at another EHR cannot list that one under this key.
  • username: Hub username, used to rebuild the session.
  • pod_key_path: Path to pod_rsa.pem; retained for compatibility, no longer used by the cache.
  • pod_control_url: Base URL of the pod control server, where the EHR configuration and credentials come from, and where progress events are relayed.
  • refresh: Why the pod submitted the listing, a ListingRefresh value, which sets the trigger its progress events report.

Returns What the run did.

Raises

  • ConfigError: If the pod served no EHR configuration, or one whose listing key is not listing_key.

Classes​

EHRPatientListingOutcome​

class EHRPatientListingOutcome(    listing_key: str,    listed: bool,    run_id: str | None = None,    patients_listed: int = 0,    truncated: bool = False,):

What one run of ehr_patient_listing_runtime did.

Attributes

  • listing_key: The listing the run served.
  • listed: Whether it listed the EHR, rather than standing down because a fresh snapshot already existed.
  • run_id: The runs row of the listing, when it listed.
  • patients_listed: Distinct patient IDs the listing stored, when it listed.
  • truncated: Whether pagination failed part-way, leaving the run PARTIAL and its snapshot unserved.

Variables​

  • listed : bool
  • listing_key : str
  • patients_listed : int
  • run_id : str | None
  • truncated : bool