Skip to content

arch-12 §G: Add climate time-series (SPI) via REST backend #140

Description

@koito19960406

Parent: #133
Depends on: #139 (REST backend implementation)

Goal

Add the SPI (Standardised Precipitation Index) monthly time-series from Space2Stats as a wb_climate_rest REST-backend source in inst/hex_vars_registry.yaml.

This is a YAML-only PR — the REST adapter from #139 handles all the fetch logic.

YAML entry

sources:
  wb_climate_rest:
    backend: "rest"
    api_root: "https://space2stats.ds.io"
    collection: "climate"
    pop_var: ~
    variables:
      spi_3month:
        source_col: "spi_3"
        var_name: "SPI-3 Drought Index ({year})"
        var_description: |
          3-month Standardised Precipitation Index. Negative values indicate
          drought conditions; positive values indicate wet conditions.
        var_units: "dimensionless"
        pillar_group: ~
        pillar_name: "Climate hazards"
        legend_revert_colours: true
        time_col: "month"
        available_years: ~
        weight: "area"
        fun: "mean"
        fltr_exclude_pti: false

(Exact source_col and time_col values to be confirmed from #134 / the /fields endpoint.)

Verification

  • get_available_years("spi_3month") returns the live month/year list from https://space2stats.ds.io/fields.
  • A manual fetch for 3–5 Rwanda hex IDs returns columns spi_3month_<period>.
  • list_hex_vars() shows spi_3month under the wb_climate_rest source.
  • Existing testthat suite stays green.
  • R CMD check 0/0/0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions