os-climate / witness-core

Evaluate climate change impact
Apache License 2.0
12 stars 12 forks source link

Covid model #7

Closed MichaelTiemannOSC closed 7 months ago

MichaelTiemannOSC commented 8 months ago

These changes attempt to demonstrate how some new topic, such as the effects of a pandemic, can affect both the available workforce (diminished due to Long Covid) and total population (due to excess deaths). This could be something that gets related to temperature (increases lead to more zoonotic threats), and it could be something where each pandemic runs it own course over a 100 year period. But right now its written to just layer effects onto the workforce and death rates (not birth rates) as a constant drag.

I could not figure out how to get a displayable node in the Input parameters section of Data management. If I could have, it would make it a lot easier to upload new data files and re-run models without the need to rebuild everything from scratch every time. Feel free to drop comments in the code review.

@ sostrades-pjbarjhoux @sostrades-matthieu-meaux @sostrades-tchevalier

valentinjoncquieres commented 8 months ago

Hello Michael,

Thanks a lot for your valuable contribution.

A few remarks regarding your contribution before merge :

Regarding your issue, if you update the grammar in the population discipline (in the DESC-IN), you should see the input widget on the platform (once updated).

MichaelTiemannOSC commented 8 months ago

Agree on all points.

The docs are a bit sketchy. Where should I find flag documenation? I found reference to the word flag in l0_test_population_discipline.py and a mechanism here:

        assumptions_dict = ClimateEcoDiscipline.assumptions_dict_default
        assumptions_dict['activate_climate_effect_population'] = False

It looks like each discipline has its own assumptions_dict, so I'll try to update the correct one.

On the gradient front, I initially planned for the pandemic to act as a universal force, but on second thought there are some other factors: the first year of the pandemic, a certain percentage of the population is infected. The next year, it spreads both to new victims, but can also reinfect previous victims. The cumulative effects of reinfection appear particularly bad for COVID. So what I'm thinking is that at the very least there should be some kind of exponential infection effect that spreads through the population (related to r-factor). In that case we can look up the probabilities of disabling Long Covid upon first infection and also the death rates of first infections. Later we can add the re-infection effect. We can also add a vaccine diffusion and vaccine effectiveness rate (which seems to affect the death rates, but not necessarily Long Covid).

I would be very happy to schedule a session where we could work this out on a virtual chalkboard. I'm sure I could grovel the information out slowly by sleuthing, but I suspect is the kind of thing that we could sort in an hour.

On the documentation front, I see two things. First, I found both population_discipline.md and how_to_model_a_study.md. But I also found that in many places the documentation is just a stub file, or missing. I think it would be helpful for the documentation to refer to python files (as it sometimes does) and also for python files to reference the relevant places in the doc files (so that people know where to update things as they make enhancements).

I'll look at modifying the grammar. Thanks!

MichaelTiemannOSC commented 8 months ago

Regarding the grammar of DESC_IN, I added these:

        GlossaryCore.PandemicParamDf['var_name']: desc_in_default_pandemic_param,
    'pandemic_param': {'type': 'dataframe', 'default': desc_in_default_pandemic_param['default'], 'unit': '-',
                           'dataframe_descriptor': {'param': ('string', None, False),
                                                'disability': ('float', None, False),
                                                'mortality': ('float', None, False),}
                           },

What am I missing?

valentinjoncquieres commented 8 months ago

Hello Michael,

I will attempt to answer some of your questions:

-Regarding documentation, the how_to_model_a_study.md is a work in progress and is not relevant or complete. For each discipline, you have a .md file with the name of the discipline in a documentation folder. We are actively working on a documentation guide on how to improve/create your documentation model. We are also working with Sphinx to create documentation for Sostrades with Python files.

-Finally, for the desc_in, it looks great. If your GUI is updated, you should see a new widget in your study.

Regards,

Valentin Joncquieres

MichaelTiemannOSC commented 8 months ago

Good news...at this point the GUI is showing the pandemic data frame. Moreover, I can load new values via CSV files so I don't have to stop, delete, rebuild, and restart the server just to change some values. I still have to work out the gradient math, and that really depends more on me getting comfortable with how the pandemic model sits across the Workforce calculation (if it does) than the working age population model (which it currently does).

sostrades-matthieu-meaux commented 8 months ago

Hello Michael,

Good news that the False to True worked well.

Workforce population is directly extracted from working age population. If you didn’t modify the employment rate variable (which is fixed for now) it should work without any issue if you upated the population or working population.

Best regards,

Matthieu

From: Michael Tiemann @.> Sent: Monday, March 11, 2024 2:51 AM To: os-climate/witness-core @.> Cc: Matthieu Meaux @.>; Mention @.> Subject: Re: [os-climate/witness-core] Covid model (PR #7)

This mail has been sent from an external source. Do not reply to it, or open any links/attachments unless you are sure of the sender's identity.

Good news...at this point the GUI is showing the pandemic data frame. Moreover, I can load new values via CSV files so I don't have to stop, delete, rebuild, and restart the server just to change some values. I still have to work out the gradient math, and that really depends more on me getting comfortable with how the pandemic model sits across the Workforce calculation (if it does) than the working age population model (which it currently does).

— Reply to this email directly, view it on GitHubhttps://github.com/os-climate/witness-core/pull/7#issuecomment-1987489753, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXELDL3ZK7TXJ3TYA4TO5HLYXULZ3AVCNFSM6AAAAABDZGWRJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGQ4DSNZVGM. You are receiving this because you were mentioned.Message ID: @.**@.>> This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

MichaelTiemannOSC commented 8 months ago

Refactored pandemic effects so that disability (due to long covid) affects employment rate in the macroeconomics model and mortality affects death rate in the population model. Comments welcome as to whether I've followed the right patterns in doing this.

I continue to update the changes with the validation branch but if those merges are re-creating history and/or creating confusion, let me know what you'd like me to fix.

sostrades-tchevalier commented 8 months ago

Hi Michael, I think it's good practice for us to take and handle these inputs properly, and AFAIK when discussed this morning it was not creating chaos, so I'd advocate to continue :-) Best regards, Thierry

Le jeu. 14 mars 2024 à 11:08, Michael Tiemann @.***> a écrit :

Refactored pandemic effects so that disability (due to long covid) affects employment rate in the macroeconomics model and mortality affects death rate in the population model. Comments welcome as to whether I've followed the right patterns in doing this.

I continue to update the changes with the validation branch but if those merges are re-creating history and/or creating confusion, let me know what you'd like me to fix.

— Reply to this email directly, view it on GitHub https://github.com/os-climate/witness-core/pull/7#issuecomment-1997085264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXHREL2Z3TLPBHBTAULKQQ3YYFZJZAVCNFSM6AAAAABDZGWRJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJXGA4DKMRWGQ . You are receiving this because you were mentioned.Message ID: @.***>