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

PR to record the prevalence of disease/condition, still births, neonatal death, maternal mortality #1455

Open
wants to merge 688 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
688 commits
Select commit Hold shift + click to select a range
e7bae22
added function to calculate monthly prevalence of diarrhoea across al…
RachelMurray-Watson Aug 1, 2024
12fa604
added function to calculate monthly prevalence of different ncds. Cal…
RachelMurray-Watson Aug 1, 2024
08f2523
added function to calculate monthly prevalence of different ncds. Cal…
RachelMurray-Watson Aug 1, 2024
02fe58e
Fixed to allow for dataframes to pass through
RachelMurray-Watson Aug 2, 2024
808c4d7
Fixed from None to False
RachelMurray-Watson Aug 2, 2024
96d5096
Fixed from 0 to '0'
RachelMurray-Watson Aug 2, 2024
454d0d3
Fixed calculation of depression in last month
RachelMurray-Watson Aug 2, 2024
08e41a4
Removed checks
RachelMurray-Watson Aug 2, 2024
927a649
Added debugging
RachelMurray-Watson Aug 2, 2024
00d7b4a
Removed print checks
RachelMurray-Watson Aug 12, 2024
2b5c2a3
NOT WORKING but tried to simplify the collection process as was being…
RachelMurray-Watson Aug 13, 2024
03453e1
Now logging properly
RachelMurray-Watson Aug 13, 2024
84aa7e8
Included code for if HIV module isn't loaded
RachelMurray-Watson Aug 14, 2024
1cc0bee
Added/removed check
RachelMurray-Watson Aug 14, 2024
cae5d81
Added function to record number of antenatal stillbirthds
RachelMurray-Watson Aug 14, 2024
20541a2
renamed newborn to neonatal
RachelMurray-Watson Aug 14, 2024
694b132
Accessed all possible data from logs, but it's not matching
RachelMurray-Watson Aug 15, 2024
508eadf
not needed
RachelMurray-Watson Aug 15, 2024
afd8d22
removed prints
RachelMurray-Watson Aug 15, 2024
f934258
changed date to see if things match up more
RachelMurray-Watson Aug 15, 2024
23a4ff0
removed "isn't false"
RachelMurray-Watson Aug 15, 2024
d5cd963
removed "is true"
RachelMurray-Watson Aug 15, 2024
7a5da3e
replaced == false with not
RachelMurray-Watson Aug 15, 2024
531bd4d
Now matching up more. Have to use the second key from the function I …
RachelMurray-Watson Aug 15, 2024
8859633
Edited so no dividing by zero
RachelMurray-Watson Aug 15, 2024
0ba13e7
changed to does not equal to avoid assertion error
RachelMurray-Watson Aug 15, 2024
394ff19
removed unused imports
RachelMurray-Watson Aug 15, 2024
be2ca7b
removed == False
RachelMurray-Watson Aug 15, 2024
0f34786
Intrapartum stillbirth not working
RachelMurray-Watson Aug 16, 2024
dfa727b
added export
RachelMurray-Watson Aug 16, 2024
f146dd2
added export
RachelMurray-Watson Aug 16, 2024
d909b7a
Better readability
RachelMurray-Watson Aug 16, 2024
c3034b1
removed pandas
RachelMurray-Watson Aug 16, 2024
a68acca
isort
RachelMurray-Watson Aug 16, 2024
2196466
changed definition of COPDS
RachelMurray-Watson Aug 16, 2024
3e82dda
changed definition of COPDS
RachelMurray-Watson Aug 16, 2024
5a29382
removed calculations of maternal and newborn mortality pending help
RachelMurray-Watson Aug 16, 2024
9977883
changed years to see if things log differentlu
RachelMurray-Watson Aug 16, 2024
7e5965b
stopped logging stillbirths until fixed
RachelMurray-Watson Aug 16, 2024
2d434fd
CHecked what was registered
RachelMurray-Watson Aug 16, 2024
f390935
Skip Mockitis
RachelMurray-Watson Aug 17, 2024
65d0324
Skip Mockitis, ChronicSyndrome, DiseaseThatCausedA
RachelMurray-Watson Aug 17, 2024
5ab81db
Removed unused
RachelMurray-Watson Aug 18, 2024
ab7573b
Added check of "must have died in the last month"
RachelMurray-Watson Aug 19, 2024
9be65fe
Added check of "must have died in the last month"
RachelMurray-Watson Aug 19, 2024
3c48b0c
Removed denominators
RachelMurray-Watson Aug 19, 2024
1970f0d
Removed brackets and unneeded bracket
RachelMurray-Watson Aug 19, 2024
31be8d0
Changed back to a rate
RachelMurray-Watson Aug 20, 2024
08b4fe0
Added in dataframes to track stillbirths
RachelMurray-Watson Aug 20, 2024
a68ac79
Renamed columns
RachelMurray-Watson Aug 20, 2024
bf667f5
skip some columns
RachelMurray-Watson Aug 20, 2024
c76d021
skip some columns
RachelMurray-Watson Aug 20, 2024
a2e5dcb
Aded skip over dates that go beyond when the prevalence is logged by …
RachelMurray-Watson Aug 21, 2024
cc5bc76
Fixed up tests for all diseases WITH log stored
RachelMurray-Watson Aug 21, 2024
87a2688
Include keeping track of population to go from prevalence to cases
RachelMurray-Watson Aug 21, 2024
c2fb256
Returned to running simulation
RachelMurray-Watson Aug 21, 2024
93f6c05
removed unnecessary prints
RachelMurray-Watson Aug 21, 2024
8987bf1
added record of live birthds
RachelMurray-Watson Aug 21, 2024
3efbe21
added record of live birthds
RachelMurray-Watson Aug 21, 2024
f407f23
added record of live births
RachelMurray-Watson Aug 21, 2024
2de2e8e
redid name of column
RachelMurray-Watson Aug 21, 2024
184df81
Added in test of neonatal deaths, maternal deaths, stillbirths
RachelMurray-Watson Aug 21, 2024
caf9934
remove unused variable
RachelMurray-Watson Aug 21, 2024
dbaf020
isort
RachelMurray-Watson Aug 21, 2024
68c81a7
isort
RachelMurray-Watson Aug 21, 2024
fd939f7
TB recording isn't working...
RachelMurray-Watson Aug 21, 2024
ddca18c
changed to allow for simplified births logging
RachelMurray-Watson Aug 21, 2024
5ff10eb
removed loading
RachelMurray-Watson Aug 21, 2024
f1d4abd
removed unused imports
RachelMurray-Watson Aug 21, 2024
c1a2da7
isort
RachelMurray-Watson Aug 21, 2024
8f0bb0b
removed incorrect assignation
RachelMurray-Watson Aug 22, 2024
42ab8f8
Changed calculation of prevalence on simple whether or not person was…
RachelMurray-Watson Aug 29, 2024
d4f04e8
Changed calculation of prevalence to be the number of people who are …
RachelMurray-Watson Aug 29, 2024
037eb0d
Get_Current_Prevalence have test variable that is true/false and chan…
RachelMurray-Watson Aug 29, 2024
41a63d6
Made test a parameter that is default set to False and can be modifie…
RachelMurray-Watson Aug 29, 2024
3d7e20a
Ensured indenting was correct. Removed tolerance buffer for days and …
RachelMurray-Watson Aug 29, 2024
74b1ce3
Attempted to make the prevalence logging daily, for the purpose of th…
RachelMurray-Watson Aug 30, 2024
ad715fe
Tidied and used function to calculate prevalences.
RachelMurray-Watson Aug 30, 2024
7a06731
Tried to make the log daily by introducing more conditions.
RachelMurray-Watson Aug 30, 2024
58dbf48
Monthly call from functions
RachelMurray-Watson Aug 30, 2024
9d98c28
removed unused variable for checks
RachelMurray-Watson Aug 30, 2024
4a415af
removed unused variable for checks
RachelMurray-Watson Aug 30, 2024
4c939ff
removed unused variable for checks
RachelMurray-Watson Aug 30, 2024
f010139
isort
RachelMurray-Watson Aug 30, 2024
13095fc
new write to log function just for prevalence calculations
RachelMurray-Watson Sep 3, 2024
5e3b922
new write to log function just for prevalence calculations. Now logs …
RachelMurray-Watson Sep 3, 2024
4f4fa7d
new write to log function just for prevalence calculations. Now logs …
RachelMurray-Watson Sep 3, 2024
6800c4a
Shorter run as test
RachelMurray-Watson Sep 4, 2024
7e5c508
Allow mockitis to be read in the GetPrevalence Class.
RachelMurray-Watson Sep 4, 2024
d26f9c0
Set p(infection) of Mockitis to 1 and checked logging
RachelMurray-Watson Sep 4, 2024
04a650c
In demography, fixed labels for direct/indirect/hiv/non hiv deaths
RachelMurray-Watson Sep 4, 2024
21a7db6
Changed malaria prevalence calculator to clinical and severe malaria …
RachelMurray-Watson Sep 4, 2024
933c55d
Changed schisto prevalence calculation to check for Low-infection or …
RachelMurray-Watson Sep 4, 2024
803f828
Changed TB prevalence logging to only include active cases. "I think …
RachelMurray-Watson Sep 4, 2024
f18c119
Now using (df['rt_inj_severity'] != 'none') again to record RTI injuries
RachelMurray-Watson Sep 4, 2024
a7a19a5
Updated description of logger to show what is being saved where
RachelMurray-Watson Sep 4, 2024
10acb45
Added report_prevalence to the skeleton module so that it's formally …
RachelMurray-Watson Sep 4, 2024
018492f
Added option between daily, monthly, and yearly logging
RachelMurray-Watson Sep 4, 2024
600c582
Tidied test to have mockitis test (to check logging structures etc) a…
RachelMurray-Watson Sep 4, 2024
22c7cfc
update for actual runs
RachelMurray-Watson Sep 4, 2024
75fa450
isort
RachelMurray-Watson Sep 4, 2024
34aa5f9
Added stacked plots over time
RachelMurray-Watson Sep 6, 2024
da77fd9
Updated to create files for longterm_trends_all_diseases-2024-09-04T0…
RachelMurray-Watson Sep 9, 2024
f55053c
Changed dates for longterm_trends_all_diseases-2024-09-04T082106Z
RachelMurray-Watson Sep 9, 2024
6b01d10
Added spacing of years so can toggle finer resolution
RachelMurray-Watson Sep 9, 2024
ee3ae2f
Improved docstring
RachelMurray-Watson Sep 9, 2024
88078ef
New file calculating the prevalence of different conditions
RachelMurray-Watson Sep 9, 2024
204c4b8
isort
RachelMurray-Watson Sep 9, 2024
517d4f2
Condensed graph so Panel A is stacked bar charts of raw prevalence ov…
RachelMurray-Watson Sep 9, 2024
c0f2b25
Changed colours
RachelMurray-Watson Sep 9, 2024
d595693
Changed labels on plots
RachelMurray-Watson Sep 9, 2024
ddd6b1b
Included placeholder code for reordering; not yet working
RachelMurray-Watson Sep 9, 2024
5e9ee88
Included placeholder code for reordering; not yet working
RachelMurray-Watson Sep 9, 2024
e4516a2
Added in WPP life expectancy to graph
RachelMurray-Watson Sep 9, 2024
41b4f15
Changed colours
RachelMurray-Watson Sep 9, 2024
bf20864
Removed print statements
RachelMurray-Watson Sep 9, 2024
cf67140
Added a gif of the population pyramids
RachelMurray-Watson Sep 9, 2024
1ffa79e
Tidied graphs
RachelMurray-Watson Sep 10, 2024
ea9ece5
Tidied graphs
RachelMurray-Watson Sep 10, 2024
5dba495
Changed to a bar chart and ensured that colours matched
RachelMurray-Watson Sep 10, 2024
5c0d05d
Removed print check
RachelMurray-Watson Sep 10, 2024
99096fd
Removed colour generation
RachelMurray-Watson Sep 10, 2024
73ef618
Removed axis
RachelMurray-Watson Sep 10, 2024
c4d29d9
Now print all files
RachelMurray-Watson Sep 10, 2024
ed92007
Added gif for line graph
RachelMurray-Watson Sep 10, 2024
c9197f5
Added checks for dummy runs in life expectancy calculations. Checks f…
RachelMurray-Watson Sep 10, 2024
0538eb8
Changed timing
RachelMurray-Watson Sep 11, 2024
db92d01
Have total minutes per treatment_id
RachelMurray-Watson Sep 11, 2024
f0201cd
Have graphs of minutes per treatment id
RachelMurray-Watson Sep 11, 2024
21b1de7
Have graphs of minutes per treatment id
RachelMurray-Watson Sep 11, 2024
22b726e
Tidied up graphs
RachelMurray-Watson Sep 11, 2024
4b6837b
Changed to test new logs
RachelMurray-Watson Sep 11, 2024
7a40f7e
test
RachelMurray-Watson Sep 11, 2024
650c975
test
RachelMurray-Watson Sep 11, 2024
2a39627
return to actual params
RachelMurray-Watson Sep 11, 2024
2701a52
return to actual params
RachelMurray-Watson Sep 12, 2024
27ff926
trying
RachelMurray-Watson Sep 12, 2024
80d0693
Loaded dataframes to access
RachelMurray-Watson Sep 12, 2024
4a0f0a6
Added loops over each event and cadre. Adding time to the cadre and t…
RachelMurray-Watson Sep 13, 2024
be471d1
Changed it back to be the first part of treatment id (as those are th…
RachelMurray-Watson Sep 13, 2024
bf2e3ac
Changed it back to be the first part of treatment id (as those are th…
RachelMurray-Watson Sep 13, 2024
b02fd60
Fixed legends and titles
RachelMurray-Watson Sep 13, 2024
56484a4
Changed ASFR axis
RachelMurray-Watson Sep 13, 2024
ca21d86
Changed dates
RachelMurray-Watson Sep 13, 2024
85c8d76
Left-censured the x axis for the deaths and life expectancy graph
RachelMurray-Watson Sep 13, 2024
3965622
New dates
RachelMurray-Watson Sep 13, 2024
211025f
Edited for neatness
RachelMurray-Watson Sep 16, 2024
cc2681e
Modified for latest run input_file = '/Users/rem76/PycharmProjects/TL…
RachelMurray-Watson Sep 20, 2024
685c777
Changed so graphs are from 2020 on
RachelMurray-Watson Sep 20, 2024
a3c3350
Remove the demography summary logger
RachelMurray-Watson Sep 24, 2024
849ed03
edited for latest run
RachelMurray-Watson Sep 30, 2024
5aba8a4
edited for latest run
RachelMurray-Watson Sep 30, 2024
7eac186
Merge remote-tracking branch 'origin/rmw/long_term_projections' into …
RachelMurray-Watson Sep 30, 2024
0901eb3
Removed print statements
RachelMurray-Watson Sep 30, 2024
3564f22
Merge branch 'refs/heads/rmw/log_prevalence_all_disease' into rmw/lon…
RachelMurray-Watson Sep 30, 2024
9afedd5
Accidentally deleted scenario directory
RachelMurray-Watson Sep 30, 2024
b02b395
changed date raneg
RachelMurray-Watson Oct 1, 2024
a9b490f
changed date raneg
RachelMurray-Watson Oct 1, 2024
43c9180
resized figures
RachelMurray-Watson Oct 1, 2024
0023c25
Changed prevalence calculation for RTI to ensure accident happened in…
RachelMurray-Watson Oct 1, 2024
9aa4520
Changed prevalence calculation for RTI to ensure accident happened in…
RachelMurray-Watson Oct 1, 2024
ff99474
Aesthetic edits
RachelMurray-Watson Oct 4, 2024
93189f3
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
d98089d
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
1030b35
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
fcf1581
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
10f438d
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
5ab1312
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
a2aef46
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
0aabec2
Merge branch 'refs/heads/rmw/update_dependencies' into rmw/long_term_…
RachelMurray-Watson Oct 4, 2024
f66b281
Updated modules so that all INIT_DEPENDENCIES and OPTIONAL_INIT_DEPEN…
RachelMurray-Watson Oct 4, 2024
d588117
Moved all new dependencies to OPTIONAL_INIT_DEPENDENCIES
RachelMurray-Watson Oct 4, 2024
7305cc5
Merge branch 'refs/heads/rmw/update_dependencies' into rmw/long_term_…
RachelMurray-Watson Oct 4, 2024
0fc8682
Type
RachelMurray-Watson Oct 4, 2024
d4d186f
Merge branch 'refs/heads/rmw/update_dependencies' into rmw/long_term_…
RachelMurray-Watson Oct 4, 2024
3938a9f
Typo
RachelMurray-Watson Oct 4, 2024
a42bd61
Merge branch 'refs/heads/rmw/update_dependencies' into rmw/long_term_…
RachelMurray-Watson Oct 4, 2024
028c830
Removed unnecessary subgraphs
RachelMurray-Watson Oct 4, 2024
1e0b36f
Updated circular dependencies
RachelMurray-Watson Oct 4, 2024
82b63c0
Updated circular dependencies
RachelMurray-Watson Oct 4, 2024
282f05a
Merge branch 'refs/heads/rmw/update_dependencies' into rmw/long_term_…
RachelMurray-Watson Oct 4, 2024
4847476
Tried to add subgraph
RachelMurray-Watson Oct 4, 2024
b161b6c
Pregnancy modules are now diamonds
RachelMurray-Watson Oct 4, 2024
22cfd7d
Changed to additional dependencies
RachelMurray-Watson Oct 4, 2024
2a7d8c8
Added subgraphs
RachelMurray-Watson Oct 4, 2024
4cbc4be
graph of the property dependencies between modules
RachelMurray-Watson Oct 5, 2024
2da1b06
Have graph of properties as they relate to modules
RachelMurray-Watson Oct 7, 2024
5bceeee
Removed bad graph
RachelMurray-Watson Oct 7, 2024
6f86741
Added subgraphs
RachelMurray-Watson Oct 8, 2024
9adb1a4
Graph of properties from disease modules that contribute to other dis…
RachelMurray-Watson Oct 8, 2024
308b522
Delete src/scripts/longterm_projections/property_dependency_graph.py
RachelMurray-Watson Oct 8, 2024
ab3b3b6
isort
RachelMurray-Watson Oct 8, 2024
dc92321
Merge remote-tracking branch 'origin/rmw/update_dependencies' into rm…
RachelMurray-Watson Oct 8, 2024
0911247
isort
RachelMurray-Watson Oct 8, 2024
23cd2d1
Merge branch 'master' into rmw/update_dependencies
RachelMurray-Watson Oct 8, 2024
dc67a0e
Changed names of functions to avoid overlap
RachelMurray-Watson Oct 8, 2024
27bd108
Merge remote-tracking branch 'origin/rmw/update_dependencies' into rm…
RachelMurray-Watson Oct 8, 2024
4f8cb2d
Updated docstring
RachelMurray-Watson Oct 8, 2024
7f4d38f
Initial attempt at creating module-level property graphs
RachelMurray-Watson Oct 8, 2024
fc49e88
Fixed typo
RachelMurray-Watson Oct 8, 2024
31a61a0
Graphs for each individual module
RachelMurray-Watson Oct 8, 2024
3b94583
Aesthetics - still needs colour
RachelMurray-Watson Oct 8, 2024
b17e193
reduced duplication
RachelMurray-Watson Oct 9, 2024
987152f
Removed all additional dependencies
RachelMurray-Watson Oct 17, 2024
8c4f656
Merge branch 'refs/heads/master' into rmw/graph_dependencies
RachelMurray-Watson Oct 17, 2024
f7bb53d
typo
RachelMurray-Watson Oct 17, 2024
5363892
Moved to get_properties folder
RachelMurray-Watson Oct 17, 2024
79697c2
Tidied
RachelMurray-Watson Oct 21, 2024
bf1de4f
Increased max date
RachelMurray-Watson Oct 21, 2024
422607f
Tidied and changed to 2059
RachelMurray-Watson Oct 21, 2024
1e9f383
Increased max year for pop line
RachelMurray-Watson Oct 21, 2024
afe0618
Increased axis for deaths over time
RachelMurray-Watson Oct 21, 2024
a4e5666
Improved plotting
RachelMurray-Watson Oct 21, 2024
723fff4
changed normalization to 2020
RachelMurray-Watson Oct 21, 2024
30cbeaf
changed normalization to 2020 and improved plotting
RachelMurray-Watson Oct 21, 2024
f64d484
aesthetics
RachelMurray-Watson Oct 21, 2024
a383132
plotting
RachelMurray-Watson Oct 22, 2024
a50acf9
Merge branch 'refs/heads/rmw/graph_dependencies' into rmw/long_term_p…
RachelMurray-Watson Oct 23, 2024
a84b2b4
Typo - left out fraction_of_last_age_survived in calculating probabi…
RachelMurray-Watson Oct 23, 2024
2807b23
add lifestyle logging
RachelMurray-Watson Oct 23, 2024
194131b
shorter run + demography.detail to see if there is an issue in assump…
RachelMurray-Watson Oct 23, 2024
00e9fe8
Merge branch 'refs/heads/master' into rmw/long_term_projections
RachelMurray-Watson Oct 23, 2024
a496369
updated so that it looks at the entire code of whatever disease of in…
RachelMurray-Watson Oct 23, 2024
a17c1a2
actual logging for demography detail
RachelMurray-Watson Oct 24, 2024
f38debb
changed to latest short run
RachelMurray-Watson Nov 6, 2024
a19f8c8
Investigation into differences in LE for 2010 - 2020. Could be becaus…
RachelMurray-Watson Nov 6, 2024
03d18e6
removed unneccessary LE graph
RachelMurray-Watson Nov 7, 2024
9d086d3
More plots to investiagte proprtion of life groups lived
RachelMurray-Watson Nov 7, 2024
bfbadc4
Sample LE estimates with one year age groups and 0.5 year at beginnin…
RachelMurray-Watson Nov 18, 2024
c0fc49c
Can't get half-year age groups to work
RachelMurray-Watson Nov 18, 2024
4fedd88
Updated date
RachelMurray-Watson Nov 19, 2024
2314e40
Scripts to try and investigate why RTI DALYs etc goes up, but there i…
RachelMurray-Watson Nov 19, 2024
b2c3de4
revert to original
RachelMurray-Watson Nov 25, 2024
17c2296
New notebook for investigating the differences in LE between our meth…
RachelMurray-Watson Nov 25, 2024
0e23fc5
New notebook for investigating the differences in LE between our meth…
RachelMurray-Watson Nov 25, 2024
00809db
New notebook for investigating the differences in LE between our meth…
RachelMurray-Watson Nov 25, 2024
c100567
Merge branch 'refs/heads/master' into rmw/long_term_projections
RachelMurray-Watson Nov 25, 2024
85d8c7f
To investigate RTI
RachelMurray-Watson Dec 5, 2024
71d365b
Formattin
RachelMurray-Watson Dec 10, 2024
60ccfb1
Add in scenarios for baseline (business as usual), renamed perfect wo…
RachelMurray-Watson Dec 18, 2024
28f0503
Added in two lifestyle scenarios: cancer and CMD. Hard to paramaterise
RachelMurray-Watson Dec 18, 2024
cf3f81c
Fixed number_of_draws
RachelMurray-Watson Dec 18, 2024
3bec301
50% increase/decrease in probabilities instead of doubling?
RachelMurray-Watson Dec 18, 2024
1fb6089
Set up to run
RachelMurray-Watson Dec 19, 2024
29051d3
Added MDA_event to try and ensure that MDA events are scheduled
RachelMurray-Watson Dec 20, 2024
48b06e7
Added MDA_event to try and ensure that MDA events are scheduled
RachelMurray-Watson Dec 20, 2024
a0223c9
Merge branch 'refs/heads/master' into rmw/long_term_projections
RachelMurray-Watson Dec 20, 2024
be55fd1
Merge branch 'refs/heads/master' into rmw/log_prevalence_all_disease
RachelMurray-Watson Jan 7, 2025
fe1448e
Merge remote-tracking branch 'origin/rmw/log_prevalence_all_disease' …
RachelMurray-Watson Jan 7, 2025
d12bfe8
Somehow prevalence logging for HIV was removed
RachelMurray-Watson Jan 7, 2025
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
8 changes: 8 additions & 0 deletions src/tlo/methods/alri.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,14 @@ def report_daly_values(self):
daly_values_by_pathogen = daly_values_by_pathogen.add_prefix('ALRI_')
return daly_values_by_pathogen

def report_prevalence(self):
# This returns dataframe that reports on the prevalence of ALRI for all individuals
df = self.sim.population.props
total_prev = len(
df[(df['is_alive']) & (df['ri_current_infection_status'])]
) / len(df[df['is_alive']])

return total_prev
def over_ride_availability_of_certain_consumables(self):
"""Over-ride the availability of certain consumables, according the parameter values provided."""
p = self.parameters
Expand Down
9 changes: 9 additions & 0 deletions src/tlo/methods/bladder_cancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,15 @@ def report_daly_values(self):

return disability_series_for_alive_persons

def report_prevalence(self):
# This reports on the prevalence of bladder cancer for all individuals

df = self.sim.population.props
total_prev = len(
df[(df.bc_status != 'none') & (df.is_alive)]
) / len(df[df.is_alive])
return total_prev

def do_at_generic_first_appt(
self,
person_id: int,
Expand Down
8 changes: 8 additions & 0 deletions src/tlo/methods/breast_cancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,14 @@ def report_daly_values(self):

return disability_series_for_alive_persons

def report_prevalence(self):
# This returns dataframe that reports on the prevalence of breast cancer for all individuals
df = self.sim.population.props
total_prev = len(
df[(df['is_alive']) & (df['brc_status'] != 'none')]
) / len(df[df['is_alive']])

return total_prev
def do_at_generic_first_appt(
self,
person_id: int,
Expand Down
13 changes: 13 additions & 0 deletions src/tlo/methods/cardio_metabolic_disorders.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,19 @@ def left_censor(obs, window_open):

return dw

def report_prevalence(self):
"""Report prevalence of disease to the HealthBurden module"""
df = self.sim.population.props
prevalence_dict = {}

for condition in self.conditions:
prevalence = df[f'nc_{condition}'].sum() / len(df)
prevalence_dict[condition] = prevalence

# Create a DataFrame from the prevalence dictionary
prevalence_df = pd.DataFrame(prevalence_dict, index=[0])
return prevalence_df

def on_hsi_alert(self, person_id, treatment_id):
"""
This is called whenever there is an HSI event commissioned by one of the other disease modules.
Expand Down
9 changes: 9 additions & 0 deletions src/tlo/methods/copd.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ def report_daly_values(self):
df = self.sim.population.props
return df.loc[df.is_alive, 'ch_lungfunction'].map(self.models.disability_weight_given_lungfunction)

def report_prevalence(self):
# This returns dataframe that reports on the prevalence of COPD for all individuals
df = self.sim.population.props
total_prev = len(
df[(df['is_alive']) & (df['ch_lungfunction'] > 3)] # 3 is mild COPD
) / len(df[df['is_alive']])

return total_prev

def define_symptoms(self):
"""Define and register Symptoms"""
self.sim.modules['SymptomManager'].register_symptom(
Expand Down
50 changes: 49 additions & 1 deletion src/tlo/methods/demography.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def __init__(self, name=None, resourcefilepath=None, equal_allocation_by_distric
),

'district_num_of_residence': Property(
Types.CATEGORICAL,
Types.CATEGORICAL,
'The district number in which the person is resident',
categories=['SET_AT_RUNTIME']
),
Expand Down Expand Up @@ -383,6 +383,54 @@ def on_birth(self, mother_id, child_id):
'mother_age_at_pregnancy': _mother_age_at_pregnancy}
)

def report_prevalence(self):
"""
This function reports the prevalence of maternal death and neonatal deaths for this module generated in the previous month.
Returns a dataframe with these values.
"""
if 'SimplifiedBirths' not in self.sim.modules or 'Contraception' not in self.sim.modules:
neonatal_mortality_rate = None
maternal_mortality_rate = None
live_births = None
else:
df = self.sim.population.props
if len(df[(df['age_days'] < 29)]) == 0:
neonatal_mortality_rate = 0
maternal_mortality_rate = 0
live_births = 0
else:
neonatal_deaths = len(df[(df['age_days'] < 29) & (df['age_years'] == 0) & ~(df['is_alive']) & (
df['date_of_death'] >= (self.sim.date - DateOffset(months=1)))])
live_births = len(df[(df['age_days'] < 29) & (df['age_years'] == 0)])
neonatal_mortality_rate = neonatal_deaths/live_births * 1000
maternal_direct_deaths = len(df.loc[
(df['cause_of_death'] == 'Maternal Disorders') &
(df['date_of_death'] >= (self.sim.date - DateOffset(months=1)))
])
indirect_deaths_non_hiv = len(df.loc[
(df['is_pregnant'] | df['la_is_postpartum']) &
(df['cause_of_death'].str.contains(
'Malaria|Suicide|ever_stroke|diabetes|chronic_ischemic_hd|ever_heart_attack|chronic_kidney_disease') |
(df['cause_of_death'] == 'TB')) &
(df['date_of_death'] >= (self.sim.date - DateOffset(months=1)))
])
indirect_deaths_hiv = len(df.loc[
(df['is_pregnant'] | df['la_is_postpartum']) &
df['cause_of_death'].str.contains('AIDS_non_TB|AIDS_TB') &
(df['date_of_death'] >= (self.sim.date - DateOffset(months=1)))
])
indirect_deaths_hiv = indirect_deaths_hiv * 0.3 # https://www.who.int/publications/i/item/9789240068759
maternal_deaths = maternal_direct_deaths + indirect_deaths_non_hiv + indirect_deaths_hiv
maternal_mortality_rate = maternal_deaths/live_births * 1000

health_values_df = pd.DataFrame({
'NMR': [neonatal_mortality_rate],
'MMR': [maternal_mortality_rate],
'live_births': [live_births]
})

return health_values_df

def _edit_init_pop_to_prevent_persons_greater_than_max_age(self, df, max_age: int):
"""Return an edited version of the `pd.DataFrame` describing the probability of persons in the population being
created with certain characteristics to reflect the constraint the persons aged greater than `max_age_initial`
Expand Down
14 changes: 14 additions & 0 deletions src/tlo/methods/depression.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,20 @@ def right_censor(obs, window_close):

return av_daly_wt_last_month

def report_prevalence(self):
# This reports on the prevalence of depression for all individuals

df = self.sim.population.props
any_depr_in_the_last_month = df[((df['is_alive']) & (
~pd.isnull(df['de_date_init_most_rec_depr']) & (df['de_date_init_most_rec_depr'] <= self.sim.date)
) & (
pd.isnull(df['de_date_depr_resolved']) |
(df['de_date_depr_resolved'] >= (self.sim.date - DateOffset(months=1)))
))]
total_prev = len(
any_depr_in_the_last_month
) / len(df[df.is_alive])
return total_prev
def _check_for_suspected_depression(
self, symptoms: List[str], treatment_id: str, has_even_been_diagnosed: bool
):
Expand Down
7 changes: 7 additions & 0 deletions src/tlo/methods/diarrhoea.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,13 @@ def report_daly_values(self):
average_daly_weight_in_last_month = pd.Series(values, idx) / days_last_month
return average_daly_weight_in_last_month.reindex(index=df.loc[df.is_alive].index, fill_value=0.0)

def report_prevalence(self):
df = self.sim.population.props
total_prev = len(
df[df.gi_has_diarrhoea & df.is_alive]
) / len(df[df.is_alive])
return total_prev

def look_up_consumables(self):
"""Look up and store the consumables item codes used in each of the HSI."""
ic = self.sim.modules['HealthSystem'].get_item_code_from_item_name
Expand Down
10 changes: 10 additions & 0 deletions src/tlo/methods/epilepsy.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ def report_daly_values(self):
df = self.sim.population.props # shortcut to population properties dataframe
return df.loc[df.is_alive, 'ep_disability']

def report_prevalence(self):
# This returns dataframe that reports on the prevalence of epilepsy for all individuals
df = self.sim.population.props
total_prev = len(
df[(df['is_alive']) & (df['ep_seiz_stat'] != '0')]
) / len(df[df['is_alive']])

return total_prev


def transition_seizure_stat(self):
"""
This function handles all transitions in epilepsy seizure status, for those on and off anti epileptics. The
Expand Down
Loading