From f1eba9746b6aa8abd9aa306da0d9ef3ce494728d Mon Sep 17 00:00:00 2001 From: EddieLF <34049565+EddieLF@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:33:25 +1000 Subject: [PATCH] Hotfix insights layer to filter for only completed web analyses (#970) --- db/python/layers/project_insights.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/db/python/layers/project_insights.py b/db/python/layers/project_insights.py index 0e939cc9d..6c649c497 100644 --- a/db/python/layers/project_insights.py +++ b/db/python/layers/project_insights.py @@ -264,7 +264,9 @@ def get_sg_web_report_links( if stripy_report.outlier_loci else None ), - 'timestamp_completed': stripy_report.timestamp_completed.isoformat(), + 'timestamp_completed': stripy_report.timestamp_completed.isoformat() + if stripy_report.timestamp_completed + else None, } if mito_report := sequencing_group_mito_reports.get(report_key): @@ -272,7 +274,9 @@ def get_sg_web_report_links( 'url': self.get_report_url( project.name, sequencing_group_id, mito_report.output, 'MitoReport' ), - 'timestamp_completed': mito_report.timestamp_completed.isoformat(), + 'timestamp_completed': mito_report.timestamp_completed.isoformat() + if mito_report.timestamp_completed + else None, } return report_links @@ -705,6 +709,7 @@ async def _latest_es_indices_by_project_id_and_seq_type_and_stage( JSON_UNQUOTE(JSON_EXTRACT(meta, '$.stage')) as stage FROM analysis WHERE type='es-index' + AND status='COMPLETED' GROUP BY project, JSON_EXTRACT(meta, '$.sequencing_type'), JSON_EXTRACT(meta, '$.stage') ) max_timestamps ON a.project = max_timestamps.project AND a.timestamp_completed = max_timestamps.max_timestamp @@ -829,6 +834,7 @@ async def _details_stripy_reports( FROM analysis a LEFT JOIN analysis_sequencing_group asg on asg.analysis_id=a.id WHERE type='web' + AND status='COMPLETED' AND project IN :projects AND JSON_EXTRACT(meta, '$.stage') = 'Stripy' GROUP BY asg.sequencing_group_id @@ -875,6 +881,7 @@ async def _details_mito_reports( FROM analysis a LEFT JOIN analysis_sequencing_group asg on asg.analysis_id=a.id WHERE type='web' + AND status='COMPLETED' AND project IN :projects AND JSON_EXTRACT(meta, '$.stage') = 'MitoReport' GROUP BY asg.sequencing_group_id