Tools for Creating Interactive Web Applications for Environmental Data

Eric Bailey & Kali Frost
11/24/2014

The R Environment

  • R is a programming language and software environment for statistical computing and graphics
  • It is similar to programs such as SAS, SPSS, and STATA
  • R is widely used in academia and quickly gaining traction in government and industry
  • There are thousands of add-on packages that you can use with R
    • Special statistical functions
    • Mapping
    • Data manipulation
    • Graphing and visualization packages

Shiny Web Framework

  • Shiny is an add-on package for R that allows for the easy development of interactive web applications
  • Need some familiarity with R, but does not require knowledge of typical web development software such as HTML, CSS, or JavaScript
  • Both R and Shiny (and many other useful packages) are free

Your R Code:

bar<-fooFunction(..)

plus
The Shiny package
equals
Web applications webApp

Why Do We Use R

  • R has increased our efficiency by leaps and bounds, due to customization and automation of repeated tasks
  • Because R is open-source, people in the environmental field have created dozens of packages to streamline tasks that we do regularly
  • Just a few examples:
    • openair: provides numerous tools to analyze, interpret and understand air pollution time series data
    • Soilwaterfun: package providing soil water retention and soil hydraulic conductivity functions
    • wq: Processing and exploration of data from monitoring programs for aquatic ecosystems, with a focus on time series data for physical and chemical properties of water and plankton

Why Do We Use R and Shiny?

  • We have used R and Shiny to create web applications for communication with internal and external stakeholders

    • Industry
    • Upper Management
    • Research Partners
    • The Public

pollutionrose toxwatch

US Steel

  • High concentrations of benzene at a monitor near US Steel
  • We created an interactive application to help us quickly subset and display air toxics data associated with the monitor near their facility
  • One of our first apps (here) , able to put it together in just a couple of days

ussteel

Indiana Metals Data Explorer

  • 2000 - 2013, 1-in-6 day metals data from air quality sites around the state
    • TSP, PM 10, PM 2.5
    • As, Be, Cd, Cr, Pb, Mn, Ni
  • Xact Monitor Data for 2012-2013 near US Steel facility
  • Emissions bubble maps for 2002, 2005, 2008 and 2011 National Emissions Inventory (NEI) metals data
  • Found here (does not work in anything older than IE 10, also works in Firefox, Chrome, Safari)

ToxWatch Public Tool and Manager Dashboard

  • Input
    • 15 years of sample data
    • 1-in-6 day sampling (TO-14 and TO-15) of 62 pollutants
    • 9-12 monitors at any given time
    • Stored in Oracle database
    • User selects any combination of pollutants/monitors/dates
  • Public Tool (here)
  • Manager's Dashboard (here)

Potential benefits of these tools:

  • Apps can pull in data directly from a database, reduces user error
  • Transformation on data made using transparent & replicable code
  • Allow users (internal or public) to manipulate and view data themselves, reducing need for data requests
    • Can also create custom downloads of data
  • Can block queries on datasets that are too small or contain too many outliers, etc (i.e. may be inappropriate for statistical inference)
  • Save time by reducing duplicative work

OAQ Data Analysis Contact Info