<jupyter_start><jupyter_text>AmsterdamUMCdb - Freely Accessible ICU Databaseversion 1.0.2 March 2020  Copyright &copy; 2003-2020 Amsterdam UMC - Amsterdam Medical Data Science  Sequential Organ Failure Assessment (SOFA)The sequential organ failure assessment score (SOFA score), originally published as as the Sepsis-related Organ Failure Assessment score ([Vincent et al., 1996](http://link.springer.com/10.1007/BF01709751)), is a disease severity score designed to track the severity of critical ilness throughout the ICU stay. In contrast to APACHE (II/IV), which only calculates a score for the first 24 hours, it can be used sequentially for every following day. The code performs some data cleanup and calculates the SOFA score for the first 24 hours of ICU admission for all patients in the database.**Note**: Requires creating the [dictionaries](../../dictionaries/create_dictionaries.ipynb) before running this notebook.  Imports<jupyter_code>%matplotlib inline
import amsterdamumcdb
import psycopg2
import pandas as pd
import numpy as np
import re

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib as mpl

import io
from IPython.display import display, HTML, Markdown
sofa = pd.read_csv('sofa/sofa.csv')
oxy_flow = pd.read_csv("sofa/oxy_flow.csv" )
sofa_respiration = pd.read_csv("sofa/sofa_respiration.csv" )
sofa_platelets = pd.read_csv("sofa/sofa_platelets.csv" )
sofa_bilirubin = pd.read_csv("sofa/sofa_bilirubin.csv" )
sofa_cardiovascular = pd.read_csv("sofa/sofa_cardiovascular.csv" )
mean_abp = pd.read_csv("sofa/mean_abp.csv" )
sofa_cardiovascular_map = pd.read_csv("sofa/sofa_cardiovascular_map.csv" )
gcs = pd.read_csv("sofa/gcs.csv" )
sofa_cns = pd.read_csv("sofa/sofa_cns.csv" )
sofa_renal_urine_output = pd.read_csv("sofa/sofa_renal_urine_output.csv" )
sofa_renal_daily_urine_output = pd.read_csv("sofa/sofa_renal_daily_urine_output.csv" )
creatinine = pd.read_csv("sofa/creatinine.csv" )
sofa_renal_creatinine = pd.read_csv("sofa/sofa_renal_creatinine.csv" )
sofa_renal = pd.read_csv("sofa/sofa_renal.csv" )
'''

bloc,icustayid,charttime,gender,age,elixhauser,re_admission,died_in_hosp,died_within_48h_of_out_time,
mortality_90d,delay_end_of_record_and_discharge_or_death,

Weight_kg,GCS,HR,SysBP,MeanBP,DiaBP,RR,SpO2,Temp_C,FiO2_1,Potassium,Sodium,Chloride,Glucose,
BUN,Creatinine,Magnesium,Calcium,Ionised_Ca,CO2_mEqL,SGOT,SGPT,Total_bili,Albumin,Hb,WBC_count,
Platelets_count,PTT,PT,INR,Arterial_pH,paO2,paCO2,Arterial_BE,Arterial_lactate,HCO3,mechvent,
Shock_Index,PaO2_FiO2,median_dose_vaso,max_dose_vaso,input_total,
input_4hourly,output_total,output_4hourly,cumulated_balance,SOFA,SIRS

'''<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09513192121887774, 'fraction_numerical': 0.019695280564845784, 'mean_word_length': 7.7973856209150325, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '4429', 'license': 'MIT', 'n_tokens_mistral': 1074, 'n_tokens_neox': 989, 'n_words': 191, 'path': 'sepsis/extract_data.ipynb', 'repo_name': 'yinchangchang/AmsterdamUMCdb', 'size': '2691'}