Skip to content

Commit

Permalink
minor fixes after feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-B98 committed Nov 16, 2023
1 parent c2384af commit 36266be
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 0 additions & 2 deletions pyAKI/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ def probe(
# fmt: off
df.loc[:, self.RESNAME] = np.nan # set all urineoutput_stage values to NaN
df.loc[df.rolling(6).min()[self._column] >= 0, self.RESNAME] = 0
for ix in range(5):
df.loc[df.index.values[ix], self.RESNAME] = np.nan if np.isnan(df.rolling(ix + 1).min()[self._column].iloc[ix]) else 0

if self._method == UrineOutputMethod.STRICT:
df.loc[(df.rolling(6).max()[self._column] / weight) < 0.5, self.RESNAME] = 1
Expand Down
10 changes: 5 additions & 5 deletions test/data/validation_data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1456,11 +1456,11 @@ stay_id,charttime,urineoutput,urineoutput_stage,creat,abs_creatinine_stage,rel_c
35258379,2153-09-21 10:00:00,250.0,0.0,,,,71.1,0.0,0.0,0.0,
35258379,2153-09-21 11:00:00,120.0,0.0,,,,71.1,0.0,0.0,0.0,
35258379,2153-09-21 12:00:00,60.0,0.0,,,,71.1,0.0,0.0,0.0,
35514836,2154-01-02 16:00:00,200.0,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 17:00:00,45.0,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 18:00:00,45.0,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 19:00:00,37.5,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 20:00:00,37.5,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 16:00:00,200.0,,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 17:00:00,45.0,,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 18:00:00,45.0,,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 19:00:00,37.5,,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 20:00:00,37.5,,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 21:00:00,35.0,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 22:00:00,50.0,0.0,,,,80.2,0.0,0.0,0.0,
35514836,2154-01-02 23:00:00,30.0,1.0,,,,80.2,0.0,0.0,1.0,
Expand Down
18 changes: 9 additions & 9 deletions test/probes/test_urineoutput_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_anuria(self):
pd.testing.assert_series_equal(
df["urineoutput_stage"],
pd.Series(
data=[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 3],
data=[np.nan, np.nan, np.nan, np.nan, np.nan, 1, 1, 1, 1, 1, 1, 3],
name="urineoutput_stage",
index=pd.DatetimeIndex(
data=[
Expand Down Expand Up @@ -118,11 +118,11 @@ def test_aki(self):
df["urineoutput_stage"],
pd.Series(
data=[
0,
0,
0,
0,
0,
np.nan,
np.nan,
np.nan,
np.nan,
np.nan,
1,
1,
1,
Expand Down Expand Up @@ -222,7 +222,7 @@ def test_aki_strict(self):
pd.testing.assert_series_equal(
df["urineoutput_stage"],
pd.Series(
data=[0] * 6 + [1] * 6 + [2] * 12 + [3],
data=[np.nan] * 5 + [0] + [1] * 6 + [2] * 12 + [3],
name="urineoutput_stage",
index=pd.period_range(
start="2023-01-01 00:00:00", end="2023-01-02 00:00:00", freq="h"
Expand Down Expand Up @@ -259,7 +259,7 @@ def test_nan_values(self):
pd.testing.assert_series_equal(
df_mean["urineoutput_stage"],
pd.Series(
data=[0] * 6 + [np.nan] * 11 + [0],
data=[np.nan] * 5 + [0] + [np.nan] * 11 + [0],
name="urineoutput_stage",
index=pd.period_range(
start="2023-01-01 00:00:00", end="2023-01-01 17:00:00", freq="h"
Expand All @@ -272,7 +272,7 @@ def test_nan_values(self):
pd.testing.assert_series_equal(
df_strict["urineoutput_stage"],
pd.Series(
data=[0] * 6 + [np.nan] * 11 + [0],
data=[np.nan] * 5 + [0] + [np.nan] * 11 + [0],
name="urineoutput_stage",
index=pd.period_range(
start="2023-01-01 00:00:00", end="2023-01-01 17:00:00", freq="h"
Expand Down

0 comments on commit 36266be

Please sign in to comment.