44import json
55import time
66
7- import schedule as sched
8-
97import click
8+ import schedule as sched
109from mapswipe_workers import auth
11- from mapswipe_workers .definitions import (
12- PROJECT_TYPE_CLASSES ,
13- CustomError ,
14- logger ,
15- sentry ,
16- )
10+ from mapswipe_workers .definitions import CustomError , logger , sentry
1711from mapswipe_workers .firebase_to_postgres import (
1812 archive_project ,
1913 transfer_results ,
2014 update_data ,
2115)
2216from mapswipe_workers .generate_stats import generate_stats
2317from mapswipe_workers .project_types .build_area import build_area_tutorial
18+ from mapswipe_workers .project_types .build_area .build_area_project import (
19+ BuildAreaProject ,
20+ )
2421from mapswipe_workers .project_types .change_detection import change_detection_tutorial
22+ from mapswipe_workers .project_types .change_detection .change_detection_project import (
23+ ChangeDetectionProject ,
24+ )
25+ from mapswipe_workers .project_types .footprint .footprint_project import FootprintProject
2526from mapswipe_workers .utils import user_management
2627from mapswipe_workers .utils .slack_helper import send_slack_message
2728
@@ -53,6 +54,13 @@ def run_create_projects():
5354 Create projects with groups and tasks.
5455 Save created projects, groups and tasks to Firebase and Postgres.
5556 """
57+
58+ project_type_classes = {
59+ 1 : BuildAreaProject ,
60+ 2 : FootprintProject ,
61+ 3 : ChangeDetectionProject ,
62+ }
63+
5664 fb_db = auth .firebaseDB ()
5765 ref = fb_db .reference ("v2/projectDrafts/" )
5866 project_drafts = ref .get ()
@@ -66,7 +74,7 @@ def run_create_projects():
6674 project_name = project_draft ["name" ]
6775 try :
6876 # Create a project object using appropriate class (project type).
69- project = PROJECT_TYPE_CLASSES [project_type ](project_draft )
77+ project = project_type_classes [project_type ](project_draft )
7078 project .geometry = project .validate_geometries ()
7179 project .create_groups ()
7280 project .calc_required_results ()
0 commit comments