Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aegis301 committed Sep 25, 2023
1 parent 8fa803c commit 2fd5662
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyAKI/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def probe(self, df: pd.DataFrame = None, **kwargs) -> pd.DataFrame:
df = df.copy()
df[self.RESNAME] = 0
df.loc[(df[self._column] - baseline_values) >= 0.3, self.RESNAME] = 1
df.loc[(df[self._column] - baseline_values) >= 4, self.RESNAME] = 3
df.loc[df[self._column] >= 4, self.RESNAME] = 3

df.loc[df[self._column] == 0, self.RESNAME] = None
df[self.RESNAME] = df[self.RESNAME].ffill().fillna(0)
Expand Down
24 changes: 24 additions & 0 deletions test_machine_sec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pyAKI.kdigo
import pandas as pd

if __name__ == "__main__":
# Load the test data
data = pd.read_excel("test_aki_combined_prep.xlsx")

urine_output = data["urineoutput"]
creatinine = data["creat"]
weight = data["weight"]
crrt = data["crrt_status"]
# prep weights
weight = weight.drop_duplicates(subset=["weight"], keep="first")

ana = pyAKI.kdigo.Analyser(
[
pyAKI.utils.Dataset(pyAKI.utils.DatasetType.URINEOUTPUT, urine_output),
pyAKI.utils.Dataset(pyAKI.utils.DatasetType.CREATININE, creatinine),
pyAKI.utils.Dataset(pyAKI.utils.DatasetType.DEMOGRAPHICS, weight),
pyAKI.utils.Dataset(pyAKI.utils.DatasetType.CRRT, crrt),
]
)
ana.process_stays().to_csv("tests/data/test_machine_aki_second.csv")
ana.process_stays().to_excel("tests/data/test_machine_aki_second.xlsx")

0 comments on commit 2fd5662

Please sign in to comment.