OBOFoundry / obo-dash.github.io

Development version of OBO dashboard
http://dashboard.obofoundry.org/
8 stars 0 forks source link

Create a json version of dashboard-results #16

Open matentzn opened 3 months ago

matentzn commented 3 months ago

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 https://github.com/OBOFoundry/obo-dash.github.io/issues/15#issuecomment-2009175153

anitacaron commented 3 months ago

It may need to be part of the framework. yq is not available in the ODK.

matentzn commented 3 months ago

We could add it: https://github.com/INCATools/ontology-development-kit/issues/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

anitacaron commented 3 months ago

The second option is the fastest way to have the file.

jsstevenson commented 2 months ago

@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())