From 07f52c207c2c13fc79dd0ba97e243cef470f9fa0 Mon Sep 17 00:00:00 2001 From: signekb Date: Mon, 3 Apr 2023 17:38:08 +0200 Subject: [PATCH] fix: remove unreasonably high or low bmi values --- .../loaders/raw/load_structured_sfi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/psycop_feature_generation/loaders/raw/load_structured_sfi.py b/src/psycop_feature_generation/loaders/raw/load_structured_sfi.py index c7a5a7c9..8ea696cb 100644 --- a/src/psycop_feature_generation/loaders/raw/load_structured_sfi.py +++ b/src/psycop_feature_generation/loaders/raw/load_structured_sfi.py @@ -157,9 +157,13 @@ def weight_in_kg(n_rows: int | None = None) -> pd.DataFrame: @data_loaders.register("bmi") def bmi(n_rows: int | None = None) -> pd.DataFrame: - return sfi_loader( + df = sfi_loader( aktivitetstypenavn="Bestemmelse af Body Mass Index (BMI)", elementledetekst="BMI", n_rows=n_rows, value_col="numelementvaerdi", ) + + df = df[(df["value"] > 10.0) & (df["value"] < 70.0)] + + return df