geobeyond / Arpav-PPCV-backend

Backend di Piattaforma Proiezioni Climatiche per il Nord-Est.
Creative Commons Attribution 4.0 International
0 stars 1 forks source link

Added API endpoint for discovering coverage identifiers #140

Closed ricardogsilva closed 3 months ago

ricardogsilva commented 3 months ago

This PR adds the /api/v2/coverages/coverage-identifiers API endpoint which can be used to discover coverage identifiers (which are needed for interacting with the WMS and time series endpoints). It can be called like this:

http://localhost:8877/api/v2/coverages/coverage-identifiers?
  name_contains=tas_&
  name_contains=ensemble&
  name_contains=anomaly&
  name_contains=rcp26&
  name_contains=djf&

which produces the following response:

{
  "items": [
    "tas_30yr_anomaly_seasonal_agree_model_ensemble-tw1-rcp26-DJF", 
    "tas_30yr_anomaly_seasonal_agree_model_ensemble-tw2-rcp26-DJF", 
    "tas_seasonal_anomaly_model_ensemble-rcp26-DJF", 
    "tas_seasonal_anomaly_model_ensemble_lower_uncertainty-rcp26-DJF", 
    "tas_seasonal_anomaly_model_ensemble_upper_uncertainty-rcp26-DJF"
  ],
  "meta": {
    "returned_records": 5,
    "total_records": 1776,
    "total_filtered_records": 5
  },
  "links":{
    "self": "http://localhost:8877/api/v2/coverages/coverage-identifiers?limit=20&offset=0&name_contains=djf",
    "next":null,"previous":null,"first":"http://localhost:8877/api/v2/coverages/coverage-identifiers?limit=20&offset=0&name_contains=djf",
    "last":"http://localhost:8877/api/v2/coverages/coverage-identifiers?limit=20&offset=0&name_contains=djf"
  }
}

Note

As can be seen from the example response shown above, the current naming scheme is not ideal in ensuring that the frontend will always be able to get back a single coverage identifier - we may need to come up with a better way to name them