Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create our own OBO Dashboard badge #1739

Closed
matentzn opened this issue Jan 17, 2022 · 9 comments
Closed

Create our own OBO Dashboard badge #1739

matentzn opened this issue Jan 17, 2022 · 9 comments
Labels
automated validation of principles Issues for the editorial WG pertinent to the automating the validation of the Principles. good first issue We mark some simpler issues with this tag which are suitable for new contributors. usability feature Issues pertinent to website and tools usability

Comments

@matentzn
Copy link
Contributor

I would like to propose our own OBO dashboard badge which we can serve as part of an OBO dashboard run. Does anyone have any experience with creating GitHub badges? We still have not decided how compute the overall OBO score (OBOFoundry/OBO-Dashboard#26), but as a simple first pass I would like a badge for those passing the dashboard in their entirety..

@cthoyt
Copy link
Collaborator

cthoyt commented Jan 17, 2022

You can actually stick pretty arbitrary stuff into badges with https://shields.io, even coming from a JSON endpoint

Getting from a list

E.g., I have a YAML file on the OBO Community report that I can turn a part of into a badge with

https://img.shields.io/badge/dynamic/yaml?url=https://raw.githubusercontent.com/cthoyt/obo-community-health/main/data/contacts.yaml&query=$.0.count&label=Contact%20Score&color=blue

Creates:

Note the query $.0.count grabs the first element from the yaml then indexes the "count". This could be easily reorganized to work on a dictionary where the key is the OBO Foundry ontology ID then you ask people to format their own in. Or use some kind of clever redirect that does some URL rewriting so it can be simplified and a lot of the URL abstracted

Getting from a dict

https://img.shields.io/badge/dynamic/json?url=https://github.com/cthoyt/obo-community-health/raw/main/data/data.json&query=$.go.score&label=OBO%20Community%20Health%20Score&color=blue

Note the query $.go.score grabs the data from the "go" entry in the JSON file.

@nlharris nlharris added automated validation of principles Issues for the editorial WG pertinent to the automating the validation of the Principles. usability feature Issues pertinent to website and tools usability labels Jan 19, 2022
@matentzn matentzn added the good first issue We mark some simpler issues with this tag which are suitable for new contributors. label Jan 20, 2022
@matentzn
Copy link
Contributor Author

Thanks @cthoyt that would be super cool. Anyone wanting to pick this up would be greatly appreciated!

@matentzn
Copy link
Contributor Author

@gouttegd
Copy link
Contributor

Assuming we work from the YAML results file available on https://raw.githubusercontent.com/OBOFoundry/obo-nor.github.io/master/dashboard/dashboard-results.yml, a URL like the following:

https://img.shields.io/badge/dynamic/yaml?label=OBO%20Dashboard&query=%24..ontologies%5B%3F%28%40.namespace%3D%3D%27ngbo%27%29%5D.summary.comment&url=https%3A%2F%2Fraw.githubusercontent.com%2FOBOFoundry%2Fobo-nor.github.io%2Fmaster%2Fdashboard%2Fdashboard-results.yml

would give you a badge like this for the ngbo ontology.

The URL looks awful because many characters need to be URL-encoded, but it can be broken down in the following parameters:

label=OBO Dashboard

The left-side label of the badge

query=$..ontologies[?(@.namespace=='ngbo')].summary.comment

In the ontologies dictionary within the provided YAML file, select the ontology with namespace ngbo, and use the value in the comment key within the summary dictionary as the right-side text of the badge.

To have a badge for another ontology, change ngbo to the namespace of the desired ontology.

Use summary.status instead of summary.comment to simply display ERROR, WARN, or PASS.

url=https://raw.githubusercontent.com/OBOFoundry/obo-nor.github.io/master/dashboard/dashboard-results.yml

The link to the YAML file.

Of note, the dynamic version of Shields.io does not seem to allow to set the colour of the badge based on a JSONpath query, only the value of the badge can be set that way. So it would not be possible to have a red badge for ontologies with an error status and a green badge for ontologies with a pass status. If you want that, then the Dashboard needs to generate a custom JSON file following this schema.

@gouttegd
Copy link
Contributor

I just realised that the OBO Dashboard already publishes per-ontology YAML files. We can then use slightly simpler URLs, such as this one for example for FBbt:

https://img.shields.io/badge/dynamic/yaml?label=OBO%20Dashboard&query=%24.summary.comment&url=http%3A%2F%2Fdashboard.obofoundry.org%2Fdashboard%2Ffbbt%2Fdashboard.yml

It is slightly simpler because we no longer need complex JSONpath syntax to select the correct value in the input file; to generate a badge for a different ontology, just replace fbbt%2Fdashboard.yml by XXXX%2Fdashboard.yml at the end of the URL, where XXXX is the name of the desired ontology.

@matentzn
Copy link
Contributor Author

Thank you so much for looking into it. Shame about the colour:

I tried this: https://github.com/matentzn/badges/blob/main/bfo/dashboard.json

But I cant get it to work. This is clearly according to the json schema you suggest, but it keeps giving me "unparseable json" (this is when I decided it was more productive to dispair than to move on). @cthoyt suggested this could be due to somehow github not providing the correct mimetype or something?

@matentzn
Copy link
Contributor Author

I think we will go your way in the end; I would have liked something more "motivational" to get people to say: LETS FIX, I want this GREEEEN :D

@gouttegd
Copy link
Contributor

For the "unparseable JSON" bit: check that GitHub is returning the actual JSON file when using that URL, and not some HTML. You might need to use "raw.githubusercontent.com" to force GitHub to do that.

@matentzn
Copy link
Contributor Author

Thank you sooo much @gouttegd and @cthoyt for helping me sort this out - this was a long standing issue for me and dear to my heart. I think the first draft is done.

There are two badges, OBO QC and OBO Dashboard score:

See here for an example how I envision this for NORs (top of the page):

#1912

I will announce this more widely tomorrow (for general ontologies).

cthoyt added a commit to cthoyt/OBOFoundry.github.io that referenced this issue Mar 21, 2023
erik-whiting added a commit that referenced this issue Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated validation of principles Issues for the editorial WG pertinent to the automating the validation of the Principles. good first issue We mark some simpler issues with this tag which are suitable for new contributors. usability feature Issues pertinent to website and tools usability
Projects
None yet
Development

No branches or pull requests

4 participants