Insights API is a GraphQL service for calculating correlations between geospatial indicators. It accepts polygons in GeoJSON format and lists of numerators and denominators for the X and Y axes.
For more details on available endpoints and database schema see the docs directory.
A basic GraphiQL interface is available at http://url/graphiql.
{ allStatistic(defaultParam: 1) { fields } }{ polygonStatistic(polygonStatisticRequest: {
polygon: "{\"type\":\"Polygon\",\"coordinates\":[[[27.2021484375,54.13347814286039],[26.9989013671875,53.82335438174398],[27.79541015625,53.70321053273598],[27.960205078125,53.90110181472825],[28.004150390625,54.081951104880396],[27.6470947265625,54.21707306629117],[27.2021484375,54.13347814286039]]]}",
xNumeratorList: ["count", "area_km2"],
yNumeratorList: ["population", "area_km2"]
}) { fields } }Field definitions are available in the GraphQL schema.
A simple Locust test script is provided under scripts/test.py. It uses
several geometry samples from the development environment.
How to run:
locust -f scripts/test.py
CorrelationRateResolveris currently used. In the futureCovarianceRateResolvershould replace it.- Two H3 data structures are supported. The
calculations.useStatSeparateTablesflag inapplication.ymltoggles between them. - Resolver classes correspond to root GraphQL values.
- Review the "Optimize performance of data uploading in insights-api" story before uploading indicators.
- Java version: 16.