worldbank / DECAT_Space2Stats

https://worldbank.github.io/DECAT_Space2Stats/
Other
1 stars 2 forks source link

Add aggregation endpoint #57

Closed zacharyDez closed 1 month ago

zacharyDez commented 2 months ago

Some WB end-users would like an aggregated result for their input polygon.

We will start with an example and be open to feedback.

andresfchamorro commented 2 months ago

@zacharyDez @bpstewar

Here is the example I was playing around with: https://github.com/worldbank/DECAT_Space2Stats/blob/notebooks/notebooks/API/api_population_use_case.ipynb

What I envision is a function that takes in a GeoDataFrame, a list of API fields, and a method for aggregation. It could cover the following:

  1. Run the necessary requests per AOIs (efficiently?)
  2. Handle duplicate hex ids (one way could be to assign an h3 cell to the admin area with the largest overlap)
  3. Summarize by area (sum, mean, median, maybe even weighted mean)
  4. Return same GeoDataFrame with summary stats
zacharyDez commented 2 months ago

Ok, let's discuss together! Opened a draft PR (#59) with an aggregation example. I have a few concerns that we can address there.

zacharyDez commented 2 months ago

After discussion, we want to support an aggregation endpoint that has the following details: