geosolutions-it / gfdrr-det

Data Exploration Tool
https://waffle.io/geosolutions-it/gfdrr-det
GNU General Public License v3.0
3 stars 0 forks source link

Added detail API endpoint for vulnerabilitites from vf_table #120

Closed ricardogsilva closed 6 years ago

ricardogsilva commented 6 years ago

This PR is connected to #114

It adds a detail view for vulnerability instances that are of type vulnerability_function with the fields mentioned in the issue description.

/gfdrr_det/api/v1/vulnerabilities/{pk}
{
  "function_parameters": {
    "Beta": {
      "med_par_value": 0.5
    },
    "Median": {
      "med_par_value": 12
    }
  },
  "vf_relationship": "Mathematical",
  "im_definition": "L_AF refers to the loading exerted by an ash fall, and depends on its density ρ (in kg/m3) and the thickness h_AF.",
  "loss_parameter_description": "Damage Index judges the proportion of the replacement cost of the structure.",
  "vf_math": "Parametric",
  "reference": "Blong et al_2017",
  "vulnerability_type": "vulnerability_function",
  "taxonomy": "CR/LFINF",
  "im_range": null,
  "loss_parameter_name": "Damage Index",
  "hazard": "Volcanic Ash",
  "geographical_applicability": [
    "Indonesia"
  ],
  "im_name_f": "Ash loading",
  "vf_math_model": "Cumulative lognormal",
  "loss_parameter_units": null,
  "im_data_source": null,
  "im_units": "kPa",
  "id": 14,
  "exposure": "Buildings"
}

Also included in the PR is a custom pagination class for harmonizing the behaviour of the vulnerabilities list endpoint. The page_size is now supported, just like in the exposures list endpoint. Example request:

/gfdrr_det/api/v1/vulnerabilities?page_size=2