Skip to content

Commit 5975d18

Browse files
authored
Merge pull request #523 from mapswipe/update_docu
Draft: Documentation update
2 parents 473ccc9 + 2d6b911 commit 5975d18

17 files changed

+553
-590
lines changed
127 KB
Loading
136 KB
Loading

docs/source/cli.md

Lines changed: 4 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Command Line Interface
22

3-
THIS DOCUMENT IS OUTDATED: Please use the `--help` flag of the CLI.
3+
The Mapswipe Backend provides a Command Line Interface(CLI) with which the users can interact with the program.
4+
They can be used for example to create projects, which were uploaded to the [manager-dashboard](for_mapswipe_managers.html),
5+
or to export statistics on the finished projects. To get a comprehensible lists of the available commands use the ```--help``` flag.
46

5-
---
6-
7-
This document describes how to use the command line interface of MapSwipe Worker.
7+
```mapswipe_workers --help``` would get you all possible commands, while e.g. ```mapswipe_workers archive --help``` would get you additional information on how to use that command.
88

99
In our current deployment setup the commands of the MapSwipe Workers CLI are hard-coded in the Docker-Compose File.
1010

@@ -13,148 +13,3 @@ You can run these commands also using docker-compose:
1313
```
1414
docker-compose run mapswipe_workers mapswipe_workers --help
1515
```
16-
17-
18-
```
19-
Usage: mapswipe_workers [OPTIONS] COMMAND [ARGS]...
20-
21-
Options:
22-
-v, --verbose
23-
--version Show the version and exit.
24-
--help Show this message and exit.
25-
26-
Commands:
27-
create-projects
28-
create-tutorial
29-
firebase-to-postgres
30-
generate-stats
31-
run
32-
user-management
33-
```
34-
35-
36-
## Create projects from submitted project drafts
37-
38-
```
39-
Usage: mapswipe_workers create-projects [OPTIONS]
40-
41-
Options:
42-
-s, --schedule [m|h|d] Will create projects every 10 minutes (m), every
43-
hour (h) or every day (d).
44-
--help Show this message and exit.
45-
```
46-
47-
48-
## Transfer data from Firebase to Postgres
49-
50-
```
51-
Usage: mapswipe_workers firebase-to-postgres [OPTIONS]
52-
53-
Options:
54-
-s, --schedule [m|h|d] Will update and transfer relevant data (i.a. users
55-
and results) from Firebase into Postgres every 10
56-
minutes (m), every hour (h) or every day (d).
57-
--help Show this message and exit.
58-
```
59-
60-
61-
## Generate Statistics
62-
63-
```
64-
Usage: mapswipe_workers generate-stats [OPTIONS]
65-
66-
Options:
67-
-s, --schedule [m|h|d] Generate stats every 10 minutes (m), every hour (h)
68-
or every day (d).
69-
--project_id_list TEXT provide project id strings as a list stats will be
70-
generated only for these projects.
71-
Use it like '["project_a", "project_b"]'
72-
--help Show this message and exit.
73-
```
74-
75-
## Generate Statistics for all projects
76-
77-
Ideally you run this using a separate docker container. e.g. like this:
78-
79-
```
80-
docker-compose run mapswipe_workers mapswipe_workers generate-stats-all-projects
81-
```
82-
83-
```
84-
Usage: mapswipe_workers generate-stats-all-projects [OPTIONS]
85-
86-
Options:
87-
-s, --schedule [m|h|d] Generate stats every 10 minutes (m), every hour (h)
88-
or every day (d).
89-
--help Show this message and exit.
90-
```
91-
92-
## User Management
93-
94-
```
95-
Usage: mapswipe_workers user-management [OPTIONS]
96-
97-
Options:
98-
--email TEXT The email of the MapSwipe user. [required]
99-
--manager BOOLEAN Set option to grant or remove project manager
100-
credentials. Use true to grant credentials. Use false to
101-
remove credentials.
102-
--help Show this message and exit.
103-
```
104-
105-
## Archive Projects
106-
107-
```
108-
Usage: mapswipe_workers archive [OPTIONS]
109-
110-
Archive projects in Postgres. Delete groups, tasks and results from
111-
Firebase.
112-
113-
Options:
114-
-i, --project-id TEXT Archive project with giving project id
115-
--project-ids TEXT Archive multiple projects. Provide project id strings
116-
as a list: '["project_a", "project_b"]'
117-
118-
--help Show this message and exit.
119-
120-
```
121-
122-
You can get the project ids for the projects to be archive either from the manager dashboard or query directly in postgres. For example:
123-
124-
```
125-
SELECT project_id
126-
FROM projects
127-
WHERE status = 'finished' AND created < '2020-09-01'
128-
```
129-
130-
## Delete Projects
131-
132-
```
133-
Usage: mapswipe_workers delete [OPTIONS]
134-
135-
Delete tasks, groups, project and results.
136-
137-
Options:
138-
-i, --project-id TEXT Delete project with giving project id
139-
--project-ids TEXT Delete multiple projects. Provide project id strings
140-
as a list: '["project_a", "project_b"]'
141-
142-
--help Show this message and exit.
143-
```
144-
145-
146-
## Create Tutorial from json file (e.g. provided in sample data)
147-
148-
```
149-
Usage: mapswipe_workers create-tutorial [OPTIONS]
150-
151-
Options:
152-
--input_file TEXT The json file with your tutorial information. [required]
153-
--help Show this message and exit.
154-
155-
```
156-
157-
## Run a script which requires mapswipe_workers library
158-
```
159-
docker-compose run mapswipe_workers python3 python_scripts/add_project_geometries_to_api.py
160-
```

docs/source/configuration.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,24 @@ In following chapters configuration values and keys are discussed for each part
1313
All configuration values for MapSwipe Workers are stored in environment variables.
1414

1515
Required environment variables are:
16+
### Firebase
1617
- FIREBASE_API_KEY
1718
- FIREBASE_DB
19+
- FIREBASE_TOKEN
20+
- GOOGLE_APPLICATION_CREDENTIALS
21+
22+
### Postgres DB
1823
- POSTGRES_DB
1924
- POSTGRES_HOST
2025
- POSTGRES_PASSWORD
2126
- POSTGRES_PORT
2227
- POSTGRES_USER
2328

24-
Optional environment variables are:
29+
### OSMCha
30+
31+
- OSMCHA_API_KEY
32+
33+
### Optional environment variables:
2534
- SLACK_CHANNEL
2635
- SLACK_TOKEN
2736
- SENTRY_DSN
@@ -34,19 +43,16 @@ For satellite imagery access to at least one provider is needed. Define the API
3443
- IMAGE_ESRI_API_KEY
3544
- IMAGE_ESRI_BETA_API_KEY
3645

37-
In addition to get access to Firebase a Service Account Key is required.
38-
The path the Service Account Key is defined in:
39-
- GOOGLE_APPLICATION_CREDENTIALS
40-
4146
> Notes: When deploying using `docker` or `docker-compose` `POSTGRES_HOST` should have the value `postgres` and the Service Account Key (`serviceAccountKey.json`) should be copied to `mapswipe_workers/serviceAccountKey.json` so that during the build of the image the file can by copied by Docker.
4247
43-
4448
### Elaboration
4549

4650
**Firebase**: MapSwipe Workers use the Firebase Python SDK and the Firebase REST API. Both require the database name (`FIREBASE_DB`) and the API-Key from the Firebase instance. The Firebase Python SDK does also need a Service Account Key. The path to this file is set in the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
4751

4852
**Postgres**: MapSwipe Workers writes data to a Postgres database and generate files for the API based data in Postgres.
4953

54+
**OSMCha**: MapSwipe Workers enriches some Projects with data from OSM changelogs which are requested from OSMCha. Create an account, you will find you api key in your profile e.g. `Token 589adf125234a`
55+
5056
**Sentry (optional)**: MapSwipe workers use sentry to capture exceptions. You can find your project’s DSN in the “Client Keys” section of your “Project Settings” in Sentry. Check [Sentry's documentation](https://docs.sentry.io/error-reporting/configuration/?platform=python) for more information.
5157

5258
**Slack (optional)**: The MapSwipe workers send messages to slack when a project has been created successfully, the project creation failed or an exception gets raised. refer to [Python slackclient's documentation](https://github.com/slackapi/python-slackclient) how to get a Slack Token.
@@ -80,13 +86,26 @@ The Service Account Key (`serviceAccountKey.json`) should be saved to `postgres/
8086

8187
## Manager Dashboard
8288

89+
Please refer to the official [documentation](https://firebase.google.com/docs/web/learn-more#config-object) if you set up your own firebase.
90+
Otherwise you can request guidance on the settings from the mapswipe team. The structure of your app.js should look like below.
91+
8392
`manager_dashboard/manager_dashboard/js/app.js`
8493

8594
```
86-
TODO
95+
// Your web app's Firebase configuration
96+
var firebaseConfig = {
97+
apiKey: "",
98+
authDomain: "",
99+
databaseURL: "",
100+
projectId: "",
101+
storageBucket: "",
102+
messagingSenderId: "",
103+
appId: ""
104+
};
105+
// Initialize Firebase
106+
firebase.initializeApp(firebaseConfig);
87107
```
88108

89-
90109
## NGINX
91110

92111
`nginx/nginx.conf`:

docs/source/contributing.md

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

docs/source/data.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Attributes:
3131

3232

3333
## Aggregated Results
34-
This gives you the unfiltered MapSwipe results. This is most suited if you want to apply some custom data processing with the MapSwipe data, e.g. select only specific tasks for machine learning. If you want to use MapSwipe data in the Tasking Manager you might look for the data explained below.
34+
This gives you the unfiltered MapSwipe results. This is most suited if you want to apply some custom data processing with the MapSwipe data, e.g. select only specific tasks for machine learning. If you want to use MapSwipe data in the Tasking Manager you might look for the data described below.
3535

3636
Files:
3737
- `aggregated_results_{project_id}.csv`, e.g. [agg\_results\_-M56eeMCZ5VeOHjJN4Bx.csv](https://apps.mapswipe.org/api/agg_results/agg_results_-M56eeMCZ5VeOHjJN4Bx.csv)
@@ -51,11 +51,13 @@ Files:
5151
| 2_share | float | 2_count divived by total_count. This gives you the share of all users who marked as 2. |
5252
| 3_share | float | 3_count divived by total_count. This gives you the share of all users who marked as 3. |
5353
| agreement | float | This is defined as [Scott's Pi](https://en.wikipedia.org/wiki/Scott%27s_Pi) and gives you an understanding of inter-rater reliability. The value is 1.0 if all users agree, e.g. all users classify as "building". If users disagree this value will be lower. |
54-
| geom | string | The geometry of this task as WKT geometry. |
54+
| geom | string | The geometry of this task as WKT geometry. |
5555

56+
Additionally, project type specific data can be found here. E.g. footprint projects which were created based on OSM data, will have data describing the original OSM object included.
5657

57-
## HOT Tasking Manager Geometries
58-
This gives you filtered MapSwipe data ready to be imported to the HOT Tasking Manager. Currently, the geometries in this dataset consist of maximum 15 MapSwipe Tasks, where at least 35% of all users indicated the presence of a building by classifying as "yes" or "maybe".
58+
59+
## HOT Tasking Manager Geometries
60+
This gives you filtered MapSwipe data ready to be imported to the HOT Tasking Manager. Currently, the geometries in this dataset consist of maximum 15 MapSwipe Tasks, where at least 35% of all users indicated the presence of a building by classifying as "yes" or "maybe".
5961

6062
Files:
6163
- `hot_tm_{project_id}.geojson`, e.g. [hot\_tm\_-M56eeMCZ5VeOHjJN4Bx.geojson](https://apps.mapswipe.org/api/hot_tm/hot_tm_-M56eeMCZ5VeOHjJN4Bx.geojson)
@@ -67,4 +69,15 @@ Files:
6769

6870
<img src="_static/img/tasking_manager_geometries_example.png" width="600px">
6971

70-
72+
## Users
73+
74+
This gives you data on the users which contributed to a project.
75+
76+
| Name | Type | Description |
77+
|---------------------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
78+
| idx | integer | - |
79+
| groups_completed | integer | Number of groups completed |
80+
| total_contributions | integer | Number of tasks completed |
81+
| agreeing_contributions | integer | Tasks with the same result as the final result (e.g. Tile has buildings). |
82+
| disagreeing_contributions | integer | Tasks with other result as the final result. |
83+
| simple_agreement_score | float | Share of tasks which had the same result as the final result. E.g. 0.8 would mean that the user labeled 80% of the tiles the same way as the majority of voters. |

docs/source/deployment_overview.md

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

0 commit comments

Comments
 (0)