app.db.postgres =============== .. py:module:: app.db.postgres .. autoapi-nested-parse:: Database file for the MRI sequence manager service. Attributes ---------- .. autoapisummary:: app.db.postgres.postgres_user_filepath app.db.postgres.postgres_password_filepath app.db.postgres.postgres_db_name_filepath app.db.postgres.postgres_user app.db.postgres.MappedBase app.db.postgres.Device Classes ------- .. autoapisummary:: app.db.postgres.Base app.db.postgres.Protocol app.db.postgres.Task app.db.postgres.AcquisitionTask app.db.postgres.Result Functions --------- .. autoapisummary:: app.db.postgres.init_db Module Contents --------------- .. py:class:: Base Bases: :py:obj:`sqlalchemy.orm.DeclarativeBase` Declarative base class. .. py:method:: update(data: pydantic.BaseModel) -> None Update a protocol entry. .. py:data:: postgres_user_filepath :value: '/run/secrets/scanhub_database_postgres_user' .. py:data:: postgres_password_filepath :value: '/run/secrets/scanhub_database_postgres_password' .. py:data:: postgres_db_name_filepath :value: '/run/secrets/scanhub_database_postgres_db_name' .. py:data:: postgres_user .. py:function:: init_db() -> None Initialize the database. .. py:class:: Protocol Bases: :py:obj:`Base` Protocol ORM model. .. py:attribute:: __tablename__ :value: 'protocol' .. py:attribute:: __table_args__ .. py:attribute:: id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: creator :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: datetime_created :type: sqlalchemy.orm.Mapped[datetime.datetime] .. py:attribute:: datetime_updated :type: sqlalchemy.orm.Mapped[datetime.datetime] .. py:attribute:: tasks :type: sqlalchemy.orm.Mapped[list[Task]] .. py:attribute:: patient_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: description :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: indication :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: patient_height_cm :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: patient_weight_kg :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: comment :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: status :type: sqlalchemy.orm.Mapped[scanhub_libraries.models.ItemStatus] .. py:attribute:: is_template :type: sqlalchemy.orm.Mapped[bool] .. py:class:: Task Bases: :py:obj:`Base` Abstract task ORM model. .. py:attribute:: __tablename__ :value: 'task' .. py:attribute:: __table_args__ .. py:attribute:: id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: creator :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: datetime_created :type: sqlalchemy.orm.Mapped[datetime.datetime] .. py:attribute:: datetime_updated :type: sqlalchemy.orm.Mapped[datetime.datetime] .. py:attribute:: protocol_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: name :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: description :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: task_type :type: sqlalchemy.orm.Mapped[scanhub_libraries.models.TaskType] .. py:attribute:: destination :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: status :type: sqlalchemy.orm.Mapped[scanhub_libraries.models.ItemStatus] .. py:attribute:: progress :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: is_template :type: sqlalchemy.orm.Mapped[bool] .. py:attribute:: position :type: sqlalchemy.orm.Mapped[int] .. py:attribute:: results :type: sqlalchemy.orm.Mapped[list[Result]] .. py:attribute:: __mapper_args__ .. py:class:: AcquisitionTask Bases: :py:obj:`Task` Acquisition task ORM model. .. py:attribute:: __tablename__ :value: 'acquisition_task' .. py:attribute:: __mapper_args__ .. py:attribute:: id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: sequence_id :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: calibration :type: sqlalchemy.orm.Mapped[list[scanhub_libraries.models.CalibrationType]] .. py:attribute:: device_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: acquisition_parameter :type: sqlalchemy.orm.Mapped[scanhub_libraries.models.AcquisitionParameter] .. py:attribute:: acquisition_limits :type: sqlalchemy.orm.Mapped[scanhub_libraries.models.AcquisitionLimits] .. py:class:: Result Bases: :py:obj:`Base` Abstract result ORM model. .. py:attribute:: __tablename__ :value: 'result' .. py:attribute:: __table_args__ .. py:attribute:: id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: datetime_created :type: sqlalchemy.orm.Mapped[datetime.datetime] .. py:attribute:: task_id :type: sqlalchemy.orm.Mapped[uuid.UUID] .. py:attribute:: type :type: sqlalchemy.orm.Mapped[scanhub_libraries.models.ResultType] .. py:attribute:: directory :type: sqlalchemy.orm.Mapped[str] .. py:attribute:: files :type: sqlalchemy.orm.Mapped[list[str]] .. py:attribute:: meta :type: sqlalchemy.orm.Mapped[dict] .. py:data:: MappedBase .. py:data:: Device