exam-manager.app.dal.exam_dal#

Data acess layer (DAL) between fastapi endpoint and sql database.

Functions#

add_exam_data(→ app.db.postgres.Exam)

Create new exam.

get_exam_data(→ app.db.postgres.Exam | None)

Get exam by id.

get_all_exam_data(→ list[app.db.postgres.Exam])

Get a list of all exams assigned to a certain patient.

get_all_exam_template_data(→ list[app.db.postgres.Exam])

Get a list of all exams assigned to a certain patient.

delete_exam_data(→ bool)

Delete exam by id. Also deletes associated workflows and tasks.

update_exam_data(→ app.db.postgres.Exam | None)

Update existing exam entry.

Module Contents#

async exam-manager.app.dal.exam_dal.add_exam_data(payload: scanhub_libraries.models.BaseExam, creator: str) app.db.postgres.Exam#

Create new exam.

Parameters#

payload

Exam pydantic base model

creator

The username/id of the user who creats this exam

Returns#

Database orm model of created exam

async exam-manager.app.dal.exam_dal.get_exam_data(exam_id: uuid.UUID) app.db.postgres.Exam | None#

Get exam by id.

Parameters#

exam_id

Id of requested exam

Returns#

Database orm model of exam or none

async exam-manager.app.dal.exam_dal.get_all_exam_data(patient_id: uuid.UUID) list[app.db.postgres.Exam]#

Get a list of all exams assigned to a certain patient.

Parameters#

patient_id

Id of the parent patient entry, exams are assigned to

Returns#

List of exam data base orm models

async exam-manager.app.dal.exam_dal.get_all_exam_template_data() list[app.db.postgres.Exam]#

Get a list of all exams assigned to a certain patient.

Parameters#

patient_id

Id of the parent patient entry, exams are assigned to

Returns#

List of exam data base orm models

async exam-manager.app.dal.exam_dal.delete_exam_data(exam_id: uuid.UUID) bool#

Delete exam by id. Also deletes associated workflows and tasks.

Parameters#

exam_id

Id of the exam to be deleted

Returns#

Success of deletion

async exam-manager.app.dal.exam_dal.update_exam_data(exam_id: uuid.UUID, payload: scanhub_libraries.models.BaseExam) app.db.postgres.Exam | None#

Update existing exam entry.

Parameters#

exam_id

Id of the database entry to be updated

payload

Pydantic base exam model with data to be updated

Returns#

Database orm model of updated exam