From 4b3391522ba554ee20eabb038193255d4847787e Mon Sep 17 00:00:00 2001 From: seallard Date: Tue, 6 Aug 2024 10:27:36 +0200 Subject: [PATCH] logging --- .../endpoint_services/plate_service.py | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/genotype_api/services/endpoint_services/plate_service.py b/genotype_api/services/endpoint_services/plate_service.py index 9739620..c6f3d46 100644 --- a/genotype_api/services/endpoint_services/plate_service.py +++ b/genotype_api/services/endpoint_services/plate_service.py @@ -11,10 +11,22 @@ from pydantic import EmailStr from genotype_api.constants import Types -from genotype_api.database.filter_models.plate_models import PlateSignOff, PlateOrderParams +from genotype_api.database.filter_models.plate_models import ( + PlateSignOff, + PlateOrderParams, +) from genotype_api.database.models import Plate, Analysis, User, Sample -from genotype_api.dto.plate import PlateResponse, UserOnPlate, AnalysisOnPlate, SampleStatus -from genotype_api.exceptions import PlateNotFoundError, UserNotFoundError, PlateExistsError +from genotype_api.dto.plate import ( + PlateResponse, + UserOnPlate, + AnalysisOnPlate, + SampleStatus, +) +from genotype_api.exceptions import ( + PlateNotFoundError, + UserNotFoundError, + PlateExistsError, +) from genotype_api.file_parsing.excel import GenotypeAnalysis from genotype_api.file_parsing.files import check_file from genotype_api.services.endpoint_services.base_service import BaseService @@ -85,8 +97,12 @@ def upload_plate(self, file: UploadFile) -> None: plate_obj = Plate(plate_id=plate_id) plate: Plate = self.store.create_plate(plate=plate_obj) new_plate: Plate = self.store.get_plate_by_plate_id(plate_id=plate_id) - analyses: list[Analysis] = list(excel_parser.generate_analyses(plate_id=new_plate.id)) - self.store.check_analyses_objects(analyses=analyses, analysis_type=Types.GENOTYPE) + analyses: list[Analysis] = list( + excel_parser.generate_analyses(plate_id=new_plate.id) + ) + self.store.check_analyses_objects( + analyses=analyses, analysis_type=Types.GENOTYPE + ) self.store.create_analyses_samples(analyses=analyses) for analysis in analyses: self.store.create_analysis(analysis=analysis) @@ -97,7 +113,11 @@ def upload_plate(self, file: UploadFile) -> None: self.store.refresh_plate(plate=plate) def update_plate_sign_off( - self, plate_id: int, user_email: EmailStr, method_document: str, method_version: str + self, + plate_id: int, + user_email: EmailStr, + method_document: str, + method_version: str, ) -> PlateResponse: plate: Plate = self.store.get_plate_by_id(plate_id=plate_id) if not plate: @@ -131,7 +151,9 @@ def delete_plate(self, plate_id) -> list[int]: plate = self.store.get_plate_by_id(plate_id=plate_id) if not plate: raise PlateNotFoundError - analyses: list[Analysis] = self.store.get_analyses_by_plate_id(plate_id=plate_id) + analyses: list[Analysis] = self.store.get_analyses_by_plate_id( + plate_id=plate_id + ) analysis_ids: list[int] = [analyse.id for analyse in analyses] for analysis in analyses: self.store.delete_analysis(analysis=analysis)