Skip to content

Commit ead5083

Browse files
authored
Merge pull request #11 from pythonhealthdatascience/dev
Dev
2 parents eb70bef + f227a84 commit ead5083

File tree

13 files changed

+988
-52
lines changed

13 files changed

+988
-52
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ __pycache__
33
.pytest_cache
44
.pytype
55

6-
# Log messages, except the example one generated by logs.ipynb
7-
*.log
8-
!log_example.log
9-
106
# vscode
117
.vscode/*
128

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Dates formatted as YYYY-MM-DD as per [ISO standard](https://www.iso.org/iso-8601-date-and-time-format.html).
7+
8+
## v0.1.0 - 2025-06-02
9+
10+
🌱 First release of the repository. Contains implementation of the DES model from Monks et al. 2016, with reproduction of all tables and figures with results from the article and supplementary material. Also includes some tests, and a demonstration of logging, and of how parameters could be stored in a `.csv`.

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ abstract: >-
2121
from Monks et al. 2016.
2222
license: MIT
2323
version: '0.1.0'
24-
date-released: '2025-03-26'
24+
date-released: '2025-06-02'

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Original:
9999

100100
From this repository:
101101

102-
![](outputs/occupancy_freq_asu.png)
102+
![](outputs/figure1_asu.png)
103103

104104
**Figure 3**
105105

@@ -109,23 +109,15 @@ Original:
109109

110110
From this repository:
111111

112-
![](outputs/delay_prob_asu.png)
112+
![](outputs/figure3_asu.png)
113113

114114
<br>
115115

116116
## Run time and machine specification
117117

118-
TBC
118+
The run time for this analysis (`notebooks/analysis.ipynb`) is 10 seconds. This was on an Intel Core i7-12700H, 32GB RAM, Ubuntu 24.04.1.
119119

120-
<!-- State the run time, and give the specification of the machine used (which achieved that run time).
121-
122-
**Example:** Intel Core i7-12700H with 32GB RAM running Ubuntu 24.04.1 Linux.
123-
124-
To find this information:
125-
126-
* **Linux:** Run `neofetch` on the terminal and record your CPU, memory and operating system.
127-
* **Windows:** Open "Task Manager" (Ctrl + Shift + Esc), go to the "Performance" tab, then select "CPU" and "Memory" for relevant information.
128-
* **Mac:** Click the "Apple Menu", select "About This Mac", then window will display the details.-->
120+
The other notebooks generate results for tests and illustrate other functionality (e.g. importing parameters from csv, running with logs), and these just take a second or two.
129121

130122
<br>
131123

notebooks/analysis.ipynb

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"\n",
4141
"# pylint: disable=wrong-import-position\n",
4242
"import os\n",
43+
"import time\n",
4344
"\n",
4445
"from IPython.display import display\n",
4546
"import numpy as np\n",
@@ -55,6 +56,16 @@
5556
"execution_count": 2,
5657
"metadata": {},
5758
"outputs": [],
59+
"source": [
60+
"# Start timer\n",
61+
"start_time = time.time()"
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": 3,
67+
"metadata": {},
68+
"outputs": [],
5869
"source": [
5970
"# Path to the outputs folder\n",
6071
"OUTPUT_DIR = \"../outputs/\""
@@ -71,7 +82,7 @@
7182
},
7283
{
7384
"cell_type": "code",
74-
"execution_count": 3,
85+
"execution_count": 4,
7586
"metadata": {},
7687
"outputs": [],
7788
"source": [
@@ -93,7 +104,7 @@
93104
},
94105
{
95106
"cell_type": "code",
96-
"execution_count": 4,
107+
"execution_count": 5,
97108
"metadata": {},
98109
"outputs": [],
99110
"source": [
@@ -154,7 +165,7 @@
154165
},
155166
{
156167
"cell_type": "code",
157-
"execution_count": 5,
168+
"execution_count": 6,
158169
"metadata": {},
159170
"outputs": [
160171
{
@@ -1918,7 +1929,7 @@
19181929
},
19191930
{
19201931
"cell_type": "code",
1921-
"execution_count": 6,
1932+
"execution_count": 7,
19221933
"metadata": {},
19231934
"outputs": [],
19241935
"source": [
@@ -1973,7 +1984,7 @@
19731984
},
19741985
{
19751986
"cell_type": "code",
1976-
"execution_count": 7,
1987+
"execution_count": 8,
19771988
"metadata": {},
19781989
"outputs": [
19791990
{
@@ -3785,7 +3796,7 @@
37853796
},
37863797
{
37873798
"cell_type": "code",
3788-
"execution_count": 8,
3799+
"execution_count": 9,
37893800
"metadata": {},
37903801
"outputs": [
37913802
{
@@ -3823,7 +3834,7 @@
38233834
},
38243835
{
38253836
"cell_type": "code",
3826-
"execution_count": 9,
3837+
"execution_count": 10,
38273838
"metadata": {},
38283839
"outputs": [],
38293840
"source": [
@@ -3845,7 +3856,7 @@
38453856
},
38463857
{
38473858
"cell_type": "code",
3848-
"execution_count": 10,
3859+
"execution_count": 11,
38493860
"metadata": {},
38503861
"outputs": [],
38513862
"source": [
@@ -3913,7 +3924,7 @@
39133924
},
39143925
{
39153926
"cell_type": "code",
3916-
"execution_count": 11,
3927+
"execution_count": 12,
39173928
"metadata": {},
39183929
"outputs": [
39193930
{
@@ -4124,7 +4135,7 @@
41244135
},
41254136
{
41264137
"cell_type": "code",
4127-
"execution_count": 12,
4138+
"execution_count": 13,
41284139
"metadata": {},
41294140
"outputs": [
41304141
{
@@ -4341,7 +4352,7 @@
43414352
},
43424353
{
43434354
"cell_type": "code",
4344-
"execution_count": 13,
4355+
"execution_count": 14,
43454356
"metadata": {},
43464357
"outputs": [],
43474358
"source": [
@@ -4355,7 +4366,7 @@
43554366
},
43564367
{
43574368
"cell_type": "code",
4358-
"execution_count": 14,
4369+
"execution_count": 15,
43594370
"metadata": {},
43604371
"outputs": [],
43614372
"source": [
@@ -4375,7 +4386,7 @@
43754386
},
43764387
{
43774388
"cell_type": "code",
4378-
"execution_count": 15,
4389+
"execution_count": 16,
43794390
"metadata": {},
43804391
"outputs": [
43814392
{
@@ -4575,7 +4586,7 @@
45754586
},
45764587
{
45774588
"cell_type": "code",
4578-
"execution_count": 16,
4589+
"execution_count": 17,
45794590
"metadata": {},
45804591
"outputs": [
45814592
{
@@ -5021,7 +5032,7 @@
50215032
},
50225033
{
50235034
"cell_type": "code",
5024-
"execution_count": 17,
5035+
"execution_count": 18,
50255036
"metadata": {},
50265037
"outputs": [
50275038
{
@@ -5042,7 +5053,7 @@
50425053
},
50435054
{
50445055
"cell_type": "code",
5045-
"execution_count": 18,
5056+
"execution_count": 19,
50465057
"metadata": {},
50475058
"outputs": [
50485059
{
@@ -5072,7 +5083,7 @@
50725083
},
50735084
{
50745085
"cell_type": "code",
5075-
"execution_count": 19,
5086+
"execution_count": 20,
50765087
"metadata": {},
50775088
"outputs": [],
50785089
"source": [
@@ -5349,7 +5360,7 @@
53495360
},
53505361
{
53515362
"cell_type": "code",
5352-
"execution_count": 20,
5363+
"execution_count": 21,
53535364
"metadata": {},
53545365
"outputs": [],
53555366
"source": [
@@ -5398,7 +5409,7 @@
53985409
},
53995410
{
54005411
"cell_type": "code",
5401-
"execution_count": 21,
5412+
"execution_count": 22,
54025413
"metadata": {},
54035414
"outputs": [],
54045415
"source": [
@@ -5426,7 +5437,7 @@
54265437
},
54275438
{
54285439
"cell_type": "code",
5429-
"execution_count": 22,
5440+
"execution_count": 23,
54305441
"metadata": {},
54315442
"outputs": [],
54325443
"source": [
@@ -5449,7 +5460,7 @@
54495460
},
54505461
{
54515462
"cell_type": "code",
5452-
"execution_count": 23,
5463+
"execution_count": 24,
54535464
"metadata": {},
54545465
"outputs": [
54555466
{
@@ -5621,6 +5632,35 @@
56215632
"tab3.to_csv(\n",
56225633
" os.path.join(OUTPUT_DIR, \"table3.csv\"), index=False)"
56235634
]
5635+
},
5636+
{
5637+
"cell_type": "markdown",
5638+
"metadata": {},
5639+
"source": [
5640+
"## Run time"
5641+
]
5642+
},
5643+
{
5644+
"cell_type": "code",
5645+
"execution_count": 25,
5646+
"metadata": {},
5647+
"outputs": [
5648+
{
5649+
"name": "stdout",
5650+
"output_type": "stream",
5651+
"text": [
5652+
"Notebook run time: 0m 10s\n"
5653+
]
5654+
}
5655+
],
5656+
"source": [
5657+
"# Get run time in seconds\n",
5658+
"end_time = time.time()\n",
5659+
"runtime = round(end_time - start_time)\n",
5660+
"\n",
5661+
"# Display converted to minutes and seconds\n",
5662+
"print(f'Notebook run time: {runtime // 60}m {runtime % 60}s')"
5663+
]
56245664
}
56255665
],
56265666
"metadata": {

notebooks/generate_exp_results.ipynb

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"\n",
2323
"# pylint: disable=wrong-import-position\n",
2424
"import os\n",
25+
"import time\n",
2526
"\n",
2627
"from IPython.display import display\n",
2728
"import pandas as pd\n",
@@ -36,6 +37,16 @@
3637
"execution_count": 2,
3738
"metadata": {},
3839
"outputs": [],
40+
"source": [
41+
"# Start timer\n",
42+
"start_time = time.time()"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 3,
48+
"metadata": {},
49+
"outputs": [],
3950
"source": [
4051
"# Define path to folder for expected results for tests\n",
4152
"TESTS = \"../tests/exp_results/\""
@@ -50,7 +61,7 @@
5061
},
5162
{
5263
"cell_type": "code",
53-
"execution_count": 3,
64+
"execution_count": 4,
5465
"metadata": {},
5566
"outputs": [
5667
{
@@ -149,7 +160,7 @@
149160
},
150161
{
151162
"cell_type": "code",
152-
"execution_count": 4,
163+
"execution_count": 5,
153164
"metadata": {},
154165
"outputs": [
155166
{
@@ -349,6 +360,35 @@
349360
"runner_df[\"rehab\"].to_csv(os.path.join(TESTS, \"rehab_occupancy.csv\"),\n",
350361
" index=False)"
351362
]
363+
},
364+
{
365+
"cell_type": "markdown",
366+
"metadata": {},
367+
"source": [
368+
"## Run time"
369+
]
370+
},
371+
{
372+
"cell_type": "code",
373+
"execution_count": 6,
374+
"metadata": {},
375+
"outputs": [
376+
{
377+
"name": "stdout",
378+
"output_type": "stream",
379+
"text": [
380+
"Notebook run time: 0m 0s\n"
381+
]
382+
}
383+
],
384+
"source": [
385+
"# Get run time in seconds\n",
386+
"end_time = time.time()\n",
387+
"runtime = round(end_time - start_time)\n",
388+
"\n",
389+
"# Display converted to minutes and seconds\n",
390+
"print(f'Notebook run time: {runtime // 60}m {runtime % 60}s')"
391+
]
352392
}
353393
],
354394
"metadata": {

0 commit comments

Comments
 (0)