OutdoorRD / trails-viz

1 stars 3 forks source link

Update config so that demographics are shown for KingCo #210

Closed jblehr closed 2 months ago

jblehr commented 2 months ago

Related to https://github.com/OutdoorRD/trails-viz-data/pull/60.

After deploying the dashboard, the demographics tab was not showing anything. When viewing the logs, (docker logs -f <container-id>), I found this error:

[2024-08-16 15:31:51,158] ERROR in app: Exception on /api/projects/KingCo/homeLocationsDemographics [GET]
Traceback (most recent call last):
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/trailsvizapi/controller/home_locations.py", line 63, in get_project_home_locations_demographics
    data = home_locations.get_project_demographic_summary(project)
  File "/miniconda3/envs/trails-viz-api/lib/python3.7/site-packages/trailsvizapi/repository/home_locations.py", line 191, in get_project_demographic_summary
    census_tract_states = app_config.CENSUS_TRACT_STATES[project]
KeyError: 'KingCo'

I determined that the trails-viz-api/trailsvizapi/config/app_config.py file needs to be updated:

CENSUS_TRACT_STATES = {
    'WestCascades': ['53'],
    'WestCascades_MiddleFork': ['53'],
    # 'OKW_WILD': ['53'],
    # 'OKW_GFA': ['53'],
    'NNM': ['35'],
    # 'KingCo': ['53'],
    'MBS_WILD': ['53'],
    'WestCascades_MtnLoop': ['53'],
    'WestCascades_SMtnLoop': ['53'],
    # 'MBS_GFA': ['53']
    'EastCascades': ['53']
}

It should include KingCo. Unfortunately, this requires an entire re-build and re-deploy.

EmiliaH commented 2 months ago

Is this bug as simple as uncommenting KingCo but will still require re-build and re-deploy?