-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from AI2MS/45-absolute-creatinine-criterion-do…
…es-not-get-calculated-correctly 45 absolute creatinine criterion does not get calculated correctly
- Loading branch information
Showing
21 changed files
with
10,119 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,339 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import numpy as np" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>stay_id</th>\n", | ||
" <th>charttime</th>\n", | ||
" <th>urineoutput</th>\n", | ||
" <th>urineoutput_stage</th>\n", | ||
" <th>creat</th>\n", | ||
" <th>abs_crea_stage</th>\n", | ||
" <th>rel_crea_stage</th>\n", | ||
" <th>weight</th>\n", | ||
" <th>rrt_status</th>\n", | ||
" <th>rrt_stage</th>\n", | ||
" <th>stage</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>30057454.0</td>\n", | ||
" <td>2171-11-07 21:00:00</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>87.2</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2171-11-07 22:00:00</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>87.2</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2171-11-07 23:00:00</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>87.2</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>3</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2171-11-08 00:00:00</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>87.2</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>4</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2171-11-08 01:00:00</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>87.2</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>...</th>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" <td>...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>17939</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2148-01-08 12:00:00</td>\n", | ||
" <td>100.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>120.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>17940</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2148-01-08 13:00:00</td>\n", | ||
" <td>270.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>120.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>17941</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2148-01-08 14:00:00</td>\n", | ||
" <td>120.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>120.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>17942</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2148-01-08 15:00:00</td>\n", | ||
" <td>125.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>120.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>17943</th>\n", | ||
" <td>NaN</td>\n", | ||
" <td>2148-01-08 16:00:00</td>\n", | ||
" <td>250.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>120.0</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>NaN</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"<p>17944 rows × 11 columns</p>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" stay_id charttime urineoutput urineoutput_stage creat \\\n", | ||
"0 30057454.0 2171-11-07 21:00:00 NaN NaN 2.0 \n", | ||
"1 NaN 2171-11-07 22:00:00 NaN NaN 2.0 \n", | ||
"2 NaN 2171-11-07 23:00:00 NaN NaN 2.0 \n", | ||
"3 NaN 2171-11-08 00:00:00 NaN NaN 2.0 \n", | ||
"4 NaN 2171-11-08 01:00:00 NaN NaN 2.0 \n", | ||
"... ... ... ... ... ... \n", | ||
"17939 NaN 2148-01-08 12:00:00 100.0 NaN NaN \n", | ||
"17940 NaN 2148-01-08 13:00:00 270.0 NaN NaN \n", | ||
"17941 NaN 2148-01-08 14:00:00 120.0 NaN NaN \n", | ||
"17942 NaN 2148-01-08 15:00:00 125.0 NaN NaN \n", | ||
"17943 NaN 2148-01-08 16:00:00 250.0 NaN NaN \n", | ||
"\n", | ||
" abs_crea_stage rel_crea_stage weight rrt_status rrt_stage stage \n", | ||
"0 NaN NaN 87.2 NaN NaN NaN \n", | ||
"1 NaN NaN 87.2 NaN NaN NaN \n", | ||
"2 NaN NaN 87.2 NaN NaN NaN \n", | ||
"3 NaN NaN 87.2 NaN NaN NaN \n", | ||
"4 NaN NaN 87.2 NaN NaN NaN \n", | ||
"... ... ... ... ... ... ... \n", | ||
"17939 NaN NaN 120.0 NaN NaN NaN \n", | ||
"17940 NaN NaN 120.0 NaN NaN NaN \n", | ||
"17941 NaN NaN 120.0 NaN NaN NaN \n", | ||
"17942 NaN NaN 120.0 NaN NaN NaN \n", | ||
"17943 NaN NaN 120.0 NaN NaN NaN \n", | ||
"\n", | ||
"[17944 rows x 11 columns]" | ||
] | ||
}, | ||
"execution_count": 7, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"data = pd.read_excel('tests/experiment/data/test_human_aki.xlsx')\n", | ||
"data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"[37267577.0,\n", | ||
" 39268883.0,\n", | ||
" 38540883.0,\n", | ||
" 34592300.0,\n", | ||
" 35009126.0,\n", | ||
" 32314488.0,\n", | ||
" 34617352.0,\n", | ||
" 39635619.0,\n", | ||
" 32391858.0,\n", | ||
" 32119961.0,\n", | ||
" 38383343.0,\n", | ||
" 35514836.0,\n", | ||
" 30849778.0,\n", | ||
" 33281088.0,\n", | ||
" 35258379.0]" | ||
] | ||
}, | ||
"execution_count": 15, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import random\n", | ||
"stay_ids = data.stay_id.unique()\n", | ||
"# select 3 sets of 5 random stays\n", | ||
"random.seed(301)\n", | ||
"random_stay_ids = random.sample(list(stay_ids), 15)\n", | ||
"random_stay_ids" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 16, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"([37267577.0, 39268883.0, 38540883.0, 34592300.0, 35009126.0],\n", | ||
" [32314488.0, 34617352.0, 39635619.0, 32391858.0, 32119961.0],\n", | ||
" [38383343.0, 35514836.0, 30849778.0, 33281088.0, 35258379.0])" | ||
] | ||
}, | ||
"execution_count": 16, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"set_1 = random_stay_ids[:5]\n", | ||
"set_2 = random_stay_ids[5:10]\n", | ||
"set_3 = random_stay_ids[10:15]\n", | ||
"set_1, set_2, set_3" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "pyakienv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.4" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ description_file = README.md | |
long_description_content_type = text/markdown | ||
summary = pyAKI allows calculation of Acute Kidney Injury from urine output and creatinine based on KDIGO criteria. | ||
author = 'Jan Ernsting, Christian Porschen' | ||
author_email = '[email protected], ' | ||
author_email = '[email protected], [email protected]' | ||
url = https://github.com/AI2MS/pyAKI | ||
project_urls= | ||
Source Code = https://github.com/AI2MS/pyAKI | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pyAKI.kdigo | ||
import pandas as pd | ||
|
||
if __name__ == "__main__": | ||
# Load the test data | ||
urine_output = pd.read_csv("tests/data/test_machine_urineoutput.csv") | ||
creatinine = pd.read_csv("tests/data/test_machine_creatinine.csv") | ||
crrt = pd.read_csv("tests/data/test_machine_crrt.csv") | ||
patient_data = pd.read_csv("tests/data/test_machine_weights.csv") | ||
|
||
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, patient_data), | ||
pyAKI.utils.Dataset(pyAKI.utils.DatasetType.CRRT, crrt), | ||
] | ||
) | ||
ana.process_stays().to_csv("tests/data/test_machine_aki.csv") | ||
ana.process_stays().to_excel("tests/data/test_machine_aki.xlsx") |
Oops, something went wrong.