Skip to content

Commit

Permalink
Split Earth.textproto to NL specific config (#2374)
Browse files Browse the repository at this point in the history
* Renamed Earth.textproto to disaster_dashboard/dashboard.textproto
* Renamed Earth.textproto to nl_page/disasters.textproto
   * Removed descriptions
   * Added earthquake config
* Added "topic" that works on local/dev/autopush:
/topic/nl_disasters/Earth (note it only works for Earth now)
* --> we can update the severity limits for the NL demo, eg lower fire
thresholds so we show more than 3 fires in CA last year
* Also added a redirect from /disaster to /disaster/Earth
  • Loading branch information
beets authored Mar 6, 2023
1 parent 2c79c95 commit 27a77c7
Show file tree
Hide file tree
Showing 11 changed files with 641 additions and 55 deletions.
12 changes: 7 additions & 5 deletions server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def register_routes_custom_dc(app):
pass


def register_routes_stanford_dc(app, is_local):
def register_routes_disasters(app):
# Install blueprints specific to Stanford DC
from server.routes import disasters
from server.routes import event
Expand All @@ -98,8 +98,8 @@ def register_routes_stanford_dc(app, is_local):
return

# load disaster dashboard configs
disaster_dashboard_configs = libutil.get_disaster_dashboard_configs()
app.config['DISASTER_DASHBOARD_CONFIGS'] = disaster_dashboard_configs
disaster_dashboard_config = libutil.get_disaster_dashboard_config()
app.config['DISASTER_DASHBOARD_CONFIG'] = disaster_dashboard_config

if app.config['INTEGRATION']:
return
Expand Down Expand Up @@ -211,12 +211,12 @@ def create_app():
register_routes_custom_dc(app)
if (cfg.ENV == 'stanford' or os.environ.get('ENABLE_MODEL') == 'true' or
cfg.LOCAL and not cfg.LITE):
register_routes_stanford_dc(app, cfg.LOCAL)
register_routes_disasters(app)

if cfg.TEST or cfg.INTEGRATION:
# disaster dashboard tests require stanford's routes to be registered.
register_routes_base_dc(app)
register_routes_stanford_dc(app, cfg.LOCAL)
register_routes_disasters(app)
else:
register_routes_base_dc(app)

Expand Down Expand Up @@ -297,6 +297,8 @@ def create_app():

nl_model = nl.Model()
app.config['NL_MODEL'] = nl_model
# This also requires disaster and event routes.
app.config['NL_DISASTER_CONFIG'] = libutil.get_nl_disaster_config()

if not cfg.TEST:
urls = get_health_check_urls()
Expand Down
Loading

0 comments on commit 27a77c7

Please sign in to comment.