Technical details on the everviz / PxWeb integration

This post covers things not relevant for most people which could’ve been said in its parent (How to integrate everviz with PxWeb and statistics agencies)

This middleware is published at GitHub as free to use software. We’ve designed it to run on Vercel which provides generous free plan for this particular use-case, especially when we cache requests. After all, national statistics is seldom updated daily.

To run the service yourself

It is necessary to create a Vercel account. A quickstart guide for Serverless Functions is found on their pages.

CORS and edge caching is already enabled, but appears shaky at times.

On JSON-Stat

It is necessary to aquaint yourself with JSON-Stat.

It’s main explainer page is: https://json-stat.org/, further (https://jsonstat.com) contains information about the different tools supporting JSON-Stat, of which we use the toolkit.

JSON-Stat is based on the concept of data cubes, which told me very little, but in practice it seems like a good format for tables of an arbitrary amount of data, such as this hog:

Apologies for my poor illustration, I figure it is better than none:

The labels in red are dimensions, which are specified by a few categories. If you select one category from each dimension, including the dimension of time, you precisely refer to any given cell. Dimension of size 1 you don’t specify, such as “Heltidsansatte” here.

If any single dimension is left out, you have a free variable, which as expected identify all cells where this variable is unspecified. A common choice is to not denote any point in time, and receive a series of values across time.

That’s in essence how the middleware works. We identify all dimensions (other than time) with more than one category, and mix these in every possible combination.