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

[Feature Request]: Modify calls to HDC Stats API to use new query structure #1243

Closed wadhwamatic closed 6 months ago

wadhwamatic commented 6 months ago

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

The HDC Stats API which PRISM uses for charts will be updated soon. The update includes a slight change to the parameters and URL. The following parameter changes have been been implemented on the the API that we need to accommodate in PRISM:

  1. admin_id is now called id_code
  2. vam query argument can be omitted, in which case both vim & rfh are returned in a single response
  3. format can be set to csv for csv response format (can be useful for user bulk download of tabular data). The default value is json

See swagger below:

Example requests: New: curl -X 'GET' \ 'https://dev.api.earthobservation.vam.wfp.org/stats/admin?id_code=31&level=0&coverage=full&vam=rfh&start=2024-04-01&end=2024-04-30&format=json' \ -H 'accept: application/json'

Old: curl -X 'GET' \ 'https://api.earthobservation.vam.wfp.org/stats/admin/fetch?admin_id=31&level=0&coverage=full&vam=rfh&start=2024-04-01&end=2024-04-30' \ -H 'accept: application/json'

Note that once we're ready on the PRISM side, dev.api.earthobservation.vam.wfp.org will replace api.earthobservation.vam.wfp.org. This will be a breaking change for PRISM deployments.

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

@valpesendorfer - anything to add?

valpesendorfer commented 6 months ago

additionally:

wadhwamatic commented 6 months ago

thanks @valpesendorfer, I edited the original text to add those changes too

valpesendorfer commented 6 months ago

I've created a redirect in the current endpoint PRISM is using, to facilitate the switchover and avoid any service disruptions.

So you can:

At the moment this will redirect your request to the API deployed at dev.api.earthobservation.vam.wfp.org but we're very close to rolling that over, and like this there should be no service disruption.

wadhwamatic commented 6 months ago

Thanks @valpesendorfer - that's very helpful!