2024-05-08 17:45:29 +02:00
{
"cells": [
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Demographic Plots\n",
"This Notebook is used to read the data from the pickle files and to create a dataframe with the demographic data.\n",
"With this data we can create a plots to show the distribution of the demographic data."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-05-29 09:25:12 +02:00
"execution_count": 1,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import seaborn as sns\n",
"import matplotlib.pyplot as plt\n",
2024-05-15 20:20:01 +02:00
"import pickle"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Set path to data\n",
"path = \"C:/Studium/dsa/data\"\n",
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load Data"
2024-05-08 17:45:29 +02:00
]
},
{
"cell_type": "code",
2024-05-29 09:25:12 +02:00
"execution_count": 2,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Reading SB\n",
2024-05-29 09:25:12 +02:00
"Length of SB: 50\n",
2024-05-08 17:45:29 +02:00
"Reading AFIB\n",
2024-05-29 09:25:12 +02:00
"Length of AFIB: 27\n",
2024-05-08 17:45:29 +02:00
"Reading GSVT\n",
2024-05-29 09:25:12 +02:00
"Length of GSVT: 0\n",
2024-05-08 17:45:29 +02:00
"Reading SR\n",
2024-05-29 09:25:12 +02:00
"Length of SR: 13\n"
2024-05-08 17:45:29 +02:00
]
}
],
"source": [
"\n",
2024-05-29 09:25:12 +02:00
"#path = \"C:/Studium/dsa/data\"\n",
2024-05-08 17:45:29 +02:00
"#path = \"C:/Users/Nils/Documents/HS-Mannheim/0000_MASTER/DSA/EKG_Prog/data\"\n",
2024-05-29 09:25:12 +02:00
"path = \"C:/Users/klara/projects/DSA/data\"\n",
2024-05-08 17:45:29 +02:00
"\n",
"categories_dict = {\n",
"'SB': [426177001],\n",
"'AFIB': [164889003, 164890007],\n",
"'GSVT': [426761007, 713422000, 233896004, 233897008, 713422000],\n",
"'SR': [426783006, 427393009]\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)"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot Data"
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
2024-05-29 09:25:12 +02:00
"execution_count": 3,
2024-05-08 17:45:29 +02:00
"metadata": {},
"outputs": [
{
"data": {
2024-05-29 09:25:12 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhIAAAHHCAYAAADqJrG+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABqhklEQVR4nO3dd1hT59sH8G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qKkr4+/uLGzduKOvS5D2jzt/H0OlNIuHp6SlMTU3FunXr8j2uTZs2wszMTPnlK4QQ9+7dEzY2NuLjjz/OU1+DBg1Edna2Sh0NGzYUAMS8efNUypctWyaMjIzEP//8o1I+b948AUAcPHhQWfbmB92LFy9ETk6Oyv0SEhKEXC4X48ePV5YdP348zwdqrjcTiXXr1gkAYsKECSrHdejQQchkMnHt2jVlGQBhZmamUnbmzBkBQMyaNUtZZmdnJwYMGJDn3K/LfX7++OMPZdmlS5cEAGFkZKSSsG3fvj3P43n9wzvX4cOHBQDlF4UQrxKOgj7cPD09BQCxbdu2fPe9+SUzf/58AUD89ttv4siRI8LY2DhPspWf3PudO3dOpdzHx0c0atRIeXvIkCECgMprIz09XZQtW1Z4eXkp//a5XwJVqlQRmZmZymN/+umnfM+TnxMnTggAYufOnUKIVwllqVKlxODBg/Mc+3oiIYQQU6ZMyffL6caNG8LY2FhMnDhRpfzcuXPCxMREpbyg98fatWv/80tGCCFWr14tAIgZM2Yoy3JycpQfqm8mEgDEyJEj89SjaSJRsmRJlWR21apVAoD46aef8jyuqVO
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",
2024-05-15 20:20:01 +02:00
"plt.title('Korrelationsmatrix von Altersgruppen und Diagnosen', fontsize=16)\n",
2024-05-08 17:45:29 +02:00
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Altersgruppe')\n",
"plt.show()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Correlation matrix of age groups and diagnoses.This matrix describes the four diagnosis groupings on the horizontal axis and the age groupings in decades steps on the vertical axis. The color scale blue (low) to red (high) describes the correlation of the two categorization types."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "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qJbt26iVq1awtDQUDRo0ECpfl7PV9r7cN26dRmWLVmyRDpnlStXFp07dxZ169aV3tezZs3KsE5kZKSoW7euACD09PREgwYNRPfu3UWjRo1EkSJFMrxP0/Y/cuRIYWZmJpycnETXrl2Fh4eH9Jls37690jpjx44VderUEQBEiRIllD478+bNy/qFS6dBgwYCgDhx4kSmy7O6pqaV+/j4CAcHB2FjYyM6duwoWrZsKczNzQUAUb169QzXaCGEGDFihAAg5HK5qF+/vvDy8hJly5YVcrlcjBw5UgDI8Lp+TNprm9VxpImIiBAymUwAEFu2bFFaltW1PLfXtTRbtmyR3jcVKlQQ3bt3F/Xr1xdyuVxMmDAhy+tVWvn06dOFTCYTderUEd26dROVKlUSAIRMJsv0s/vo0SPpGIoUKSI6deok2rZtK0xNTQUAUbVqVREeHq60zvr164VMJhMymUzUqFFDdOvWTbRt21ZUrVpV6OjoiJEjR2bYz9ixY6XX76uvvhJdunQRNWrUEDKZTOjo6Ii1a9eq7Zg+pTwnUq1atRK6uroCgPjhhx+yXWflypUCgChcuLC4du2aVJ6SkiJ9iCwsLMTr168z3ZeOjo74888/Mz+Af0+qmZmZOH/+fIblr169EoUKFRIymUysWLFCJCcnS8vevHkjGjdunOkFLKsPfVRUlPjzzz9FfHy8UnlCQoKYNGmSACBatmyZIY7sLq4fHu+HH75u3boJAKJGjRrizZs3Uvm7d+9EixYtBABRu3ZtpXXSEqm0ZOrevXvSsqSkJOHj4yMlken169dPABBz5szJEF9sbKw4deqUUllaYgJAtGnTRsTExEjLrly5InR1dYVcLhdly5YVgwc
2024-05-08 17:45:29 +02:00
"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",
2024-05-15 20:20:01 +02:00
"plt.title('Korrelationsmatrix von Geschlecht und Diagnosen', fontsize=16)\n",
2024-05-08 17:45:29 +02:00
"plt.xlabel('Diagnose')\n",
"plt.ylabel('Geschlecht')\n",
"plt.show()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Correlation matrix of genders and diagnoses. This matrix describes the four diagnosis groupings on the horizontal axis and the gender in decades steps on the vertical axis. The color scale blue (low) to red (high) describes the correlation of the two categorization types."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
2024-05-15 20:20:01 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHbCAYAAACtCWxXAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABxa0lEQVR4nO3deVxU5fs//tewzAAh4MambKmBuCIqomYuCBruWGqohJRvDS3T1CxzzTAzl8y0EqHeuX/fWoqmEopk4kbimlpKYcmSKwoKI3P//vDH+TiyDTDDLLyej8c8au77nnOuwwyXF+fc5x6ZEEKAiIiIiIyamb4DICIiIqKaY1FHREREZAJY1BERERGZABZ1RERERCaARR0RERGRCWBRR0RERGQCWNQRERERmQAWdUREREQmgEUdERERkQlgUUdl8vT0hEwmQ3x8fIXjevbsCZlMhnnz5qm1JycnQyaToWfPnjqLkYzXq6++qtHnS1+WLVsGmUwGmUyGVatWVTiWn3XjEh8fD5lMhldffVWt/c8//4RMJoOnp6de4iLSBhZ1ZNDKS8BEuhQbGyv9//r166u9nZLCkKqu5A/G5ORkfYdCZDQs9B0AmabOnTvjt99+g42Njb5DIaqSo0eP4sKFC3BwcIBSqUR6ejp+/fVXdOjQQd+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IMHz5cABDPP/+82j+qN2/eFAEBAVI8T3++vvrqK2l/p0+fVus7dOiQqFevnpDL5eLy5ctqfZq8J5ro2rWrACBWrFghtcXExAgAonfv3mW+przP+pNxlefMmTNCoVAIKysr8b///U+t788//xRt2rQRAMQ333yj1lfyewdArF69utR2//rrLwFANG3aVGRlZZXqv3Dhgvjrr7+k54mJiVJRWZaVK1cKACIsLEyt/b333pN+965evarWt23bNmFubi7q168vbt++LbU/+Tlv2rSpuHTpUpn7LDnGgwcPltlfUFAgFT6zZ88WhYWFUl9+fr5UqD5dFOujqLO0tBS7du0qMw57e3tRUFCg1jd06FABQPTs2VPcvXtXar99+7bo3r17ub8/RCzqqEwlyUjTh6ZFna+vrwAgbt26pVEclRV1f/31lzAzMxMymaxUESCEEH///bd0FuSXX36R2hcsWCAAiMDAwDK3+84771Ra1C1YsECjY3javn37BADx0ksvqbU/+Y/d7t27S71u2bJlAoCQyWRlFoyTJ08WAMT8+fPV2kuKOnd3d/HgwYNSr2vbtq0AIDp37lzq7KFSqRQNGjQQANSKgIpkZmZK78n58+dL9Z86darMf5SKi4uFq6urACBOnjxZ5raXLFkiAIhp06aptdf0PRFCiN9++00AKHU26vr168Lc3FzIZLJShYsQNSvqSv4gWbp0aZn9x48fFwCEv7+/WntJwVNeoVnyukGDBpW77yepVCrpd/7IkSOl+kvOhCckJEhtN2/eFNbW1sLKykr8/fffZW73jTfeEADEqlWrpLYnP+fffvttuTFVVtStWbNGABADBgwos//evXvC0dFRWFhYqOUbfRR1U6dOLfN1Pj4+AoBISUmR2v78808hk8mEmZmZ+O2330q95uzZs0Imk7GoozJxTh1VqFu3boiIiCj34eTkVKXtde7cGQAQHh6Ow4cP49GjRzWKLyUlBSqVCn5+fmjbtm2p/iZNmiAkJAQAcPDgQam9ZL5OeHh4mdstr/1Jw4cPr7C/sLAQu3btwpw5czBhwgRERkbi1VdfxZdffgkAuHTpUpmvs7CwQHBwcKn2Fi1aAADc3d3RunXrcvuvX79e5nZ79eoFKyurcl/Xv3//UnMILSwspLlE5W33aSXvSYcOHeDr61uqv3379mW+V6d
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",
2024-05-15 20:20:01 +02:00
"fig.suptitle('Histogramm der Altersverteilung', fontsize=16)\n",
2024-05-08 17:45:29 +02:00
"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()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Histogram of the age distribution. Breakdown of grouped diagnoses by age group and absolute incidence of diagnoses."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAk0AAAHHCAYAAACiOWx7AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABSSUlEQVR4nO3dd1QU1/8+8GfpTapURcQuigVUxF6IoGCPLdi7ASNi+Uii2GPEbqISEwVjMJoYeyegMSo2bMSCiigmCsRCs4DA/f3hj/m6gjoouIs+r3P2HPfeOzPv2VngceburEIIIUBEREREr6Wh6gKIiIiIygKGJiIiIiIZGJqIiIiIZGBoIiIiIpKBoYmIiIhIBoYmIiIiIhkYmoiIiIhkYGgiIiIikoGhiYiIiEgGhiaiEtCmTRvUr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KbpaVloctpkZGRSEtLQ79+/XDv3j3poampCTc3Nxw8eLDQuseMGVPsel7FyMjojZ+ie/E1TE9Px71799C6dWvcuHFDuvwVFRWF3NxcfP7550rLFkw8L8rIkSOVLgW2bNkSeXl50mTjP/74Azk5OQgICFCaSzNixAgYGxtj9+7dACCdSdq/f/8rL9Ns2bIF+fn56N27t9LrbGNjg+rVqxd6nd/1veDh4YGqVatKz+vVqwdjY2Ol5V98XZ89e4b79++jWrVqMDU1xZkzZ6S+33//HfXr15fO3Lzo5UupQ4YMgY6OjvT8TT83AJCRkQHg+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()"
]
},
2024-05-15 20:20:01 +02:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Barplot to visualize the distribution of diagnoses by gender. Where blue is female and orange is male."
]
},
2024-05-08 17:45:29 +02:00
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
2024-05-12 13:31:54 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHHCAYAAABeLEexAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8qNh9FAAAACXBIWXMAAA9hAAAPYQGoP6dpAABhoUlEQVR4nO3dd1gU1/s28HtpS5PeRIooRsUuRkGiWFA0xBJJNMaCPRrUqIn6JVEsiTGxGxtJRFFjT2wRu4gVGxG7WAJqFNCggJV63j/y7vxcFxRkYdW5P9e118WceWbmPLM7uw+zc2YVQggBIi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Lf3x9///239JXU3r17kZeXh88//1xtWdVF3IUZNGiQ2tdzzZo1Q35+Pq5fvw4A2LNnD3JycjBixAjo6f3f29LAgQNhYWGB6OhoAJDOAO3cubPIa042bNiAgoICdO3aVW0/Ozk5oVq1ahr7ubSvhYCAAFStWlWarlu3LiwsLNSWf3a/5ubmIj09HZ6enrCyssJff/0lzfvjjz9Qr149fPjhhxrbef7rzb59+8LIyEiaftlx86ySHqPFUdL9rlQq0bdvX7U21RmkrVu3Ijc3t9Dt7NixA4aGhmpnOvX09NTOYD5PG8dR7969UaFCBWn6o48+QsWKFbFt2za1OAMDA3z22WfStJGRET777DPcuXMH8fHxAID169ejZs2aqFGjhtq+atWqFQBo7KvivMao9FgQkVbl5+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()"
]
2024-05-15 20:20:01 +02:00
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Barplot to show the distribution of diagnoses based on the age groupings. The difference in the incidence of the various diseases can be clearly seen here."
]
2024-05-08 17:45:29 +02:00
}
],
"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",
2024-05-29 09:25:12 +02:00
"version": "3.11.9"
2024-05-08 17:45:29 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 2
}