Annotate Document App
flask_app.app_annotate_document.start_annotate(experiment_id)
Renders the Log-in page for the Score Annotate UI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_id |
int
|
The ID of the experiment. |
required |
Returns:
Type | Description |
---|---|
flask.Response or flask.render_template: The response object or the rendered template. |
Notes
This function is responsible for handling the initial steps when a user logs in to the Score Annotate UI. If the user is authenticated, it sets the session variables and redirects to the next task URL. If the request method is POST, it records the user in the database and creates a new user if necessary. Finally, it renders the 'start_annotate.html' template.
Source code in flask_app/app_annotate_document.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
flask_app.app_annotate_document.logout()
Logs out the user and redirects to the login page.
Returns:
Type | Description |
---|---|
flask.Response: The response object with the redirect to the login page. |
Source code in flask_app/app_annotate_document.py
148 149 150 151 152 153 154 155 156 157 158 159 |
|
flask_app.app_annotate_document.get_next_task(experiment_id)
Get the next task to be assessed by the annotator based on the experiment list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_id |
str
|
The ID of the experiment. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
A JSON response containing the next task to be assessed. The response has the following format: { 'next_task': str } If there are no more tasks to be assessed, the 'next_task' value will be 'form' or 'stop_experiment'. |
Source code in flask_app/app_annotate_document.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
flask_app.app_annotate_document.index_annotate(experiment_id, n_task)
Renders the Score Annotate UI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
experiment_id |
str
|
The ID of the experiment. |
required |
n_task |
int
|
The index of the task. |
required |
Returns:
Name | Type | Description |
---|---|---|
render_template |
The rendered template for the Score Annotate UI. |
Source code in flask_app/app_annotate_document.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
flask_app.app_annotate_document.store_data_annotate()
Stores the annotation data received from the user to the MongoDB database.
Returns:
Name | Type | Description |
---|---|---|
str |
A string indicating the success of the operation. |
Source code in flask_app/app_annotate_document.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
|
flask_app.app_annotate_document.form_demographic_data()
Renders the 'form_template.html' template with the items specified in the 'exit_survey' configuration.
Returns:
Type | Description |
---|---|
The rendered template. |
Source code in flask_app/app_annotate_document.py
295 296 297 298 299 300 301 302 303 304 305 |
|
flask_app.app_annotate_document.form_submit()
Stores the data collected in the form to the MongoDB database.
Returns:
Name | Type | Description |
---|---|---|
str |
A string indicating the success of the operation. |
Source code in flask_app/app_annotate_document.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
flask_app.app_annotate_document.stop_experiment()
Stops the experiment and performs a quality check on the annotator's responses.
This function is called when the app reaches the last experiment task. It checks whether the annotator failed the attention check task.
Returns:
Type | Description |
---|---|
A rendered template for the stop_experiment_template.html. |
Source code in flask_app/app_annotate_document.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|