app.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 app.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

Returns#

Patient database entry

async app.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

Returns#

Patient database entry

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

Get a list of all existing patients.

Returns#

List of database orm models

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

Delete patient entry from database.

Parameters#

patient_id

Id of the patient to be deleted

Returns#

Delete success

async app.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

Returns#

Updated database entry