From 52578a2e1a904447b45b6b60b4e24188f9f05121 Mon Sep 17 00:00:00 2001 From: TomMonks Date: Wed, 1 May 2024 17:13:56 +0100 Subject: [PATCH 1/2] PATCH: added self.args as opposed to global args in trauma pathway --- content/02_model_code/04_model.ipynb | 318 +++++++++++------------ content/02_model_code/output/table_3.txt | 12 +- 2 files changed, 165 insertions(+), 165 deletions(-) diff --git a/content/02_model_code/04_model.ipynb b/content/02_model_code/04_model.ipynb index ac7fae0..287141a 100644 --- a/content/02_model_code/04_model.ipynb +++ b/content/02_model_code/04_model.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "9864ff04", + "id": "a616ab85", "metadata": {}, "source": [ "# SimPy: Treatment Centre\n", @@ -16,7 +16,7 @@ }, { "cell_type": "markdown", - "id": "67d378b9", + "id": "a673d596", "metadata": {}, "source": [ "## 1. Imports\n", @@ -27,7 +27,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "7d374b31", + "id": "1510fa82", "metadata": {}, "outputs": [ { @@ -49,7 +49,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "11fac8cf", + "id": "9eaa009e", "metadata": {}, "outputs": [], "source": [ @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "559ee23e", + "id": "306923f0", "metadata": {}, "source": [ "## 2. Constants and defaults for modelling **as-is**" @@ -71,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "87c119bd", + "id": "1c652e9e", "metadata": {}, "source": [ "### 2.1 Distribution parameters" @@ -80,7 +80,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "6f01d888", + "id": "5fb682b6", "metadata": {}, "outputs": [], "source": [ @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "7bb06c1d", + "id": "f198407f", "metadata": {}, "source": [ "### 2.2 Time dependent arrival rates data\n", @@ -126,7 +126,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "e55e450a", + "id": "123eab09", "metadata": {}, "outputs": [ { @@ -154,7 +154,7 @@ }, { "cell_type": "markdown", - "id": "18ce33a2", + "id": "f21f31f7", "metadata": {}, "source": [ "### 2.3 Resource counts\n", @@ -165,7 +165,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "93644445", + "id": "90e3588c", "metadata": {}, "outputs": [], "source": [ @@ -183,7 +183,7 @@ }, { "cell_type": "markdown", - "id": "814e3a78", + "id": "4b965df5", "metadata": {}, "source": [ "### 2.4 Simulation model run settings" @@ -192,7 +192,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "0038a24f", + "id": "1248fa08", "metadata": {}, "outputs": [], "source": [ @@ -213,7 +213,7 @@ }, { "cell_type": "markdown", - "id": "4df7855a", + "id": "233831f7", "metadata": {}, "source": [ "## 3. Utility functions" @@ -222,7 +222,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "9e150cb9", + "id": "597c802d", "metadata": {}, "outputs": [], "source": [ @@ -243,7 +243,7 @@ }, { "cell_type": "markdown", - "id": "dab518e5", + "id": "57b4015e", "metadata": {}, "source": [ "## 4. Distribution classes\n", @@ -261,7 +261,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "48e2c282", + "id": "f46f8817", "metadata": {}, "outputs": [], "source": [ @@ -387,7 +387,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "ffd5ca32", + "id": "3c7af4be", "metadata": {}, "outputs": [], "source": [ @@ -469,7 +469,7 @@ }, { "cell_type": "markdown", - "id": "da4e0ca7", + "id": "463b23dc", "metadata": {}, "source": [ "## 5. Model parameterisation\n", @@ -480,7 +480,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "4cbd58d2", + "id": "66bb7e69", "metadata": {}, "outputs": [], "source": [ @@ -694,7 +694,7 @@ }, { "cell_type": "markdown", - "id": "e3cb73a1", + "id": "0d3de644", "metadata": {}, "source": [ "## 6. Patient Pathways Process Logic\n", @@ -705,7 +705,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "34edd733", + "id": "cb42b1fb", "metadata": {}, "outputs": [], "source": [ @@ -771,7 +771,7 @@ " f'{self.env.now:.3f}')\n", " \n", " # sample triage duration.\n", - " self.triage_duration = args.triage_dist.sample()\n", + " self.triage_duration = self.args.triage_dist.sample()\n", " yield self.env.timeout(self.triage_duration)\n", " self.triage_complete()\n", " \n", @@ -786,7 +786,7 @@ " self.wait_trauma = self.env.now - start_wait\n", " \n", " # sample stablisation duration.\n", - " self.trauma_duration = args.trauma_dist.sample()\n", + " self.trauma_duration = self.args.trauma_dist.sample()\n", " yield self.env.timeout(self.trauma_duration)\n", " \n", " self.trauma_complete()\n", @@ -804,7 +804,7 @@ " f'{self.env.now:.3f}')\n", " \n", " # sample treatment duration.\n", - " self.treat_duration = args.treat_dist.sample()\n", + " self.treat_duration = self.args.treat_dist.sample()\n", " yield self.env.timeout(self.treat_duration)\n", " \n", " self.treatment_complete()\n", @@ -837,7 +837,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "30185f46", + "id": "38835e7e", "metadata": {}, "outputs": [], "source": [ @@ -988,7 +988,7 @@ }, { "cell_type": "markdown", - "id": "39bb1a70", + "id": "e38ca3fd", "metadata": {}, "source": [ "## 7. Main model class\n", @@ -999,7 +999,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "32fe1593", + "id": "c7f923cf", "metadata": {}, "outputs": [], "source": [ @@ -1141,7 +1141,7 @@ }, { "cell_type": "markdown", - "id": "b697a7f0", + "id": "062d2235", "metadata": {}, "source": [ "### 8. Logic to process end of run results.\n", @@ -1152,7 +1152,7 @@ { "cell_type": "code", "execution_count": 14, - "id": "91cb2537", + "id": "ea5b009c", "metadata": {}, "outputs": [], "source": [ @@ -1343,7 +1343,7 @@ }, { "cell_type": "markdown", - "id": "2ed1e0a7", + "id": "5323b72b", "metadata": {}, "source": [ "## 9. Model execution\n", @@ -1356,7 +1356,7 @@ { "cell_type": "code", "execution_count": 15, - "id": "9dcc164b", + "id": "a9a49c40", "metadata": {}, "outputs": [], "source": [ @@ -1404,7 +1404,7 @@ { "cell_type": "code", "execution_count": 16, - "id": "3320cd7c", + "id": "62e7c149", "metadata": {}, "outputs": [], "source": [ @@ -1442,7 +1442,7 @@ }, { "cell_type": "markdown", - "id": "c2773977", + "id": "01c2b3e0", "metadata": {}, "source": [ "### 9.1 Single run of the model\n", @@ -1458,7 +1458,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "ab928ff2", + "id": "0df45de2", "metadata": {}, "outputs": [ { @@ -1605,7 +1605,7 @@ }, { "cell_type": "markdown", - "id": "7ce7a397", + "id": "d9788eab", "metadata": {}, "source": [ "### 9.2 Multiple independent replications\n", @@ -1616,7 +1616,7 @@ { "cell_type": "code", "execution_count": 18, - "id": "7d1bd513", + "id": "8f51ab34", "metadata": {}, "outputs": [ { @@ -1625,8 +1625,8 @@ "text": [ "Running multiple replications => done.\n", "\n", - "CPU times: user 3.21 s, sys: 25 ms, total: 3.23 s\n", - "Wall time: 5.8 s\n" + "CPU times: user 2.63 s, sys: 21 ms, total: 2.66 s\n", + "Wall time: 4.15 s\n" ] }, { @@ -1807,7 +1807,7 @@ { "cell_type": "code", "execution_count": 19, - "id": "0964cfc9", + "id": "f13002ef", "metadata": {}, "outputs": [ { @@ -1844,7 +1844,7 @@ }, { "cell_type": "markdown", - "id": "f3d13d68", + "id": "463c761b", "metadata": {}, "source": [ "### 9.3 Visualise replications" @@ -1853,7 +1853,7 @@ { "cell_type": "code", "execution_count": 20, - "id": "83bb0cb6", + "id": "dc99c76f", "metadata": {}, "outputs": [ { @@ -1877,7 +1877,7 @@ }, { "cell_type": "markdown", - "id": "1cdb9f2c", + "id": "b01bfab4", "metadata": {}, "source": [ "## 10. Scenario Analysis\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": 21, - "id": "938b1851", + "id": "ad680b14", "metadata": {}, "outputs": [], "source": [ @@ -1925,7 +1925,7 @@ { "cell_type": "code", "execution_count": 22, - "id": "ffc0b669", + "id": "7652fcd8", "metadata": {}, "outputs": [], "source": [ @@ -1967,7 +1967,7 @@ }, { "cell_type": "markdown", - "id": "702e13a3", + "id": "56c57ea5", "metadata": {}, "source": [ "### 10.1 Script to run scenario analysis" @@ -1976,7 +1976,7 @@ { "cell_type": "code", "execution_count": 23, - "id": "36a7271a", + "id": "97e994a4", "metadata": {}, "outputs": [ { @@ -2016,7 +2016,7 @@ { "cell_type": "code", "execution_count": 24, - "id": "ae7a3a51", + "id": "f407478c", "metadata": {}, "outputs": [], "source": [ @@ -2047,7 +2047,7 @@ { "cell_type": "code", "execution_count": 25, - "id": "7c370630", + "id": "3db4bad0", "metadata": {}, "outputs": [ { @@ -2089,27 +2089,27 @@ " \n", " \n", " 01a_triage_wait\n", - " 29.52\n", - " 1.17\n", - " 29.47\n", - " 23.99\n", - " 1.21\n", + " 30.23\n", + " 1.00\n", + " 29.81\n", + " 26.35\n", + " 1.15\n", " \n", " \n", " 01b_triage_util\n", - " 0.60\n", + " 0.61\n", " 0.30\n", + " 0.60\n", " 0.59\n", - " 0.58\n", " 0.30\n", " \n", " \n", " 02a_registration_wait\n", - " 101.88\n", - " 128.14\n", - " 101.09\n", - " 109.70\n", - " 125.47\n", + " 102.75\n", + " 128.30\n", + " 102.10\n", + " 105.89\n", + " 125.88\n", " \n", " \n", " 02b_registration_util\n", @@ -2121,10 +2121,10 @@ " \n", " \n", " 03a_examination_wait\n", - " 25.34\n", - " 24.93\n", + " 25.61\n", + " 24.14\n", " 0.16\n", - " 24.03\n", + " 23.73\n", " 0.14\n", " \n", " \n", @@ -2132,80 +2132,80 @@ " 0.86\n", " 0.86\n", " 0.67\n", - " 0.85\n", + " 0.86\n", " 0.67\n", " \n", " \n", " 04a_treatment_wait(non_trauma)\n", - " 134.19\n", - " 134.80\n", - " 148.81\n", - " 2.10\n", - " 150.61\n", + " 131.91\n", + " 134.52\n", + " 147.37\n", + " 2.07\n", + " 152.00\n", " \n", " \n", " 04b_treatment_util(non_trauma)\n", " 0.88\n", " 0.88\n", " 0.88\n", - " 0.62\n", + " 0.63\n", " 0.88\n", " \n", " \n", " 05_total_time(non-trauma)\n", - " 226.57\n", - " 223.52\n", - " 213.47\n", - " 184.42\n", - " 210.25\n", + " 227.31\n", + " 222.75\n", + " 214.16\n", + " 182.92\n", + " 211.24\n", " \n", " \n", " 06a_trauma_wait\n", - " 171.44\n", - " 182.96\n", - " 139.42\n", - " 166.51\n", - " 178.34\n", + " 168.52\n", + " 189.80\n", + " 167.94\n", + " 168.45\n", + " 189.11\n", " \n", " \n", " 06b_trauma_util\n", - " 0.88\n", - " 0.88\n", - " 0.83\n", - " 0.87\n", + " 0.85\n", + " 0.86\n", + " 0.85\n", + " 0.85\n", " 0.86\n", " \n", " \n", " 07a_treatment_wait(trauma)\n", - " 20.38\n", - " 22.61\n", - " 19.24\n", - " 16.89\n", - " 19.46\n", + " 14.69\n", + " 14.95\n", + " 13.80\n", + " 14.90\n", + " 14.92\n", " \n", " \n", " 07b_treatment_util(trauma)\n", " 0.52\n", " 0.52\n", " 0.52\n", - " 0.51\n", + " 0.52\n", " 0.52\n", " \n", " \n", " 08_total_time(trauma)\n", - " 316.94\n", - " 298.88\n", - " 271.56\n", - " 297.58\n", - " 288.86\n", + " 306.53\n", + " 298.11\n", + " 303.77\n", + " 302.25\n", + " 297.92\n", " \n", " \n", " 09_throughput\n", - " 166.15\n", - " 167.45\n", - " 169.15\n", - " 196.85\n", - " 170.40\n", + " 166.25\n", + " 167.35\n", + " 169.10\n", + " 197.85\n", + " 170.45\n", " \n", " \n", "\n", @@ -2214,21 +2214,21 @@ "text/plain": [ " base triage+1 exam+1 treat+1 triage+exam\n", "00_arrivals 227.25 227.25 227.25 227.25 227.25\n", - "01a_triage_wait 29.52 1.17 29.47 23.99 1.21\n", - "01b_triage_util 0.60 0.30 0.59 0.58 0.30\n", - "02a_registration_wait 101.88 128.14 101.09 109.70 125.47\n", + "01a_triage_wait 30.23 1.00 29.81 26.35 1.15\n", + "01b_triage_util 0.61 0.30 0.60 0.59 0.30\n", + "02a_registration_wait 102.75 128.30 102.10 105.89 125.88\n", "02b_registration_util 0.84 0.85 0.84 0.84 0.84\n", - "03a_examination_wait 25.34 24.93 0.16 24.03 0.14\n", - "03b_examination_util 0.86 0.86 0.67 0.85 0.67\n", - "04a_treatment_wait(non_trauma) 134.19 134.80 148.81 2.10 150.61\n", - "04b_treatment_util(non_trauma) 0.88 0.88 0.88 0.62 0.88\n", - "05_total_time(non-trauma) 226.57 223.52 213.47 184.42 210.25\n", - "06a_trauma_wait 171.44 182.96 139.42 166.51 178.34\n", - "06b_trauma_util 0.88 0.88 0.83 0.87 0.86\n", - "07a_treatment_wait(trauma) 20.38 22.61 19.24 16.89 19.46\n", - "07b_treatment_util(trauma) 0.52 0.52 0.52 0.51 0.52\n", - "08_total_time(trauma) 316.94 298.88 271.56 297.58 288.86\n", - "09_throughput 166.15 167.45 169.15 196.85 170.40" + "03a_examination_wait 25.61 24.14 0.16 23.73 0.14\n", + "03b_examination_util 0.86 0.86 0.67 0.86 0.67\n", + "04a_treatment_wait(non_trauma) 131.91 134.52 147.37 2.07 152.00\n", + "04b_treatment_util(non_trauma) 0.88 0.88 0.88 0.63 0.88\n", + "05_total_time(non-trauma) 227.31 222.75 214.16 182.92 211.24\n", + "06a_trauma_wait 168.52 189.80 167.94 168.45 189.11\n", + "06b_trauma_util 0.85 0.86 0.85 0.85 0.86\n", + "07a_treatment_wait(trauma) 14.69 14.95 13.80 14.90 14.92\n", + "07b_treatment_util(trauma) 0.52 0.52 0.52 0.52 0.52\n", + "08_total_time(trauma) 306.53 298.11 303.77 302.25 297.92\n", + "09_throughput 166.25 167.35 169.10 197.85 170.45" ] }, "execution_count": 25, @@ -2245,7 +2245,7 @@ }, { "cell_type": "markdown", - "id": "e1075c3a", + "id": "8bcc535e", "metadata": {}, "source": [ "## 11. Script to produce formatted LaTeX table for paper" @@ -2254,7 +2254,7 @@ { "cell_type": "code", "execution_count": 26, - "id": "9d4388bd", + "id": "ee16defc", "metadata": {}, "outputs": [ { @@ -2290,56 +2290,56 @@ " \n", " 0\n", " Triage\n", - " 29.52\n", - " 1.17\n", - " 29.47\n", - " 23.99\n", - " 1.21\n", + " 30.23\n", + " 1.00\n", + " 29.81\n", + " 26.35\n", + " 1.15\n", " \n", " \n", " 1\n", " Registation\n", - " 101.88\n", - " 128.14\n", - " 101.09\n", - " 109.70\n", - " 125.47\n", + " 102.75\n", + " 128.30\n", + " 102.10\n", + " 105.89\n", + " 125.88\n", " \n", " \n", " 2\n", " Examination\n", - " 25.34\n", - " 24.93\n", + " 25.61\n", + " 24.14\n", " 0.16\n", - " 24.03\n", + " 23.73\n", " 0.14\n", " \n", " \n", " 3\n", " Non-trauma treatment\n", - " 134.19\n", - " 134.80\n", - " 148.81\n", - " 2.10\n", - " 150.61\n", + " 131.91\n", + " 134.52\n", + " 147.37\n", + " 2.07\n", + " 152.00\n", " \n", " \n", " 4\n", " Trauma stabilisation\n", - " 171.44\n", - " 182.96\n", - " 139.42\n", - " 166.51\n", - " 178.34\n", + " 168.52\n", + " 189.80\n", + " 167.94\n", + " 168.45\n", + " 189.11\n", " \n", " \n", " 5\n", " Trauma treatment\n", - " 20.38\n", - " 22.61\n", - " 19.24\n", - " 16.89\n", - " 19.46\n", + " 14.69\n", + " 14.95\n", + " 13.80\n", + " 14.90\n", + " 14.92\n", " \n", " \n", "\n", @@ -2347,12 +2347,12 @@ ], "text/plain": [ " Mean waiting time (mins) base triage+1 exam+1 treat+1 triage+exam\n", - "0 Triage 29.52 1.17 29.47 23.99 1.21\n", - "1 Registation 101.88 128.14 101.09 109.70 125.47\n", - "2 Examination 25.34 24.93 0.16 24.03 0.14\n", - "3 Non-trauma treatment 134.19 134.80 148.81 2.10 150.61\n", - "4 Trauma stabilisation 171.44 182.96 139.42 166.51 178.34\n", - "5 Trauma treatment 20.38 22.61 19.24 16.89 19.46" + "0 Triage 30.23 1.00 29.81 26.35 1.15\n", + "1 Registation 102.75 128.30 102.10 105.89 125.88\n", + "2 Examination 25.61 24.14 0.16 23.73 0.14\n", + "3 Non-trauma treatment 131.91 134.52 147.37 2.07 152.00\n", + "4 Trauma stabilisation 168.52 189.80 167.94 168.45 189.11\n", + "5 Trauma treatment 14.69 14.95 13.80 14.90 14.92" ] }, "execution_count": 26, @@ -2382,7 +2382,7 @@ { "cell_type": "code", "execution_count": 27, - "id": "12fbe03a", + "id": "5490f9a4", "metadata": {}, "outputs": [ { @@ -2397,12 +2397,12 @@ "\\toprule\n", "Mean waiting time (mins) & base & triage+1 & exam+1 & treat+1 & triage+exam \\\\\n", "\\midrule\n", - " Triage & 29.52 & 1.17 & 29.47 & 23.99 & 1.21 \\\\\n", - " Registation & 101.88 & 128.14 & 101.09 & 109.70 & 125.47 \\\\\n", - " Examination & 25.34 & 24.93 & 0.16 & 24.03 & 0.14 \\\\\n", - " Non-trauma treatment & 134.19 & 134.80 & 148.81 & 2.10 & 150.61 \\\\\n", - " Trauma stabilisation & 171.44 & 182.96 & 139.42 & 166.51 & 178.34 \\\\\n", - " Trauma treatment & 20.38 & 22.61 & 19.24 & 16.89 & 19.46 \\\\\n", + " Triage & 30.23 & 1.00 & 29.81 & 26.35 & 1.15 \\\\\n", + " Registation & 102.75 & 128.30 & 102.10 & 105.89 & 125.88 \\\\\n", + " Examination & 25.61 & 24.14 & 0.16 & 23.73 & 0.14 \\\\\n", + " Non-trauma treatment & 131.91 & 134.52 & 147.37 & 2.07 & 152.00 \\\\\n", + " Trauma stabilisation & 168.52 & 189.80 & 167.94 & 168.45 & 189.11 \\\\\n", + " Trauma treatment & 14.69 & 14.95 & 13.80 & 14.90 & 14.92 \\\\\n", "\\bottomrule\n", "\\end{tabular}\n", "\\end{table}\n", @@ -2431,7 +2431,7 @@ }, { "cell_type": "markdown", - "id": "c3098904", + "id": "7de968d9", "metadata": {}, "source": [ "## End" diff --git a/content/02_model_code/output/table_3.txt b/content/02_model_code/output/table_3.txt index 21d335f..5e31448 100644 --- a/content/02_model_code/output/table_3.txt +++ b/content/02_model_code/output/table_3.txt @@ -6,12 +6,12 @@ \toprule Mean waiting time (mins) & base & triage+1 & exam+1 & treat+1 & triage+exam \\ \midrule - Triage & 29.52 & 1.17 & 29.47 & 23.99 & 1.21 \\ - Registation & 101.88 & 128.14 & 101.09 & 109.70 & 125.47 \\ - Examination & 25.34 & 24.93 & 0.16 & 24.03 & 0.14 \\ - Non-trauma treatment & 134.19 & 134.80 & 148.81 & 2.10 & 150.61 \\ - Trauma stabilisation & 171.44 & 182.96 & 139.42 & 166.51 & 178.34 \\ - Trauma treatment & 20.38 & 22.61 & 19.24 & 16.89 & 19.46 \\ + Triage & 30.23 & 1.00 & 29.81 & 26.35 & 1.15 \\ + Registation & 102.75 & 128.30 & 102.10 & 105.89 & 125.88 \\ + Examination & 25.61 & 24.14 & 0.16 & 23.73 & 0.14 \\ + Non-trauma treatment & 131.91 & 134.52 & 147.37 & 2.07 & 152.00 \\ + Trauma stabilisation & 168.52 & 189.80 & 167.94 & 168.45 & 189.11 \\ + Trauma treatment & 14.69 & 14.95 & 13.80 & 14.90 & 14.92 \\ \bottomrule \end{tabular} \end{table} From 277c11b511fd127dd9aae70b48127043243e8887 Mon Sep 17 00:00:00 2001 From: TomMonks Date: Wed, 1 May 2024 17:17:53 +0100 Subject: [PATCH 2/2] PATCH: added self.args as opposed to global args in NON trauma pathway --- content/02_model_code/04_model.ipynb | 326 +++++++++++------------ content/02_model_code/output/table_3.txt | 12 +- 2 files changed, 169 insertions(+), 169 deletions(-) diff --git a/content/02_model_code/04_model.ipynb b/content/02_model_code/04_model.ipynb index 287141a..51030aa 100644 --- a/content/02_model_code/04_model.ipynb +++ b/content/02_model_code/04_model.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "a616ab85", + "id": "f3f10bdd", "metadata": {}, "source": [ "# SimPy: Treatment Centre\n", @@ -16,7 +16,7 @@ }, { "cell_type": "markdown", - "id": "a673d596", + "id": "5344ce91", "metadata": {}, "source": [ "## 1. Imports\n", @@ -27,7 +27,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "1510fa82", + "id": "ca232cb6", "metadata": {}, "outputs": [ { @@ -49,7 +49,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "9eaa009e", + "id": "ece07572", "metadata": {}, "outputs": [], "source": [ @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "306923f0", + "id": "66f25c4f", "metadata": {}, "source": [ "## 2. Constants and defaults for modelling **as-is**" @@ -71,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "1c652e9e", + "id": "933ecf77", "metadata": {}, "source": [ "### 2.1 Distribution parameters" @@ -80,7 +80,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "5fb682b6", + "id": "3d0d7972", "metadata": {}, "outputs": [], "source": [ @@ -115,7 +115,7 @@ }, { "cell_type": "markdown", - "id": "f198407f", + "id": "6533d97e", "metadata": {}, "source": [ "### 2.2 Time dependent arrival rates data\n", @@ -126,7 +126,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "123eab09", + "id": "006f81bc", "metadata": {}, "outputs": [ { @@ -154,7 +154,7 @@ }, { "cell_type": "markdown", - "id": "f21f31f7", + "id": "65d93ada", "metadata": {}, "source": [ "### 2.3 Resource counts\n", @@ -165,7 +165,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "90e3588c", + "id": "3a930c2f", "metadata": {}, "outputs": [], "source": [ @@ -183,7 +183,7 @@ }, { "cell_type": "markdown", - "id": "4b965df5", + "id": "58a31996", "metadata": {}, "source": [ "### 2.4 Simulation model run settings" @@ -192,7 +192,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "1248fa08", + "id": "b9aa15a8", "metadata": {}, "outputs": [], "source": [ @@ -213,7 +213,7 @@ }, { "cell_type": "markdown", - "id": "233831f7", + "id": "652b6cd9", "metadata": {}, "source": [ "## 3. Utility functions" @@ -222,7 +222,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "597c802d", + "id": "9515f479", "metadata": {}, "outputs": [], "source": [ @@ -243,7 +243,7 @@ }, { "cell_type": "markdown", - "id": "57b4015e", + "id": "0bae94d8", "metadata": {}, "source": [ "## 4. Distribution classes\n", @@ -261,7 +261,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "f46f8817", + "id": "93ad8937", "metadata": {}, "outputs": [], "source": [ @@ -387,7 +387,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "3c7af4be", + "id": "f7ca81c7", "metadata": {}, "outputs": [], "source": [ @@ -469,7 +469,7 @@ }, { "cell_type": "markdown", - "id": "463b23dc", + "id": "a12b49e7", "metadata": {}, "source": [ "## 5. Model parameterisation\n", @@ -480,7 +480,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "66bb7e69", + "id": "907f92f0", "metadata": {}, "outputs": [], "source": [ @@ -694,7 +694,7 @@ }, { "cell_type": "markdown", - "id": "0d3de644", + "id": "92caa2c3", "metadata": {}, "source": [ "## 6. Patient Pathways Process Logic\n", @@ -705,7 +705,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "cb42b1fb", + "id": "17c275b0", "metadata": {}, "outputs": [], "source": [ @@ -837,7 +837,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "38835e7e", + "id": "bb9701a8", "metadata": {}, "outputs": [], "source": [ @@ -911,7 +911,7 @@ " f'{self.env.now:.3f}')\n", " \n", " # sample triage duration.\n", - " self.triage_duration = args.triage_dist.sample()\n", + " self.triage_duration = self.args.triage_dist.sample()\n", " yield self.env.timeout(self.triage_duration)\n", " \n", " trace(f'triage {self.identifier} complete {self.env.now:.3f}; '\n", @@ -930,7 +930,7 @@ " f'{self.env.now:.3f}')\n", " \n", " # sample registration duration.\n", - " self.reg_duration = args.reg_dist.sample()\n", + " self.reg_duration = self.args.reg_dist.sample()\n", " yield self.env.timeout(self.reg_duration)\n", " \n", " trace(f'patient {self.identifier} registered at'\n", @@ -950,7 +950,7 @@ " f'{self.env.now:.3f}')\n", " \n", " # sample examination duration.\n", - " self.exam_duration = args.exam_dist.sample()\n", + " self.exam_duration = self.args.exam_dist.sample()\n", " yield self.env.timeout(self.exam_duration)\n", " \n", " trace(f'patient {self.identifier} examination complete ' \n", @@ -975,7 +975,7 @@ " f'{self.env.now:.3f}')\n", "\n", " # sample treatment duration.\n", - " self.treat_duration = args.nt_treat_dist.sample()\n", + " self.treat_duration = self.args.nt_treat_dist.sample()\n", " yield self.env.timeout(self.treat_duration)\n", "\n", " trace(f'patient {self.identifier} treatment complete '\n", @@ -988,7 +988,7 @@ }, { "cell_type": "markdown", - "id": "e38ca3fd", + "id": "b63dc313", "metadata": {}, "source": [ "## 7. Main model class\n", @@ -999,7 +999,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "c7f923cf", + "id": "eb818845", "metadata": {}, "outputs": [], "source": [ @@ -1141,7 +1141,7 @@ }, { "cell_type": "markdown", - "id": "062d2235", + "id": "20371a7d", "metadata": {}, "source": [ "### 8. Logic to process end of run results.\n", @@ -1152,7 +1152,7 @@ { "cell_type": "code", "execution_count": 14, - "id": "ea5b009c", + "id": "84b6ba9c", "metadata": {}, "outputs": [], "source": [ @@ -1343,7 +1343,7 @@ }, { "cell_type": "markdown", - "id": "5323b72b", + "id": "66903748", "metadata": {}, "source": [ "## 9. Model execution\n", @@ -1356,7 +1356,7 @@ { "cell_type": "code", "execution_count": 15, - "id": "a9a49c40", + "id": "ee84259b", "metadata": {}, "outputs": [], "source": [ @@ -1404,7 +1404,7 @@ { "cell_type": "code", "execution_count": 16, - "id": "62e7c149", + "id": "821b19c0", "metadata": {}, "outputs": [], "source": [ @@ -1442,7 +1442,7 @@ }, { "cell_type": "markdown", - "id": "01c2b3e0", + "id": "95ceb94f", "metadata": {}, "source": [ "### 9.1 Single run of the model\n", @@ -1458,7 +1458,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "0df45de2", + "id": "7fbd36ef", "metadata": {}, "outputs": [ { @@ -1605,7 +1605,7 @@ }, { "cell_type": "markdown", - "id": "d9788eab", + "id": "f28faeb9", "metadata": {}, "source": [ "### 9.2 Multiple independent replications\n", @@ -1616,7 +1616,7 @@ { "cell_type": "code", "execution_count": 18, - "id": "8f51ab34", + "id": "bc86afc7", "metadata": {}, "outputs": [ { @@ -1625,8 +1625,8 @@ "text": [ "Running multiple replications => done.\n", "\n", - "CPU times: user 2.63 s, sys: 21 ms, total: 2.66 s\n", - "Wall time: 4.15 s\n" + "CPU times: user 3.11 s, sys: 34.6 ms, total: 3.14 s\n", + "Wall time: 4.56 s\n" ] }, { @@ -1807,7 +1807,7 @@ { "cell_type": "code", "execution_count": 19, - "id": "f13002ef", + "id": "bd73717a", "metadata": {}, "outputs": [ { @@ -1844,7 +1844,7 @@ }, { "cell_type": "markdown", - "id": "463c761b", + "id": "e16a5004", "metadata": {}, "source": [ "### 9.3 Visualise replications" @@ -1853,7 +1853,7 @@ { "cell_type": "code", "execution_count": 20, - "id": "dc99c76f", + "id": "d6aa0e6f", "metadata": {}, "outputs": [ { @@ -1877,7 +1877,7 @@ }, { "cell_type": "markdown", - "id": "b01bfab4", + "id": "dee26e8c", "metadata": {}, "source": [ "## 10. Scenario Analysis\n", @@ -1890,7 +1890,7 @@ { "cell_type": "code", "execution_count": 21, - "id": "ad680b14", + "id": "a9a407df", "metadata": {}, "outputs": [], "source": [ @@ -1925,7 +1925,7 @@ { "cell_type": "code", "execution_count": 22, - "id": "7652fcd8", + "id": "e5e5dd90", "metadata": {}, "outputs": [], "source": [ @@ -1967,7 +1967,7 @@ }, { "cell_type": "markdown", - "id": "56c57ea5", + "id": "83369fd0", "metadata": {}, "source": [ "### 10.1 Script to run scenario analysis" @@ -1976,7 +1976,7 @@ { "cell_type": "code", "execution_count": 23, - "id": "97e994a4", + "id": "3bf68f8b", "metadata": {}, "outputs": [ { @@ -2016,7 +2016,7 @@ { "cell_type": "code", "execution_count": 24, - "id": "f407478c", + "id": "0688e4e9", "metadata": {}, "outputs": [], "source": [ @@ -2047,7 +2047,7 @@ { "cell_type": "code", "execution_count": 25, - "id": "3db4bad0", + "id": "560b8a99", "metadata": {}, "outputs": [ { @@ -2089,42 +2089,42 @@ " \n", " \n", " 01a_triage_wait\n", - " 30.23\n", - " 1.00\n", - " 29.81\n", - " 26.35\n", - " 1.15\n", + " 32.56\n", + " 1.26\n", + " 32.56\n", + " 32.56\n", + " 1.26\n", " \n", " \n", " 01b_triage_util\n", " 0.61\n", - " 0.30\n", - " 0.60\n", - " 0.59\n", - " 0.30\n", + " 0.31\n", + " 0.61\n", + " 0.61\n", + " 0.31\n", " \n", " \n", " 02a_registration_wait\n", - " 102.75\n", - " 128.30\n", - " 102.10\n", - " 105.89\n", - " 125.88\n", + " 104.69\n", + " 131.82\n", + " 104.69\n", + " 104.69\n", + " 131.82\n", " \n", " \n", " 02b_registration_util\n", - " 0.84\n", " 0.85\n", - " 0.84\n", - " 0.84\n", - " 0.84\n", + " 0.85\n", + " 0.85\n", + " 0.85\n", + " 0.85\n", " \n", " \n", " 03a_examination_wait\n", - " 25.61\n", - " 24.14\n", - " 0.16\n", - " 23.73\n", + " 23.36\n", + " 24.44\n", + " 0.14\n", + " 23.36\n", " 0.14\n", " \n", " \n", @@ -2137,51 +2137,51 @@ " \n", " \n", " 04a_treatment_wait(non_trauma)\n", - " 131.91\n", - " 134.52\n", - " 147.37\n", - " 2.07\n", - " 152.00\n", + " 130.73\n", + " 133.09\n", + " 144.50\n", + " 2.15\n", + " 147.81\n", " \n", " \n", " 04b_treatment_util(non_trauma)\n", " 0.88\n", " 0.88\n", " 0.88\n", - " 0.63\n", + " 0.62\n", " 0.88\n", " \n", " \n", " 05_total_time(non-trauma)\n", - " 227.31\n", - " 222.75\n", - " 214.16\n", - " 182.92\n", - " 211.24\n", + " 229.04\n", + " 226.38\n", + " 218.29\n", + " 187.98\n", + " 215.06\n", " \n", " \n", " 06a_trauma_wait\n", - " 168.52\n", - " 189.80\n", - " 167.94\n", - " 168.45\n", - " 189.11\n", + " 166.98\n", + " 189.67\n", + " 166.98\n", + " 166.98\n", + " 189.67\n", " \n", " \n", " 06b_trauma_util\n", - " 0.85\n", + " 0.84\n", " 0.86\n", - " 0.85\n", - " 0.85\n", + " 0.84\n", + " 0.84\n", " 0.86\n", " \n", " \n", " 07a_treatment_wait(trauma)\n", - " 14.69\n", - " 14.95\n", - " 13.80\n", - " 14.90\n", - " 14.92\n", + " 14.39\n", + " 14.77\n", + " 14.39\n", + " 14.39\n", + " 14.77\n", " \n", " \n", " 07b_treatment_util(trauma)\n", @@ -2193,19 +2193,19 @@ " \n", " \n", " 08_total_time(trauma)\n", - " 306.53\n", - " 298.11\n", - " 303.77\n", - " 302.25\n", - " 297.92\n", + " 306.46\n", + " 298.22\n", + " 306.46\n", + " 306.46\n", + " 298.22\n", " \n", " \n", " 09_throughput\n", - " 166.25\n", - " 167.35\n", + " 165.85\n", + " 166.65\n", " 169.10\n", - " 197.85\n", - " 170.45\n", + " 196.85\n", + " 169.85\n", " \n", " \n", "\n", @@ -2214,21 +2214,21 @@ "text/plain": [ " base triage+1 exam+1 treat+1 triage+exam\n", "00_arrivals 227.25 227.25 227.25 227.25 227.25\n", - "01a_triage_wait 30.23 1.00 29.81 26.35 1.15\n", - "01b_triage_util 0.61 0.30 0.60 0.59 0.30\n", - "02a_registration_wait 102.75 128.30 102.10 105.89 125.88\n", - "02b_registration_util 0.84 0.85 0.84 0.84 0.84\n", - "03a_examination_wait 25.61 24.14 0.16 23.73 0.14\n", + "01a_triage_wait 32.56 1.26 32.56 32.56 1.26\n", + "01b_triage_util 0.61 0.31 0.61 0.61 0.31\n", + "02a_registration_wait 104.69 131.82 104.69 104.69 131.82\n", + "02b_registration_util 0.85 0.85 0.85 0.85 0.85\n", + "03a_examination_wait 23.36 24.44 0.14 23.36 0.14\n", "03b_examination_util 0.86 0.86 0.67 0.86 0.67\n", - "04a_treatment_wait(non_trauma) 131.91 134.52 147.37 2.07 152.00\n", - "04b_treatment_util(non_trauma) 0.88 0.88 0.88 0.63 0.88\n", - "05_total_time(non-trauma) 227.31 222.75 214.16 182.92 211.24\n", - "06a_trauma_wait 168.52 189.80 167.94 168.45 189.11\n", - "06b_trauma_util 0.85 0.86 0.85 0.85 0.86\n", - "07a_treatment_wait(trauma) 14.69 14.95 13.80 14.90 14.92\n", + "04a_treatment_wait(non_trauma) 130.73 133.09 144.50 2.15 147.81\n", + "04b_treatment_util(non_trauma) 0.88 0.88 0.88 0.62 0.88\n", + "05_total_time(non-trauma) 229.04 226.38 218.29 187.98 215.06\n", + "06a_trauma_wait 166.98 189.67 166.98 166.98 189.67\n", + "06b_trauma_util 0.84 0.86 0.84 0.84 0.86\n", + "07a_treatment_wait(trauma) 14.39 14.77 14.39 14.39 14.77\n", "07b_treatment_util(trauma) 0.52 0.52 0.52 0.52 0.52\n", - "08_total_time(trauma) 306.53 298.11 303.77 302.25 297.92\n", - "09_throughput 166.25 167.35 169.10 197.85 170.45" + "08_total_time(trauma) 306.46 298.22 306.46 306.46 298.22\n", + "09_throughput 165.85 166.65 169.10 196.85 169.85" ] }, "execution_count": 25, @@ -2245,7 +2245,7 @@ }, { "cell_type": "markdown", - "id": "8bcc535e", + "id": "f0975eb0", "metadata": {}, "source": [ "## 11. Script to produce formatted LaTeX table for paper" @@ -2254,7 +2254,7 @@ { "cell_type": "code", "execution_count": 26, - "id": "ee16defc", + "id": "74eeca17", "metadata": {}, "outputs": [ { @@ -2290,56 +2290,56 @@ " \n", " 0\n", " Triage\n", - " 30.23\n", - " 1.00\n", - " 29.81\n", - " 26.35\n", - " 1.15\n", + " 32.56\n", + " 1.26\n", + " 32.56\n", + " 32.56\n", + " 1.26\n", " \n", " \n", " 1\n", " Registation\n", - " 102.75\n", - " 128.30\n", - " 102.10\n", - " 105.89\n", - " 125.88\n", + " 104.69\n", + " 131.82\n", + " 104.69\n", + " 104.69\n", + " 131.82\n", " \n", " \n", " 2\n", " Examination\n", - " 25.61\n", - " 24.14\n", - " 0.16\n", - " 23.73\n", + " 23.36\n", + " 24.44\n", + " 0.14\n", + " 23.36\n", " 0.14\n", " \n", " \n", " 3\n", " Non-trauma treatment\n", - " 131.91\n", - " 134.52\n", - " 147.37\n", - " 2.07\n", - " 152.00\n", + " 130.73\n", + " 133.09\n", + " 144.50\n", + " 2.15\n", + " 147.81\n", " \n", " \n", " 4\n", " Trauma stabilisation\n", - " 168.52\n", - " 189.80\n", - " 167.94\n", - " 168.45\n", - " 189.11\n", + " 166.98\n", + " 189.67\n", + " 166.98\n", + " 166.98\n", + " 189.67\n", " \n", " \n", " 5\n", " Trauma treatment\n", - " 14.69\n", - " 14.95\n", - " 13.80\n", - " 14.90\n", - " 14.92\n", + " 14.39\n", + " 14.77\n", + " 14.39\n", + " 14.39\n", + " 14.77\n", " \n", " \n", "\n", @@ -2347,12 +2347,12 @@ ], "text/plain": [ " Mean waiting time (mins) base triage+1 exam+1 treat+1 triage+exam\n", - "0 Triage 30.23 1.00 29.81 26.35 1.15\n", - "1 Registation 102.75 128.30 102.10 105.89 125.88\n", - "2 Examination 25.61 24.14 0.16 23.73 0.14\n", - "3 Non-trauma treatment 131.91 134.52 147.37 2.07 152.00\n", - "4 Trauma stabilisation 168.52 189.80 167.94 168.45 189.11\n", - "5 Trauma treatment 14.69 14.95 13.80 14.90 14.92" + "0 Triage 32.56 1.26 32.56 32.56 1.26\n", + "1 Registation 104.69 131.82 104.69 104.69 131.82\n", + "2 Examination 23.36 24.44 0.14 23.36 0.14\n", + "3 Non-trauma treatment 130.73 133.09 144.50 2.15 147.81\n", + "4 Trauma stabilisation 166.98 189.67 166.98 166.98 189.67\n", + "5 Trauma treatment 14.39 14.77 14.39 14.39 14.77" ] }, "execution_count": 26, @@ -2382,7 +2382,7 @@ { "cell_type": "code", "execution_count": 27, - "id": "5490f9a4", + "id": "e997f352", "metadata": {}, "outputs": [ { @@ -2397,12 +2397,12 @@ "\\toprule\n", "Mean waiting time (mins) & base & triage+1 & exam+1 & treat+1 & triage+exam \\\\\n", "\\midrule\n", - " Triage & 30.23 & 1.00 & 29.81 & 26.35 & 1.15 \\\\\n", - " Registation & 102.75 & 128.30 & 102.10 & 105.89 & 125.88 \\\\\n", - " Examination & 25.61 & 24.14 & 0.16 & 23.73 & 0.14 \\\\\n", - " Non-trauma treatment & 131.91 & 134.52 & 147.37 & 2.07 & 152.00 \\\\\n", - " Trauma stabilisation & 168.52 & 189.80 & 167.94 & 168.45 & 189.11 \\\\\n", - " Trauma treatment & 14.69 & 14.95 & 13.80 & 14.90 & 14.92 \\\\\n", + " Triage & 32.56 & 1.26 & 32.56 & 32.56 & 1.26 \\\\\n", + " Registation & 104.69 & 131.82 & 104.69 & 104.69 & 131.82 \\\\\n", + " Examination & 23.36 & 24.44 & 0.14 & 23.36 & 0.14 \\\\\n", + " Non-trauma treatment & 130.73 & 133.09 & 144.50 & 2.15 & 147.81 \\\\\n", + " Trauma stabilisation & 166.98 & 189.67 & 166.98 & 166.98 & 189.67 \\\\\n", + " Trauma treatment & 14.39 & 14.77 & 14.39 & 14.39 & 14.77 \\\\\n", "\\bottomrule\n", "\\end{tabular}\n", "\\end{table}\n", @@ -2431,7 +2431,7 @@ }, { "cell_type": "markdown", - "id": "7de968d9", + "id": "aea6dfee", "metadata": {}, "source": [ "## End" diff --git a/content/02_model_code/output/table_3.txt b/content/02_model_code/output/table_3.txt index 5e31448..06ef3b0 100644 --- a/content/02_model_code/output/table_3.txt +++ b/content/02_model_code/output/table_3.txt @@ -6,12 +6,12 @@ \toprule Mean waiting time (mins) & base & triage+1 & exam+1 & treat+1 & triage+exam \\ \midrule - Triage & 30.23 & 1.00 & 29.81 & 26.35 & 1.15 \\ - Registation & 102.75 & 128.30 & 102.10 & 105.89 & 125.88 \\ - Examination & 25.61 & 24.14 & 0.16 & 23.73 & 0.14 \\ - Non-trauma treatment & 131.91 & 134.52 & 147.37 & 2.07 & 152.00 \\ - Trauma stabilisation & 168.52 & 189.80 & 167.94 & 168.45 & 189.11 \\ - Trauma treatment & 14.69 & 14.95 & 13.80 & 14.90 & 14.92 \\ + Triage & 32.56 & 1.26 & 32.56 & 32.56 & 1.26 \\ + Registation & 104.69 & 131.82 & 104.69 & 104.69 & 131.82 \\ + Examination & 23.36 & 24.44 & 0.14 & 23.36 & 0.14 \\ + Non-trauma treatment & 130.73 & 133.09 & 144.50 & 2.15 & 147.81 \\ + Trauma stabilisation & 166.98 & 189.67 & 166.98 & 166.98 & 189.67 \\ + Trauma treatment & 14.39 & 14.77 & 14.39 & 14.39 & 14.77 \\ \bottomrule \end{tabular} \end{table}