Skip to content

Commit

Permalink
Complete README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgechp committed May 10, 2023
1 parent 7b3981d commit fe8fd7c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
56 changes: 54 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ information to check whether a resource complies with certain FAIR Maturity Indi
Unfortunately, currently, only Gen2 Maturity Indicators can be automatically tested, Gen1 MIs should be
checked by humans. In any case, we can still verify a lot of MIs. Take a look at: https://fairdata.services:7171/FAIR_Evaluator/metrics

## Resources and interfaces

A **resource** is any element that can be accessed through an uri. For example, this repository is a resource
(and can be accessed with the uri https://github.com/jorgechp/fair-check).

An **interface** is the uri of a service that is used to test a Maturity Indicator. For
example, https://w3id.org/FAIR_Tests/tests/gen2_unique_identifier.

You can find a complete list of FAIR Evaluator endpoints at https://fairdata.services:7171/FAIR_Evaluator/metrics


## Requirements

Expand All @@ -24,14 +34,46 @@ And that's all. Fair-check is properly installed.

## How does Fair-check work?

The basic behaviour of Fair-check is to call the script from python with the following command sintax:
The basic behaviour of Fair-check is to call the script from python with the following command syntax:

python faircheck.py <resources> <tests>

For example:

python faircheck.py 10.5281/zenodo.7911779 https://w3id.org/FAIR_Tests/tests/gen2_unique_identifier


Executing tests
Generating output file
Testing resource: 'https://10.5281/zenodo.7911779'
Test: 'https://w3id.org/FAIR_Tests/tests/gen2_unique_identifier'
SUCCESS: "INFO: TEST VERSION 'Hvst-1.4.4:Tst-0.2.2'\n\nSUCCESS: Found an identifier of type 'uri'"
Passed: 1/1
Done

You can also use a list of resources or a list of interfaces as input (using commas as separator):

python faircheck.py https://10.5281/zenodo.7911779,https://doi.org/10.1007/s11192-023-04720-7 https://w3id.org/FAIR_Tests/tests/gen2_unique_identifier,https://w3id.org/FAIR_Tests/tests/gen2_metadata_identifier_persistence


Executing tests
Generating output file
Testing resource: 'https://10.5281/zenodo.7911779'
Test: 'https://w3id.org/FAIR_Tests/tests/gen2_metadata_identifier_persistence'
FAILED!: "INFO: TEST VERSION 'Hvst-1.4.4:Tst-0.2.3'\n\nINFO: END OF HARVESTING\n\nINFO: The metadata GUID appears to be a URL. Testing known URL persistence schemas (purl, oclc, fdlp, purlz, w3id, ark, doi(as URL)).\n\nFAILURE: The metadata GUID does not conform with any known permanent-URL system."
Test: 'https://w3id.org/FAIR_Tests/tests/gen2_unique_identifier'
SUCCESS: "INFO: TEST VERSION 'Hvst-1.4.4:Tst-0.2.2'\n\nSUCCESS: Found an identifier of type 'uri'"
Passed: 1/2

Testing resource: 'https://doi.org/10.1007/s11192-023-04720-7'
Test: 'https://w3id.org/FAIR_Tests/tests/gen2_metadata_identifier_persistence'
SUCCESS: "INFO: TEST VERSION 'Hvst-1.4.4:Tst-0.2.3'\n\nINFO: END OF HARVESTING\n\nINFO: The metadata GUID appears to be a URL. Testing known URL persistence schemas (purl, oclc, fdlp, purlz, w3id, ark, doi(as URL)).\n\nSUCCESS: The metadata GUID conforms with doi.org, which is known to be persistent."
Test: 'https://w3id.org/FAIR_Tests/tests/gen2_unique_identifier'
SUCCESS: "INFO: TEST VERSION 'Hvst-1.4.4:Tst-0.2.2'\n\nSUCCESS: Found an identifier of type 'uri'"
Passed: 2/2
Done


But you can also use different parameters:

- -h / --help -> Show help.
Expand All @@ -40,9 +82,19 @@ But you can also use different parameters:
- -r / --resources -> Path to a resource file.
- -t / --tests -> Path to a test file.

## Examples
Remember that if no interfaces are provided, Fair-check will use all the interfaces listed on
config/tests file.

## Resources and test files

You can save all the tests and resources into files. The resources file requires to input
one resource per line.

For tests files, you can put one endpoint per line or using the following line format:

<Name of the Maturity Indicator>,<interface>

###



10 changes: 5 additions & 5 deletions faircheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def main():
prog='faircheck.py',
description="Check the degree of compliance with FAIR principles of a resource.",
epilog='Jorge Chamorro Padial - GNU GPLv3')
parser.add_argument('resources_list', nargs='*', default=[])
parser.add_argument('tests_list', nargs='*', default=[])
parser.add_argument('resources_list', nargs='?', default=[])
parser.add_argument('tests_list', nargs='?', default=[])
parser.add_argument('-e', '--export', help="Specify a path to export the results as a csv file.")
parser.add_argument('-nv', '--no-verbosity', help="Don't display the test results on the default output.")
parser.add_argument('-r', '--resources', help="Path to a resource file")
Expand All @@ -134,11 +134,11 @@ def main():
parser.print_help()
exit(0)

resource_list: List[str] = args.resources_list if len(args.resources_list) > 0 \
resource_list: List[str] = args.resources_list.split(',') if len(args.resources_list) > 0 \
else __extract_from_file(args.resources)

if len(args.tests_list) > 0 or args.tests is not None:
test_list: List[str] = args.tests_list if len(args.tests_list) > 0 \
test_list: List[str] = args.tests_list.split(',') if len(args.tests_list) > 0 \
else __extract_from_file(args.tests)
else:
test_list: List[str] = __extract_from_file("config/tests")
Expand All @@ -148,8 +148,8 @@ def main():
print("Executing tests")
results_dict, name_list, interface_list = __launch_test(resource_list, name_list, interface_list)

print("Generating output file")
if args.no_verbosity is None:
print("Generating output file")
__print_results(results_dict, name_list)

if args.export is not None:
Expand Down

0 comments on commit fe8fd7c

Please sign in to comment.