Map Page

The page of the app that generates the map view of the data.

Setup some of the key data contiaining objects

Customize the Layout


source

layout

def layout():

Call self as a function.

Global Variables

Build callbacks to create interaction

Manage Sidebar

On page load, manage the dropdowns displayed in the sidebar for all pages

Update active page on nav based on current page


source

Update Current Dataset

When the census or population page are loaded, then set the currently selected value of the dataset dropdown to the respective ones

show_doc(dataset_selection)

Update Title

For all pages of the dash app

Update location dropdown value based on map click

This callback also will trigger an update to the selected card data

Update map selections

Update the location options based on geography selected


source

update_geography

def update_geography(
    geo_input:str, # User input from the geography dropdown
    locations:[<class 'str'>], # Currently selected locations
)->[<class 'str'>]: # Returns a new list of locations to display

Updates the dropdown_location dropdown based on the currently selected data aggregation. Check to see if current locations are in geography, if they are not then reset them.

Update the variable dropdowns based on the selection of the overall variable

Update the measure selection from clicks on the bar graph

Update map based on inputs

This updates the map for both the census page and the population page

Update the selected part of the map based on the dropdown

Update Selected Bar Graph based on inputs


source

update_bargraph

def update_bargraph(
    data_type:str, # User input of type of data
    measure:str, # A string contiaining the census variable and measure split by ':'
    loc_selection:[<class 'str'>], # The selected locations, may be none
    init_load:{}, # An empty dictionary always, triggers initial load
    geo_input:str, # User input from the geography dropdown
    variable:str, # The state of the variable dropdown
)->Figure: # Returns a graph object figure after being updated and the dynamic title

Updates the focus census variable or geography dispalayed on the map

On click, update the contents of the kpi’s