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

Fix YLL/Y:D/DALY and death #455

Merged
merged 12 commits into from
Jun 25, 2024
Merged

Fix YLL/Y:D/DALY and death #455

merged 12 commits into from
Jun 25, 2024

Conversation

jamesturner246
Copy link
Contributor

@jamesturner246 jamesturner246 commented Jun 20, 2024

Fixes #442.

The loops for mean and std have been tidied up, and are now 'opt-in', so no unwanted surprises in other columns that don't opt in.

YLL/YLD/DALY are now correctly computed by dividing by active PLUS deceased population.

Everything that should be an integer, such as deaths, migrations, weight classifications, is now an integer. Update your scripts accordingly.

@jamesturner246 jamesturner246 marked this pull request as ready for review June 20, 2024 16:21
@jamesturner246
Copy link
Contributor Author

jamesturner246 commented Jun 20, 2024

Don't they do CI on these Ubuntu builder images? 😕

 Preparing to unpack .../00-firefox_1%3a1snap1-0ubuntu2_amd64.deb ...
=> Installing the firefox snap
==> Checking connectivity with the snap store
===> Unable to contact the store, trying every minute for the next 30 minutes
==> Installing the firefox snap
error: cannot install "firefox": cannot query the store for updates: got
       unexpected HTTP status code 503 via POST to
       "https://api.snapcraft.io/v2/snaps/refresh"
dpkg: error processing archive /tmp/apt-dpkg-install-V2b2KG/00-firefox_1%3a1snap1-0ubuntu2_amd64.deb (--unpack):
 new firefox package pre-installation script subprocess returned error exit status 1
Please restart all running instances of firefox, or you will experience problems.

@jzhu20
Copy link
Contributor

jzhu20 commented Jun 24, 2024

I don't really understand the codes for calculating standard deviation.
Lines 452-456 and 458-461: Do you substract individual value from group mean, then take squared to generate sum? I cannot locate this step. I get sqrt(sum/count) or sqrt(sum/(count+deaths)). @jamesturner246

@jamesturner246
Copy link
Contributor Author

Hi @jzhu20, this was done in a prior PR -- see lines 402-434.

@jamesturner246
Copy link
Contributor Author

Any thoughts @alexdewar?

@alexdewar
Copy link
Contributor

Sorry for the slow reply! I'll take a look at this today

Copy link
Contributor

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've eyeballed the code and it looks like it's doing the right thing. I've made some comments, none of which are actually about this PR 🙃

That said, the calculate_population_statistics() method is a bit overcomplicated (we have to suppress a clang-tidy warning about this), so trying to keep track of everything that's going on made my head hurt. We should probably factor out some of the logic into separate functions at some point. Maybe we need a new issue for this?

if (!entity.is_active()) {
if (!entity.is_alive() && entity.time_of_death() == current_time) {
if (!person.is_active()) {
if (!person.is_alive() && person.time_of_death() == current_time) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not relevant for this PR, but I feel like a has_died() method would be clearer than an is_alive() one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you'd have is_alive and has_died = !is_alive functions?

Unless you mean like:

bool Person::has_just_died(unsigned int current_time) {
    return !is_alive() && time_of_death() == current_time;
}

@@ -487,9 +502,6 @@ void AnalysisModule::initialise_output_channels(RuntimeContext &context) {
channels_.emplace_back("incidence_" + disease.code.to_string());
}

channels_.emplace_back("disability_weight");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need disability_weight anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One can just divide YLD by 100000 to get it if they still want. I understand YLD is the actually useful one.

Comment on lines 310 to 312
if (series.size() > 0) {
throw std::logic_error("This should be a new object!");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make more sense to return a new DataSeries object rather than modify an input argument.

But that's not something we need to do now.

@jamesturner246
Copy link
Contributor Author

That said, the calculate_population_statistics() method is a bit overcomplicated (we have to suppress a clang-tidy warning about this), so trying to keep track of everything that's going on made my head hurt. We should probably factor out some of the logic into separate functions at some point. Maybe we need a new issue for this?

Agree in principle, but I'm hesitant to invest any more time in this whilst knowing it will eventually be replaced by @TinyMarsh's work. Let's wait for the result of that before making any decisions.

@jamesturner246 jamesturner246 merged commit 0f613a6 into main Jun 25, 2024
5 checks passed
@jamesturner246 jamesturner246 deleted the fix_yll_death branch June 25, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix incorrect YLL and deaths in output
3 participants