datenguide / datenguide-api

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

Retrieve regions from genesis data instead of bundled JSON file #149

Closed crijke closed 4 years ago

crijke commented 4 years ago

This PR changes the API server to download region information fom GenesAPI data instead of a bundled json file.

This leads to some differences (some region names and keys have changed), and Berlin gets more NUTS levels again.

Question:

This query:

{
  allRegions(page: 0, itemsPerPage: 10) {
    regions(parent: "11") {
      id
      name
      WAHL09(year: 2017, PART04: B90_GRUENE) {
        value
        year
        PART04
      }
    }
    page
    itemsPerPage
    total
  }
}

returns this:

{
  "data": {
    "allRegions": {
      "regions": [
        {
          "id": "110",
          "name": "Berlin",
          "WAHL09": [
            {
              "value": 234947,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11000",
          "name": "Berlin",
          "WAHL09": [
            {
              "value": 234947,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11000000",
          "name": "Berlin, Stadt",
          "WAHL09": [
            {
              "value": 234947,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11001001",
          "name": "Berlin-Mitte",
          "WAHL09": [
            {
              "value": 25708,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11002002",
          "name": "Berlin-Friedrichshain-Kreuzberg",
          "WAHL09": [
            {
              "value": 28368,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11003003",
          "name": "Berlin-Pankow",
          "WAHL09": [
            {
              "value": 33360,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11004004",
          "name": "Berlin-Charlottenburg-Wilmersdorf",
          "WAHL09": [
            {
              "value": 26589,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11005005",
          "name": "Berlin-Spandau",
          "WAHL09": [
            {
              "value": 9244,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11006006",
          "name": "Berlin-Steglitz-Zehlendorf",
          "WAHL09": [
            {
              "value": 25361,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        },
        {
          "id": "11007007",
          "name": "Berlin-Tempelhof-Schöneberg",
          "WAHL09": [
            {
              "value": 27956,
              "year": 2017,
              "PART04": "B90_GRUENE"
            }
          ]
        }
      ],
      "page": 0,
      "itemsPerPage": 10,
      "total": 15
    }
  }
}

Is this what we mean by 'parent', to return all children (all levels) of the parent node? (It also behaved like this before, just not for Berlin, but for example with region 10 Saarbrücken).