DSA_SS24/notebooks/demographic_plots.ipynb

241 lines
209 KiB
Plaintext
Raw Normal View History

2024-05-08 17:45:29 +02:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt\n",
"import pickle\n",
"import wfdb"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading SB\n",
"Length of SB: 16559\n",
"Reading AFIB\n",
"Length of AFIB: 9839\n",
"Reading GSVT\n",
"Length of GSVT: 948\n",
"Reading SR\n",
"Length of SR: 9720\n"
]
}
],
"source": [
"\n",
"path = \"C:/Studium/dsa/data\"\n",
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\"\n",
"\n",
"categories_dict = {\n",
"'SB': [426177001],\n",
"'AFIB': [164889003, 164890007],\n",
"'GSVT': [426761007, 713422000, 233896004, 233897008, 713422000],\n",
"'SR': [426783006, 427393009]\n",
"}\n",
"\n",
"\n",
"data = {}\n",
"for cat_name in categories_dict.keys():\n",
" print(f\"Reading {cat_name}\")\n",
" with open(f'{path}/{cat_name}.pkl', 'rb') as f:\n",
" records = pickle.load(f)\n",
" data[cat_name] = records\n",
" print(f\"Length of {cat_name}: {len(records)}\")\n",
"\n",
"data_demographic = {'age':[], 'diag':[], 'gender':[]}\n",
"for cat_name, records in data.items():\n",
" for record in records:\n",
" age = record.comments[0].split(' ')[1]\n",
" sex = record.comments[1].split(' ')[1]\n",
" if age == 'NaN' or sex == 'NaN':\n",
" continue\n",
" # cut Age: from alter string \n",
" data_demographic['age'].append(int(age))\n",
" data_demographic['diag'].append(cat_name)\n",
" data_demographic['gender'].append(sex)\n",
"\n",
"df_dgc = pd.DataFrame(data_demographic)\n",
"\n",
"# Change from group to category\n",
2024-05-12 13:31:54 +02:00
"age_categories = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90]\n",
2024-05-08 17:45:29 +02:00
"df_dgc['age_group'] = pd.cut(df_dgc['age'], bins=age_categories)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
2024-05-12 13:31:54 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHHCAYAAACiOWx7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAADKa0lEQVR4nOzdd3hT1RvA8W+SNuledEOhhbKKbBkVZEuBgiDwQ5wMmTJkCIigDJkqAoKIMhVQQRQXexVBhgyZZUPLagt075Hc3x+1gdBCUyy0lPfzPHkg556c+96bJnlzzrknKkVRFIQQQgghxAOpizoAIYQQQogngSRNQgghhBBmkKRJCCGEEMIMkjQJIYQQQphBkiYhhBBCCDNI0iSEEEIIYQZJmoQQQgghzCBJkxBCCCGEGSRpEkIIIYQwgyRNJZCvry89e/Ys1DZ79uyJr69vobZZEj2Kc/+kUqlUTJw4sajDEMVcSEgIKpWKkJCQQm974sSJqFSqQm9XPL0kaTLD8uXLUalUHDp0yKQ8Pj6e+vXrY2VlxaZNm4oousJz48YNJk6cyNGjR4s6lCIXGhrKxIkTCQsLK+pQiqUFCxagUqlo0KCB2Y/Zu3cvEydOJC4u7tEFJkqsnPfhnJuVlRXe3t4EBQXx+eefk5iYWNQhiqeAJE0PKSEhgdatW3P8+HHWrVtHmzZtijqk/+zGjRtMmjQpz6Rp0aJFnD179vEHVURCQ0OZNGlSgZOms2fPsmjRokcTVDGyatUqfH19+fvvv7lw4YJZj9m7dy+TJk2SpEn8J5MnT2bFihV8+eWXDBkyBIBhw4ZRvXp1jh8/blJ3/PjxpKamFkWYooSSpOkhJCYmEhQUxNGjR/npp59o27btf24zOTn5vttSUlL+c/v/laWlJTqdrqjDKJYURTG+Met0OiwtLYs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lSkpKSorJY729vRV3d3dl8ODByueff640btxYAZQlS5aYHIO57wPmvu7ykvMedfnyZZPynGPK+Xu/O3YfHx/lnXfeURYsWKC0aNFCAZQNGzYY66WkpCiVKlVSrKyslNGjRytz5sxR6tatq9SoUSNXmw+K6eDBg3luv3r1qgIoXbt2NZZNmDBBufdjrl69ekrPnj2V2bNnK/PmzVNat26tAMr8+fNN6o0ePVoBlA4dOijz589X+vbtq5QpU0ZxdXU1ef5z4qpdu7bSokULZd68ecrIkSMVjUajdOvWzaTNnHhatWqlzJs3Txk8eLCi0WiUevXqKRkZGYqiKEp6erri5+eneHt7K1OmTFEWL16sTJo0SalXr54SFhZmbKsgrxlznh9hHkmazJDzoihXrpxiaWmp/PLLL3nW69Spk6LVao2JhqIoyo0bNxR7e3ulSZMmudpr3LixkpWVZdJG06ZNFUBZuHChSfmKFSsUtVqt7N6926R84cKFCqD89ddfxrJ739TT0tIUvV5v8rjLly8rOp1OmTx5srHs4MGDuT48ctybNP3yyy8KoEyZMsWkXteuXRWVSqVcuHDBWAYoWq3WpOzYsWMKoMybN89Y5ujoqAwaNCjXvu+Wc36+++47Y9mZM2cUQFGr1SbJ6ebNm3Mdz90fVDn27dunAMYPRUXJTq7u90Zerlw5BVA2bdqU57Z7P1C/+uorBVBWrlyp7N+/X9FoNLkSy7zkPO7EiRMm5QEBAUqLFi2M94cNG6YAJn8biYmJip+fn+Lr62t87nM+8KpWraqkp6cb686dOzfP/eTl0KFDCqBs3bpVUZTs5LlMmTLKO++8k6vu3UmToijKJ598kucHcVhYmKLRaJSpU6ealJ84cUKxsLAwKb/f62PdunUP/EBVFEX56aefFECZM2e
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Correlation matrix\n",
"corr_matrix_age_diag= pd.crosstab(df_dgc['age_group'], df_dgc['diag'])\n",
"\n",
"# Plot the correlation matrix\n",
"sns.heatmap(corr_matrix_age_diag, annot=True, cmap='coolwarm', fmt='d')\n",
"plt.title('Korrelationsmatrix von Altersgruppen und Diagnosen')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Altersgruppe')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiwAAAHHCAYAAACcHAM1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABwNUlEQVR4nO3dd1QUVxsG8GdpS69SBQEFURQ16qexd7Fr1ERjF0tULKix9xZji12xl8QSe4uxt0SJvWBvKDZAKSKI1Pv9QZi4ggrsrrvA8ztnzmHv3Jl5Z7a93DIrE0IIEBEREWkxHU0HQERERPQ5TFiIiIhI6zFhISIiIq3HhIWIiIi0HhMWIiIi0npMWIiIiEjrMWEhIiIirceEhYiIiLQeExYiIiLSekxY1MzNzQ3dunVT6T67desGNzc3le4zP1LHtafsmzhxImQyGV69evXZuup+rmQyGfr376+2/X8JtWvXRu3atdWyb5lMhokTJ6pl30SqkucSlrVr10Imk+HChQsK5a9fv0alSpVgaGiIAwcOaCg61Xn+/DkmTpyIK1euaDoUjbt58yYmTpyIR48eaToUrRMSEoL+/fujePHiMDY2hrGxMby9veHv749r165pOrw858yZM5g4cSJiYmI0HUquubm5QSaTQSaTQUdHB5aWlvDx8UHv3r1x9uxZTYdHlGt6mg5AFWJjY9GwYUNcu3YNO3fuRKNGjTQdktKeP3+OSZMmwc3NDeXKlVNYt2LFCqSlpWkmMA24efMmJk2ahNq1a+eoZenOnTvQ0clzOXm27du3D+3atYOenh46duyIsmXLQkdHB7dv38aOHTuwdOlShISEwNXVVdOh5hlnzpzBpEmT0K1bN1haWmo6nFwrV64chg4dCgB48+YNbt26ha1bt2LFihUYPHgwfvnlF4X6CQkJ0NPLF18H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AGLu3LnSay0uLu6j1/TDuDPUqlVL1KpVS3qck+d75cqVAoCoWrWqWLBggQgICBCWlpaiaNGiCvv8VExNmzb96PoePXoIAOL69esK12fChAnS4+y8N4UQ4unTp8La2lrY2NiISZMmidmzZ4sSJUqIsmXLCgAiJCREIS4vLy9hb28vRo8eLRYtWiTKly8vZDKZQizZfQ8tX75cABBt27YVy5YtE/Pnzxc9evQQAwcOVNiXs7OzcHFxEZMnTxZLly4VLVq0kJ7j3Dw/pDl5NmFxdXUV+vr6YteuXVnWa9WqlTAwMJC+5IUQ4vnz58LMzEzUrFkz0/6qV68uUlJSFPZRq1YtAUAEBgYqlP/6669CR0dH/PXXXwrlgYGBAoA4ffq0VPbhB9q7d+9EamqqwnYhISFCLpeLyZMnS2Xnz58XAMSaNWsynduHCcuuXbsEADF16lSFem3bthUymUzcv39fKgMgDAwMFMquXr0qACh8wFtYWAh/f/9Mx35fxvXZuHGjVHb79m0BQOjo6CgkhgcPHsx0Pm/fvs20z6CgIAFArF+/XirbunWrACAlIu9zdXUVAMSBAweyXPfhl8myZcsEAPHbb7+Jf/75R+jq6mZK6rKSsV1wcLBCube3t6hbt670OCAgQABQeG28efNGuLu7Czc3N+m5z/iALFmypEhMTJTqzp8/P8vjvO/169cCgGjVqlWmddHR0eLly5fS8v41rlevnvDx8RHv3r2TytLS0kTVqlWFp6enVFa2bNlPfuEJIUTNmjWFmZmZePz4sUJ5Wlqa9HdGwuLn56dQ55tvvhE2NjYKZR8+V1OmTBEmJibi7t27CvVGjhwpdHV1RWhoqBBCiGPHjgkACl9SWcWS3df9rFmzMn3RfkpOE5bPPd9JSUnCzs5OlCtXTqFexpezKhKWuXPnCgAK/+h9mLBk9705YMA
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# cut out sex 'unknown' (because only one occurence)\n",
"df_dgc_bineary = df_dgc[df_dgc['gender'] != 'Unknown']\n",
"# Correlation matrix\n",
"corr_matrix_sex_diag = pd.crosstab(df_dgc_bineary['gender'], df_dgc_bineary['diag'])\n",
"\n",
"# Plot the correlation matrix\n",
"sns.heatmap(corr_matrix_sex_diag, annot=True, cmap='coolwarm', fmt='d')\n",
"plt.title('Korrelationsmatrix von Geschlecht und Diagnosen')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Geschlecht')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
2024-05-12 13:31:54 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHbCAYAAABGPtdUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABuZklEQVR4nO3deVhUZfsH8O+wDSICogKigKQm7hooouaKoJG7haXmbhpq7subC25pWi6ZS7lgveFaarmkTCiSiRtFbuWS9GLJUqmgoDAyz+8PL87PcVBZZpg5h+/nuubSec4z59xnZri5Oec8z1EJIQSIiIiISPaszB0AERERERkHCzsiIiIihWBhR0RERKQQLOyIiIiIFIKFHREREZFCsLAjIiIiUggWdkREREQKwcKOiIiISCFY2BEREREpBAs7Ktdq1aqFIUOGmDsMekyHDh3QoUMHc4dhYMuWLVCpVPjjjz/MHYpsDRkyBLVq1dJrU6lUiIyMNEs8RErEwo4Uo+AX79mzZwtd3qFDBzRq1KjU2zl48CB/ESlQy5YtoVKpsG7duiK/Zu3atdiyZYvpgrIgJ06cQGRkJO7cuWPuUIjoGVjYUbl2+fJlbNiwoVivOXjwIObNm2eiiMgcrl69ijNnzqBWrVqIjo4u8uvKW2E3b968UhV2GzZswOXLl40XFBEZYGFH5ZparYatra25wyiW7Oxsc4cgGzqdDg8ePHhuvy+//BJubm746KOPcOLECbOebn348CHy8vLMtv0nGfP7ZmtrC7VabbT1EZEhFnZUrj15jZ1Wq8W8efNQt25d2Nvbo0qVKm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02s+fPy9sbGz02gcPHmzw3XjyO19YHyH+/3v85Gvt7Oykny0hhPjll18EALF69WqprXv37sLBwUH89ddfUtvVq1eFjY1NoT/LRHLGU7GkOGvWrIFGozF4NGnS5LmvdXFxwcWLF3H16tVib/fgwYOwtrbG+PHj9donT54MIQS+++47AJBOE73zzjt6/caNG/fUdY8ePdqgrUKFCtL/Hzx4gH/++QetWrUCAPz0008G/UeMGCH939raGgEBARBCYPjw4VK7i4sL6tWrh+vXrxu8/q233tK7HjEwMBBCCAwbNkyvX2BgIG7cuIGHDx8+dX/Onj2LjIwMjB49GnZ2dlL7kCFD4OzsrNd3165dqF+/Pvz8/PDPP/9Ij06dOgEAjh49qte/ffv2aNCgwVO3/biHDx9ix44dCA8Pl45wdurUCW5ubsUaRPGkXbt24eWXX0blypX1Yg4ODkZ+fj7i4+P1+vft29fg6JGLiwv+/PNPnDlz5qnbCQ8PR0ZGBuLi4qS2r776CjqdDuHh4QCAW7du4ciRI3j99ddx9+5dKZZ///0XoaGhuHr1Kv766y+99Y4cORLW1tZF2tfdu3dDp9Ph9ddf19tXDw8P1K1b1+DzMbbg4GDUrl1bet6kSRM4OTlJ3+H8/Hx8//336NWrFzw9PaV+derUQbdu3UwaG5E58FQsKU7Lli0REBBg0F7wS/ZZ5s+fj549e+LFF19Eo0aN0LVrVwwaNKhIReH//vc/eHp6olKlSnrt9evXl5YX/GtlZQVfX1+9fnXq1Hnqup/sCzz6hT1v3jxs374dGRkZessyMzMN+nt7e+s9d3Z2hr29vXRa7fH2J6/Te9rrAeidNi1o1+l0yMzMlE6FPangvahbt65eu62tLV544QW9tqtXr+LXX3996mmzJ/e9sPfqaWJiYvD333+jZcuWuHbtmtTesWNHbNu2DR988AGsrIr/9+/Vq1dx7ty5UsU8ffp0fP/992jZsiXq1KmDkJAQvPnmm2jTpo3Up2vXrnB2dsaOHTvQuXNnAI9
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 4 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# 4 subplots for each diagnosis a histrgramm for the age\n",
"fig, axs = plt.subplots(2, 2)\n",
"fig.suptitle('Histogramm der Altersverteilung')\n",
"for i, cat_name in enumerate(categories_dict.keys()):\n",
" ax = axs[i // 2, i % 2]\n",
" df_dgc[df_dgc['diag'] == cat_name]['age'].hist(ax=ax)\n",
" ax.set_title(cat_name)\n",
" ax.set_xlabel('Alter')\n",
" ax.set_ylabel('Anzahl')\n",
2024-05-12 13:31:54 +02:00
" # add some space between the subplots\n",
"plt.tight_layout()\n",
2024-05-08 17:45:29 +02:00
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHHCAYAAACiOWx7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABSSUlEQVR4nO3dd1QU1/8+8GfpTapURcQuigVUxF6IoGCPLdi7ASNi+Uii2GPEbqISEwVjMJoYeyegMSo2bMSCiigmCsRCs4DA/f3hj/m6gjoouIs+r3P2HPfeOzPv2VngceburEIIIUBEREREr6Wh6gKIiIiIygKGJiIiIiIZGJqIiIiIZGBoIiIiIpKBoYmIiIhIBoYmIiIiIhkYmoiIiIhkYGgiIiIikoGhiYiIiEgGhiaiEtCmTRvUrVv3jeNu3rwJhUKB8PDwt9pOeHg4FAoFbt68+VbLl7YZM2ZAoVCougwqpkOHDkGhUGDz5s2qLqXUFLw3792798axlStXxuDBg0utFoVCAX9//1JbP5UehiYqU1auXAmFQgE3NzdVl/LBKwhoBQ89PT3Y2dnB09MTy5cvR2ZmpqpLJDWTmJgIf39/1KhRAwYGBjAwMICTkxP8/Pxw4cIFVZdX5hw7dgwzZsxAWlqaqkuh/4+hicqUiIgIVK5cGSdPnsT169dVXc5HYdasWVi/f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15fO3Lzo5UupQ4YMgY6OjvT8TT83AJCRkQHg+T6/rE2bNrC0tJQeK1asAAA8ePAA0dHR6N2
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# a barplot for each category with the age grpuoped besides each other\n",
"fig, ax = plt.subplots()\n",
"sns.countplot(data=df_dgc_bineary, x='diag', hue='gender', ax=ax)\n",
"plt.title('Anzahl der Diagnosen nach Geschlecht')\n",
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Anzahl')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
2024-05-12 13:31:54 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHHCAYAAABeLEexAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABhoUlEQVR4nO3dd1gU1/s28HtpS5PeRIooRsUuRkGiWFA0xBJJNMaCPRrUqIn6JVEsiTGxGxtJRFFjT2wRu4gVGxG7WAJqFNCggJV63j/y7vxcFxRkYdW5P9e118WceWbmPLM7uw+zc2YVQggBIiIiIhnT03UHiIiIiHSNBRERERHJHgsiIiIikj0WRERERCR7LIiIiIhI9lgQERERkeyxICIiIiLZY0FEREREsseCiIiIiGSPBRHJTosWLVC7du2XxiUnJ0OhUCAqKuqVthMVFQWFQoHk5ORXWr6sTZw4EQqFQtfdoBKKjY2FQqHA77//Xi7bUygUmDhxYrlsi0iXWBBRmVm4cCEUCgWaNGmi66689VTFl+phbGwMZ2dnBAYG4qeffsKDBw903UV6Db3KMXrkyBFMnDgRGRkZZdcxIh1gQURlZuXKlahcuTKOHz+Oq1ev6ro7sjB58mSsWLECixYtwrBhwwAAI0aMQJ06dXDmzBm12HHjxuHJkye66Ca9Jl7lGD1y5AgmTZrEgojeOiyIq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ivMao9FgQkVbl5+djzZo1aNmyJZKSknD16lVcvXoVTZo0QVpaGvb
2024-05-08 17:45:29 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# barplot how many diagnosis are in each age group\n",
"fig, ax = plt.subplots()\n",
"sns.countplot(data=df_dgc, x='age_group', hue='diag', ax=ax)\n",
"plt.title('Anzahl der Diagnosen nach Altersgruppen')\n",
"plt.xlabel('Altersgruppe')\n",
"plt.ylabel('Anzahl')\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}