Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion python/lib/db/models/physio_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,21 @@ class DbPhysioFile(Base):
type : Mapped[str | None] = mapped_column('FileType')
acquisition_time : Mapped[datetime | None] = mapped_column('AcquisitionTime')
inserted_by_user : Mapped[str] = mapped_column('InsertedByUser')
path : Mapped[Path] = mapped_column('FilePath', StringPath)
index : Mapped[int | None] = mapped_column('Index')
parent_id : Mapped[int | None] = mapped_column('ParentID')

path: Mapped[Path] = mapped_column('FilePath', StringPath)
"""
The path of this physiological file, which may be a directory (notably for MEG CTF data). The
path is relative to the LORIS data directory.
"""

download_path: Mapped[Path] = mapped_column('DownloadPath', StringPath)
"""
The path from which to download this physiological file, which is guaranteed to be a normal
file or an archive. The path is relative to the LORIS data directory.
"""

output_type : Mapped['db_physio_output_type.DbPhysioOutputType'] = relationship('DbPhysioOutputType')
modality : Mapped['db_physio_modality.DbPhysioModality | None'] = relationship('DbPhysioModality')
session : Mapped['db_session.DbSession'] = relationship('DbSession')
Expand Down
6 changes: 6 additions & 0 deletions python/lib/physio/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ def insert_physio_file(
modality: DbPhysioModality,
output_type: DbPhysioOutputType,
acquisition_time: datetime | None,
download_path: Path | None = None,
) -> DbPhysioFile:
"""
Insert a physiological file into the database.
"""

# If the download path is not provided, use the normal file path.
if download_path is None:
download_path = file_path

file = DbPhysioFile(
path = file_path,
download_path = download_path,
type = file_type.name,
session_id = session.id,
modality_id = modality.id,
Expand Down
Loading