Spaces:
Running
Running
Commit ·
d016624
1
Parent(s): 59cfd68
Refactor evaluation process and enhance navigation controls
Browse filesUpdate the evaluation function to handle skip and stop_save actions before validation, improving user experience. Remove the description field from the evaluation data submission. Revamp the top navigation styles and structure in the HTML and CSS to provide clearer access to navigation buttons, ensuring a more intuitive interface for users.
- app.py +3 -1
- static/style.css +30 -6
- templates/evaluate.html +24 -12
app.py
CHANGED
|
@@ -385,6 +385,7 @@ def evaluate():
|
|
| 385 |
if request.method == 'POST':
|
| 386 |
action = request.form.get('action', 'submit')
|
| 387 |
|
|
|
|
| 388 |
if action == 'skip':
|
| 389 |
current_index = min(current_index + 1, len(documents) + 1)
|
| 390 |
save_current_index(evaluator_name, current_index)
|
|
@@ -395,6 +396,7 @@ def evaluate():
|
|
| 395 |
flash("Progress saved. You can resume later.")
|
| 396 |
return redirect(url_for('results', session_saved=True))
|
| 397 |
|
|
|
|
| 398 |
elif action == 'submit':
|
| 399 |
if current_index <= len(documents):
|
| 400 |
current_doc = documents[current_index - 1]
|
|
@@ -451,7 +453,7 @@ def evaluate():
|
|
| 451 |
current_note_number=current_index,
|
| 452 |
evaluator_name=evaluator_name,
|
| 453 |
note=document.get('note', ''),
|
| 454 |
-
description
|
| 455 |
mrn=document.get('mrn', ''),
|
| 456 |
criteria=CRITERIA,
|
| 457 |
descriptions=CRITERIA_DESCRIPTIONS,
|
|
|
|
| 385 |
if request.method == 'POST':
|
| 386 |
action = request.form.get('action', 'submit')
|
| 387 |
|
| 388 |
+
# Handle skip and stop_save BEFORE any validation
|
| 389 |
if action == 'skip':
|
| 390 |
current_index = min(current_index + 1, len(documents) + 1)
|
| 391 |
save_current_index(evaluator_name, current_index)
|
|
|
|
| 396 |
flash("Progress saved. You can resume later.")
|
| 397 |
return redirect(url_for('results', session_saved=True))
|
| 398 |
|
| 399 |
+
# Only validate fields for submit action
|
| 400 |
elif action == 'submit':
|
| 401 |
if current_index <= len(documents):
|
| 402 |
current_doc = documents[current_index - 1]
|
|
|
|
| 453 |
current_note_number=current_index,
|
| 454 |
evaluator_name=evaluator_name,
|
| 455 |
note=document.get('note', ''),
|
| 456 |
+
# Removed description from here
|
| 457 |
mrn=document.get('mrn', ''),
|
| 458 |
criteria=CRITERIA,
|
| 459 |
descriptions=CRITERIA_DESCRIPTIONS,
|
static/style.css
CHANGED
|
@@ -196,24 +196,34 @@ h1, h2, h3 {
|
|
| 196 |
margin: 20px 0;
|
| 197 |
}
|
| 198 |
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
padding: 15px;
|
|
|
|
| 202 |
border-radius: 8px;
|
| 203 |
-
margin-bottom: 20px;
|
| 204 |
border: 1px solid #dee2e6;
|
| 205 |
}
|
| 206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
.jump-form {
|
| 208 |
display: flex;
|
| 209 |
align-items: center;
|
| 210 |
gap: 10px;
|
| 211 |
-
|
| 212 |
}
|
| 213 |
|
| 214 |
.jump-form label {
|
| 215 |
font-weight: bold;
|
| 216 |
color: #333;
|
|
|
|
| 217 |
}
|
| 218 |
|
| 219 |
.jump-form input[type="number"] {
|
|
@@ -341,10 +351,24 @@ h1, h2, h3 {
|
|
| 341 |
align-items: center;
|
| 342 |
}
|
| 343 |
|
| 344 |
-
.
|
| 345 |
flex-direction: column;
|
| 346 |
gap: 15px;
|
| 347 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
}
|
| 349 |
|
| 350 |
.jump-form input[type="number"] {
|
|
|
|
| 196 |
margin: 20px 0;
|
| 197 |
}
|
| 198 |
|
| 199 |
+
/* Updated styles for top navigation */
|
| 200 |
+
.top-navigation-buttons {
|
| 201 |
+
display: flex;
|
| 202 |
+
align-items: center;
|
| 203 |
+
gap: 10px;
|
| 204 |
+
justify-content: space-between;
|
| 205 |
+
margin-bottom: 20px;
|
| 206 |
padding: 15px;
|
| 207 |
+
background-color: #f8f9fa;
|
| 208 |
border-radius: 8px;
|
|
|
|
| 209 |
border: 1px solid #dee2e6;
|
| 210 |
}
|
| 211 |
|
| 212 |
+
.top-navigation-buttons form {
|
| 213 |
+
margin: 0;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
.jump-form {
|
| 217 |
display: flex;
|
| 218 |
align-items: center;
|
| 219 |
gap: 10px;
|
| 220 |
+
margin: 0 !important;
|
| 221 |
}
|
| 222 |
|
| 223 |
.jump-form label {
|
| 224 |
font-weight: bold;
|
| 225 |
color: #333;
|
| 226 |
+
margin: 0;
|
| 227 |
}
|
| 228 |
|
| 229 |
.jump-form input[type="number"] {
|
|
|
|
| 351 |
align-items: center;
|
| 352 |
}
|
| 353 |
|
| 354 |
+
.top-navigation-buttons {
|
| 355 |
flex-direction: column;
|
| 356 |
gap: 15px;
|
| 357 |
+
align-items: stretch;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
.top-navigation-buttons form {
|
| 361 |
+
width: 100%;
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
.top-navigation-buttons button {
|
| 365 |
+
width: 100%;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
.jump-form {
|
| 369 |
+
flex-direction: row;
|
| 370 |
+
justify-content: center;
|
| 371 |
+
width: 100%;
|
| 372 |
}
|
| 373 |
|
| 374 |
.jump-form input[type="number"] {
|
templates/evaluate.html
CHANGED
|
@@ -27,6 +27,17 @@
|
|
| 27 |
.origin-option input[type="radio"] {
|
| 28 |
margin: 0;
|
| 29 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
</style>
|
| 31 |
</head>
|
| 32 |
<body>
|
|
@@ -54,9 +65,18 @@
|
|
| 54 |
</div>
|
| 55 |
</div>
|
| 56 |
|
| 57 |
-
<
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
<input type="number" id="document_number" name="document_number"
|
| 61 |
min="1" max="{{ total_docs }}" value="{{ current_note_number }}" required>
|
| 62 |
<button type="submit" class="jump-btn">Jump</button>
|
|
@@ -71,18 +91,13 @@
|
|
| 71 |
<strong>MRN:</strong> {{ mrn }}
|
| 72 |
</div>
|
| 73 |
{% endif %}
|
| 74 |
-
{% if description %}
|
| 75 |
-
<div class="info-item">
|
| 76 |
-
<strong>Description:</strong> {{ description }}
|
| 77 |
-
</div>
|
| 78 |
-
{% endif %}
|
| 79 |
</div>
|
| 80 |
<div class="note-content">
|
| 81 |
{{ note }}
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
|
| 85 |
-
<!-- Single form for
|
| 86 |
<form method="POST" action="{{ url_for('evaluate') }}" id="evaluation-form">
|
| 87 |
<div class="criteria-container">
|
| 88 |
{% for i in range(criteria|length) %}
|
|
@@ -119,9 +134,6 @@
|
|
| 119 |
|
| 120 |
<div class="form-buttons">
|
| 121 |
<button type="submit" name="action" value="submit" class="submit-btn">Submit Evaluation</button>
|
| 122 |
-
<button type="submit" name="action" value="skip" class="skip-btn"
|
| 123 |
-
onclick="return confirm('Are you sure you want to skip this document?');">Skip Document</button>
|
| 124 |
-
<button type="submit" name="action" value="stop_save" class="stop-save-btn">Stop and Save Progress</button>
|
| 125 |
</div>
|
| 126 |
</form>
|
| 127 |
|
|
|
|
| 27 |
.origin-option input[type="radio"] {
|
| 28 |
margin: 0;
|
| 29 |
}
|
| 30 |
+
|
| 31 |
+
.top-navigation-buttons {
|
| 32 |
+
display: flex;
|
| 33 |
+
gap: 10px;
|
| 34 |
+
justify-content: flex-end;
|
| 35 |
+
margin-bottom: 20px;
|
| 36 |
+
padding: 15px;
|
| 37 |
+
background-color: #f8f9fa;
|
| 38 |
+
border-radius: 8px;
|
| 39 |
+
border: 1px solid #dee2e6;
|
| 40 |
+
}
|
| 41 |
</style>
|
| 42 |
</head>
|
| 43 |
<body>
|
|
|
|
| 65 |
</div>
|
| 66 |
</div>
|
| 67 |
|
| 68 |
+
<!-- Top navigation buttons for Skip and Exit -->
|
| 69 |
+
<div class="top-navigation-buttons">
|
| 70 |
+
<form method="POST" action="{{ url_for('evaluate') }}" style="display: inline;">
|
| 71 |
+
<button type="submit" name="action" value="skip" class="skip-btn">Skip Document</button>
|
| 72 |
+
</form>
|
| 73 |
+
|
| 74 |
+
<form method="POST" action="{{ url_for('evaluate') }}" style="display: inline;">
|
| 75 |
+
<button type="submit" name="action" value="stop_save" class="stop-save-btn">Exit and Save Progress</button>
|
| 76 |
+
</form>
|
| 77 |
+
|
| 78 |
+
<form method="POST" action="{{ url_for('jump_to_document') }}" class="jump-form" style="display: inline; margin-left: 20px;">
|
| 79 |
+
<label for="document_number">Jump to Note:</label>
|
| 80 |
<input type="number" id="document_number" name="document_number"
|
| 81 |
min="1" max="{{ total_docs }}" value="{{ current_note_number }}" required>
|
| 82 |
<button type="submit" class="jump-btn">Jump</button>
|
|
|
|
| 91 |
<strong>MRN:</strong> {{ mrn }}
|
| 92 |
</div>
|
| 93 |
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
</div>
|
| 95 |
<div class="note-content">
|
| 96 |
{{ note }}
|
| 97 |
</div>
|
| 98 |
</div>
|
| 99 |
|
| 100 |
+
<!-- Single form for evaluation data -->
|
| 101 |
<form method="POST" action="{{ url_for('evaluate') }}" id="evaluation-form">
|
| 102 |
<div class="criteria-container">
|
| 103 |
{% for i in range(criteria|length) %}
|
|
|
|
| 134 |
|
| 135 |
<div class="form-buttons">
|
| 136 |
<button type="submit" name="action" value="submit" class="submit-btn">Submit Evaluation</button>
|
|
|
|
|
|
|
|
|
|
| 137 |
</div>
|
| 138 |
</form>
|
| 139 |
|