App Data

Class that loads and stores the data and sidebar for the dash app
# TODO think about what differentiates dash_components and app_data

Load Data

Instatialise Data and Dash Components

The plan for the data is to store it in a dcc.Store object. This is import as if the app scales, variables will only be global if they are stored in a store or another dash component. As an aside, dash uses this strategy so that each app is stateless and multiple different workers can be assigned to run processes.

This stored data and additional components will then be refereced via imports used by each page so that each pages shares the common data and components and they will not need to be reloaded. Because the data is imported as a module by each page and app that uses them, it will be global and it will run before the rest of the code.

SolomonGeo.gen_stored() can be used to reconstuct the SolomonGeo object from the dict format.

The following components and data objects are created:

  • stored_data: The dict version of the dataset,
  • dropdown_location: Dropdown for location selection,
  • dropdown_geo: Dropdown for the type of geographical aggregation selected,
  • control_type: The type of data, Proportion or Total,
  • dd_var: Dropdown for the variable to be displayed,
  • dd_measure: Dropdown for the emasure to be displayed.

Setup and create the dropdowns

Date Slider

Lets you pick a date for the population projection map

dropdown_location
Div(children=Dropdown(options=array(['Central', 'Choiseul', 'Guadalcanal', 'Honiara', 'Isabel',
       'Makira-Ulawa', 'Malaita', 'Rennell-Bell', 'Temotu', 'Western'],
      dtype=object), value=[], multi=True, clearable=True, searchable=True, placeholder='Select Dropdown Location', optionHeight=35, id='locDropdown'), id='locationDiv')

Create a sidebar

The sidebar will house all of the relevant dropdowns

Intialise page data components

It will create:

  • mytitle: title for the apge
  • map_graph: map object for the page
  • selectedBarGraph: bar graph object for the page

Elections data