Skip to main content

models

The models the patient-data API's domains share.

They are not any one domain's: the caller's identity, the failure body every route can return, and the liveness payload of the one route that is not a domain's at all.

Classes​

AuthenticatedUser​

class AuthenticatedUser(**data: Any):

Authenticated caller identity produced by the auth dependency.

Arguments

  • user_id: The caller's Bitfount user ID (the hub's ID for the user, not the token sub). Writes are attributed to this.
  • username: The verified username of the authenticated caller, matching the user the pod is logged in as.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables​

  • static model_config
  • static user_id : str
  • static username : str

ErrorDetail​

class ErrorDetail(**data: Any):

FastAPI's HTTPException response body.

Arguments

  • detail: The failure reason. Never carries a filesystem path or a file basename, either of which can itself encode PHI.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables​

  • static detail : str
  • static model_config

HealthStatus​

class HealthStatus(**data: Any):

Liveness payload for the unauthenticated /health endpoint.

Arguments

  • status: Always "ok" when the API process is serving requests.
  • api_version: The version of the API contract this server implements (info.version in its OpenAPI document), as major.minor.patch. A client that needs a route or field introduced in a given version reads this to tell whether the server it is talking to has it.
  • pid: The id of the process serving the API. Says which server
  • answered: a compute starting its API finds one an earlier run left on the port by this, and clears it.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Variables​

  • static api_version : str
  • static model_config
  • static pid : int
  • static status : Literal['ok']