Skip to content

Commit 8291dde

Browse files
chore(poc3): Show label instead of numeric value for the effects in the table
1 parent 3cc4de3 commit 8291dde

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

app/data/app-data.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
"effect": 2
3939
}
4040
],
41+
"effectsLabel": {
42+
"-2": "aggravating",
43+
"-1": "somewhat aggravating",
44+
"0": "undetermined",
45+
"1": "somewhat mitigating",
46+
"2": "mitigating"
47+
},
4148
"selectedQuestionIndex": null,
4249
"cases": {
4350
"case 1": {

app/poc3.html

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@
4242
background-color: #eee;
4343
border-top: 1px solid grey;
4444
}
45+
td.score--2 {
46+
background-color: hsl(350, 60%, 85%);
47+
}
48+
td.score--1 {
49+
background-color: hsl(350, 60%, 95%);
50+
}
51+
td.score-1 {
52+
background-color: hsl(150, 60%, 95%);
53+
}
54+
td.score-2 {
55+
background-color: hsl(150, 60%, 85%);
56+
}
4557
</style>
4658
</head>
4759
<body>
@@ -74,9 +86,12 @@ <h2 class="title is-3">Automated review ✨</h2>
7486
<tr v-for="(question, idx) in reviewRows">
7587
<td>{{idx+1}}. {{question.text}}</td>
7688
<td>{{question.answer}}</td>
77-
<td>{{question.score}}</td>
89+
<td :class="`score-${question.score}`">
90+
{{getEffectLabelFromQuestion(question)}}
91+
<template v-if="areScoresShown">({{question.score}})</template>
92+
</td>
7893
</tr>
79-
<tr>
94+
<tr v-if="areScoresShown">
8095
<td></td>
8196
<td>Total:</td>
8297
<td>{{totalScore}}</td>

app/poc3.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ createApp({
6363
questionnaire: {},
6464
modelsList: [],
6565
areDetailsShown: false,
66+
areScoresShown: false,
6667
}
6768
},
6869
async mounted() {
@@ -207,6 +208,9 @@ createApp({
207208
let nameParts = acase.name.split(/\s/)
208209
return `${acase.incidentDate} - ${nameParts[1]} ${nameParts[0][0]}.`;
209210
},
211+
getEffectLabelFromQuestion(question) {
212+
return this.questionnaire.effectsLabel[question.score] || 'undetermined'
213+
},
210214
highlightText(text, highlights) {
211215
// TODO: deduped this code from nlpui.js
212216
let ret = text ?? ''

0 commit comments

Comments
 (0)