Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasting Module #543

Draft
wants to merge 234 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
1b3c72e
add test_wasting.py
tbhallett Apr 6, 2022
7c57737
add wasting.py
tbhallett Apr 6, 2022
d35833c
edit hsi_generic_first_appts.py
tbhallett Apr 6, 2022
55aa12c
made some changes in wasting to ensure all tests in test_wasting are …
mnjowe Oct 5, 2023
e34e350
Merge branch 'master' into hallett/wasting_module
mnjowe Oct 5, 2023
f399fbf
getting things running in the current wasting state and generate some…
mnjowe Oct 6, 2023
75ebb3a
not import but important
mnjowe Oct 6, 2023
5f12010
Linter Changes
thewati Oct 9, 2023
25d4493
added more treatment ids to color map
thewati Oct 10, 2023
22e013d
Updated policies excel and wasting dependencies python files
thewati Oct 11, 2023
0c12856
module dependencies, cause of death color map, linting
mnjowe Oct 12, 2023
4c089a1
Merge branch 'master' into hallett/wasting_module
mnjowe Oct 13, 2023
44cb176
HSI event name should include module name
mnjowe Oct 17, 2023
3e6c6f0
changed some logic, linting, progress individuals to SAM instead of k…
mnjowe Oct 20, 2023
9df52aa
code cleaning
mnjowe Oct 20, 2023
4cae512
fixed line error
thewati Oct 23, 2023
c416d7a
added oedema reset to Wasting Natural Recovery
inesll Nov 3, 2023
3c80825
Remove progression to severe following treatment failure for MAM.
inesll Nov 3, 2023
d4fff87
re-structuring wasting module, activated HSI events, modified some pa…
mnjowe Dec 4, 2023
639fecd
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
mnjowe Dec 4, 2023
344cf92
added a new sheet as per same file in master
mnjowe Dec 5, 2023
19e6c5a
Merge branch 'master' into hallett/wasting_module
mnjowe Dec 5, 2023
a711061
addressing the test membership error
mnjowe Dec 5, 2023
1cecf26
update
thewati Dec 5, 2023
09a1326
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
thewati Dec 5, 2023
7563c94
Worked on graphs
thewati Dec 5, 2023
c57438f
Wasting Graphs
thewati Dec 5, 2023
7583361
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
thewati Dec 5, 2023
5176fbc
remove hard-corded parameters and add them to resource file, reformat…
mnjowe Dec 7, 2023
2e68ce4
run from simulation
mnjowe Dec 7, 2023
1f0d55e
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
mnjowe Dec 7, 2023
b902922
resolving test health system error, changed values in resource file f…
mnjowe Dec 11, 2023
0768775
correcting imports
mnjowe Dec 11, 2023
721ed0c
linting
mnjowe Dec 19, 2023
a4ff6bf
Merge branch 'master' into hallett/wasting_module
mnjowe Jan 4, 2024
cd20c5c
removing unnecessary semicolon
mnjowe Jan 4, 2024
7a7138d
Merge branch 'master' into hallett/wasting_module
mnjowe Jan 8, 2024
308e453
General changes after review 1
thewati Jan 29, 2024
cea20e0
Updated Priority Ranking Policies resource file
thewati Jan 31, 2024
b7f9e34
Stunting Rollback
thewati Jan 31, 2024
ed1723f
Treatment_ID update
thewati Jan 31, 2024
760e092
Update src/tlo/analysis/utils.py
thewati Feb 1, 2024
73407ad
Added Dalys reported test, Treatment_ID naming and other fixes
thewati Feb 2, 2024
7e5375e
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
thewati Feb 2, 2024
140641c
removing unused death parameters and linear model, restructuring line…
mnjowe Feb 5, 2024
6ba66ca
Merge branch 'master' into hallett/wasting_module
mnjowe Feb 5, 2024
e1ab6f1
addressing failing tests
mnjowe Feb 5, 2024
e4b2df8
resolving checks error
mnjowe Feb 5, 2024
8f22e8e
isort error
mnjowe Feb 5, 2024
6c5d875
small fixes in wasting analyses, test and main module
mnjowe Feb 6, 2024
a038a8a
use "left" not left when assigning inclusive value in linear models
mnjowe Feb 6, 2024
b6b7306
remove misleading comment
mnjowe Feb 6, 2024
84ef308
Merge branch 'master' into hallett/wasting_module
thewati Feb 12, 2024
83d3ec4
addressing eva's comments and suggestions
mnjowe Feb 13, 2024
5c2fce3
Merge branch 'master' into hallett/wasting_module
mnjowe Feb 13, 2024
5fc9747
Merge branch 'master' into hallett/wasting_module
mnjowe Feb 13, 2024
bcb9bec
resolving conflicts
mnjowe Feb 15, 2024
7f39dea
Merge branch 'master' into hallett/wasting_module
mnjowe Feb 15, 2024
f522fed
RF_Wasting: CSV instead of XLSX
EvaJanouskova Feb 11, 2024
a6281a5
RF_Wasting: comments added
EvaJanouskova Feb 11, 2024
a348b88
wast: parameters re-ordered, comments adjusted
EvaJanouskova Feb 11, 2024
2776254
wast & test_wast: property renamed un_acute_malnutrition_tx_start_dat…
EvaJanouskova Feb 11, 2024
be848bb
wast: read parameters from CSV
EvaJanouskova Feb 12, 2024
2c67007
wast: properties descriptions adjusted
EvaJanouskova Feb 12, 2024
255e841
RF_Wast: note updated
EvaJanouskova Feb 12, 2024
645acc1
wast: minor changes (param moved; comment added)
EvaJanouskova Feb 12, 2024
177d8b0
RF_Wast: rename col 'more notes' to 'old values'; avoid multiple rows…
EvaJanouskova Feb 12, 2024
e70b39e
RF_Wast: added REF to some old values
EvaJanouskova Feb 19, 2024
d983393
wast: comments adjusted
EvaJanouskova Feb 19, 2024
b0d0b91
wast: setting properties in the order they are defined
EvaJanouskova Feb 19, 2024
a4d15e0
wast: TODO
EvaJanouskova Feb 19, 2024
11bfe6c
wast: tidy up the get_prob_severe_wasting_or_odds_wasting fnc; TODO i…
EvaJanouskova Feb 20, 2024
bee7e69
wast: descriptions and comments adjusted
EvaJanouskova Feb 20, 2024
e6e581e
Updated proportion, prob/odds function_name, rng
thewati Feb 22, 2024
d56f677
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
thewati Feb 22, 2024
20b5cb5
Updated proportion, prob/odds function_name, rng
thewati Feb 22, 2024
e98abc7
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
mnjowe Feb 26, 2024
268bebe
Fix prob_odds function_name, rng
thewati Mar 1, 2024
b263ef4
Merge branch 'master' into hallett/wasting_module
mnjowe Mar 1, 2024
06cf3ee
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
mnjowe Mar 1, 2024
a6eb7b8
wast: fix a bug; rm TODOs
EvaJanouskova Mar 1, 2024
89e54ad
Standardize progression to sev wasting
thewati Mar 5, 2024
0a8c3ce
fixing the bug. return proportion not product
mnjowe Mar 5, 2024
0228ad2
changing all appearance of '115-<125mm' to '[115,125)mm'
mnjowe Mar 5, 2024
9420a41
Merge remote-tracking branch 'origin/hallett/wasting_module' into hal…
mnjowe Mar 5, 2024
7e5b471
adding random number generator to linear model
mnjowe Mar 5, 2024
f1eb95c
squeeze single row output
mnjowe Mar 6, 2024
ada21ed
plotting wasting prevalence by age group and year
mnjowe Mar 16, 2024
444f6d0
Merge branch 'master' into hallett/wasting_module
mnjowe Mar 16, 2024
30f480d
added footnote, fixed isort error
mnjowe Mar 17, 2024
7030202
RF_Wast, wast: CSV instead of XLSX
EvaJanouskova Feb 11, 2024
6f398bb
added wasting scenario run file for azure
mnjowe Jul 19, 2024
b0b8827
Merge branch 'master' into hallett/wasting_module
EvaJanouskova Jul 23, 2024
4558afd
PEP8
EvaJanouskova Jul 23, 2024
361c89d
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Jul 23, 2024
d5da5db
Merge branch 'EvaJ/wasting/first_suggestions' into hallett/wasting_mo…
EvaJanouskova Jul 23, 2024
de06bf6
RF_Wast, wast: [115,125) -> [115-125) (comma confuses the data as it …
EvaJanouskova Jul 24, 2024
070ec85
wast: fix the imports of HSIEventScheduler and IndividualProperties
EvaJanouskova Jul 24, 2024
17e4f21
RF_PriorityRanking_ALLPOLICIES: priorities changed for undernutrition…
EvaJanouskova Jul 25, 2024
79ba5e1
test_wast: input params of sim.modules['SymptomManager'].has_what fixed
EvaJanouskova Jul 25, 2024
c2646e2
wast: duplicated logger setup rm; logger arguments added
EvaJanouskova Jul 29, 2024
42f49c1
Merge branch 'master' into hallett/wasting_module
EvaJanouskova Jul 30, 2024
e59c24a
wast: fix MUAC distribution for moderate wasting; apply choice fnc to…
EvaJanouskova Jul 30, 2024
baa2631
RF_PriorityRanking_ALLPOLICIES: priorities changed for undernutrition…
EvaJanouskova Jul 30, 2024
11c7124
wast: apply fixed to be used on rows
EvaJanouskova Jul 31, 2024
005e3a8
test_wast: update checking of scheduled hsi events; outpatient and in…
EvaJanouskova Jul 31, 2024
dad77e6
wast: simplified setting of oedema status
EvaJanouskova Jul 31, 2024
190ede1
wast: returns rm from fnc descriptions if no return, outdated params …
EvaJanouskova Jul 31, 2024
cc05882
wast: update the var/fnc names to reflect what they store/do (esp. do…
EvaJanouskova Aug 2, 2024
4c29cca
[no ci] wast: update the par names to reflect what they represent
EvaJanouskova Aug 2, 2024
7cec79e
Merge branch 'master' into hallett/wasting_module
EvaJanouskova Aug 2, 2024
14e6b18
RF_Wast: update the par names to reflect what they represent
EvaJanouskova Aug 2, 2024
7158286
wast: assert added as stated in comment + minor changes (out of loop …
EvaJanouskova Aug 6, 2024
1f033fa
wast & analysis_wast: logging key updated to reflect prevalence props…
EvaJanouskova Aug 6, 2024
3246500
wast & test_wast: MAM/SAM corrected to mod/sev wasting
EvaJanouskova Aug 6, 2024
2fad6be
wast & test_wast: DALY calculations corrected
EvaJanouskova Aug 6, 2024
d0c88f4
wast: minor changes (comments, debug messages adjusted)
EvaJanouskova Aug 6, 2024
daef56b
wast: minor changes (params descriptions adjusted)
EvaJanouskova Aug 8, 2024
c73742c
wast & RF_wast: probs corrected
EvaJanouskova Aug 9, 2024
5baa6de
wast & test_wast: PollingEvent name specified
EvaJanouskova Aug 9, 2024
2115441
wast: MUAC, oedema, clinical state of acute malnutrition, and complic…
EvaJanouskova Aug 9, 2024
42b9bf5
wast & test_wast: natural recovery -prepared for future (to improve a…
EvaJanouskova Aug 23, 2024
0770b13
wast, RF_Wast & test_wast: treatment -lengths as parameters, -var nam…
EvaJanouskova Aug 23, 2024
a2efbf8
wast: actual mean for wasting incidence lm corrected
EvaJanouskova Aug 23, 2024
ebca720
wast: track incidence only (it is not incidence if they remained non-…
EvaJanouskova Aug 24, 2024
cc8d4ba
wast: return wasted always as series (even if 1 bool retuned) when in…
EvaJanouskova Oct 8, 2024
0c15bee
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Oct 8, 2024
cf83494
wast: progress/recovery from moderate wasting schedule only for new c…
EvaJanouskova Oct 8, 2024
be8521e
wast: split get_prob_severe_wasting_or_odds_wasting() fnc into two se…
EvaJanouskova Oct 8, 2024
c7a25a4
wast: fix wasting_prevalence_props calculations (logged)
EvaJanouskova Oct 8, 2024
03cae88
wast: typo
EvaJanouskova Oct 9, 2024
ad2ace6
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Oct 9, 2024
9ae10c1
wast & test_wast: fix and simplify calculation of proportion_normalWH…
EvaJanouskova Oct 9, 2024
91b70e5
wast: more descriptive names (consistent with other names)
EvaJanouskova Oct 10, 2024
15272c8
analysis_wast: rm note, update axis label
EvaJanouskova Oct 11, 2024
b454398
RF_wast: more precise value of proportion_oedema_with_WHZ<-2
EvaJanouskova Oct 11, 2024
61e6570
scenario_wast: create 2 scenarios incl. wasting - minimal and full_mo…
EvaJanouskova Oct 11, 2024
92eb806
scenario_wast_full|minimal_model: scenarios updated
EvaJanouskova Oct 11, 2024
16bf5bb
analysis_wast: renamed -> .._with_sim_running
EvaJanouskova Oct 11, 2024
9e12d96
analysis_wast: new analysis script analysis without running sim, to a…
EvaJanouskova Oct 11, 2024
a6de785
scenarios wast: names udpated in comments
EvaJanouskova Oct 11, 2024
3d7adfb
scenarios wast: start and end dates corrected
EvaJanouskova Oct 11, 2024
4880416
scenario_wast_min_model: 1 year sim & 2K pop
EvaJanouskova Oct 11, 2024
4b18b14
scenario_wast_orig: match modules with minimal_model
EvaJanouskova Oct 14, 2024
e607927
scenario_wast_orig: add name of scenario to output filename
EvaJanouskova Oct 14, 2024
9a52b89
undernutrion_analyses folder renamed -> stunting_analyses
EvaJanouskova Oct 14, 2024
57796ee
wast: print rm
EvaJanouskova Oct 14, 2024
dbaae82
analysis_wast: update the analysis script to analyse sim run from Azu…
EvaJanouskova Oct 15, 2024
b38e79a
analysis_wast: PEP 8
EvaJanouskova Oct 15, 2024
62af5e7
analysis_wast: save both png and pdf for each figure & all_figures in…
EvaJanouskova Oct 15, 2024
a0efad1
analysis_wast: save figs into simulation results folder
EvaJanouskova Oct 15, 2024
c7c3497
scenario_wast_full|minimal_model: sim 2010-2030(incl), 20K pop, 10 runs
EvaJanouskova Oct 15, 2024
ef9cb70
analysis_wast: PEP 8
EvaJanouskova Oct 15, 2024
065d1f4
scenario_wast_full|minimal_model: up to 2023-01-02 (wasting log after…
EvaJanouskova Oct 15, 2024
5695d74
wast: clinical acute malnutrition categories written together
EvaJanouskova Oct 17, 2024
4601dc6
analysis_wast: footnote corrected
EvaJanouskova Oct 17, 2024
a7fdda8
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Oct 17, 2024
c328ddb
wast: tidy up
EvaJanouskova Oct 17, 2024
3deb9f7
analysis_wast: title corrected
EvaJanouskova Oct 17, 2024
d463b56
wast: increase care_seeking_odds_ratio for SAM symptom, so almost eve…
EvaJanouskova Oct 22, 2024
88bc3f0
wast: follow-up MAM treatment after SAM treatment when recovered to MAM
EvaJanouskova Oct 22, 2024
5b5d8a2
wast: *new MAM, SAM cases start with 'none' treatment (not only wasti…
EvaJanouskova Oct 22, 2024
d96b53a
wast & test_wast: new HSI_Wasting_GrowthMonitoring; other events renamed
EvaJanouskova Oct 27, 2024
5ae5958
wast: rm duplicated setting of tx_start_date
EvaJanouskova Oct 28, 2024
c7adae1
wast: diagnosis any rnd day within the month; fasten run by excluding…
EvaJanouskova Oct 29, 2024
164f055
wast: priority=2 for HSI_Wasting_GrowthMonitoring
EvaJanouskova Oct 29, 2024
fa8cf23
wast: comment corrected
EvaJanouskova Oct 29, 2024
c2028d6
RF_PriorityRanking_ALLPOLICIES: Undernutrition_GrowthMonitoring added
EvaJanouskova Oct 29, 2024
e7023be
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Oct 30, 2024
14a8e11
Revert "RF_PriorityRanking_ALLPOLICIES: Undernutrition_GrowthMonitori…
EvaJanouskova Oct 30, 2024
4f8190c
RF_PriorityRanking_ALLPOLICIES: Undernutrition_GrowthMonitoring added…
EvaJanouskova Oct 29, 2024
17e7f20
hs: enforce_priority_policy() fnc updated to work for individual & po…
EvaJanouskova Oct 30, 2024
7da7768
scenario_wast_full_model|minimal_model|orig: till the end of 2030 no …
EvaJanouskova Oct 30, 2024
1c04df1
Revert "hs: enforce_priority_policy() fnc updated to work for individ…
EvaJanouskova Oct 30, 2024
dbcd577
wast & RF_Wast: used coverage wasn't treatment coverage, hence rm
EvaJanouskova Nov 8, 2024
35acc35
wast: HSI_Wasting_GrowthMonitoring changed to IndividualScope (incl. …
EvaJanouskova Nov 9, 2024
36001f2
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Nov 10, 2024
cfa03aa
wast: improved code readability
EvaJanouskova Nov 10, 2024
d4e9322
wast & RF_Wast: parameters added and used
EvaJanouskova Nov 10, 2024
a1542f3
wast: vars names and description updated
EvaJanouskova Nov 12, 2024
fb0e8a5
scenario_wast_min_model: use simplified_births
EvaJanouskova Nov 13, 2024
d36304a
wast: minor (tidy up)
EvaJanouskova Nov 15, 2024
1ea06b4
RF_Wast & test_wast: parameter names udpated
EvaJanouskova Nov 15, 2024
277ede2
wast: minor (comment updated)
EvaJanouskova Nov 15, 2024
11985b1
test_wast: minor (superfluous assert rm)
EvaJanouskova Nov 15, 2024
e61f1b7
scenario_wast_min_model: contraception module not needed
EvaJanouskova Nov 15, 2024
4baf50a
equipment: description updated
EvaJanouskova Nov 15, 2024
e116ac8
wast: diagnosis code completed
EvaJanouskova Nov 15, 2024
172725d
wast & test wast: property un_am_bilateral_oedema renamed to un_am_nu…
EvaJanouskova Dec 3, 2024
0938207
wast: initial & on birth properties setup (not need to set up dates t…
EvaJanouskova Dec 3, 2024
add465d
test_wast: correct asserts
EvaJanouskova Dec 3, 2024
57458f8
wast: apply mod wast incidence only if not on tx, and reset recovery …
EvaJanouskova Dec 3, 2024
8935a5d
wast: joining the conditions when the Event should not run into one i…
EvaJanouskova Dec 6, 2024
ad8a143
wast: if on tx, and discharge date scheduled, they shouldn't have die…
EvaJanouskova Dec 6, 2024
85ada27
wast: minor (HSI_Event description updated)
EvaJanouskova Dec 6, 2024
6cbd18d
wast: set discharge date only if not destined to die; do not reset wi…
EvaJanouskova Dec 6, 2024
f42e82b
test_wast: tx coverages were rm
EvaJanouskova Dec 6, 2024
bec0769
wast: rm unused local vars
EvaJanouskova Dec 6, 2024
b949156
wast: footprint assignment simplified; dates properties: tidy up desc…
EvaJanouskova Dec 7, 2024
30ba983
wast & test_wast: update names of tx programmes to be in line with wr…
EvaJanouskova Dec 7, 2024
745d548
scenario_wast_min_model: 30K pop, 2010-2030 for 1st round calibration
EvaJanouskova Dec 10, 2024
8dd0ba0
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Dec 10, 2024
92e3ed8
RF_Wast: prob_death_after_SAMcare updated (substantially lower), henc…
EvaJanouskova Dec 11, 2024
66cf53c
analysis_wast: minor (tidy up comments)
EvaJanouskova Dec 11, 2024
ce8b0ec
analysis_wast: combine deaths of both genders together
EvaJanouskova Dec 11, 2024
5601969
wast: log both mod & sev wasting prevalence (instead of overall prev.…
EvaJanouskova Dec 11, 2024
a41986d
wast & analysis_wast: tidy up
EvaJanouskova Dec 11, 2024
85f5253
wast: rm above5 prevalence logging
EvaJanouskova Dec 11, 2024
03ddcca
Merge remote-tracking branch 'origin/master' into hallett/wasting_module
EvaJanouskova Dec 11, 2024
7666291
analysis_wast: incidence - fix legend names, prevalence - mod & sev w…
EvaJanouskova Dec 12, 2024
037d40d
wast: calculation of under5s for prevalence logging fixed
EvaJanouskova Dec 12, 2024
86b4c85
wast: log wasting prev in 5y+ olds
EvaJanouskova Dec 12, 2024
46a3f58
analysis_wast: prev by age grp - plot mod/sev wast separately, for ye…
EvaJanouskova Dec 12, 2024
e515e0d
analysis_wast: incidence mod:wast props - tidy up
EvaJanouskova Dec 12, 2024
0c4468b
wast: add logging of under5s pop size
EvaJanouskova Dec 12, 2024
f77381e
analysis_wast: tidy up update of df
EvaJanouskova Dec 12, 2024
ecb01f2
wast: log pop sizes (mod/sev/total)
EvaJanouskova Dec 12, 2024
ca519f9
analysis_wast: incidence - plot nmbs of new cases instead of props mo…
EvaJanouskova Dec 13, 2024
3554a40
wast: log avg length of wasting
EvaJanouskova Dec 13, 2024
4fcd605
wast: log initial prevalence
EvaJanouskova Dec 15, 2024
3fdd9da
wast: length logging - sev wasted cannot be on MAM tx
EvaJanouskova Dec 15, 2024
d1d2cce
analysis_wast: plot avg length of wasting by recovery options
EvaJanouskova Dec 15, 2024
d1582c1
analysis_wast: prints rm
EvaJanouskova Dec 15, 2024
e81f630
analysis_wast: add plot init prevalence by age grp
EvaJanouskova Dec 15, 2024
dd59b08
wast: log length for above5 too
EvaJanouskova Dec 16, 2024
0cb7c4c
analysis_wast: higher upper y-axis limit for length of not yet recovered
EvaJanouskova Dec 18, 2024
0d82002
wast: minor (properties description updated)
EvaJanouskova Dec 27, 2024
f13b169
wast: logging adjusted to avoid division by zero
EvaJanouskova Dec 27, 2024
3ac6565
wast & RF_Wast & test_wast: natural death due SAM scheduled when SAM …
EvaJanouskova Dec 27, 2024
8164ed6
wast: tidy up
EvaJanouskova Dec 29, 2024
067062f
wast: log wasting_length_avg only at debug level
EvaJanouskova Dec 29, 2024
0a4dee7
scenario_wast_min_model: setup as for status quo
EvaJanouskova Dec 20, 2024
e9d897f
Merge branch 'master' into hallett/wasting_module
EvaJanouskova Dec 29, 2024
f388ae8
RF_PriorityRanking_ALLPOLICIES: after-merge update
EvaJanouskova Dec 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions resources/ResourceFile_Wasting.xlsx
Git LFS file not shown
Git LFS file not shown
199 changes: 199 additions & 0 deletions src/scripts/wasting_analyses/analysis_wasting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
"""
An analysis file for the wasting module
"""
import datetime
# %% Import statements
from pathlib import Path

import pandas as pd
from matplotlib import pyplot as plt

from tlo import Date, Simulation, logging
from tlo.analysis.utils import compare_number_of_deaths, parse_log_file
from tlo.methods import (
care_of_women_during_pregnancy,
contraception,
demography,
enhanced_lifestyle,
epi,
healthburden,
healthseekingbehaviour,
healthsystem,
hiv,
labour,
newborn_outcomes,
postnatal_supervisor,
pregnancy_supervisor,
symptommanager,
tb,
wasting,
)


class WastingAnalyses:
"""
This class looks at plotting all important outputs from the wasting module
"""

def __init__(self, log_file_path):
self.__log_file_path = log_file_path
# parse wasting logs
self.__logs_dict = \
parse_log_file(self.__log_file_path)['tlo.methods.wasting']

# gender description
self.__gender_desc = {'M': 'Males',
'F': 'Females'}

# wasting types description
self.__wasting_types_desc = {'WHZ<-3': 'severe wasting',
'-3<=WHZ<-2': 'moderate wasting',
'WHZ>=-2': 'not undernourished'}

def plot_wasting_incidence(self):
""" plot the incidence of wasting over time """
w_inc_df = self.__logs_dict['wasting_incidence_count']
w_inc_df.set_index(w_inc_df.date.dt.year, inplace=True)
w_inc_df.drop(columns='date', inplace=True)
# get age year. doesn't matter what wasting category you choose for
# they all have same age groups
age_years = list(w_inc_df.loc[w_inc_df.index[0], 'WHZ<-3'].keys(

))
age_years.remove('5+y')

_row_counter = 0
_col_counter = 0
# plot setup
fig, axes = plt.subplots(nrows=2, ncols=3, sharex=True, sharey=True)
for _age in age_years:
new_df = pd.DataFrame()
for state in w_inc_df.columns:
new_df[state] = \
w_inc_df.apply(lambda row: row[state][_age], axis=1)

new_df = new_df.apply(lambda _row: _row / _row.sum(), axis=1)
plotting = new_df[["WHZ<-3", "-3<=WHZ<-2"]]
# convert into proportions
ax = plotting.plot(kind='bar', stacked=True,
ax=axes[_row_counter, _col_counter],
title=f"incidence of wasting in {_age} infants",
ylim=[0, 0.05])
ax.legend(self.__wasting_types_desc.values(), loc='lower right')
ax.set_xlabel('year')
ax.set_ylabel('proportions')
# move to another row
if _col_counter == 2:
_row_counter += 1
_col_counter = -1
_col_counter += 1 # increment column counter
fig.tight_layout()

def plot_wasting_prevalence(self):
w_prev_df = self.__logs_dict['wasting_prevalence_count']
w_prev_df.set_index(w_prev_df.date.dt.year, inplace=True)
w_prev_df.drop(columns='date', inplace=True)
w_prev_df = w_prev_df.apply(lambda _row: _row / _row.sum(), axis=1)
w_prev_df.plot(kind='bar', stacked=True,
title="Wasting prevalence in children 0-59 months",
ylabel='proportions',
xlabel='year'
)

def plot_modal_gbd_deaths_by_gender(self):
""" compare modal and GBD deaths by gender """
death_compare = \
compare_number_of_deaths(self.__log_file_path, resources)
fig, axs = plt.subplots(nrows=1, ncols=2, sharey=True, sharex=True)
for _col, sex in enumerate(('M', 'F')):
plot_df = death_compare.loc[(['2010-2014', '2015-2019'],
sex, slice(None), 'Childhood Undernutrition'
)].groupby('period').sum()
plotting = plot_df.loc[['2010-2014', '2015-2019']]
ax = plotting['model'].plot.bar(label='Model', ax=axs[_col], rot=0)
ax.errorbar(x=plotting['model'].index, y=plotting.GBD_mean,
yerr=[plotting.GBD_lower, plotting.GBD_upper],
fmt='o', color='#000', label="GBD")
ax.set_title(f'{self.__gender_desc[sex]} '
f'wasting deaths, 2010-2014')
ax.set_xlabel("Time period")
ax.set_ylabel("Number of deaths")
ax.legend(loc=2)
fig.tight_layout()
fig.savefig(
outputs / ('modal_gbd_deaths_by_gender' + datestamp + ".pdf"),
format="pdf"
)


if __name__ == "__main__":
seed = 1

thewati marked this conversation as resolved.
Show resolved Hide resolved
# Path to the resource files used by the disease and intervention methods
resources = Path("./resources")
outputs = Path("./outputs")

# create a datestamp
datestamp = datetime.date.today().strftime("__%Y_%m_%d") + \
datetime.datetime.now().strftime("%H_%M_%S")

# configure logging
log_config = {
# output filename. A timestamp will be added to this.
"filename": "wasting",
"custom_levels": { # Customise the output of specific loggers
"tlo.methods.demography": logging.INFO,
"tlo.methods.population": logging.INFO,
"tlo.methods.wasting": logging.INFO,
'*': logging.WARNING
}
}

# Basic arguments required for the simulation
start_date = Date(2010, 1, 1)
end_date = Date(2030, 1, 2)
pop_size = 30000

# Create simulation instance for this run.
sim = Simulation(start_date=start_date, seed=seed, log_config=log_config)

# Register modules for simulation
sim.register(
demography.Demography(resourcefilepath=resources),
healthsystem.HealthSystem(resourcefilepath=resources,
service_availability=['*'],
cons_availability='default'),
healthseekingbehaviour.HealthSeekingBehaviour(resourcefilepath=resources),
healthburden.HealthBurden(resourcefilepath=resources),
symptommanager.SymptomManager(resourcefilepath=resources),
enhanced_lifestyle.Lifestyle(resourcefilepath=resources),
labour.Labour(resourcefilepath=resources),
care_of_women_during_pregnancy.CareOfWomenDuringPregnancy(
resourcefilepath=resources),
contraception.Contraception(resourcefilepath=resources),
pregnancy_supervisor.PregnancySupervisor(resourcefilepath=resources),
postnatal_supervisor.PostnatalSupervisor(resourcefilepath=resources),
newborn_outcomes.NewbornOutcomes(resourcefilepath=resources),
hiv.Hiv(resourcefilepath=resources),
tb.Tb(resourcefilepath=resources),
epi.Epi(resourcefilepath=resources),
wasting.Wasting(resourcefilepath=resources),
)

sim.make_initial_population(n=pop_size)
sim.simulate(end_date=end_date)

# read the results
output_path = sim.log_filepath

# initialise the wasting class
wasting_analyses = WastingAnalyses(output_path)

# plot wasting incidence
wasting_analyses.plot_wasting_incidence()

# plot wasting prevalence
wasting_analyses.plot_wasting_prevalence()

# plot wasting deaths by gender as compared to GBD deaths
wasting_analyses.plot_modal_gbd_deaths_by_gender()
2 changes: 1 addition & 1 deletion src/tlo/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,6 @@ def get_color_coarse_appt(coarse_appt_type: str) -> str:
'*': 'black',

'FirstAttendance*': 'darkgrey',
'Inpatient*': 'silver',

'Contraception*': 'darkseagreen',
'AntenatalCare*': 'green',
Expand Down Expand Up @@ -804,6 +803,7 @@ def get_color_short_treatment_id(short_treatment_id: str) -> str:

'Lower respiratory infections': 'darkorange',
'Childhood Diarrhoea': 'tan',
'Childhood Undernutrition': 'tomato',

'AIDS': 'deepskyblue',
'Malaria': 'lightsteelblue',
Expand Down
3 changes: 3 additions & 0 deletions src/tlo/methods/hsi_generic_first_appts.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ def do_at_generic_first_appt_non_emergency(hsi_event, squeeze_factor):
if 'Stunting' in sim.modules:
sim.modules['Stunting'].do_routine_assessment_for_chronic_undernutrition(person_id=person_id)

if 'Wasting' in sim.modules:
sim.modules['Wasting'].do_when_acute_malnutrition_assessment(person_id)

else:
# ----------------------------------- ADULT -----------------------------------
if 'OesophagealCancer' in sim.modules:
Expand Down
Loading
Loading