Analysis of NHANES data
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
additional_data
journal
output
processed
sql
.gitignore
README.md
categories-uniq.txt
categories.txt
convert.py
create_table.js
insert.sh
insert_data.js
insert_food.js
package-lock.json
package.json
process.sh
scrape.js

README.md

NHANES Explorer

Supporting data for "When the Government Counts Calories" from the OCR Journal #0002.

men vs women

Requirements

  • Python / PIP
  • xport: pip install xport
  • Node / NPM
  • Postgres (create a database called nhanes)

Process data

npm install

# Scrape and convert data
# ./process.sh [YEAR-PAIR] [FILENAME]
./process.sh 2011-2012 DR1IFF_G

# Insert non-unique tables
# ./insert.sh [FILENAME] [USE_PKEY?]
./insert.sh DR1IFF_G false

# (if the data is unique, leave off the last variable)
./insert.sh OCQ_G

# Food labels are different
node insert_food.js processed/DRXFCD_G.labels.csv processed/DRXFCD_G.csv

Visualization server

Use a static site serving tool on journal, e.g.:

cd journal
python -m http.server 8000

Requires editing journal/app/app.js to see different visualizations.