Skip to content

Commit

Permalink
Rerun notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKlug committed Jun 4, 2024
1 parent 29ebf34 commit ee85170
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 149 deletions.
160 changes: 146 additions & 14 deletions data_visualisation/denormalized_preprocessed_nihss_visualisation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T12:59:45.542016Z",
"start_time": "2024-06-04T12:59:45.531495Z"
}
},
"outputs": [],
"source": [
"import pandas as pd\n",
Expand All @@ -25,18 +30,29 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:06:22.673404Z",
"start_time": "2024-06-04T13:06:22.670729Z"
}
},
"outputs": [],
"source": [
"preprocessed_features_path = '/Users/jk1/temp/mimic/preprocessing/test/mimic_prepro_29122022_173530/preprocessed_features_29122022_173530.csv'\n",
"admission_notes_data_path = '/Users/jk1/OneDrive - unige.ch/stroke_research/geneva_stroke_unit_dataset/data/mimic_data/combined_notes_labels.xlsx'\n",
"normalisation_params_path = '/Users/jk1/temp/mimic/preprocessing/test/mimic_prepro_29122022_163718/logs_29122022_163718/reference_population_normalisation_parameters.csv'"
"preprocessed_features_path = '/Users/jk1/temp/opsum_mimic/preprocessing/mimic_prepro_25012023_232713/preprocessed_features_25012023_232713.csv'\n",
"admission_notes_data_path = '/Users/jk1/Library/CloudStorage/OneDrive-unige.ch/stroke_research/geneva_stroke_unit_dataset/data/mimic_data/combined_notes_labels_v2.xlsx'\n",
"normalisation_params_path = '/Users/jk1/temp/opsum_mimic/preprocessing/mimic_prepro_25012023_232713/logs_25012023_232713/reference_population_normalisation_parameters.csv'\n",
"monitoring_df_path = '/Users/jk1/temp/opsum_mimic/extraction/monitoring_df.csv'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:46.966985Z",
"start_time": "2024-06-04T13:02:45.994751Z"
}
},
"outputs": [],
"source": [
"preprocessed_features_df = pd.read_csv(preprocessed_features_path)\n",
Expand All @@ -46,16 +62,27 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:06:38.421307Z",
"start_time": "2024-06-04T13:06:32.048822Z"
}
},
"outputs": [],
"source": [
"admission_notes_data_df = pd.read_excel(admission_notes_data_path)"
"admission_notes_data_df = pd.read_excel(admission_notes_data_path)\n",
"monitoring_df = pd.read_csv(monitoring_df_path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:48.936093Z",
"start_time": "2024-06-04T13:02:48.931422Z"
}
},
"outputs": [],
"source": [
"def reverse_normalisation_for_subj(norm_subj_df, normalisation_parameters_df):\n",
Expand All @@ -76,7 +103,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:49.830315Z",
"start_time": "2024-06-04T13:02:49.819538Z"
}
},
"outputs": [],
"source": [
"preprocessed_features_df.head()"
Expand All @@ -85,7 +117,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:50.791252Z",
"start_time": "2024-06-04T13:02:50.706681Z"
}
},
"outputs": [],
"source": [
"pa_id = np.random.choice(preprocessed_features_df['case_admission_id'].unique())\n",
Expand All @@ -95,7 +132,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:51.567514Z",
"start_time": "2024-06-04T13:02:51.543597Z"
}
},
"outputs": [],
"source": [
"admission_notes_data_df['case_admission_id'] = admission_notes_data_df.hadm_id.astype(str) + '_' + admission_notes_data_df.icustay_id.astype(str)\n",
Expand All @@ -105,7 +147,78 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:06:40.065189Z",
"start_time": "2024-06-04T13:06:39.856481Z"
}
},
"outputs": [],
"source": [
"NIHSS_labels = [\"Level of Consciousness\",\n",
" \"Level of Conscious\",\n",
" \"Richmond-RAS Scale\",\n",
" \"Riker-SAS Scale\",\n",
" \"GCS Total\",\n",
" \"Ramsey SedationScale\",\n",
" \"PAR-Consciousness\",\n",
" \"Orientation\",\n",
" \"Orientation to Place\",\n",
" \"Orientation to Time\",\n",
" \"Orient/Clouding Sensory\",\n",
" \"Follows Commands\",\n",
" \"Commands Response\",\n",
" \"Visual Field Cut\",\n",
" \"Facial Droop\",\n",
" \"Face Droop\",\n",
" \"RU Strength/Movement\",\n",
" \"Strength R Arm\",\n",
" \"LU Strength/Movement\",\n",
" \"Strength L Arm\",\n",
" \"RL Strength/Movement\",\n",
" \"Strength R Leg\",\n",
" \"LL Strength/Movement\",\n",
" \"Strength L Leg\",\n",
" \"Ataxia\",\n",
" \"LUE Sensation\",\n",
" \"LLE Sensation\",\n",
" \"LLE [Sensation]\",\n",
" \"LUE [Sensation]\",\n",
" \"RUE Sensation\",\n",
" \"RLE Sensation\",\n",
" \"RLE [Sensation]\",\n",
" \"RUE [Sensation]\",\n",
" \"Braden Sensory Perception\",\n",
" \"Braden SensoryPercep\",\n",
" \"Speech\",\n",
" \"Slurred Speech\"]\n",
"\n",
"NIHSS_df = monitoring_df[monitoring_df.label.isin(NIHSS_labels)]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:06:46.024867Z",
"start_time": "2024-06-04T13:06:46.013906Z"
}
},
"outputs": [],
"source": [
"NIHSS_df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:52.444358Z",
"start_time": "2024-06-04T13:02:52.441817Z"
}
},
"outputs": [],
"source": [
"pa_id = '120793_201738'"
Expand All @@ -114,7 +227,26 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:07:45.864657Z",
"start_time": "2024-06-04T13:07:45.841391Z"
}
},
"outputs": [],
"source": [
"NIHSS_df[NIHSS_df.hadm_id == int(pa_id.split('_')[0])].sort_values('charttime')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-04T13:02:53.558450Z",
"start_time": "2024-06-04T13:02:53.062735Z"
}
},
"outputs": [],
"source": [
"vital_name = 'median_NIHSS'\n",
Expand Down
Loading

0 comments on commit ee85170

Please sign in to comment.