Skip to content

Commit 8641d38

Browse files
committed
Import Murfey database classes differently, to eventually differentiate them from ISPyB database tables
1 parent b3464bb commit 8641d38

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

src/murfey/workflows/clem/register_preprocessing_results.py

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,8 @@
1717
from pydantic import BaseModel
1818
from sqlmodel import Session, select
1919

20+
import murfey.util.db as MurfeyDB
2021
from murfey.server import _transport_object
21-
from murfey.util.db import (
22-
CLEMImageMetadata,
23-
CLEMImageSeries,
24-
CLEMImageStack,
25-
CLEMLIFFile,
26-
CLEMTIFFFile,
27-
Session as MurfeySession,
28-
)
2922
from murfey.util.processing_params import (
3023
default_clem_align_and_merge_parameters as processing_params,
3124
)
@@ -84,23 +77,23 @@ def run(message: dict, murfey_db: Session, demo: bool = False) -> dict[str, bool
8477
try:
8578
# Register items in database if not already present
8679
try:
87-
clem_img_series: CLEMImageSeries = get_db_entry(
80+
clem_img_series: MurfeyDB.CLEMImageSeries = get_db_entry(
8881
db=murfey_db,
89-
table=CLEMImageSeries,
82+
table=MurfeyDB.CLEMImageSeries,
9083
session_id=session_id,
9184
series_name=result.series_name,
9285
)
93-
clem_metadata: CLEMImageMetadata = get_db_entry(
86+
clem_metadata: MurfeyDB.CLEMImageMetadata = get_db_entry(
9487
db=murfey_db,
95-
table=CLEMImageMetadata,
88+
table=MurfeyDB.CLEMImageMetadata,
9689
session_id=session_id,
9790
file_path=result.metadata,
9891
)
9992
# Register and link parent LIF file if present
10093
if result.parent_lif is not None:
101-
clem_lif_file: CLEMLIFFile = get_db_entry(
94+
clem_lif_file: MurfeyDB.CLEMLIFFile = get_db_entry(
10295
db=murfey_db,
103-
table=CLEMLIFFile,
96+
table=MurfeyDB.CLEMLIFFile,
10497
session_id=session_id,
10598
file_path=result.parent_lif,
10699
)
@@ -115,9 +108,9 @@ def run(message: dict, murfey_db: Session, demo: bool = False) -> dict[str, bool
115108

116109
# Iteratively register the output image stacks
117110
for c, (channel, output_file) in enumerate(result.output_files.items()):
118-
clem_img_stk: CLEMImageStack = get_db_entry(
111+
clem_img_stk: MurfeyDB.CLEMImageStack = get_db_entry(
119112
db=murfey_db,
120-
table=CLEMImageStack,
113+
table=MurfeyDB.CLEMImageStack,
121114
session_id=session_id,
122115
file_path=output_file,
123116
)
@@ -154,9 +147,9 @@ def run(message: dict, murfey_db: Session, demo: bool = False) -> dict[str, bool
154147
# Register TIFF file subset
155148
clem_tiff_files = []
156149
for file in tiff_file_subset:
157-
clem_tiff_file: CLEMTIFFFile = get_db_entry(
150+
clem_tiff_file: MurfeyDB.CLEMTIFFFile = get_db_entry(
158151
db=murfey_db,
159-
table=CLEMTIFFFile,
152+
table=MurfeyDB.CLEMTIFFFile,
160153
session_id=session_id,
161154
file_path=file,
162155
)
@@ -187,7 +180,7 @@ def run(message: dict, murfey_db: Session, demo: bool = False) -> dict[str, bool
187180
try:
188181
instrument_name = (
189182
murfey_db.exec(
190-
select(MurfeySession).where(MurfeySession.id == session_id)
183+
select(MurfeyDB.Session).where(MurfeyDB.Session.id == session_id)
191184
)
192185
.one()
193186
.instrument_name

0 commit comments

Comments
 (0)