Create a json version of dashboard-results
Opened this issue · 4 comments
In order for James S. to do his work on the website, we need a stable JSON version of overall results file which is currently YAML.
This is the command to do this with yq
yq eval -o=json dashboard/dashboard-results.yml > dashboard/dashboard-results.json
But you can also just cycle it through the JSON module when writing the file as part of the framework.
Would you be able to do that @anitacaron?
Originally posted by @anitacaron in #15 (comment)
It may need to be part of the framework. yq
is not available in the ODK.
We could add it: INCATools/ontology-development-kit#838
Or dump it here like:
json_string = json.dumps(json_data)
with open(filepath, "w") as text_file:
print(json_string, file=text_file)
perhaps. Not sure whats best
The second option is the fastest way to have the file.
@anitacaron @matentzn I noticed yesterday that the dashboard JSON produced here is now out of date, so I took a very initial stab at a durable fix in the PR above. I'd agree with @anitacaron that dumping the JSON within Python would be much more straightforward and portable -- just make sure to pass an extra handler function to properly serialize datetimes, because they're a full type in YAML but not in JSON (need to be converted to strings somehow eg with isoformat()
)