Skip to content

Use :format in table function #262

@graft

Description

@graft

The table() function is how Archimedes composes data from Magma into a Matrix, that is, a data frame with rows and columns. Currently the JSON response from Magma is parsed, 1) to transform dates and 2) to transform arrays of [ key, value ] pairs into a Vector. Archimedes does this without knowing anything about how the Magma response is formatted; unsurprising since the query response format is poorly documented and I'm not even really sure what it looks like.

However, now Magma reports a :format in addition to an :answer. This specifies the project::model#attribute of each entry in the response (and whether it is nested in an array). Using this information we can correctly format the response without relying on guesswork as we currently do.

The main issue is that while the :format reports name and attribute, it doesn't report type, so we'd probably want to change the format to be something like project::model#attribute.type. In fact, Archimedes is already using :format to splay the columns of a matrix attribute into the table, but again it relies on some guesswork which could also be removed by specifying type in the format.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions