# 1. Create a virtual environment
python -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windows
# 2. Install dependencies
pip install -r requirements.txt
# 3. Run the dashboard
streamlit run app.pyOpen app.py and find the two functions marked with ╔══╗ banners:
Your DataFrame needs these columns:
| Column | Description |
|---|---|
GEOID |
Census tract ID — must match your shapefile |
predicted_rate |
Model output: overdose rate per 100k |
risk_tier |
Integer 1–4 (1=Low, 4=Critical) |
cluster_label |
GBTM cluster name string |
shap_top_feature |
Top SHAP driver for that tract |
neighbor_median_income |
Raw feature value |
neighbor_pct_vacancy |
Raw feature value |
pct_no_hs_diploma |
Raw feature value |
neighbor_pct_renter |
Raw feature value |
pct_renter_occupancy |
Raw feature value |
pct_vacant_units |
Raw feature value |
pct_black |
Raw feature value |
median_income |
Raw feature value |
pct_college |
Raw feature value |
pct_no_health_ins |
Raw feature value |
Example replacement:
def load_data():
df = pd.read_csv("your_predictions.csv")
return dfdef load_shapefile():
gdf = gpd.read_file("path/to/king_county_tracts.shp")
gdf = gdf.to_crs(epsg=4326)
# Make sure GEOID column exists and matches tract_df
return gdfUpdate the dictionary with your real global SHAP importances from your model.
- Push your code to a GitHub repo (keep your data files small or synthetic for public repos)
- Go to share.streamlit.io
- Connect your repo → deploy
- You get a public URL like
https://yourname-opioidswatch.streamlit.app
Just run streamlit run app.py and demo live. No deployment needed for science fair.
"Rather than leaving our findings in a research paper, we built a deployment-ready policy tool. A King County health official could open this today, enter their budget, and receive a ranked list of census tracts to prioritize — along with projections of how many overdose cases specific interventions would prevent."
That framing — from research to deployable tool — is what separates finalist projects.