Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

US dams example dashboard #1350

Merged
merged 55 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a99aba6
us-dams example
May 15, 2024
ce4c89f
update table, chart heights, some org
May 15, 2024
6d3649c
update condition order in histogram
May 15, 2024
60e3217
remove unrelated examples/hotel-bookings/dist
Fil May 15, 2024
8e5f23a
clean up overview a bit
May 15, 2024
83db21f
Merge branch 'allison/dams-example' of https://github.com/observableh…
May 15, 2024
60fb29a
fix path for dams example
allisonhorst May 16, 2024
60db5ed
fix path in us-states loader
allisonhorst May 16, 2024
2d558e6
Reorder condition: Satisfactory better than Fair (per data dictionary…
pettiross May 16, 2024
ad06359
deck.gl dams map tinkering
allisonhorst May 16, 2024
73bd374
deck.gl hexagon layer updates
allisonhorst May 16, 2024
89e3a9e
start adding charts to index
allisonhorst May 17, 2024
7396d38
Color and format tweaks on Plots
pettiross May 17, 2024
8753466
map updates, add overview charts, incorporate Jeff's changes
May 17, 2024
46bb7e8
Update nationwide overview charts, incorporate Jeff changes
May 17, 2024
63541c3
add search to table, finish homepage layout
May 17, 2024
fc33e91
switch homepage map to scatter with fill by condition
May 17, 2024
06ba8e8
update legend in nationwide map
May 17, 2024
2e6d68a
edits
May 17, 2024
8d08d63
update overview page and by-state dashboard
May 20, 2024
902ac5a
fix text color and add tooltips in purpose chart
May 20, 2024
3ad46e7
overview back to 3d hexbin map
May 21, 2024
12ad749
clean up code, delete unused, add comments, update ReadMe
May 21, 2024
9d4353a
Merge branch 'main' into allison/dams-example
May 21, 2024
8942ce0
Update ReadMe based on other examples, incorporate Fil feedback
May 21, 2024
b2e3a31
fix map re-run code to avoid overlap on selection
May 21, 2024
e079cea
Merge branch 'main' into allison/dams-example
May 22, 2024
aa86900
gets polygons from us-atlas, calculates centroids
May 22, 2024
11475a8
Update examples/us-dams/package.json
allisonhorst May 22, 2024
35cc8d1
Update examples/us-dams/package.json
allisonhorst May 22, 2024
9153ab6
Update examples/us-dams/README.md
allisonhorst May 22, 2024
6b6d566
moves dam data to data loader, updates data descriptions in ReadMe
May 22, 2024
d1420bb
Merge branch 'allison/dams-example' of https://github.com/observableh…
May 22, 2024
7cd39eb
update config file to match other examples
May 22, 2024
1da2c24
remove leftover display
May 22, 2024
4240927
adds sidebar back
May 22, 2024
6bd68a9
title change
May 22, 2024
ce706d4
fix conditionHeatmap height
Fil May 28, 2024
b194aa2
Merge branch 'main' into allison/dams-example
allisonhorst Jun 4, 2024
81e16f1
Add description to examples ReadMe, add webp images
allisonhorst Jun 4, 2024
5b37367
Merge branch 'allison/dams-example' of https://github.com/observableh…
allisonhorst Jun 4, 2024
2c32427
Apply suggestions from code review
allisonhorst Jun 5, 2024
846b179
match bubble chart orders to nationwide page
allisonhorst Jun 5, 2024
8fa54ea
code formatting, updates purpose barchart labels
allisonhorst Jun 5, 2024
ca32b88
update config keeping sidebar
allisonhorst Jun 5, 2024
d15077f
fine tune conditional text
allisonhorst Jun 5, 2024
03f06e7
Merge branch 'main' into allison/dams-example
allisonhorst Jun 14, 2024
9dabdc9
clean up unused columns in loader
allisonhorst Jun 14, 2024
e013faf
Merge branch 'main' into allison/dams-example
Fil Jun 18, 2024
074b81a
small edits
Fil Jun 18, 2024
4632622
condition
Fil Jun 18, 2024
0662a38
Merge branch 'main' into allison/dams-example
allisonhorst Jun 18, 2024
c0e5e22
Merge branch 'main' into allison/dams-example
allisonhorst Jun 18, 2024
bb0ce9a
update example readme, data directly from NID API
allisonhorst Jun 18, 2024
9520d50
resize webp thumbnails
allisonhorst Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/us-dams-dark.webp
Binary file not shown.
Binary file added docs/assets/us-dams.webp
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@

[Source](./mortgage-rates) · This dashboard visualizes Freddie Mac’s historical mortgage rates data. The included data loader demonstrates how to retrieve CSV data from Freddie Mac and visualize the result as a zoomable chart with Observable Plot. The larger time-series line chart at the bottom allows brushing to select an arbitrary time range, while the smaller visualization above zooms to show the selected range.

### [`us-dams`](https://observablehq.observablehq.cloud/framework-example-us-dams/) - U.S. dam conditions

<a href="https://observablehq.observablehq.cloud/framework-example-us-dams/"><img src="../docs/assets/us-dams.webp" alt="U.S. dams" width="312" height="237"></a>

[Source](./us-dams) · This dashboard visualizes locations and conditions for 90k+ dams in the U.S. with data from the National Inventory of Dams (NID). An R data loader accesses the data directly from the NID and generates a simplified CSV. Maps created with deck.gl allow a user to zoom and scroll while exploring dam locations nationwide, or by state. Bar and bubble charts made in Observable Plot highlight dam conditions and hazard potential.

## Technique examples 🛠️

### Charts
Expand Down
8 changes: 8 additions & 0 deletions examples/us-dams/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
dist/
src/.observablehq/cache/
node_modules/
yarn-error.log
src/.observablehq/deploy.json
.Rhistory
.Rdata
39 changes: 39 additions & 0 deletions examples/us-dams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[Framework examples →](../)

# U.S. dams

View live: <https://observablehq.observablehq.cloud/framework-example-us-dams/>

This Observable Framework example explores data for 90,000+ dams in the United States from the [National Inventory of Dams](https://nid.sec.usace.army.mil/) (NID).

The pages feature nationwide and state-by-state summaries of dam locations, highlighting dam conditions and hazard assessment.

Interactive maps are created with [deck.gl](https://deck.gl/). To create your own maps with deck.gl in Observable Framework, see our [documentation](https://observablehq.com/framework/lib/deckgl). All other charts are built with [Observable Plot](https://observablehq.com/plot/), and searchable tables are created with Observable Inputs by combining [Inputs.search and Inputs.table](https://observablehq.com/framework/inputs/search).

## Implementation

```
.
├── README.md
├── observablehq.config.js
├── package.json
└── src
├── data
│   ├── county_fips_master.csv
│   ├── dam-simple.csv.R
│   └── us-state-capitals.csv
├── by-state.md
└── index.md
```

The R data loader `dam-simple.csv.R` accesses data directly from the NID (at https://nid.sec.usace.army.mil/api/nation/csv) and generates the `dam-simple.csv` snapshot used in both pages. To run the data loader, you need to have [R](https://www.r-project.org/) installed, along with the [data.table](https://github.com/Rdatatable/data.table), [dplyr](https://github.com/tidyverse/dplyr), and [readr](https://github.com/tidyverse/readr) packages (e.g. with `install.packages("dplyr")`).

### Data

- Dam records are downloaded from the NID as a CSV then minimally wrangled by the `dam-simple.csv.R` data loader to produce the static file with dam records used in our dashboard (`dam-simple.csv`)

- County FIPS codes (`src/data/county_fips_master.csv`) are from https://github.com/kjhealy/fips-codes/blob/master/county_fips_master.csv

- US state capitals and locations (`src/data/us-state-capitals.csv`) are from https://github.com/jasperdebie/VisInfo/blob/master/us-state-capitals.csv

- County, state, and nation-level spatial polygons are accessed from the [us-atlas](https://www.npmjs.com/package/us-atlas?activeTab=readme) repository
8 changes: 8 additions & 0 deletions examples/us-dams/observablehq.config.js
allisonhorst marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
root: "src",
title: "U.S. dams overview",
theme: "wide",
sidebar: true,
pager: false,
toc: false
};
24 changes: 24 additions & 0 deletions examples/us-dams/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "module",
"private": true,
"scripts": {
"clean": "rimraf src/.observablehq/cache",
"build": "rimraf dist && observable build",
"dev": "observable preview",
"deploy": "observable deploy",
"observable": "observable"
},
"dependencies": {
"@observablehq/framework": "^1.7.1",
"d3-dsv": "^3.0.1",
"d3-time-format": "^4.1.0",
"topojson-client": "^3.1.0",
"topojson-simplify": "^3.0.3"
},
"devDependencies": {
"rimraf": "^5.0.5"
},
"engines": {
"node": ">=18"
}
}
Loading