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
47 stars 34 forks source link

[Feature Request]: aggregate CDI results by admin area and make available for download #1337

Open wadhwamatic opened 1 week ago

wadhwamatic commented 1 week ago

Provide a clear and concise description of what you want to happen.

Users have requested access to CDI data aggregated by admin areas. I believe that hip-analysis already supports this (see zonal stats in https://github.com/WFP-VAM/hip-analysis/blob/dev/hip/analysis/analyses/drought.py) but PRISM hasn't made use of this capability as of yet.

A few things to consider:

  1. Can hip-service / hip-analysis use the zones used in PRISM without issue?
  2. I believe this would warrant a separate layer for admin-level CDI so that users can choose between point-estimate CDI or admin-level CDI in the layer navigation panel
  3. We would need to add configuration of an admin-level CDI layer in layers.json
  4. Should we add a new layer sub-type - composite_aggregate?

Is there anything else you can add about the proposal? You might want to link to related issues here, if you haven't already.

No response

wadhwamatic commented 1 week ago

would like to hear your thoughts on the layer type question (point 4 in the description) @ericboucher

ericboucher commented 1 week ago

I believe we could keep the same layer type but add a config flag.

It might be worth thinking about a specific tab design for the composite layers so that we don't have to duplicate the layer in the table? Maybe a toggle or something like that could be sufficient?

gislawill commented 1 week ago

@ericboucher do you have any maxims you use to determine when to define a new layer type vs when to add to an existing layer type?

We're facing a similar question in #1332 in which we need to add a collection of geojson polygons to the map. It's technically straightforward but determining how it fits into our layer taxonomy is less so.

gislawill commented 6 days ago

Based on my reading of hip/analysis/analyses/drought.py, I don't believe that zonal stats are already supported by q_multi. We could update our hip-service endpoint to perform the zonal stats and return admin level data instead of point level data.

Alternatively, what would you think about handling this in the Analysis panel? Currently, only raster types and polygons are support but we could add support for point data like these? I believe that would better match our current approach to running zonal stats based on admin level.

wadhwamatic commented 6 days ago

Thanks for looking into it @gislawill. I had thought about using the analysis panel for this. It's a departure from how that is currently built though as it introduces a hazard layer which needs to be computed first. I think it might be simpler to have a separate layer instead, but it would be good to understand which would be easier to maintain.

gislawill commented 6 days ago

My understanding of the analysis panel is still somewhat limited so I'm not sure I understand the difference between a "hazard layer" and any other layer we have in PRISM?

The two options I see are:

  1. Optionally run zonal stats in hip-service for q_multi requests
  2. Run zonal stats in PRISM API for composite layers

I lean towards the second option for a couple reasons:

I think one of the most important factors though is the UX that Jordan users would find intuitive. If going through the analysis panel would make it less useful for them, we can create a new layer and add this functionality into hip-service

gislawill commented 4 days ago

Following up based on Slack conversation with @wadhwamatic: