Code Monkey home page Code Monkey logo

ro-crate-validator-py's People

Contributors

logan-174 avatar stain avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

johnf

ro-crate-validator-py's Issues

Is a workflow necessary?

You seem to be able to leave the function

def scripts_and_workflow_check(tar_file, extension):
"""
For workflow RO-Crate, if there is an unrecognised workflow file, the function will return an warning message.
Please check more details at RO-Crate website:
<https://www.researchobject.org/ro-crate/1.1/workflow-and-scripts.html>
"""
NAME = "Scripts and workflow check"
# wkfext_path = '/Users/xuanqili/Desktop/ro-crate-validator-py/src/workflow_extension.txt'
error_message = {
"WorkflowError":"Semantic Error: Scripts and Workflow is Wrong",
"TypeError": "Semantic Error: Invalid @type value for workflow file {}. It must have File, SoftwareSourceCode and ComputationalWorkflow as value."
}
warning_message = {
"UnrecognizedWkf" : "WARNING: {} is not a recognised workflow extension. Please raise an issue at GitHub: <https://github.com/ResearchObject/ro-crate-validator-py/issues>."
}
### dictionary to store checking result
workflow_result = {}
context, metadata = rocrate.read_metadata(os.path.join(tar_file, "ro-crate-metadata.json"))
### check if recognised workflow file meets the requirments
for entity in metadata.values():
id_ = utils.get_norm_value(entity, "@id")[0]
extension_set = list(we.get_workflow_extension())
# with open (wkfext_path, "r") as file:
# extension_set = file.read().splitlines()
recognisedWkf_upd(extension_set, entity, workflow_result, id_, error_message)
### check unrecognised workflow file with ComputaionalWorkflow in its @type
for entity in metadata.values():
type = utils.get_norm_value(entity, "@type")
if "ComputationalWorkflow" in type:
unrecognisedWfk_upd(type, extension_set, entity, workflow_result, warning_message, error_message)
### fucntion will return True only when the all of the recognised workflow file are correct
for values in workflow_result.values():
if isinstance(values, list):
return Result(NAME, code = -1, message = values[1])
elif isinstance(values, str):
return Result(NAME, code = 1, message = values)
else:
return Result(NAME)
return Result(NAME, code = -1, message = error_message["WorkflowError"])

only if you have at least one workflow. But is such a thing mandatory in an RO-Crate?

undeclared dependency on pytest, new release requested

Hey y'all, just installed the package via pip and saw an error due to pytest, I'd written a long issue about it before discovering e95b1ab so it's already been fixed, yay! Could a new release be made at some point in the future (no rush from my side.)

feature request: cli

Even something as simple as

import sys                                          
                                                    
from rocrateValidator import validate as validate   
v = validate.validate(sys.argv[1])                  
v.validator()                                       

would be a great help! Additionally to return the message on validator() rather than invoking print could be nice for consumers to decide how they want to handle the output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.