Repository: Sage-Bionetworks/Genie

Issue:
Modify check for DEAD variable in clinical file
if DEAD is False, then YEAR_DEATH and INT_DOD must be ‘Not Applicable’
https://www.synapse.org/#!Synapse:syn3380222/wiki/412290

Discussion:

Patch:
diff --git a/genie_registry/clinical.py b/genie_registry/clinical.py
index 90fca60..7739b2e 100644
--- a/genie_registry/clinical.py
+++ b/genie_registry/clinical.py
@@ -95,10 +95,10 @@ def _check_int_dead_consistency(clinicaldf: DataFrame) -> str:
     # Check that all string values are equal each other
     is_equal = all(clinicaldf.loc[is_str, "DEAD"] == clinicaldf.loc[is_str, "INT_DOD"])
     # If dead, int column can't be Not Applicable
-    # If alive, int column can't have values
+    # If alive, int column must be Not Applicable
     if (
         any(clinicaldf.loc[is_dead, "INT_DOD"] == "Not Applicable")
-        or not all(clinicaldf.loc[is_alive, "INT_DOD"].isin(allowed_str))
+        or not all(clinicaldf.loc[is_alive, "INT_DOD"] == "Not Applicable")
         or not is_equal
     ):
         return (


Test patch:
diff --git a/tests/test_clinical.py b/tests/test_clinical.py
index 8668f71..18937f2 100644
--- a/tests/test_clinical.py
+++ b/tests/test_clinical.py
@@ -804,8 +804,8 @@ def test__check_int_year_consistency_inconsistent(inconsistent_df,
              "DEAD": [True, False]}
         ),
         pd.DataFrame(
-            {"INT_DOD": [1111, "Not Released"],
-             "DEAD": [True, False]}
+            {"INT_DOD": ["Not Applicable", "Not Applicable"],
+             "DEAD": [False, False]}
         )
     ]
 )
@@ -824,6 +824,10 @@ def test__check_int_dead_consistency_valid(valid_df):
             {"INT_DOD": ["Not Applicable", "Not Applicable"],
              "DEAD": [True, False]}
         ),
+        pd.DataFrame(
+            {"INT_DOD": [1111, "Not Released"],
+             "DEAD": [True, False]}
+        ),
         pd.DataFrame(
             {"INT_DOD": [1111, 11111],
              "DEAD": [True, False]}