From 4e865ee2b5c2b79c7ffb063e0e162fc637ce117e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 16 Feb 2024 17:58:02 +0100 Subject: [PATCH] feat(code): Warn if findings studies do not match available Since we add the studies that bring findings for the finding tables manually, this ensures that we spot any mistakes when entering them, or similar discrepancies on the other side of the raw data. --- src/model/validity.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/model/validity.py b/src/model/validity.py index d493fb5..f3922d5 100644 --- a/src/model/validity.py +++ b/src/model/validity.py @@ -19,9 +19,15 @@ def _combined_validities( return combined = 0.0 for study in apply_to.split(";"): + if study not in by_intervention["citation"].unique(): + print( + f"WARNING: Findings table {study} study did not match any study in interventions dataframe!" + ) new = by_intervention.loc[by_intervention["citation"] == study, column] - if len(new) > 0 and not math.isnan(new.iat[0]): - combined += new.iat[0] + if len(new) == 0 or math.isnan(new.iat[0]): + continue + combined += new.iat[0] + if combined: return _binned_strength(combined) return r"\-"