18F / imls-pi-stack

Other
7 stars 0 forks source link

Backend `durations_v2` does not match struct in v3 #35

Open jadudm opened 3 years ago

jadudm commented 3 years ago

We converted start and end to int64 values, but the schema says TEXT.

We can "fix" this for now by making the JSON unmarshaller aware that the number is stored as a string. It will then unmarshal correctly. However, this is not the "right" fix. We should instead flip the schema over to INTEGER.

We... can't do that through the Directus web interface; at least, a cursory glance suggests we cannot. However, if we flip to a v3 set of tables/API/etc., then we could roll a new version that works correctly.

For now, the durations struct can be modified as follows:

    Start     int64  `json:"start,string" db:"start" type:"INTEGER"`
    End       int64  `json:"end,string" db:"end" type:"INTEGER"`

Note the ,string added to the JSON marshalling portion. This fixes it for this schema.

jadudm commented 3 years ago

This now requires more testing before another build happens. This was necessary to make cache-to-sqlite work, which is necessary for testing the local generation of images. (Which is really only necessary for checking on data that is generated by sensors other than the one in hand...)

jadudm commented 3 years ago

Made these changes in fix-cache-and-waterfall. Just wanted a way to see data locally. After caching ME8675-309 to a local table, waterfall produced the same image that exists on the Pi currently. This is good; the data produced locally, and stored locally, produces images that are the same as data pulled down from Directus. v3 is looking good.