-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example YAML and update schema JSON (#35)
- Loading branch information
Showing
4 changed files
with
222 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import json | ||
import sys | ||
import argparse | ||
|
||
import jsonschema | ||
import yaml | ||
from jsonschema import validate | ||
|
||
# Argument parsing | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--schema_file", help="file location of the JSON schema file to check the YAML against", | ||
type=str) | ||
parser.add_argument("--yaml_file", help="file location of te YAML file to check the schema against", | ||
type=str) | ||
args = parser.parse_args() | ||
|
||
# Load the JSON schema | ||
with open(args.schema_file, "r") as schema_file: | ||
schema = json.load(schema_file) | ||
|
||
# Load the YAML file | ||
f = args.yaml_file | ||
with open(f, "r") as yaml_file: | ||
data = yaml.safe_load(yaml_file) | ||
|
||
# Validate the data | ||
try: | ||
validate(instance=data, schema=schema) | ||
print("Validation of '{f}' successful.".format(f=f)) | ||
except jsonschema.exceptions.ValidationError as err: | ||
print("Validation error in '{f}': {err.message}".format(f=f, err=err)) | ||
sys.exit(1) |
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,53 @@ | ||
version: 1.0.0 | ||
name: Test Decision Tree | ||
questions: | ||
|
||
### 1e vraag | ||
- questionId: '0' | ||
question: "Is het een algoritme?" | ||
questionType: SingleChoice | ||
source: "AI Wetgeving MinBZK" | ||
source_url: "https://minbzk.nl/AI_wetgeving/" | ||
description: "Een klein test beschrijving" | ||
answers: | ||
- answer: Ja | ||
labels: | ||
- "Wel een algoritme" | ||
- "Hoog risico AI" | ||
subresult: "Het is eeen algoritme en een hoog risico AI systeem" | ||
nextQuestionId: '1.0' | ||
- answer: Nee | ||
labels: | ||
- "Geen algoritme" | ||
nextQuestionId: '1.0' | ||
|
||
## Checkvraag | ||
- questionId: '1.0' | ||
question: "Is het écht geen algoritme?" | ||
questionType: SingleChoice | ||
answers: | ||
- answer: Ja | ||
redirects: | ||
- nextQuestionId: '2.0' | ||
if: '"Wel een algoritme" in labels' | ||
- nextQuestionId: '3.0' | ||
if: '"Geen algoritme" in labels' | ||
- answer: Nee | ||
redirects: | ||
- nextQuestionId: '3.0' | ||
if: '"Wel een algoritme" in labels' | ||
- nextQuestionId: '2.0' | ||
if: '"Geen algoritme" in labels' | ||
- default: '3.0' | ||
|
||
## Resultaat dat alles oke is | ||
- conclusionId: '2.0' | ||
conclusion: "Je antwoord is consistent, goed zo" | ||
questionType: Conclusion | ||
obligation: "Volgens Art. 5 lid 2 ben je goed bezig" | ||
|
||
### Resultaat dat iemand inconsistent is | ||
- conclusionId: '3.0' | ||
conclusion: "Je antwoord is niet consistent, probeer opnieuw" | ||
questionType: Conclusion | ||
obligation: "Volgens Art. 5 lid 2 ben je slecht bezig" |