diff --git a/data-serving/reusable-data-service/data_service/day_zero_fields.json b/data-serving/reusable-data-service/data_service/day_zero_fields.json index d5ae2cbc4..20e95d6bf 100644 --- a/data-serving/reusable-data-service/data_service/day_zero_fields.json +++ b/data-serving/reusable-data-service/data_service/day_zero_fields.json @@ -18,6 +18,17 @@ "omit_error" ] }, + { + "key": "pathogenStatus", + "type": "string", + "data_dictionary_text": "Whether the infection occured in an endemic, or non-endemic region.", + "required": "true", + "values": [ + "endemic", + "emerging", + "unknown" + ] + }, { "key": "confirmationDate", "type": "date", diff --git a/data-serving/reusable-data-service/tests/data/case.excluded.json b/data-serving/reusable-data-service/tests/data/case.excluded.json index f9be1e501..bf54aba34 100644 --- a/data-serving/reusable-data-service/tests/data/case.excluded.json +++ b/data-serving/reusable-data-service/tests/data/case.excluded.json @@ -7,5 +7,6 @@ "date": "2022-06-01T01:23:45.678Z", "note": "Excluded upon this day, for reasons" }, - "caseStatus": "omit_error" + "caseStatus": "omit_error", + "pathogenStatus": "endemic" } \ No newline at end of file diff --git a/data-serving/reusable-data-service/tests/data/case.minimal.json b/data-serving/reusable-data-service/tests/data/case.minimal.json index 8fd3ef798..1c21bfbb0 100644 --- a/data-serving/reusable-data-service/tests/data/case.minimal.json +++ b/data-serving/reusable-data-service/tests/data/case.minimal.json @@ -3,5 +3,6 @@ "caseReference": { "sourceId": "fedc09876543210987654321" }, - "caseStatus": "probable" + "caseStatus": "probable", + "pathogenStatus": "emerging" } \ No newline at end of file diff --git a/data-serving/reusable-data-service/tests/data/case.with_location.json b/data-serving/reusable-data-service/tests/data/case.with_location.json index f1a629bda..7f9dbcfe5 100644 --- a/data-serving/reusable-data-service/tests/data/case.with_location.json +++ b/data-serving/reusable-data-service/tests/data/case.with_location.json @@ -16,5 +16,6 @@ "country": "IND" } }, - "caseStatus": "probable" + "caseStatus": "probable", + "pathogenStatus": "unknown" } \ No newline at end of file diff --git a/data-serving/reusable-data-service/tests/test_case_model.py b/data-serving/reusable-data-service/tests/test_case_model.py index 822ec29f1..f17a20605 100644 --- a/data-serving/reusable-data-service/tests/test_case_model.py +++ b/data-serving/reusable-data-service/tests/test_case_model.py @@ -31,7 +31,7 @@ def test_csv_header(): header_line = Case.csv_header() assert ( header_line - == "_id,caseStatus,confirmationDate,caseReference.sourceId,location.country,location.latitude,location.longitude,location.admin1,location.admin2,location.admin3\r\n" + == "_id,caseStatus,pathogenStatus,confirmationDate,caseReference.sourceId,location.country,location.latitude,location.longitude,location.admin1,location.admin2,location.admin3\r\n" ) @@ -44,8 +44,9 @@ def test_csv_row_with_no_id(): case.confirmationDate = date(2022, 6, 13) case.caseReference = ref case.caseStatus = "probable" + case.pathogenStatus = "emerging" csv = case.to_csv() - assert csv == ",probable,2022-06-13,abcd12903478565647382910,,,,,,\r\n" + assert csv == ",probable,emerging,2022-06-13,abcd12903478565647382910,,,,,,\r\n" def test_csv_row_with_id(): @@ -59,8 +60,9 @@ def test_csv_row_with_id(): case.confirmationDate = date(2022, 6, 13) case.caseReference = ref case.caseStatus = "probable" + case.pathogenStatus = "unknown" csv = case.to_csv() - assert csv == f"{id1},probable,2022-06-13,{id2},,,,,,\r\n" + assert csv == f"{id1},probable,unknown,2022-06-13,{id2},,,,,,\r\n" def test_apply_update_to_case():