From 90cc0c7f34d441bfe9a708ea44a643db25001b1f Mon Sep 17 00:00:00 2001 From: Anandashankar Anil Date: Thu, 30 May 2024 14:16:11 +0200 Subject: [PATCH] Show pending projects in the report --- daily_read/config.py | 2 +- daily_read/daily_report.py | 7 ++++--- daily_read/ngi_data.py | 3 ++- daily_read/templates/daily_report.html.j2 | 2 +- tests/test_ngi_data.py | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/daily_read/config.py b/daily_read/config.py index 9ddd49d..48f0c17 100644 --- a/daily_read/config.py +++ b/daily_read/config.py @@ -20,7 +20,7 @@ def __init__(self, env_file_path): self.FETCH_FROM_SNPSEQ = os.getenv("DAILY_READ_FETCH_FROM_SNPSEQ") self.FETCH_FROM_UGC = os.getenv("DAILY_READ_FETCH_FROM_UGC") self.STATUS_PRIORITY = { - 0: "None", + 0: "Pending", 1: "Samples Received", 2: "Reception Control finished", 3: "Library QC finished", diff --git a/daily_read/daily_report.py b/daily_read/daily_report.py index 0eaaa47..f7fb47d 100644 --- a/daily_read/daily_report.py +++ b/daily_read/daily_report.py @@ -23,11 +23,12 @@ } STATUS_DESCRIPTIONS = { - "All Raw data Delivered": "The data has been made available through NGIs delivery system", - "All Samples Sequenced": "Sequencing (including potential resequencing) of all samples has been finished", + "All Raw data Delivered": "The data has been made available through NGIs delivery system.", + "All Samples Sequenced": "Sequencing (including potential resequencing) of all samples has been finished.", "Library QC finished": "Library QC is a quality control of the sequencing library produced either by NGI or supplied by you, depending on the type of project.", "Reception Control finished": "Reception Control consists of NGI staff measuring e.g. concentration and volume for the samples received.", - "Samples Received": "The samples have been received and registered at NGI", + "Samples Received": "The samples have been received and registered at NGI.", + "Pending": "The order has been set up but the samples have not yet been received by NGI.", } PORTAL_URL = "https://ngisweden.scilifelab.se/orders" diff --git a/daily_read/ngi_data.py b/daily_read/ngi_data.py index addbd2c..a2ddf75 100644 --- a/daily_read/ngi_data.py +++ b/daily_read/ngi_data.py @@ -278,7 +278,8 @@ def __init__( else: self.status = latest_statuses[0] else: - log.info(f"No project dates found for {project_id}") + log.info(f"No project dates found for {project_id}, so setting its status to Pending") + self.status = "Pending" @property def internal_id_or_portal_id(self): diff --git a/daily_read/templates/daily_report.html.j2 b/daily_read/templates/daily_report.html.j2 index 2cf1c4a..8dac544 100644 --- a/daily_read/templates/daily_report.html.j2 +++ b/daily_read/templates/daily_report.html.j2 @@ -148,7 +148,7 @@ - {% if data["projects"]|length == 1 and None in data["projects"] %} + {% if data["projects"]|length == 0 %}
No recorded activity at the time of report generation!
diff --git a/tests/test_ngi_data.py b/tests/test_ngi_data.py index a65d86e..5f5461c 100644 --- a/tests/test_ngi_data.py +++ b/tests/test_ngi_data.py @@ -229,7 +229,8 @@ def test_get_data_with_no_project_dates(data_repo_full, mocked_statusdb_conn_row data_master.get_data("NGI123459") assert len(data_master.data.keys()) == 1 assert "NGI123459" in data_master.data - assert "No project dates found for NGI123459" in caplog.text + assert "No project dates found for NGI123459, so setting its status to Pending" in caplog.text + assert data_master.data["NGI123459"].status == "Pending" def test_skip_order_with_no_year(data_repo_full, mocked_statusdb_conn_rows, caplog, get_env_file_path):