Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

victorkjung/Socrata-Powerball

Repository files navigation

Socrata-Powerball

Powerball Analyzer for Entertainment Purposes

License Python Streamlit

๐Ÿ“Š NY Powerball Analyzer (Socrata API + Streamlit)

A production-ready Streamlit web application that analyzes historical New York Powerball winning numbers using the official NY Open Data Socrata API.

The app provides advanced visual analytics, statistical trend scoring, probability simulations, and mobile-optimized dashboards.

Live dataset source:
https://dev.socrata.com/foundry/data.ny.gov/d6yy-54nr


๐Ÿš€ Features

๐Ÿ”ฅ Heat Maps

Monthly frequency heatmaps for:

  • White balls
  • Powerball

๐Ÿ“ˆ Top & Bottom Numbers

Defined as:

Top 6 = Top 5 white balls + Top 1 Powerball
Bottom 6 = Bottom 5 white balls + Bottom 1 Powerball

Includes monthly win % trend charts.


๐Ÿง  Hot vs Cold Trend Scoring

Statistical z-score style model comparing:

  • Recent draw frequency
  • Long-term baseline

Highlights:

๐Ÿ”ฅ Hot numbers rising in frequency
๐ŸงŠ Cold numbers dropping in frequency


๐Ÿงฎ Probability Simulator

Includes:

  • Exact probability for every match pattern
  • Jackpot odds
  • Monte Carlo simulation sessions

Supports:

  • Current Powerball rules (5 from 69 + PB from 26)
  • Dataset-derived number ranges

โœ… Mock Drawing Checker

Enter:

  • 5 white balls (unordered)
  • 1 Powerball

Searches the full dataset to find:

  • Whether the combination ever occurred
  • The exact draw dates

๐ŸŒ™ Dark Mode + ๐Ÿ“ฑ Mobile Optimization

  • In-app dark/light toggle
  • Responsive layout
  • Compact chart mode
  • Sidebar collapses on mobile

๐Ÿ”„ Smart API Caching

Streamlit-native caching with:

  • Configurable TTL (1โ€“48 hours)
  • Manual force refresh
  • Rate-limit protection

๐Ÿ“ฅ CSV Export

Download:

  • Full draw history
  • Long-format exploded dataset

๐Ÿ“ Project Structure


SocrataPowerball/
โ”‚
โ”œโ”€โ”€ SocrataPowerball.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ CONTRIBUTING.md
โ”‚
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_api.py
โ”‚
โ””โ”€โ”€ .github/
โ””โ”€โ”€ workflows/
โ””โ”€โ”€ ci.yml

๐Ÿ“ฆ Requirements

requirements.txt

streamlit
pandas
numpy
requests
plotly
pytest

โš™๏ธ Local Setup

1๏ธโƒฃ Install dependencies

pip install -r requirements.txt

2๏ธโƒฃ Add Socrata API Token (recommended)

Without a token you may hit rate limits.

Option A โ€” environment variable:

export SOCRATA_APP_TOKEN="YOUR_TOKEN"

Option B โ€” Streamlit secrets:

Create:

.streamlit/secrets.toml

Add:

SOCRATA_APP_TOKEN = "YOUR_TOKEN"

3๏ธโƒฃ Run locally

streamlit run SocrataPowerball.py

โ˜๏ธ Deploy on Streamlit Cloud

  1. Push repo to GitHub
  2. Visit https://share.streamlit.io
  3. Create new app

Main file path:

SocrataPowerball.py
  1. Add token in:

App โ†’ Settings โ†’ Secrets

SOCRATA_APP_TOKEN = "YOUR_TOKEN"

โœ… Continuous Integration

GitHub Actions automatically runs pytest:

  • On every push
  • On pull requests
  • Daily scheduled health check

Validates:

  • API availability
  • Required dataset fields

๐Ÿ“š Data Source & Attribution

This application uses publicly available data from:

New York State Open Data (powered by Socrata) Dataset: Powerball Winning Numbers https://data.ny.gov

API endpoint: https://data.ny.gov/resource/d6yy-54nr.json

All data subject to NY Open Data terms of use.


โš ๏ธ Disclaimer

  • Lottery outcomes are independent random events
  • Historical trends do NOT predict future results
  • Hot/Cold scoring is descriptive only
  • Simulator assumes uniform randomness

This project is for educational and analytical purposes only.


๐Ÿ“„ License

This project is licensed under the MIT License.

See the LICENSE file for details.


๐Ÿค Contributing

Contributions are welcome!

Please see CONTRIBUTING.md for:

  • Bug reports
  • Feature requests
  • Pull request workflow

๐Ÿง  Tech Stack

  • Python 3.10+
  • Streamlit
  • Pandas / NumPy
  • Plotly
  • Socrata Open Data API
  • GitHub Actions CI

โญ Future Enhancements

  • Daily auto-refresh ping workflow
  • Installable PWA shell
  • Correlation & streak analysis
  • Historical rule change handling
  • Alerts for hot/cold number shifts

About

Powerball Analyzer for Entertainment Purposes

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /