Skip to content

Commit 59974d7

Browse files
committed
aligning column names with ISPyB
1 parent 5f3244a commit 59974d7

1 file changed

Lines changed: 34 additions & 24 deletions

File tree

src/murfey/util/db.py

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ class Tilt(SQLModel, table=True): # type: ignore
415415

416416

417417
class DataCollectionGroup(SQLModel, table=True): # type: ignore
418-
id: int = Field(primary_key=True, unique=True)
418+
dataCollectionGroupId: int = Field(primary_key=True, unique=True, alias="id")
419419
session_id: int = Field(foreign_key="session.id", primary_key=True)
420420
tag: str = Field(primary_key=True)
421421
atlas_id: Optional[int] = None
@@ -453,7 +453,7 @@ class DataCollectionGroup(SQLModel, table=True): # type: ignore
453453

454454
class NotificationParameter(SQLModel, table=True): # type: ignore
455455
id: Optional[int] = Field(default=None, primary_key=True)
456-
dcg_id: int = Field(foreign_key="datacollectiongroup.id")
456+
dcg_id: int = Field(foreign_key="datacollectiongroup.dataCollectionGroupId")
457457
name: str
458458
min_value: float
459459
max_value: float
@@ -479,9 +479,11 @@ class NotificationValue(SQLModel, table=True): # type: ignore
479479

480480

481481
class DataCollection(SQLModel, table=True): # type: ignore
482-
id: int = Field(primary_key=True, unique=True)
482+
dataCollectionId: int = Field(primary_key=True, unique=True, alias="id")
483483
tag: str = Field(primary_key=True)
484-
dcg_id: int = Field(foreign_key="datacollectiongroup.id")
484+
dataCollectionGroupId: int = Field(
485+
foreign_key="datacollectiongroup.dataCollectionGroupid", alias="dcg_id"
486+
)
485487
data_collection_group: Optional[DataCollectionGroup] = Relationship(
486488
back_populates="data_collections"
487489
)
@@ -500,9 +502,11 @@ class DataCollection(SQLModel, table=True): # type: ignore
500502

501503

502504
class ProcessingJob(SQLModel, table=True): # type: ignore
503-
id: int = Field(primary_key=True, unique=True)
505+
processingJobId: int = Field(primary_key=True, unique=True, alias="id")
504506
recipe: str = Field(primary_key=True)
505-
dc_id: int = Field(foreign_key="datacollection.id")
507+
dataCollectionId: int = Field(
508+
foreign_key="datacollection.dataCollectionId", alias="dc_id"
509+
)
506510
data_collection: Optional[DataCollection] = Relationship(
507511
back_populates="processing_jobs"
508512
)
@@ -567,7 +571,7 @@ class PreprocessStash(SQLModel, table=True): # type: ignore
567571
class SelectionStash(SQLModel, table=True): # type: ignore
568572
id: Optional[int] = Field(default=None, primary_key=True)
569573
class_selection_score: float
570-
pj_id: int = Field(foreign_key="processingjob.id")
574+
pj_id: int = Field(foreign_key="processingjob.processingJobId")
571575
processing_job: Optional[ProcessingJob] = Relationship(
572576
back_populates="selection_stash"
573577
)
@@ -590,8 +594,10 @@ class TomographyProcessingParameters(SQLModel, table=True): # type: ignore
590594

591595

592596
class AutoProcProgram(SQLModel, table=True): # type: ignore
593-
id: int = Field(primary_key=True, unique=True)
594-
pj_id: int = Field(foreign_key="processingjob.id")
597+
autoProcProgramId: int = Field(primary_key=True, unique=True, alias="id")
598+
processingJobId: int = Field(
599+
foreign_key="processingjob.processingJobId", alias="pj_id"
600+
)
595601
processing_job: Optional[ProcessingJob] = Relationship(
596602
back_populates="auto_proc_programs"
597603
)
@@ -760,8 +766,12 @@ class SearchMap(SQLModel, table=True): # type: ignore
760766

761767

762768
class Movie(SQLModel, table=True): # type: ignore
763-
murfey_id: int = Field(primary_key=True, foreign_key="murfeyledger.id")
764-
data_collection_id: Optional[int] = Field(foreign_key="datacollection.id")
769+
movieId: int = Field(
770+
primary_key=True, foreign_key="murfeyledger.id", alias="murfey_id"
771+
)
772+
dataCollectionId: Optional[int] = Field(
773+
foreign_key="datacollection.dataCollectionId", alias="data_collection_id"
774+
)
765775
foil_hole_id: int = Field(foreign_key="foilhole.id", nullable=True, default=None)
766776
path: str
767777
image_number: int
@@ -780,7 +790,7 @@ class Movie(SQLModel, table=True): # type: ignore
780790

781791
class CtfParameters(SQLModel, table=True): # type: ignore
782792
id: Optional[int] = Field(default=None, primary_key=True)
783-
pj_id: int = Field(foreign_key="processingjob.id")
793+
pj_id: int = Field(foreign_key="processingjob.processingJobId")
784794
micrographs_file: str
785795
coord_list_file: str
786796
extract_file: str
@@ -797,7 +807,7 @@ class CtfParameters(SQLModel, table=True): # type: ignore
797807

798808
class TomogramPicks(SQLModel, table=True): # type: ignore
799809
tomogram: str = Field(primary_key=True)
800-
pj_id: int = Field(foreign_key="processingjob.id")
810+
pj_id: int = Field(foreign_key="processingjob.processingJobId")
801811
cbox_3d: str
802812
particle_count: int
803813
tomogram_pixel_size: float
@@ -808,15 +818,15 @@ class TomogramPicks(SQLModel, table=True): # type: ignore
808818

809819
class ParticleSizes(SQLModel, table=True): # type: ignore
810820
id: Optional[int] = Field(default=None, primary_key=True)
811-
pj_id: int = Field(foreign_key="processingjob.id")
821+
pj_id: int = Field(foreign_key="processingjob.processingJobId")
812822
particle_size: float
813823
processing_job: Optional[ProcessingJob] = Relationship(
814824
back_populates="particle_sizes"
815825
)
816826

817827

818828
class SPARelionParameters(SQLModel, table=True): # type: ignore
819-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
829+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
820830
angpix: float
821831
dose_per_frame: float
822832
gain_ref: Optional[str]
@@ -836,7 +846,7 @@ class SPARelionParameters(SQLModel, table=True): # type: ignore
836846

837847

838848
class ClassificationFeedbackParameters(SQLModel, table=True): # type: ignore
839-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
849+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
840850
estimate_particle_diameter: bool = True
841851
hold_class2d: bool = False
842852
rerun_class2d: bool = False
@@ -858,7 +868,7 @@ class ClassificationFeedbackParameters(SQLModel, table=True): # type: ignore
858868

859869
class Class2DParameters(SQLModel, table=True): # type: ignore
860870
particles_file: str = Field(primary_key=True)
861-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
871+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
862872
murfey_id: int = Field(foreign_key="murfeyledger.id")
863873
class2d_dir: str
864874
batch_size: int
@@ -876,15 +886,15 @@ class Class2D(SQLModel, table=True): # type: ignore
876886
particles_file: str = Field(
877887
primary_key=True,
878888
)
879-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
889+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
880890
murfey_id: int = Field(foreign_key="murfeyledger.id")
881891
processing_job: Optional[ProcessingJob] = Relationship(back_populates="class2ds")
882892
murfey_ledger: Optional[MurfeyLedger] = Relationship(back_populates="class2ds")
883893

884894

885895
class Class3DParameters(SQLModel, table=True): # type: ignore
886896
particles_file: str = Field(primary_key=True)
887-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
897+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
888898
murfey_id: int = Field(foreign_key="murfeyledger.id")
889899
class3d_dir: str
890900
batch_size: int
@@ -904,7 +914,7 @@ class Class3DParameters(SQLModel, table=True): # type: ignore
904914
class Class3D(SQLModel, table=True): # type: ignore
905915
class_number: int = Field(primary_key=True)
906916
particles_file: str = Field(primary_key=True)
907-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
917+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
908918
murfey_id: int = Field(foreign_key="murfeyledger.id")
909919
# class3d_parameters: Optional[Class3DParameters] = Relationship(
910920
# back_populates="class3ds"
@@ -916,7 +926,7 @@ class Class3D(SQLModel, table=True): # type: ignore
916926
class RefineParameters(SQLModel, table=True): # type: ignore
917927
tag: str = Field(primary_key=True)
918928
refine_dir: str = Field(primary_key=True)
919-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
929+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
920930
murfey_id: int = Field(foreign_key="murfeyledger.id")
921931
class3d_dir: str
922932
class_number: int
@@ -932,15 +942,15 @@ class RefineParameters(SQLModel, table=True): # type: ignore
932942
class Refine3D(SQLModel, table=True): # type: ignore
933943
tag: str = Field(primary_key=True)
934944
refine_dir: str = Field(primary_key=True)
935-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
945+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
936946
murfey_id: int = Field(foreign_key="murfeyledger.id")
937947
processing_job: Optional[ProcessingJob] = Relationship(back_populates="refine3ds")
938948
murfey_ledger: Optional[MurfeyLedger] = Relationship(back_populates="refine3ds")
939949

940950

941951
class BFactorParameters(SQLModel, table=True): # type: ignore
942952
project_dir: str = Field(primary_key=True)
943-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
953+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
944954
batch_size: int
945955
refined_grp_uuid: int
946956
refined_class_uuid: int
@@ -952,7 +962,7 @@ class BFactorParameters(SQLModel, table=True): # type: ignore
952962

953963
class BFactors(SQLModel, table=True): # type: ignore
954964
bfactor_directory: str = Field(primary_key=True)
955-
pj_id: int = Field(primary_key=True, foreign_key="processingjob.id")
965+
pj_id: int = Field(primary_key=True, foreign_key="processingjob.processingJobId")
956966
number_of_particles: int
957967
resolution: float
958968

0 commit comments

Comments
 (0)