Skip to content

malonekt/NSSP-Fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSSP ED Trajectories — fetch & filter (Texas)

Simple Python tools to download the CDC NSSP Emergency Department Visit Trajectories dataset and produce a cleaned Texas extract suitable for Tableau or further analysis.


What this repo does

  • Fetches the NSSP trajectories CSV from CDC (raw export).
  • Provides a filtering script that narrows the dataset to Texas (and optionally 2024).
  • Includes a small debugger/analysis script for quick testing.

Files (key)

  • nssp_fetch_state_tx.py — fetch raw NSSP CSV (CDC / Socrata), save to outputs/.
  • filter_nssp_tx.py — filter the raw CSV to Texas rows and write outputs/nssp_tx_all_years.csv and outputs/nssp_tx_2024.csv.
  • nssp_fetch_and_analysis.py — lightweight debugger / analysis runner (used for testing; prints status, runs mini-EDA).
  • outputs/ — (generated) directory where CSVs and figures are written.
  • README.md — this file.

(If you have other helper scripts in the folder, they’re optional — the three above are the main flow.)


Requirements

  • Python 3.8+ (recommended)
  • pip

Packages required:

  • pandas
  • requests
  • numpy
  • scikit-learn
  • scipy
  • matplotlib

Install quickly:

python -m pip install --upgrade pip
python -m pip install pandas requests scikit-learn numpy scipy matplotlib

Or create requirements.txt and install:

pandas
requests
numpy
scikit-learn
scipy
matplotlib
python -m pip install -r requirements.txt

Quick usage

  1. Fetch the CDC NSSP export (raw CSV) — writes into outputs/:
python nssp_fetch_state_tx.py
  1. Filter raw CDC export to Texas (and 2024 if available):
python filter_nssp_tx.py
  1. Run the debugger / quick analysis (optional):
python nssp_fetch_and_analysis.py

After running the two main scripts you should have outputs/nssp_tx_all_years.csv (and outputs/nssp_tx_2024.csv if 2024 rows exist). Those files are ready for Tableau or downstream analysis.


Tableau

A live map/dashboard built from a cleaned export is available here:

https://public.tableau.com/app/profile/kevin.malone4673/viz/CourseraCapstone_17617624293390/Dashboard1

Use the nssp_tx_all_years.csv / nssp_tx_2024.csv as the data source in Tableau. Prefer 5-digit FIPS for reliable county mapping.


Output locations

  • outputs/nssp_cdc_raw.csv — raw CDC/Socrata download (saved by fetch script)
  • outputs/nssp_tx_all_years.csv — Texas rows (all years)
  • outputs/nssp_tx_2024.csv — Texas rows filtered to 2024 (if present)
  • outputs/*.png or outputs/figs/ — any plots generated by the debugger/analysis scripts

Troubleshooting (short)

  • ModuleNotFoundError: No module named 'matplotlib' — run the pip install command above.
  • No rows returned from API for county/state? NSSP sometimes suppresses county-level rows — use the CDC CSV export (Socrata) fetch (the fetch script does this).
  • If mapping in Tableau fails, prefer FIPS5 (5-digit FIPS). County name mismatches are common.

Notes / provenance

  • Data source: CDC NSSP Emergency Department Visit Trajectories (Socrata dataset rdmq-nq56). Cite CDC if you publish results.
  • These scripts are intended for exploratory / capstone work (Coursera capstone). Not production-grade ETL.

License & contact

MIT-style (do what you want, please cite the dataset). Questions or want a quick Tableau-ready CSV or sample map exported as PNG? Open an issue or ping me.

About

API fetch for the CDC “NSSP Emergency Department Visit Trajectories” dataset using python which outputs raw data. There is then a separate script to filter down the data. There is separate debugger.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages