Skip to main content

lookup_values

The values a patient is looked up by, checked the same way for every backend.

Module​

Functions​

check_patient_id​

def check_patient_id(patient_id: str, *, method: str) ‑> None:

Refuse a blank patient ID, which names no patient.

The ID is otherwise used as given: a backend's key is opaque.

Arguments

  • patient_id: The backend's key for the patient.
  • method: The service method given it, named in the error.

Raises

  • ValueError: If the ID is blank (empty or whitespace only).

mrn_values​

def mrn_values(mrn: str | Sequence[str]) ‑> list[str]:

The medical record numbers to search for, each stripped of whitespace.

Leading and trailing whitespace is not part of an identifier, so " MRN-1 " is searched as "MRN-1".

Arguments

  • mrn: One identifier, or several to try in turn.

Returns The identifiers, stripped, in the order given.

Raises

  • ValueError: If no identifier is given, or one is blank (empty or whitespace only).