micronutrientsupport / database-architecture

The Postgres database code for the MAPS tool
3 stars 0 forks source link

Update impact summary view to use a non-hardcoded threshold value #95

Closed bgsandan closed 3 years ago

bgsandan commented 3 years ago

Currently impact_summary view has a hardcoded value for all thresholds (abstracted to a simple with CTE).

This should be replaced with a threshold from the threshold table for the selected micronutrient

rbroth commented 3 years ago

We'll need to sort out nutrient name equivalents for the intake_threshold table. For example, the intake_threshold table has "Retinol equivalent (WHO)" and "Retinol activity equivalent (IOM)", which are not micronutrients that appear in the micronutrient table. I am ignoring non-matching micronutrients for the time being.

rbroth commented 3 years ago

Question: how do we want to aggregate the different threshold values? Do we want it for each age/sex/etc. group? Or take an average? Or pick just one group?

bgsandan commented 3 years ago

Hi @rbroth, I think we want to aggregate the thresholds to give a threshold for either Adult Female Equivalent (AFE) or Adult Male Equivalent (AME), don't think it matters too much atm which we use. I'll forward you a table from @kmtang with conversion factors from age to %age of AFE/AME which should help.

We will also eventually need to use this data to scale individual intake in the household intake calculations to get AFE/AME per household so storing the conversion factors probably a good task (though can be put in a linked separate issue if helpful)