protocol_manager.dal.result_dal#

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

Functions#

add_blank_result_db(→ app.db.postgres.Result)

Add new result to database.

add_dicom_result_db(→ app.db.postgres.Result)

Add a DICOM result record to the database (called by Dagster on_run_success sensor).

get_result_db(→ app.db.postgres.Result | None)

Get result by id.

get_all_results_db(→ list[app.db.postgres.Result])

Get a list of all results assigned to a certain task.

update_result_db(→ app.db.postgres.Result | None)

Update existing result in database.

delete_result_db(→ bool)

Delete result by id.

Module Contents#

async protocol_manager.dal.result_dal.add_blank_result_db(task_id: str | uuid.UUID) → app.db.postgres.Result#

Add new result to database.

Parameters:

payload – Result pydantic base model

Return type:

Database orm model of created result

async protocol_manager.dal.result_dal.add_dicom_result_db(task_id: uuid.UUID, directory: str, files: list[str], meta: dict | None = None) → app.db.postgres.Result#

Add a DICOM result record to the database (called by Dagster on_run_success sensor).

async protocol_manager.dal.result_dal.get_result_db(result_id: uuid.UUID) → app.db.postgres.Result | None#

Get result by id.

Parameters:

result_id – Id of the requested result

Return type:

Database orm model with data of requested result

async protocol_manager.dal.result_dal.get_all_results_db(task_id: uuid.UUID) → list[app.db.postgres.Result]#

Get a list of all results assigned to a certain task.

Parameters:

task_id – Id of the parent task entry, results are assigned to

Return type:

List of result data base orm models

async protocol_manager.dal.result_dal.update_result_db(result_id: uuid.UUID, payload: scanhub_libraries.models.SetResult) → app.db.postgres.Result | None#

Update existing result in database.

Parameters:
  • result_id – Id of the result to be updateed

  • payload – Result pydantic base model with data to be updated

Return type:

Resuld database orm model of updated result

async protocol_manager.dal.result_dal.delete_result_db(result_id: uuid.UUID) → bool#

Delete result by id.

Parameters:

result_id – Id of the result to be deleted

Return type:

Success of deletion