Skip to content
Merged
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
1 change: 0 additions & 1 deletion .github/workflows/db-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
push:
paths:
- "database/**"
branches: ["master"]

env:
REGISTRY: ghcr.io
Expand Down
10 changes: 5 additions & 5 deletions database/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ CREATE TABLE `DataCollection` (
CONSTRAINT `DataCollection_ibfk_6` FOREIGN KEY (`startPositionId`) REFERENCES `MotorPosition` (`motorPositionId`),
CONSTRAINT `DataCollection_ibfk_7` FOREIGN KEY (`endPositionId`) REFERENCES `MotorPosition` (`motorPositionId`),
CONSTRAINT `DataCollection_ibfk_8` FOREIGN KEY (`blSubSampleId`) REFERENCES `BLSubSample` (`blSubSampleId`)
) ENGINE=InnoDB AUTO_INCREMENT=6017785 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
) ENGINE=InnoDB AUTO_INCREMENT=6017786 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down Expand Up @@ -2996,7 +2996,7 @@ CREATE TABLE `DataCollectionGroup` (
CONSTRAINT `DataCollectionGroup_ibfk_1` FOREIGN KEY (`blSampleId`) REFERENCES `BLSample` (`blSampleId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `DataCollectionGroup_ibfk_2` FOREIGN KEY (`sessionId`) REFERENCES `BLSession` (`sessionId`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `DataCollectionGroup_ibfk_4` FOREIGN KEY (`experimentTypeId`) REFERENCES `ExperimentType` (`experimentTypeId`)
) ENGINE=InnoDB AUTO_INCREMENT=5441043 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='a dataCollectionGroup is a group of dataCollection for a spe';
) ENGINE=InnoDB AUTO_INCREMENT=5441044 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='a dataCollectionGroup is a group of dataCollection for a spe';
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down Expand Up @@ -5284,7 +5284,7 @@ CREATE TABLE `ProcessingJob` (
PRIMARY KEY (`processingJobId`),
KEY `ProcessingJob_ibfk1` (`dataCollectionId`),
CONSTRAINT `ProcessingJob_ibfk1` FOREIGN KEY (`dataCollectionId`) REFERENCES `DataCollection` (`dataCollectionId`)
) ENGINE=InnoDB AUTO_INCREMENT=3702 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='From this we get both job times and lag times';
) ENGINE=InnoDB AUTO_INCREMENT=3711 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci COMMENT='From this we get both job times and lag times';
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down Expand Up @@ -5379,7 +5379,7 @@ CREATE TABLE `ProcessingJobParameter` (
KEY `ProcessingJobParameter_ibfk1` (`processingJobId`),
KEY `ProcessingJobParameter_idx_paramKey_procJobId` (`parameterKey`,`processingJobId`),
CONSTRAINT `ProcessingJobParameter_ibfk1` FOREIGN KEY (`processingJobId`) REFERENCES `ProcessingJob` (`processingJobId`)
) ENGINE=InnoDB AUTO_INCREMENT=24155 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
) ENGINE=InnoDB AUTO_INCREMENT=24255 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down Expand Up @@ -8275,4 +8275,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2025-03-20 11:49:05
-- Dump completed on 2025-04-23 9:38:30
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"pydantic[email]~=2.9.2",
"fpdf2~=2.8.2",
"types-requests",
"lims-utils~=0.4.1"
"lims-utils~=0.4.3"
]
dynamic = ["version"]
license.file = "LICENSE"
Expand Down
11 changes: 10 additions & 1 deletion src/pato/crud/movies.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Optional

from fastapi import HTTPException, status
from lims_utils.tables import CTF, FoilHole, MotionCorrection, Movie, RelativeIceThickness
from sqlalchemy import func as f
from sqlalchemy import select
Expand Down Expand Up @@ -77,8 +78,16 @@ def get_relative_ice_thickness(
return IceThicknessWithAverage(avg=None, current=movie_data)

def get_movie_info(movieId: int) -> MovieData:
return db.session.execute(
movie = db.session.execute(
select(*unravel(Movie), FoilHole.gridSquareId)
.join(FoilHole, FoilHole.foilHoleId==Movie.foilHoleId)
.filter(Movie.movieId == movieId)
).one_or_none()

if movie is None:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="No items found",
)

return movie
8 changes: 4 additions & 4 deletions src/pato/models/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,10 @@ class Classification(OrmBaseModel):
classNumber: int
classImageFullPath: Optional[str] = None
particlesPerClass: Optional[int] = None
rotationAccuracy: float
translationAccuracy: float
estimatedResolution: float
overallFourierCompleteness: float
rotationAccuracy: Optional[float] = None
translationAccuracy: Optional[float] = None
estimatedResolution: Optional[float] = None
overallFourierCompleteness: Optional[float] = None
classDistribution: Optional[float] = None
selected: Optional[bool] = None
bFactorFitIntercept: Optional[float] = None
Expand Down
4 changes: 4 additions & 0 deletions tests/movies/test_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ def test_get_movie_info(mock_permissions, client):
assert resp.json()["foilHoleId"] == 1
assert resp.json()["gridSquareId"] == 1

def test_inexistent(mock_permissions, client):
"""Should raise exception if movie not in database"""
resp = client.get("/movies/9999")
assert resp.status_code == 404
Loading