From b96779ad7c5b339c4c5bb4bea79425f9a82e710f Mon Sep 17 00:00:00 2001 From: EddieLF Date: Thu, 14 Sep 2023 13:35:01 +1000 Subject: [PATCH] ProjectsSummaryInternal model and test endpoint --- api/routes/web.py | 46 +++++++++++++++++++++++++++++++++++++++++--- models/models/web.py | 8 ++++---- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/api/routes/web.py b/api/routes/web.py index 26a314313..5abbe24ae 100644 --- a/api/routes/web.py +++ b/api/routes/web.py @@ -17,7 +17,7 @@ from db.python.layers.web import WebLayer, SearchItem from db.python.tables.project import ProjectPermissionsTable from models.models.search import SearchResponse -from models.models.web import ProjectSummary, PagingLinks +from models.models.web import ProjectsSummaryInternal, ProjectSummary, PagingLinks class SearchResponseModel(BaseModel): @@ -126,10 +126,50 @@ async def sync_seqr_project( @router.post('/projects-summary', operation_id='getProjectsSummary') -async def get_projects_summary(sequencing_types: list[str] = None): +async def get_projects_summary( + projects: list[int] = None, sequencing_types: list[str] = None +): """ - Get the summary of all projects + Get the project summaries """ + return [ + ProjectsSummaryInternal( + project=1, + dataset='test-dataset-1', + sequencing_type='genome', + total_families=1, + total_participants=3, + total_samples=3, + total_sequencing_groups=3, + total_crams=3, + total_sgs_in_latest_es_index=3, + total_sgs_in_latest_annotate_dataset=3, + ), + ProjectsSummaryInternal( + project=1, + dataset='test-dataset-1', + sequencing_type='exome', + total_families=1, + total_participants=1, + total_samples=1, + total_sequencing_groups=1, + total_crams=1, + total_sgs_in_latest_es_index=1, + total_sgs_in_latest_annotate_dataset=1, + ), + ProjectsSummaryInternal( + project=2, + dataset='test-dataset-2', + sequencing_type='genome', + total_families=5, + total_participants=5, + total_samples=5, + total_sequencing_groups=5, + total_crams=4, + total_sgs_in_latest_es_index=4, + total_sgs_in_latest_annotate_dataset=4, + ), + ] return await WebLayer(get_projectless_db_connection).get_projects_summary( sequencing_types=sequencing_types ) diff --git a/models/models/web.py b/models/models/web.py index 04fd173fc..23b2b934a 100644 --- a/models/models/web.py +++ b/models/models/web.py @@ -36,10 +36,10 @@ class ProjectsSummaryInternal: total_crams: int # latest_es_index_output: str # latest_es_index_timestamp: str - # total_sgs_in_latest_es_index: int - # latest_joint_call_output: str - # latest_joint_call_timestamp: str - # total_sgs_in_latest_joint_call: int + total_sgs_in_latest_es_index: int + # latest_annotate_dataset_output: str + # latest_annotate_dataset_timestamp: str + total_sgs_in_latest_annotate_dataset: int @dataclasses.dataclass