patient_manager.api.dal#

Data Access Layer (DAL).

Functions#

add_patient(→ app.api.db.Patient)

Create a new patient entry in database.

get_patient(→ app.api.db.Patient | None)

Fetch a patient from database.

get_all_patients(→ list[app.api.db.Patient])

Get a list of all existing patients.

delete_patient(→ bool)

Delete patient entry from database.

update_patient(→ app.api.db.Patient | None)

Update existing patient in database.

Module Contents#

async patient_manager.api.dal.add_patient(payload: scanhub_libraries.models.BasePatient) → app.api.db.Patient#

Create a new patient entry in database.

Parameters:

payload – Patient pydantic base model

Return type:

Patient database entry

async patient_manager.api.dal.get_patient(patient_id: uuid.UUID) → app.api.db.Patient | None#

Fetch a patient from database.

Parameters:

patient_id – Id of the requested patient

Return type:

Patient database entry

async patient_manager.api.dal.get_all_patients() → list[app.api.db.Patient]#

Get a list of all existing patients.

Return type:

List of database orm models

async patient_manager.api.dal.delete_patient(patient_id: uuid.UUID) → bool#

Delete patient entry from database.

Parameters:

patient_id – Id of the patient to be deleted

Return type:

Delete success

async patient_manager.api.dal.update_patient(patient_id: uuid.UUID, payload: scanhub_libraries.models.BasePatient) → app.api.db.Patient | None#

Update existing patient in database.

Parameters:

patient_id – Id of the patient to be updated

Return type:

Updated database entry