{ "cells": [ { "cell_type": "markdown", "id": "9dffd99f-e5e4-4655-971f-ac701cd93c54", "metadata": {}, "source": [ "# Plotting thrombolysis rate by feature value for low and high thrombolysing hopsitals\n", "\n", "## Plain English summary\n", "\n", "This experiment plots the relationships between feature values and thrombolysis use for low and high thrombolysing hospitals. The high and low thrombolysing hopsitals are taken as the top and bottom 30 hospitals as ranked by the predicted thrombolysis use in the same 10k cohort of patients. We also call the top 30 thrombolysing hospitals 'benchmark' hospitals.\n", "\n", "We find that thrombolysis use in low thrombolysing hospitals follows the same general relationship with feature values as the high thrombolysing hospitals, but thrombolysis is consistently lower.\n", "\n", "## Aims\n", "\n", "* Plots the relationships between feature values and thrombolysis use for low and high thrombolysing hospitals\n", "\n", "## Observations\n", "\n", "* Thrombolysis use in low thrombolysing hospitals follows the same general relationship with feature values as the high thrombolysing hospitals, but thrombolysis is consistently lower." ] }, { "cell_type": "code", "execution_count": 1, "id": "876983b4-d86f-4e16-adfa-2f411f4ffdcd", "metadata": {}, "outputs": [], "source": [ "# Turn warnings off to keep notebook tidy\n", "import warnings\n", "warnings.filterwarnings(\"ignore\")\n", "\n", "import json\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "8714f148-386b-4255-962a-70d884c2b6e9", "metadata": {}, "source": [ "## Read in JSON file\n", "\n", "Contains a dictionary for plain English feature names for the 8 features selected in the model. Use these as the column titles in the DataFrame." ] }, { "cell_type": "code", "execution_count": 2, "id": "fd650e1e-843b-4012-8f1d-0734e574723c", "metadata": {}, "outputs": [], "source": [ "with open(\"./output/feature_name_dict.json\") as json_file:\n", " feature_name_dict = json.load(json_file)" ] }, { "cell_type": "markdown", "id": "434d8899-7e9e-4554-8cfd-015e61038e84", "metadata": {}, "source": [ "## Load data on predicted 10k cohort thrombolysis use at each hospital\n", "Use the hospitals thrombolysis rate on the same set of 10k patients to select the 30 hospitals with the highest thrombolysis rates." ] }, { "cell_type": "code", "execution_count": 3, "id": "40cfc68d-ecef-4658-ba0d-f0874b60aaff", "metadata": {}, "outputs": [], "source": [ "thrombolysis_by_hosp = pd.read_csv(\n", " './output/10k_thrombolysis_rate_by_hosp_key_features.csv', index_col='stroke_team')\n", "thrombolysis_by_hosp.sort_values(\n", " 'Thrombolysis rate', ascending=False, inplace=True)" ] }, { "cell_type": "code", "execution_count": 4, "id": "a505df68-ddc3-45d5-a83a-c9396dab956a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Thrombolysis rate | \n", "
---|---|
stroke_team | \n", "\n", " |
VKKDD9172T | \n", "0.4610 | \n", "
GKONI0110I | \n", "0.4356 | \n", "
CNBGF2713O | \n", "0.4207 | \n", "
HPWIF9956L | \n", "0.4191 | \n", "
MHMYL4920B | \n", "0.3981 | \n", "
\n", " | StrokeTeam | \n", "S1AgeOnArrival | \n", "S1OnsetToArrival_min | \n", "S2RankinBeforeStroke | \n", "Loc | \n", "LocQuestions | \n", "LocCommands | \n", "BestGaze | \n", "Visual | \n", "FacialPalsy | \n", "... | \n", "AFAnticoagulentHeparin_missing | \n", "S2NewAFDiagnosis_No | \n", "S2NewAFDiagnosis_Yes | \n", "S2NewAFDiagnosis_missing | \n", "S2StrokeType_Infarction | \n", "S2TIAInLastMonth_No | \n", "S2TIAInLastMonth_No but | \n", "S2TIAInLastMonth_Yes | \n", "S2TIAInLastMonth_missing | \n", "S2Thrombolysis | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "VUHVS8909F | \n", "72.5 | \n", "80.0 | \n", "0 | \n", "3 | \n", "2.0 | \n", "2.0 | \n", "2.0 | \n", "3.0 | \n", "3.0 | \n", "... | \n", "0 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "0 | \n", "
1 | \n", "HZNVT9936G | \n", "72.5 | \n", "87.0 | \n", "2 | \n", "0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "1.0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "0 | \n", "
2 | \n", "FAJKD7118X | \n", "67.5 | \n", "140.0 | \n", "3 | \n", "0 | \n", "2.0 | \n", "0.0 | \n", "1.0 | \n", "2.0 | \n", "2.0 | \n", "... | \n", "0 | \n", "1 | \n", "0 | \n", "0 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "1 | \n", "
3 | \n", "TPXYE0168D | \n", "77.5 | \n", "108.0 | \n", "0 | \n", "0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "1.0 | \n", "2.0 | \n", "... | \n", "1 | \n", "0 | \n", "0 | \n", "1 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "1 | \n", "
4 | \n", "DNOYM6465G | \n", "87.5 | \n", "51.0 | \n", "4 | \n", "1 | \n", "1.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "1.0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "1 | \n", "0 | \n", "0 | \n", "0 | \n", "1 | \n", "0 | \n", "
5 rows × 87 columns
\n", "