Skip to content

Commit

Permalink
Include definitions and show them (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravimeijerrig authored Aug 26, 2024
1 parent b80fb20 commit 829e541
Show file tree
Hide file tree
Showing 6 changed files with 452 additions and 13 deletions.
161 changes: 161 additions & 0 deletions definitions.yaml

Large diffs are not rendered by default.

244 changes: 232 additions & 12 deletions frontend/public/decision-tree.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/src/components/BeslisboomForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function back() {
:question="currentQuestion.question"
:id="currentQuestion.questionId"
:sources="currentQuestion.sources"
:definitions="currentQuestion.definitions"
/>
<SingleAnswer
:answers="currentQuestion.answers"
Expand Down
16 changes: 15 additions & 1 deletion frontend/src/components/SingleQuestion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
interface Props {
id: string
question: string
definitions: { term: string; definition: string; url: string | undefined; }[] | undefined
sources: { source: string; url: string | undefined; }[] | undefined
}
defineProps<Props>()
Expand All @@ -19,10 +20,23 @@ defineProps<Props>()
{{ question }}
<slot />
</p>
<div>
<!-- Definitions Section -->
<DialogTitle v-if="definitions && definitions.length" class="text-sm font-semibold leading-5 text-gray-900 relative top-5">
Definities
</DialogTitle>

<ul v-if="definitions && definitions.length" class="list-disc list-inside ml-5 relative top-5">
<li v-for="(item, index) in definitions" :key="index" class="text-sm text-gray-700">
<strong>{{ item.term }}:</strong> {{ item.definition }}
</li>
</ul>
</div>

<div>
<!--Sources section-->
<!--Make an vue component from this?-->
<DialogTitle v-if='sources' as="h4" class="text-sm font-semibold leading-5 text-gray-900 relative top-5">
<DialogTitle v-if='sources && sources.length' as="h4" class="text-sm font-semibold leading-5 text-gray-900 relative top-5">
Bronnen
</DialogTitle>

Expand Down
9 changes: 9 additions & 0 deletions frontend/src/models/DecisionTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,18 @@ export const Source = t.type({
})
export type Source = t.TypeOf<typeof Source>

export const Definition = t.type({
term: t.string,
definition: t.string,
url: t.union([t.string, t.undefined]),
source: t.union([t.string, t.undefined])
})
export type Definition = t.TypeOf<typeof Definition>

export const Question = t.type({
questionId: t.string,
question: t.string,
definitions: t.union([t.array(Definition), t.undefined]),
sources: t.union([t.array(Source), t.undefined]),
description: t.union([t.string, t.undefined]),
answers: t.array(Answer)
Expand Down
34 changes: 34 additions & 0 deletions schemas/base.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@
"id": "#/$defs/Description",
"type": "string"
},
"Definition": {
"id": "#/$defs/Definition",
"type": "object",
"properties": {
"term": {
"type": "string"
},
"definition": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": ["term", "definition"]
},
"AnswerComment": {
"id": "#/$defs/AnswerComment",
"type": "string"
Expand Down Expand Up @@ -183,6 +199,12 @@
"$ref": "#/$defs/Description",
"type": "string"
},
"definitions": {
"type": "array",
"items": {
"$ref": "#/$defs/Definition"
}
},
"questionType": {
"type": "string",
"enum": ["MultipleChoice"]
Expand Down Expand Up @@ -217,6 +239,12 @@
"$ref": "#/$defs/Description",
"type": "string"
},
"definitions": {
"type": "array",
"items": {
"$ref": "#/$defs/Definition"
}
},
"questionType": {
"type": "string",
"enum": ["SingleChoice"]
Expand Down Expand Up @@ -253,6 +281,12 @@
"items": {
"$ref": "#/$defs/Source"
}
},
"definitions": {
"type": "array",
"items": {
"$ref": "#/$defs/Definition"
}
}
},
"required": ["conclusionId", "conclusion", "obligation"]
Expand Down

0 comments on commit 829e541

Please sign in to comment.