You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed with @ktk, I'll share some ideas for what we as users would expect from the next version of this library or its successor 😄
Some context: for visualize.admin.ch we built a GraphQL API for the frontend, so we could a) ship less code to the browser by only using this library on the server-side and b) simplify the frontend code because we handle all data transformations also in the "backend of the frontend".
I'm not intending to replace GraphQL because it's very convenient for us but maybe the schema that we've created can serve as a first inspiration of how we are querying the data. You can play with it at https://visualize.admin.ch/api/graphql
As you'll see, we added a few things on top of this library, most notably:
We lifted up all the extraMetadata into the DataCube type itself, so the data we're working with is less nested
We have distinct types for the different kinds of Dimensions (temporal, nominal, ordinal)
The most important thing: in the DataCube.observations query, the data is re-mapped to use the dimension IRIs as object keys again. This is important, as we need to reference these IRIs in the frontend again. I wrote about this in Explicitly vs. automatically selected dimensions #51
There's more, and I can elaborate later, but this should be a good overview of where we currently are.
Here's an example (GraphQL) query for how we are using the observations. Note that we're using the dimension IRIs as keys on the observations. This allows us to map them back to labels, colors, etc. in our app.
{"data": {"dataCubeByIri": {"title": "Investitionen in den Forstbetrieben ab 50 ha Wald in Franken nach Jahr, Forstzone, Kanton und Variable","observations": {"data": [{"http://environment.ld.admin.ch/foen/px/0703030000_122/dimension/1": "Mittelland","http://environment.ld.admin.ch/foen/px/0703030000_122/dimension/2": "Schweiz","http://environment.ld.admin.ch/foen/px/0703030000_122/dimension/0": "2008"},//...]}}}}
As just discussed, this is really the structure we prefer for observations (as "raw" and flat as possible).
We query cube metadata upfront and separately from observations, so there is really no need to map observations to the metadata structure.
@vhf @BenjaminHofstetter @martinmaillard,
As discussed with @ktk, I'll share some ideas for what we as users would expect from the next version of this library or its successor 😄
Some context: for visualize.admin.ch we built a GraphQL API for the frontend, so we could a) ship less code to the browser by only using this library on the server-side and b) simplify the frontend code because we handle all data transformations also in the "backend of the frontend".
I'm not intending to replace GraphQL because it's very convenient for us but maybe the schema that we've created can serve as a first inspiration of how we are querying the data. You can play with it at https://visualize.admin.ch/api/graphql
As you'll see, we added a few things on top of this library, most notably:
DataCube.observations
query, the data is re-mapped to use the dimension IRIs as object keys again. This is important, as we need to reference these IRIs in the frontend again. I wrote about this in Explicitly vs. automatically selected dimensions #51There's more, and I can elaborate later, but this should be a good overview of where we currently are.
/cc @lucguillemot
The text was updated successfully, but these errors were encountered: