-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
institution action update consortium redesign moving unapproved consortiums to "forReview" updating consortia build script fix. generation of outputs in JSONLD/scripts/outputs symbolic link to ld compiled outputs adding new inst
- Loading branch information
Showing
125 changed files
with
74,622 additions
and
863,363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import schema | ||
from . import institution |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os, json, sys, glob | ||
|
||
def validate(jsn,iloc): | ||
path = os.path.dirname(jsn['@id']).split(':')[-1] | ||
|
||
errors = [] | ||
close = [] | ||
|
||
# assert os.path.exists(loc), f"Path does not exist: {loc}" | ||
# existing = [os.path.splitext(os.path.basename(f))[0] for f in glob.glob(f"{loc}/*.json")] | ||
|
||
if os.path.exists(iloc): | ||
close.append(f"Current institution already exists:\n see {iloc}") | ||
|
||
|
||
if path not in iloc: | ||
errors.append(f"@id / location do not match:\n {path} || {jsn['@id']}") | ||
|
||
|
||
graph = open(os.path.dirname(iloc)+"/graph.json",'r').read() | ||
if jsn['institution:ror'] in graph: | ||
close.append(f"ROR entry already exists in graph. \n EXITING: {jsn['institution:ror']}") | ||
|
||
|
||
return close,errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
import os, json | ||
import jsonschema | ||
from jsonschema import validate | ||
|
||
|
||
def rdjsn(f): | ||
return json.load(open(f,'r')) | ||
|
||
def validate_json(jsn): | ||
|
||
if not isinstance(jsn, dict): | ||
# if we do not give a file, read this | ||
jsn = rdjsn(jsn) | ||
name = os.path.basename(jsn['@id']) | ||
|
||
schema_url = os.path.dirname(jsn['@id']).split(':')[-1] | ||
toplevel = os.popen('git rev-parse --show-toplevel').read().strip() | ||
|
||
schema_loc = f"{toplevel}/JSONLD/{schema_url}/schema.json" | ||
# outfile guarantees that we must run this | ||
|
||
schema = rdjsn(schema_loc) | ||
|
||
try: | ||
validate(instance=jsn, schema=schema) | ||
print(f"Validation succeeded: {name}") | ||
return True, f"Validation succeeded: {name}" | ||
except jsonschema.exceptions.ValidationError as err: | ||
print("Validation error:", err.message, name) | ||
return False, "Validation error:\n {err.message}\n RelevantFile: {jsn['@id']}", False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.