datenguide / datenguide-api

datenguide GraphQL API Server
MIT License
10 stars 2 forks source link

Measures have different dimensions, depending on statistic they appear in #168

Closed crijke closed 4 years ago

crijke commented 4 years ago

Measures can have different dimensions depending on the statistic they appear in.

Example: BEVSTD

This is a problem for the current design of the tree API, as the dimensions are 'hard-coded' as attributes of the measures. Corresponding graphql-query:

{
  region(id: "01001") {
    id
    name
    BEVSTD {
      year
      value
    }
  }
}

Depending on whether the user wants to query statistic 12411 or statistic 32211, BEVSTD should have a different set of subfields and arguments (which is not possible, as subfields and arguments of BEVSTD are defined statically in the schema).

We added the option to specify the source statistic like this:

{
  region(id: "01001") {
    id
    name
    BEVSTD(statistics: R12411) {
      year
      value
    }
  }
}

-> incorrect, missing dimension selection

or like this:

{
  region(id: "01001") {
    id
    name
    BEVSTD(statistics: R32211) {
      year
      value
    }
  }
}

-> correct, no dimensions