WFP-VAM / prism-app

PRISM is an interactive map-based dashboard that simplifies the integration of geospatial data on hazards, along with information on socioeconomic vulnerability
MIT License
48 stars 34 forks source link

Calculate stats from admin level and point data #322

Open wadhwamatic opened 2 years ago

wadhwamatic commented 2 years ago

One component of this calculations is the inclusion of client-side calculations based on numeric values which are stored in either admin level data layers or in point data layers. The calculations are basic including a sum, mean, median, min and max based on a dataset.

1) For admin data for example, calculate a sum of food insecure people across a province (admin 1) where the number of food insecure is captured at the district level (admin 2).

2) For point data, an additional parameter should include a buffer. In this example, the analysis would check to see if a value >= 'warning' was recorded in a given date range. Results are returned by admin areas within 500 meters of the point Slide8

3) Another example of point data analysis shows values which are read from a Kobo survey's "measurement" field Slide9

wadhwamatic commented 1 year ago

@ericboucher - I was thinking that for some basic calculations, we could consider making this a field that gets calculated in the configuration process instead of creating a user interface to trigger the calculation.

For example, in RBD, there's a need to calculate the percent of people in each phase classification. We have the number of people available across phases so this would be a simple calculation for each admin area. It could look like this:

"calc_fields": {
  "total_pop_admin2": {
    "label": "Total population (admin 2)",
    "calc": "pop_ph1_admin2 + pop_ph2_admin2 + pop_ph3_admin2 + pop_ph4_admin2 + pop_ph5_admin2"
  },
  "calc_perc_ph_3": {
    "label": "Percent of population in phase 3",
    "calc": "pop_ph3_admin2 / total_pop_admin2"
  },
  "calc_perc_ph_4": {
    "label": "Percent of population in phase 4",
    "calc": "pop_ph4_admin2 / total_pop_admin2"
  },
  "calc_perc_ph_5": {
    "label": "Percent of population in phase 5",
    "calc": "pop_ph5_admin2 / total_pop_admin2"
  },
  "calc_perc_ph_3_5": {
    "label": "Percent of population in phases 3 to 5",
    "calc": "calc_perc_ph_3 + calc_perc_ph_4 + calc_perc_ph_5"
  }
}

Each of these fields could then be included in the tooltip. What do you think?