Skip to content

Instantly share code, notes, and snippets.

@oeway
Last active January 13, 2022 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oeway/39505145f67253f4d0bf2c3bfcdc224c to your computer and use it in GitHub Desktop.
Save oeway/39505145f67253f4d0bf2c3bfcdc224c to your computer and use it in GitHub Desktop.
<config lang="json">
{
"name": "BIO-RDF-Validator",
"type": "web-python",
"version": "0.1.0",
"description": "A spec validator for bioimage RDF files.",
"tags": [],
"ui": "",
"cover": "",
"inputs": null,
"outputs": null,
"flags": [],
"icon": "extension",
"api_version": "0.1.8",
"env": "",
"permissions": [],
"requirements": ["bioimageio.spec==0.4.2.post2"],
"dependencies": []
}
</config>
<script lang="python">
import json
from imjoy import api
from bioimageio.spec import __version__
from bioimageio.spec.commands import validate
class ImJoyPlugin():
def setup(self):
api.log('BioImage RDF spec validator loaded: ' + __version__)
def validate(self, source):
# Convert js Date to string
if "timestamp" in source:
if hasattr(source["timestamp"], 'toISOString'):
source["timestamp"] = source["timestamp"].toISOString()
result = validate(source)
api.log(f"Validation results: {result}")
return result
api.export(ImJoyPlugin())
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment