Skip to content

Commit 4645f70

Browse files
committed
move physio file parameter queries
1 parent 1b26881 commit 4645f70

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

python/lib/db/queries/physio_file.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,3 @@ def try_get_physio_file_with_path(db: Database, path: str) -> DbPhysioFile | Non
1717
return db.execute(select(DbPhysioFile)
1818
.where(DbPhysioFile.path == path)
1919
).scalar_one_or_none()
20-
21-
22-
def get_physio_file_parameters(
23-
db: Database,
24-
physio_file_id: int,
25-
) -> Sequence[tuple[DbParameterType, DbPhysioFileParameter]]:
26-
"""
27-
Get the parameters of a physiological file using its ID.
28-
"""
29-
30-
return db.execute(select(DbParameterType, DbPhysioFileParameter)
31-
.join(DbPhysioFileParameter.type)
32-
.where(DbPhysioFileParameter.file_id == physio_file_id)
33-
).tuples().all()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from collections.abc import Sequence
2+
3+
from sqlalchemy import select
4+
from sqlalchemy.orm import Session as Database
5+
6+
from lib.db.models.parameter_type import DbParameterType
7+
from lib.db.models.physio_file_parameter import DbPhysioFileParameter
8+
9+
10+
def get_physio_file_parameters(
11+
db: Database,
12+
physio_file_id: int,
13+
) -> Sequence[tuple[DbParameterType, DbPhysioFileParameter]]:
14+
"""
15+
Get the parameters of a physiological file using its ID.
16+
"""
17+
18+
return db.execute(select(DbParameterType, DbPhysioFileParameter)
19+
.join(DbPhysioFileParameter.type)
20+
.where(DbPhysioFileParameter.file_id == physio_file_id)
21+
).tuples().all()

python/lib/imaging_lib/physio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sqlalchemy.orm import Session as Database
22

3-
from lib.db.queries.physio_file import get_physio_file_parameters
3+
from lib.db.queries.physio_parameter import get_physio_file_parameters
44

55

66
def get_physio_file_parameters_dict(db: Database, physio_file_id: int) -> dict[str, str | None]:

0 commit comments

Comments
 (0)