Skip to content

Commit 1c8f8d0

Browse files
committed
work on tutorials
1 parent 2bb7dbc commit 1c8f8d0

17 files changed

+369
-688
lines changed
File renamed without changes.

docs/source/for_mapswipe_managers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ docker run --name mapswipe_workers_local -it pythonmapswipeworkers_mapswipe_work
4141
mapswipe_workers --verbose user-management [email protected] --manager=true
4242
exit
4343
docker rm mapswipe_workers_local
44-
44+
```

docs/source/tutorials.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Tutorials
2+
For each project type there should be at least one tutorial. Tutorials are similar to actual projects. To display the tutorial we will use the same design and screens as if a user would map for real.
3+
4+
## Data Perspective
5+
Tutorials and projects have the following in common:
6+
* both have groups with the same structure (there can also be several groups per tutorial)
7+
* both have tasks
8+
9+
However, for tutorials there are some additional attributes for tasks:
10+
* `referenceAnswer`: this is the expected answer
11+
* `category`: this refers to what the user should learn in this task (e.g. to map a building or correctly classify clouds)
12+
13+
What are *categories*?
14+
* for each project type we can think about several steps that the users should learn (e.g. learn how to map a building, learn what is not a building, ...)
15+
* for each project type there is a fixed number of categories
16+
* for each category there will be 3 text caption:
17+
* `pre`: will be displayed initially
18+
* `post_correct`: will be displayed if expected result(s) and actual result(s) match
19+
* `post_wrong`: will be displayed if expected result(s) and actual result(s) **don't** match
20+
* the text captions for the categories should be translated to all available languages
21+
22+
## Functionality Perspective
23+
The main interaction will be the same for projects and tutorials. However, there will be sligh differences:
24+
25+
Tutorials will **not**:
26+
* upload results to firebase (and increase your user statistics)
27+
28+
Tutorials will:
29+
* show the expected results after your first swipe or interaction
30+
* show the next tasks after swiping again (after the expected results have been shown)
31+
* once all tasks have been displayed you start to map for real projects

mapswipe_workers/.gitignore

Lines changed: 0 additions & 131 deletions
This file was deleted.

mapswipe_workers/mapswipe_workers/mapswipe_workers.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import click
33
import schedule as sched
44
import pickle
5+
import json
56

67
from mapswipe_workers.definitions import CustomError
78
from mapswipe_workers.definitions import logger
@@ -14,6 +15,7 @@
1415
from mapswipe_workers.firebase_to_postgres import update_data
1516
from mapswipe_workers.project_types.build_area.build_area_project \
1617
import BuildAreaProject
18+
from mapswipe_workers.project_types.build_area import build_area_tutorial
1719
from mapswipe_workers.project_types.footprint.footprint_project \
1820
import FootprintProject
1921
from mapswipe_workers.project_types.change_detection.change_detection_project \
@@ -207,6 +209,36 @@ def run_user_management(email, manager):
207209
logger.exception(e)
208210

209211

212+
@click.command('create-tutorial')
213+
@click.option(
214+
'--input_file',
215+
help=(
216+
f'The json file with your tutorial information.'
217+
),
218+
required=True,
219+
type=str
220+
)
221+
def run_create_tutorial(input_file):
222+
sentry.init_sentry()
223+
try:
224+
logger.info(f'will generate tutorial based on {input_file}')
225+
with open(input_file) as json_file:
226+
tutorial = json.load(json_file)
227+
228+
project_type = tutorial['projectType']
229+
230+
project_types_tutorial = {
231+
# Make sure to import all project types here
232+
1: build_area_tutorial.create_tutorial
233+
}
234+
235+
project_types_tutorial[project_type](tutorial)
236+
except Exception as e:
237+
slack.send_error(e)
238+
sentry.capture_exception_sentry(e)
239+
logger.exception(e)
240+
241+
210242
@click.command('run')
211243
@click.option(
212244
'--schedule',
@@ -372,4 +404,5 @@ def _run_user_management(email, manager):
372404
cli.add_command(run_firebase_to_postgres)
373405
cli.add_command(run_generate_stats)
374406
cli.add_command(run_user_management)
407+
cli.add_command(run_create_tutorial)
375408
cli.add_command(run)

0 commit comments

Comments
 (0)