# NOAA Storm Events Explorer

A highly commented Shiny dashboard demo for the MaDS 36-613 lesson on animation,
interaction, and choosing the medium.

## What students can learn from it

- how a UI input becomes a reactive dataset and then several outputs;
- why an interaction should support a named audience task;
- how one month selection can update a map while preserving annual context;
- how to include an accessible text summary and a details table;
- how to separate data preparation, reusable helpers, and deployment.

The play button beside the month slider provides a restrained animation. It encodes
time rather than adding decorative motion.

## Files

- `app.R` — the complete Shiny UI and server, with a numbered reading guide;
- `R/dashboard_helpers.R` — small data functions that can be tested separately;
- `prepare_data.R` — reduces the 60-column teaching extract to the fields used;
- `data/noaa-dashboard-events-2024.rds` — deployment copy of the cleaned data;
- `www/dashboard.css` — small presentation additions;
- `deploy.R` — controlled shinyapps.io deployment.

## Run locally

Open this directory as the working directory, then run:

```r
shiny::runApp()
```

From the repository root, the equivalent command is:

```r
shiny::runApp("datavis-36613/demos/noaa-shiny-dashboard")
```

## Publish to shinyapps.io

The free shinyapps.io plan is enough for a class demo with modest use. At the time
this example was prepared, it included five applications and 25 active hours per
month. An app instance sleeps after an idle period, so the first visit after sleep
may take a few seconds.

1. Create a shinyapps.io account.
2. Add a token under **Account > Tokens**.
3. Run the `rsconnect::setAccountInfo(...)` command shown by shinyapps.io in your
   own R console. Do not save the token in this repository.
4. From this directory, run `Rscript deploy.R`.
5. Copy the resulting URL, normally
   `https://ACCOUNT.shinyapps.io/noaa-storm-events-explorer/`.
6. Put that URL in the empty `data-dashboard-url` attribute on the `<body>` tag
   in the repository-root `noaa-dashboard.html` page. The launch button will
   appear automatically.

The free plan is appropriate for demonstration rather than a heavily used public
service. The class site should link to the app in a new tab; an iframe is optional
and can make a sleeping app feel less responsive.

## Data boundary and interpretation

The app uses the cleaned 2024 NOAA Storm Events teaching extract. It visualizes
event records, not a census of unique physical storms. Reported damage values are
estimates, contain many zero or missing reports, and should not be treated as a
complete accounting of loss. The contiguous-state map omits Alaska, Hawaii,
territories, and marine zones from its geometry, but they remain in summary totals.
