Ranking Compare Annotate App
flask_app.app_ranking_compare_annotate.loader_user(_user_id)
Source code in flask_app/app_ranking_compare_annotate.py
64 65 66 67 |
|
flask_app.app_ranking_compare_annotate.start_compare_annotate(experiment_id)
Renders the Log-in page for the Ranking Comparison Annotate UI Args: experiment_id (int): The ID of the experiment.
Returns:
Type | Description |
---|---|
flask.Response or flask.render_template: The response object or the rendered template for the start ranking page. |
Notes
This function is responsible for handling the initial steps when a user logs in to the Interaction 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_compare.html' template.
Source code in flask_app/app_ranking_compare_annotate.py
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 |
|
flask_app.app_ranking_compare_annotate.logout()
Logs out the user and redirects to the login page.
Returns:
Type | Description |
---|---|
A Flask response object with a redirect to the login page. |
Source code in flask_app/app_ranking_compare_annotate.py
145 146 147 148 149 150 151 152 153 154 155 156 |
|
flask_app.app_ranking_compare_annotate.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_ranking_compare_annotate.py
159 160 161 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 |
|
flask_app.app_ranking_compare_annotate.index_compare_annotate(experiment_id, n_task)
Renders Ranking Comparison UI for annotators.
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 HTML template for the index_ranking_compare_template. |
Source code in flask_app/app_ranking_compare_annotate.py
192 193 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 |
|
flask_app.app_ranking_compare_annotate.store_data_compare_ranking_ranking()
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_ranking_compare_annotate.py
263 264 265 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 |
|
flask_app.app_ranking_compare_annotate.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_ranking_compare_annotate.py
293 294 295 296 297 298 299 300 301 302 303 |
|
flask_app.app_ranking_compare_annotate.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_ranking_compare_annotate.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
|
flask_app.app_ranking_compare_annotate.stop_experiment()
Returns:
Type | Description |
---|---|
A rendered template for the stop_experiment_template.html. |
Source code in flask_app/app_ranking_compare_annotate.py
325 326 327 328 329 330 331 332 |
|