patient_manager.api.routes#

Definition of patient endpoints.

Attributes#

Functions#

get_patient_out(→ scanhub_libraries.models.PatientOut)

Get pydantic output model from database ORM model.

create_patient(→ scanhub_libraries.models.PatientOut)

Create new patient database entry.

get_patient(→ scanhub_libraries.models.PatientOut)

Get a patient from database by id.

get_patient_list(...)

Get all patients endpoint.

delete_patient(→ None)

Delete patient from database.

update_patient(patient_id, payload)

Update existing patient endpoint.

Module Contents#

patient_manager.api.routes.router#
async patient_manager.api.routes.get_patient_out(data: patient_manager.api.db.Patient) → scanhub_libraries.models.PatientOut#

Get pydantic output model from database ORM model.

Parameters:

data – Database ORM model

Return type:

Pydantic output model

async patient_manager.api.routes.create_patient(payload: scanhub_libraries.models.BasePatient) → scanhub_libraries.models.PatientOut#

Create new patient database entry.

Parameters:

payload – Patient pydantic base model

Return type:

Patient pydantic output model

Raises:

HTTPException – 404: Could not create patient

async patient_manager.api.routes.get_patient(patient_id: uuid.UUID) → scanhub_libraries.models.PatientOut#

Get a patient from database by id.

Parameters:

patient_id – Id of the requested patient

Return type:

Patient pydantic output model

Raises:

HTTPException – 404: Patient not found

async patient_manager.api.routes.get_patient_list() → list[scanhub_libraries.models.PatientOut]#

Get all patients endpoint.

Return type:

List of patient pydantic output models

async patient_manager.api.routes.delete_patient(patient_id: uuid.UUID) → None#

Delete patient from database.

Parameters:

patient_id – Id of patient to be deleted

Raises:

HTTPException – _description_

async patient_manager.api.routes.update_patient(patient_id: uuid.UUID, payload: scanhub_libraries.models.BasePatient)#

Update existing patient endpoint.

Parameters:
  • patient_id – Id of the patient to be updated

  • payload – Patient data to be updated

Return type:

Updated patient pydantic output model

Raises:

HTTPException – 404: Patient not found