Skip to content

Conversation

@janbaykara
Copy link
Member

@janbaykara janbaykara commented Mar 6, 2025

Some GraphQL updates that helped me use Mapped for another project.

Choropleth statistics resolver can now return GeoJSON features

Includes aggregated data, and area data, in the properties:

query {
  statisticsForChoropleth(
    statsConfig:{
      sourceIds:"6d5dc030-d424-45d3-8416-af222d499c1b",
      summaryCalculations:false
      groupByArea:lsoa
    }) {
    area {
      polygon {
        type
        id
        properties {
          data
        }
        geometry {
          type
          coordinates
        }
      }
    }
  }
}

->

{
  "data": {
    "statisticsForChoropleth": [
      {
        "area": {
          "polygon": {
            "type": "Feature",
            "id": "E01002024",
            "properties": {
              "data": {
                "gss": "E01002024",
                "label": "Haringey 022D",
                "area_type": 0,
                "count": 1,
                "SiteName": "London Haringey Priory Park South",
                "LSOA": 0,
                "population": 0,
                "SiteNumber": 94,
                "Latitude": 51.584128,
                "Longitude": -0.125254
              }
            },
            "geometry": {
              "type": "MultiPolygon"
            }
          }
        }
      },
      ...
    ]
  }
}

GenericData can now be returned as GeoJSON features

query {
  genericDataByExternalDataSource(
    externalDataSourceId:"6d5dc030-d424-45d3-8416-af222d499c1b"
  ) {
    area(type:lsoa) {
      polygon {
        properties {
          area {
            name
            gss
          }
          genericData {
            json
          }
        }
      }
    }
  }
}

->

{
  "data": {
    "genericDataByExternalDataSource": [
      {
        "area": {
          "polygon": {
            "properties": {
              "area": {
                "name": "Coventry 028D",
                "gss": "E01009661"
              },
              "genericData": {
                "json": {
                  "Latitude": 52.407708,
                  "SiteName": "Coventry Binley Road",
                  "Longitude": -1.490082,
                  "SiteNumber": 44
                }
              }
            }
          }
        }
      },
      ...
    ]
  }
}

@commonknowledge-bot commonknowledge-bot deployed to geojson - meep-database PR #226 March 6, 2025 11:36 — with Render Active
@sentry
Copy link

sentry bot commented Mar 6, 2025

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: hub/graphql/types/model_types.py

Function Unhandled Issue
statistics_for_choropleth GraphQLError: 'variable' /graphql
Event Count: 4

Did you find this useful? React with a 👍 or 👎

@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - pgbouncer PR #226 March 6, 2025 11:37 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-backend PR #226 March 6, 2025 11:38 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-backend PR #226 March 6, 2025 11:38 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-frontend PR #226 March 6, 2025 11:38 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot deployed to geojson - meep-intelligence-hub-worker PR #226 March 6, 2025 11:38 — with Render Active
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-frontend PR #226 March 6, 2025 11:38 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-worker PR #226 March 6, 2025 12:37 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-backend PR #226 March 6, 2025 12:37 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-backend PR #226 March 6, 2025 12:40 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot requested a deployment to geojson - meep-intelligence-hub-worker PR #226 March 6, 2025 12:40 — with Render In progress
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-worker PR #226 March 6, 2025 12:40 — with Render Destroyed
@commonknowledge-bot commonknowledge-bot temporarily deployed to geojson - meep-intelligence-hub-frontend PR #226 March 6, 2025 12:40 — with Render Destroyed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants