Skip to content

Commit

Permalink
Merge pull request #43 from alneberg/typofix
Browse files Browse the repository at this point in the history
Typofix
  • Loading branch information
aanil authored Jun 14, 2024
2 parents 0e888e9 + 91c0f32 commit a4376ff
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions daily_read/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def __init__(self, env_file_path):
self.STATUS_PRIORITY = {
0: "Pending",
1: "Samples Received",
2: "Reception Control finished",
3: "Library QC finished",
2: "Reception Control Finished",
3: "Library QC Finished",
4: "All Samples Sequenced",
5: "All Raw data Delivered",
5: "All Raw Data Delivered",
}
self.STATUS_PRIORITY_REV = {v: k for k, v in self.STATUS_PRIORITY.items()}
12 changes: 6 additions & 6 deletions daily_read/daily_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@


STATUS_ICONS = {
"All Raw data Delivered": "cloud-download",
"All Raw Data Delivered": "cloud-download",
"All Samples Sequenced": "body-text",
"Library QC finished": "check2-all",
"Reception Control finished": "check2",
"Library QC Finished": "check2-all",
"Reception Control Finished": "check2",
"Samples Received": "box-seam",
}

STATUS_DESCRIPTIONS = {
"All Raw data Delivered": "The data has been made available through NGIs delivery system.",
"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.",
"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.",
"Pending": "The order has been set up but the samples have not yet been received or registered by NGI.",
}
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"orderer": "[email protected]",
"project_dates": {
"2023-06-15": ["Samples Received"],
"2023-06-28": ["Reception Control finished", "Library QC finished"],
"2023-06-28": ["Reception Control Finished", "Library QC Finished"],
},
"internal_id": "P123456",
"internal_name": "D.Dummysson_23_01",
Expand All @@ -24,9 +24,9 @@
"orderer": "[email protected]",
"project_dates": {
"2023-06-15": ["Samples Received"],
"2023-06-28": ["Reception Control finished", "Library QC finished"],
"2023-06-28": ["Reception Control Finished", "Library QC Finished"],
"2023-07-28": ["All Samples Sequenced"],
"2023-07-29": ["All Raw data Delivered"],
"2023-07-29": ["All Raw Data Delivered"],
},
"internal_id": "P123455",
"internal_name": "D.Dummysson_23_02",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_daily_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_write_report_to_out_dir(data_repo_full, mock_project_data_record, creat

assert op.all_orders[0]["identifier"] == order_id
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV)
assert modified_orders[orderer]["projects"]["Library QC finished"][0] == data_master.data[order_id]
assert modified_orders[orderer]["projects"]["Library QC Finished"][0] == data_master.data[order_id]
pull_date = f"{datetime.datetime.strptime(modified_orders[orderer]['pull_date'], '%Y-%m-%d %H:%M:%S.%f').date()}"
report_path = os.path.join(config_values.REPORTS_LOCATION, f"{orderer.split('@')[0]}_{pull_date}.html")

Expand Down
18 changes: 9 additions & 9 deletions tests/test_order_portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def test_get_and_process_orders_open_upload_fail(data_repo_full, mock_project_da

assert op.all_orders[0]["identifier"] == order_id
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV)
assert modified_orders[orderer]["projects"]["Library QC finished"][0] == data_master.data[order_id]
assert modified_orders[orderer]["projects"]["Library QC Finished"][0] == data_master.data[order_id]
with mock.patch("daily_read.order_portal.requests.post") as mock_post:
mock_post.return_value.status_code = 404
uploaded = op.upload_report_to_order_portal(
"<html>test data</html>", modified_orders[orderer]["projects"]["Library QC finished"][0], "published"
"<html>test data</html>", modified_orders[orderer]["projects"]["Library QC Finished"][0], "published"
)
assert not uploaded
assert f"Report not updated for order with project id: {order_id}\nReason: 404" in caplog.text
Expand All @@ -47,11 +47,11 @@ def test_get_and_process_orders_open_and_upload(data_repo_full, mock_project_dat

assert op.all_orders[0]["identifier"] == order_id
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV)
assert modified_orders[orderer]["projects"]["Library QC finished"][0] == data_master.data[order_id]
assert modified_orders[orderer]["projects"]["Library QC Finished"][0] == data_master.data[order_id]
with mock.patch("daily_read.order_portal.requests.post") as mock_post:
mock_post.return_value.status_code = 200
op.upload_report_to_order_portal(
"<html>test data</html>", modified_orders[orderer]["projects"]["Library QC finished"][0], "published"
"<html>test data</html>", modified_orders[orderer]["projects"]["Library QC Finished"][0], "published"
)
url = f"{config_values.ORDER_PORTAL_URL}/api/v1/report"
indata = dict(
Expand Down Expand Up @@ -86,12 +86,12 @@ def test_get_and_process_orders_open_with_report_and_upload(

assert op.all_orders[3]["identifier"] == order_id
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV)
assert modified_orders[orderer]["projects"]["Library QC finished"][0] == data_master.data[order_id]
assert modified_orders[orderer]["projects"]["Library QC Finished"][0] == data_master.data[order_id]
with mock.patch("daily_read.order_portal.requests.post") as mock_post:
mock_post.return_value.status_code = 200
with caplog.at_level(logging.INFO):
uploaded = op.upload_report_to_order_portal(
"<html>test data</html>", modified_orders[orderer]["projects"]["Library QC finished"][0], "published"
"<html>test data</html>", modified_orders[orderer]["projects"]["Library QC Finished"][0], "published"
)
url = f"{config_values.ORDER_PORTAL_URL}/api/v1/report/{op.all_orders[3]['reports'][0]['iuid']}"
indata = dict(
Expand Down Expand Up @@ -129,11 +129,11 @@ def test_get_and_process_orders_open_to_aborted_with_report_and_upload(
assert op.all_orders[4]["identifier"] == order_id
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV)

assert modified_orders[orderer]["delete_report_for"]["Library QC finished"][0] == data_master.data[order_id]
assert modified_orders[orderer]["delete_report_for"]["Library QC Finished"][0] == data_master.data[order_id]
with mock.patch("daily_read.order_portal.requests.post") as mock_post:
mock_post.return_value.status_code = 200
op.upload_report_to_order_portal(
"", modified_orders[orderer]["delete_report_for"]["Library QC finished"][0], "review"
"", modified_orders[orderer]["delete_report_for"]["Library QC Finished"][0], "review"
)
url = f"{config_values.ORDER_PORTAL_URL}/api/v1/report/{op.all_orders[4]['reports'][0]['iuid']}"
indata = dict(
Expand Down Expand Up @@ -161,7 +161,7 @@ def test_get_and_process_orders_closed(data_repo_full, mock_project_data_record,

assert op.all_orders[1]["identifier"] == order_id
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV)
assert modified_orders[orderer]["delete_report_for"]["All Raw data Delivered"][0] == data_master.data[order_id]
assert modified_orders[orderer]["delete_report_for"]["All Raw Data Delivered"][0] == data_master.data[order_id]


def test_get_and_process_orders_mult_reports(data_repo_full, mock_project_data_record, get_env_file_path):
Expand Down

0 comments on commit a4376ff

Please sign in to comment.