Spaces:
Runtime error
Runtime error
Michelle Lam
commited on
Commit
•
9a85cb5
1
Parent(s):
bfcb1c0
Moves Audit Category selection to per-audit panel; disables Send to Avid button when there are no complete reports; adjusts audit report panel style
Browse files
indie_label_svelte/public/global.css
CHANGED
@@ -120,7 +120,7 @@ h6 {
|
|
120 |
font-weight: bold;
|
121 |
font-size: 16px;
|
122 |
margin-top: 25px;
|
123 |
-
margin-bottom:
|
124 |
}
|
125 |
|
126 |
.head_6_non_cap {
|
@@ -204,6 +204,11 @@ table {
|
|
204 |
margin: 60px 0;
|
205 |
}
|
206 |
|
|
|
|
|
|
|
|
|
|
|
207 |
.page_title {
|
208 |
font-size: 30px;
|
209 |
font-weight: bold;
|
|
|
120 |
font-weight: bold;
|
121 |
font-size: 16px;
|
122 |
margin-top: 25px;
|
123 |
+
margin-bottom: 15px;
|
124 |
}
|
125 |
|
126 |
.head_6_non_cap {
|
|
|
204 |
margin: 60px 0;
|
205 |
}
|
206 |
|
207 |
+
.spacing_vert_100_bottom {
|
208 |
+
margin: 0 0 100px 0;
|
209 |
+
}
|
210 |
+
|
211 |
+
|
212 |
.page_title {
|
213 |
font-size: 30px;
|
214 |
font-weight: bold;
|
indie_label_svelte/src/HypothesisPanel.svelte
CHANGED
@@ -5,6 +5,7 @@
|
|
5 |
|
6 |
import Button, { Label } from "@smui/button";
|
7 |
import Textfield from '@smui/textfield';
|
|
|
8 |
import { new_evidence } from './stores/new_evidence_store.js';
|
9 |
import { open_evidence } from './stores/open_evidence_store.js';
|
10 |
import { topic_chosen } from './stores/cur_topic_store.js';
|
@@ -50,6 +51,7 @@
|
|
50 |
let editTitle = false;
|
51 |
let editErrorType = false;
|
52 |
let unfinished_count = 0;
|
|
|
53 |
|
54 |
function setActive(value: string) {
|
55 |
selected = value;
|
@@ -91,6 +93,7 @@
|
|
91 |
setActive(selected);
|
92 |
cur_open_evidence = selected["evidence"];
|
93 |
unfinished_count = all_reports.filter(item => !item.complete_status).length
|
|
|
94 |
return all_reports;
|
95 |
}
|
96 |
|
@@ -143,6 +146,8 @@
|
|
143 |
const response = await fetch("./save_reports?" + params);
|
144 |
const text = await response.text();
|
145 |
const data = JSON.parse(text);
|
|
|
|
|
146 |
return data;
|
147 |
}
|
148 |
|
@@ -152,6 +157,7 @@
|
|
152 |
error_type: "",
|
153 |
evidence: [],
|
154 |
text_entry: "",
|
|
|
155 |
complete_status: false,
|
156 |
};
|
157 |
all_reports = all_reports.concat(new_report);
|
@@ -178,6 +184,10 @@
|
|
178 |
handleSaveReport(); // Auto-save report
|
179 |
}
|
180 |
|
|
|
|
|
|
|
|
|
181 |
// Error type
|
182 |
let error_type_options = [
|
183 |
{
|
@@ -208,6 +218,14 @@
|
|
208 |
editErrorType = false;
|
209 |
}
|
210 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
let promise_submit = Promise.resolve(null);
|
212 |
function handleSubmitReport() {
|
213 |
promise_submit = submitReport();
|
@@ -412,7 +430,7 @@
|
|
412 |
{/key}
|
413 |
</div>
|
414 |
|
415 |
-
<div class="
|
416 |
<div class="head_6">
|
417 |
<b>Summary/Suggestions</b>
|
418 |
</div>
|
@@ -432,10 +450,25 @@
|
|
432 |
|
433 |
<div class="spacing_vert_40">
|
434 |
<div class="head_6">
|
435 |
-
<b>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
436 |
<FormField>
|
437 |
<Checkbox checked={selected["complete_status"]} on:change={handleMarkComplete} />
|
438 |
</FormField>
|
|
|
|
|
439 |
</div>
|
440 |
|
441 |
</div>
|
@@ -478,13 +511,17 @@
|
|
478 |
<Label>Save</Label>
|
479 |
</Button>
|
480 |
|
|
|
481 |
<Button
|
482 |
on:click={handleSubmitReport}
|
483 |
variant="outlined"
|
484 |
color="secondary"
|
|
|
485 |
>
|
486 |
<Label>Send to AVID</Label>
|
487 |
</Button>
|
|
|
|
|
488 |
|
489 |
<div>
|
490 |
<span style="color: grey"><i>Last saved:
|
|
|
5 |
|
6 |
import Button, { Label } from "@smui/button";
|
7 |
import Textfield from '@smui/textfield';
|
8 |
+
import Select, { Option } from "@smui/select";
|
9 |
import { new_evidence } from './stores/new_evidence_store.js';
|
10 |
import { open_evidence } from './stores/open_evidence_store.js';
|
11 |
import { topic_chosen } from './stores/cur_topic_store.js';
|
|
|
51 |
let editTitle = false;
|
52 |
let editErrorType = false;
|
53 |
let unfinished_count = 0;
|
54 |
+
let has_complete_report = false;
|
55 |
|
56 |
function setActive(value: string) {
|
57 |
selected = value;
|
|
|
93 |
setActive(selected);
|
94 |
cur_open_evidence = selected["evidence"];
|
95 |
unfinished_count = all_reports.filter(item => !item.complete_status).length
|
96 |
+
has_complete_report = hasCompleteReport();
|
97 |
return all_reports;
|
98 |
}
|
99 |
|
|
|
146 |
const response = await fetch("./save_reports?" + params);
|
147 |
const text = await response.text();
|
148 |
const data = JSON.parse(text);
|
149 |
+
|
150 |
+
has_complete_report = hasCompleteReport();
|
151 |
return data;
|
152 |
}
|
153 |
|
|
|
157 |
error_type: "",
|
158 |
evidence: [],
|
159 |
text_entry: "",
|
160 |
+
sep_selection: "",
|
161 |
complete_status: false,
|
162 |
};
|
163 |
all_reports = all_reports.concat(new_report);
|
|
|
184 |
handleSaveReport(); // Auto-save report
|
185 |
}
|
186 |
|
187 |
+
function hasCompleteReport() {
|
188 |
+
return all_reports.some(item => item.complete_status && (item.evidence.length > 0) && (item.text_entry != "") && (item.sep_selection));
|
189 |
+
}
|
190 |
+
|
191 |
// Error type
|
192 |
let error_type_options = [
|
193 |
{
|
|
|
218 |
editErrorType = false;
|
219 |
}
|
220 |
|
221 |
+
// SEP selection
|
222 |
+
let all_sep_options = [
|
223 |
+
"Accuracy",
|
224 |
+
"Bias/Discrimination",
|
225 |
+
"Adversarial Example",
|
226 |
+
"Other",
|
227 |
+
];
|
228 |
+
|
229 |
let promise_submit = Promise.resolve(null);
|
230 |
function handleSubmitReport() {
|
231 |
promise_submit = submitReport();
|
|
|
430 |
{/key}
|
431 |
</div>
|
432 |
|
433 |
+
<div class="spacing_vert_40">
|
434 |
<div class="head_6">
|
435 |
<b>Summary/Suggestions</b>
|
436 |
</div>
|
|
|
450 |
|
451 |
<div class="spacing_vert_40">
|
452 |
<div class="head_6">
|
453 |
+
<b>Audit Category</b>
|
454 |
+
</div>
|
455 |
+
<div>
|
456 |
+
<Select bind:value={selected["sep_selection"]} label="Audit category" style="width: 90%">
|
457 |
+
{#each all_sep_options as opt}
|
458 |
+
<Option value={opt}>{opt}</Option>
|
459 |
+
{/each}
|
460 |
+
</Select>
|
461 |
+
</div>
|
462 |
+
</div>
|
463 |
+
|
464 |
+
<div class="spacing_vert_100_bottom">
|
465 |
+
<div>
|
466 |
+
<span class="head_6"><b>Mark report as complete?</b></span>
|
467 |
<FormField>
|
468 |
<Checkbox checked={selected["complete_status"]} on:change={handleMarkComplete} />
|
469 |
</FormField>
|
470 |
+
<br>
|
471 |
+
<p>Reports must be marked as complete and include all fields before they can be sent to AVID below.</p>
|
472 |
</div>
|
473 |
|
474 |
</div>
|
|
|
511 |
<Label>Save</Label>
|
512 |
</Button>
|
513 |
|
514 |
+
{#key has_complete_report}
|
515 |
<Button
|
516 |
on:click={handleSubmitReport}
|
517 |
variant="outlined"
|
518 |
color="secondary"
|
519 |
+
disabled={!has_complete_report}
|
520 |
>
|
521 |
<Label>Send to AVID</Label>
|
522 |
</Button>
|
523 |
+
{/key}
|
524 |
+
|
525 |
|
526 |
<div>
|
527 |
<span style="color: grey"><i>Last saved:
|
indie_label_svelte/src/SubmitReportDialog.svelte
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
import Dialog, { Title, Content, Actions } from "@smui/dialog";
|
3 |
import Button, { Label } from "@smui/button";
|
4 |
import Textfield from "@smui/textfield";
|
5 |
-
import Select, { Option } from "@smui/select";
|
6 |
import CircularProgress from '@smui/circular-progress';
|
7 |
|
8 |
export let open;
|
@@ -10,13 +9,6 @@
|
|
10 |
export let all_reports;
|
11 |
let name = "";
|
12 |
let email = "";
|
13 |
-
let all_sep_options = [
|
14 |
-
"Accuracy",
|
15 |
-
"Bias/Discrimination",
|
16 |
-
"Adversarial Example",
|
17 |
-
"Other",
|
18 |
-
];
|
19 |
-
let sep_selection = "";
|
20 |
|
21 |
let promise_submit = Promise.resolve(null);
|
22 |
function handleSubmitReport() {
|
@@ -29,7 +21,6 @@
|
|
29 |
reports: JSON.stringify(all_reports),
|
30 |
name: name,
|
31 |
email: email,
|
32 |
-
sep_selection: sep_selection,
|
33 |
};
|
34 |
|
35 |
let params = new URLSearchParams(req_params).toString();
|
@@ -58,15 +49,16 @@
|
|
58 |
|
59 |
<!-- Summary of complete reports -->
|
60 |
<div>
|
61 |
-
<p><b>Summary of Reports to Send</b> (Reports that include
|
62 |
<ul>
|
63 |
{#each all_reports as report}
|
64 |
-
{#if report["complete_status"] && (report["evidence"].length > 0)}
|
65 |
<li>{report["title"]}</li>
|
66 |
<ul>
|
67 |
<li>Error Type: {report["error_type"]}</li>
|
68 |
<li>Evidence: Includes {report["evidence"].length} example{(report["evidence"].length > 1) ? 's' : ''}</li>
|
69 |
<li>Summary/Suggestions: {report["text_entry"]}</li>
|
|
|
70 |
</ul>
|
71 |
{/if}
|
72 |
{/each}
|
@@ -74,13 +66,6 @@
|
|
74 |
</div>
|
75 |
|
76 |
<!-- Form fields -->
|
77 |
-
<div>
|
78 |
-
<Select bind:value={sep_selection} label="Audit category" style="width: 90%">
|
79 |
-
{#each all_sep_options as opt}
|
80 |
-
<Option value={opt}>{opt}</Option>
|
81 |
-
{/each}
|
82 |
-
</Select>
|
83 |
-
</div>
|
84 |
<div>
|
85 |
<Textfield bind:value={name} label="(Optional) Name" style="width: 90%" />
|
86 |
</div>
|
|
|
2 |
import Dialog, { Title, Content, Actions } from "@smui/dialog";
|
3 |
import Button, { Label } from "@smui/button";
|
4 |
import Textfield from "@smui/textfield";
|
|
|
5 |
import CircularProgress from '@smui/circular-progress';
|
6 |
|
7 |
export let open;
|
|
|
9 |
export let all_reports;
|
10 |
let name = "";
|
11 |
let email = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
let promise_submit = Promise.resolve(null);
|
14 |
function handleSubmitReport() {
|
|
|
21 |
reports: JSON.stringify(all_reports),
|
22 |
name: name,
|
23 |
email: email,
|
|
|
24 |
};
|
25 |
|
26 |
let params = new URLSearchParams(req_params).toString();
|
|
|
49 |
|
50 |
<!-- Summary of complete reports -->
|
51 |
<div>
|
52 |
+
<p><b>Summary of Reports to Send</b> (Reports that include all fields and are marked as complete)</p>
|
53 |
<ul>
|
54 |
{#each all_reports as report}
|
55 |
+
{#if report["complete_status"] && (report["evidence"].length > 0) && (report["text_entry"] != "") && (report["sep_selection"])}
|
56 |
<li>{report["title"]}</li>
|
57 |
<ul>
|
58 |
<li>Error Type: {report["error_type"]}</li>
|
59 |
<li>Evidence: Includes {report["evidence"].length} example{(report["evidence"].length > 1) ? 's' : ''}</li>
|
60 |
<li>Summary/Suggestions: {report["text_entry"]}</li>
|
61 |
+
<li>Audit Category: {report["sep_selection"] || ''}</li>
|
62 |
</ul>
|
63 |
{/if}
|
64 |
{/each}
|
|
|
66 |
</div>
|
67 |
|
68 |
<!-- Form fields -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
<div>
|
70 |
<Textfield bind:value={name} label="(Optional) Name" style="width: 90%" />
|
71 |
</div>
|
server.py
CHANGED
@@ -426,6 +426,7 @@ def get_reports():
|
|
426 |
"error_type": "",
|
427 |
"evidence": [],
|
428 |
"text_entry": "",
|
|
|
429 |
"complete_status": False,
|
430 |
}
|
431 |
]
|
@@ -446,6 +447,7 @@ def get_fixed_scaffold():
|
|
446 |
"error_type": "System is under-sensitive",
|
447 |
"evidence": [],
|
448 |
"text_entry": "",
|
|
|
449 |
"complete_status": False,
|
450 |
},
|
451 |
{
|
@@ -453,6 +455,7 @@ def get_fixed_scaffold():
|
|
453 |
"error_type": "System is over-sensitive",
|
454 |
"evidence": [],
|
455 |
"text_entry": "",
|
|
|
456 |
"complete_status": False,
|
457 |
},
|
458 |
{
|
@@ -460,6 +463,7 @@ def get_fixed_scaffold():
|
|
460 |
"error_type": "System is under-sensitive",
|
461 |
"evidence": [],
|
462 |
"text_entry": "",
|
|
|
463 |
"complete_status": False,
|
464 |
},
|
465 |
{
|
@@ -467,6 +471,7 @@ def get_fixed_scaffold():
|
|
467 |
"error_type": "System is over-sensitive",
|
468 |
"evidence": [],
|
469 |
"text_entry": "",
|
|
|
470 |
"complete_status": False,
|
471 |
},
|
472 |
{
|
@@ -474,6 +479,7 @@ def get_fixed_scaffold():
|
|
474 |
"error_type": "System is under-sensitive",
|
475 |
"evidence": [],
|
476 |
"text_entry": "",
|
|
|
477 |
"complete_status": False,
|
478 |
},
|
479 |
]
|
@@ -484,6 +490,7 @@ def get_empty_report(title, error_type):
|
|
484 |
"error_type": error_type,
|
485 |
"evidence": [],
|
486 |
"text_entry": "",
|
|
|
487 |
"complete_status": False,
|
488 |
}
|
489 |
|
@@ -494,6 +501,7 @@ def get_tutorial_scaffold():
|
|
494 |
"error_type": "System is over-sensitive",
|
495 |
"evidence": [],
|
496 |
"text_entry": "",
|
|
|
497 |
"complete_status": False,
|
498 |
},
|
499 |
]
|
@@ -606,6 +614,7 @@ def get_prompts_scaffold():
|
|
606 |
"error_type": "System is over-sensitive",
|
607 |
"evidence": [],
|
608 |
"text_entry": "",
|
|
|
609 |
"complete_status": False,
|
610 |
},
|
611 |
{
|
@@ -613,6 +622,7 @@ def get_prompts_scaffold():
|
|
613 |
"error_type": "System is under-sensitive",
|
614 |
"evidence": [],
|
615 |
"text_entry": "",
|
|
|
616 |
"complete_status": False,
|
617 |
},
|
618 |
{
|
@@ -620,6 +630,7 @@ def get_prompts_scaffold():
|
|
620 |
"error_type": "",
|
621 |
"evidence": [],
|
622 |
"text_entry": "",
|
|
|
623 |
"complete_status": False,
|
624 |
},
|
625 |
{
|
@@ -627,6 +638,7 @@ def get_prompts_scaffold():
|
|
627 |
"error_type": "",
|
628 |
"evidence": [],
|
629 |
"text_entry": "",
|
|
|
630 |
"complete_status": False,
|
631 |
},
|
632 |
{
|
@@ -634,6 +646,7 @@ def get_prompts_scaffold():
|
|
634 |
"error_type": "",
|
635 |
"evidence": [],
|
636 |
"text_entry": "",
|
|
|
637 |
"complete_status": False,
|
638 |
},
|
639 |
]
|
@@ -648,7 +661,7 @@ def get_eligible_reports(reports):
|
|
648 |
|
649 |
# Submit all reports to AVID
|
650 |
# Logs the responses
|
651 |
-
def submit_reports_to_AVID(reports, cur_user, name, email,
|
652 |
# Set up the connection to AVID
|
653 |
root = os.environ.get('AVID_API_URL')
|
654 |
api_key = os.environ.get('AVID_API_KEY')
|
@@ -659,6 +672,7 @@ def submit_reports_to_AVID(reports, cur_user, name, email, sep_selection, debug=
|
|
659 |
print("Num eligible reports:", len(reports))
|
660 |
|
661 |
for r in reports:
|
|
|
662 |
new_report = utils.convert_indie_label_json_to_avid_json(r, cur_user, name, email, sep_selection)
|
663 |
url = root + "submit"
|
664 |
response = requests.post(url, json=json.loads(new_report), headers=key) # The loads ensures type compliance
|
@@ -695,13 +709,12 @@ def submit_avid_report():
|
|
695 |
cur_user = request.args.get("cur_user")
|
696 |
name = request.args.get("name")
|
697 |
email = request.args.get("email")
|
698 |
-
sep_selection = request.args.get("sep_selection")
|
699 |
reports_json = request.args.get("reports")
|
700 |
|
701 |
reports = json.loads(reports_json)
|
702 |
|
703 |
# Submit reports to AVID
|
704 |
-
submit_reports_to_AVID(reports, cur_user, name, email
|
705 |
|
706 |
results = {
|
707 |
"status": "success",
|
|
|
426 |
"error_type": "",
|
427 |
"evidence": [],
|
428 |
"text_entry": "",
|
429 |
+
"sep_selection": "",
|
430 |
"complete_status": False,
|
431 |
}
|
432 |
]
|
|
|
447 |
"error_type": "System is under-sensitive",
|
448 |
"evidence": [],
|
449 |
"text_entry": "",
|
450 |
+
"sep_selection": "",
|
451 |
"complete_status": False,
|
452 |
},
|
453 |
{
|
|
|
455 |
"error_type": "System is over-sensitive",
|
456 |
"evidence": [],
|
457 |
"text_entry": "",
|
458 |
+
"sep_selection": "",
|
459 |
"complete_status": False,
|
460 |
},
|
461 |
{
|
|
|
463 |
"error_type": "System is under-sensitive",
|
464 |
"evidence": [],
|
465 |
"text_entry": "",
|
466 |
+
"sep_selection": "",
|
467 |
"complete_status": False,
|
468 |
},
|
469 |
{
|
|
|
471 |
"error_type": "System is over-sensitive",
|
472 |
"evidence": [],
|
473 |
"text_entry": "",
|
474 |
+
"sep_selection": "",
|
475 |
"complete_status": False,
|
476 |
},
|
477 |
{
|
|
|
479 |
"error_type": "System is under-sensitive",
|
480 |
"evidence": [],
|
481 |
"text_entry": "",
|
482 |
+
"sep_selection": "",
|
483 |
"complete_status": False,
|
484 |
},
|
485 |
]
|
|
|
490 |
"error_type": error_type,
|
491 |
"evidence": [],
|
492 |
"text_entry": "",
|
493 |
+
"sep_selection": "",
|
494 |
"complete_status": False,
|
495 |
}
|
496 |
|
|
|
501 |
"error_type": "System is over-sensitive",
|
502 |
"evidence": [],
|
503 |
"text_entry": "",
|
504 |
+
"sep_selection": "",
|
505 |
"complete_status": False,
|
506 |
},
|
507 |
]
|
|
|
614 |
"error_type": "System is over-sensitive",
|
615 |
"evidence": [],
|
616 |
"text_entry": "",
|
617 |
+
"sep_selection": "",
|
618 |
"complete_status": False,
|
619 |
},
|
620 |
{
|
|
|
622 |
"error_type": "System is under-sensitive",
|
623 |
"evidence": [],
|
624 |
"text_entry": "",
|
625 |
+
"sep_selection": "",
|
626 |
"complete_status": False,
|
627 |
},
|
628 |
{
|
|
|
630 |
"error_type": "",
|
631 |
"evidence": [],
|
632 |
"text_entry": "",
|
633 |
+
"sep_selection": "",
|
634 |
"complete_status": False,
|
635 |
},
|
636 |
{
|
|
|
638 |
"error_type": "",
|
639 |
"evidence": [],
|
640 |
"text_entry": "",
|
641 |
+
"sep_selection": "",
|
642 |
"complete_status": False,
|
643 |
},
|
644 |
{
|
|
|
646 |
"error_type": "",
|
647 |
"evidence": [],
|
648 |
"text_entry": "",
|
649 |
+
"sep_selection": "",
|
650 |
"complete_status": False,
|
651 |
},
|
652 |
]
|
|
|
661 |
|
662 |
# Submit all reports to AVID
|
663 |
# Logs the responses
|
664 |
+
def submit_reports_to_AVID(reports, cur_user, name, email, debug=DEBUG):
|
665 |
# Set up the connection to AVID
|
666 |
root = os.environ.get('AVID_API_URL')
|
667 |
api_key = os.environ.get('AVID_API_KEY')
|
|
|
672 |
print("Num eligible reports:", len(reports))
|
673 |
|
674 |
for r in reports:
|
675 |
+
sep_selection = r["sep_selection"]
|
676 |
new_report = utils.convert_indie_label_json_to_avid_json(r, cur_user, name, email, sep_selection)
|
677 |
url = root + "submit"
|
678 |
response = requests.post(url, json=json.loads(new_report), headers=key) # The loads ensures type compliance
|
|
|
709 |
cur_user = request.args.get("cur_user")
|
710 |
name = request.args.get("name")
|
711 |
email = request.args.get("email")
|
|
|
712 |
reports_json = request.args.get("reports")
|
713 |
|
714 |
reports = json.loads(reports_json)
|
715 |
|
716 |
# Submit reports to AVID
|
717 |
+
submit_reports_to_AVID(reports, cur_user, name, email)
|
718 |
|
719 |
results = {
|
720 |
"status": "success",
|