identity
Stable identities for EHR servers.
Module
Functions
canonical_url
def canonical_url(url: str | None) ‑> str:Normalise url to a stable identity string, or "" when absent.
Two configs naming the same endpoint in different ways must produce the same
string, or they would partition the same EHR's cache twice. Normalises: the
scheme and host to lowercase, the scheme's default port away (:443 on
https, :80 on http), a trailing slash off the path, and the query and
fragment off entirely.
A non-default port is kept. It routinely distinguishes two real
instances on one host (a test EHR on :8443 beside production on :443),
and merging their caches would serve one trial's data for the other.
Arguments
url: The URL to normalise, orNone.
Returns
The canonical form, or "" if url is None or empty.
ehr_server_key
def ehr_server_key(base_url: str | None, provider: str | None) ‑> str:Name one EHR server, however its config spells it.
What a server has shown it cannot do is a property of the server and the provider's software on it, so the key is those two and nothing that varies by cohort (such as configured List IDs).
Arguments
base_url: The server's base URL.provider: The EHR provider.
Returns A hex digest, stable across processes and SDK runs.