From b889a2987e5ac3d0f0c3110dd9c7d988da1efd9e Mon Sep 17 00:00:00 2001 From: Bryan Brancotte <bryan.brancotte@pasteur.fr> Date: Mon, 30 Oct 2023 18:01:08 +0100 Subject: [PATCH] fix class/Model name (is on initTable and was named project) --- jass/models/phenotype.py | 4 ++-- jass/server.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jass/models/phenotype.py b/jass/models/phenotype.py index 5abe2ec6..f3fbcaae 100644 --- a/jass/models/phenotype.py +++ b/jass/models/phenotype.py @@ -76,7 +76,7 @@ def get_available_phenotypes(init_file_path: str): _initTableNamePattern = re.compile("^([A-Z]*[a-z]*-*\.?[0-9]*)+$") -class ProjectNameModel(BaseModel): +class InitTableNameModel(BaseModel): initTableName: Optional[str] = "initTable.hdf5" @validator("initTableName") @@ -85,5 +85,5 @@ class ProjectNameModel(BaseModel): raise ValueError(f"Prohibited char, only \"{_initTableNamePattern.pattern}\" allowed.") return value -class PhenotypeIdList(ProjectNameModel, BaseModel): +class PhenotypeIdList(InitTableNameModel, BaseModel): phenotypeID: List[str] = [] diff --git a/jass/server.py b/jass/server.py index 9314435d..a39869b1 100644 --- a/jass/server.py +++ b/jass/server.py @@ -12,7 +12,7 @@ from tables import HDF5ExtError from jass import util from jass.config import config -from jass.models.phenotype import Phenotype, get_available_phenotypes, PhenotypeIdList, ProjectNameModel +from jass.models.phenotype import Phenotype, get_available_phenotypes, PhenotypeIdList, InitTableNameModel from jass.models.inittable import get_inittable_meta from jass.models.project import GlobalProject, load_project as project__load_project from jass.tasks import create_project, run_project_analysis_if_needed, get_queue_status @@ -53,10 +53,10 @@ async def read_index(): @app.post("/api/phenotypes", response_model=List[Phenotype]) -def phenotypes_list(project_name: ProjectNameModel): +def phenotypes_list(init_table_name: InitTableNameModel): """List phenotypes""" try: - return get_available_phenotypes(os.path.join(config["DATA_DIR"], project_name.initTableName)) + return get_available_phenotypes(os.path.join(config["DATA_DIR"], init_table_name.initTableName)) except FileNotFoundError as e: # initTable does not exists raise HTTPException(status_code=404, detail=str(e)) -- GitLab