100 lines
3.4 KiB
Markdown
100 lines
3.4 KiB
Markdown
# Lottery_Project
|
|
|
|
A Python project to analyze and pick lottery numbers using past draw results to predict future draws.
|
|
|
|
## Draw Dates
|
|
|
|
Mega Millions drawings are held every Tuesday and Friday. Powerball drawings are held every Monday,
|
|
Wednesday, and Friday. In order to conserve processing cycles, the predictor will only request new data
|
|
if there is the potential for new drawings to collect and save.
|
|
|
|
|
|
## Storage
|
|
|
|
The data will eventually be stored in database tables for faster execution. This will also allow for dynamic
|
|
calls for more data based on the draw dates and last drawing stored locally.
|
|
|
|
### Database Engine
|
|
|
|
Sqlite has been chosen for portability and ease of use.
|
|
|
|
## Historical Info
|
|
|
|
The first Powerball drawing was on April 22, 1992.
|
|
The first Mega Millions drawing was on September 6, 1996. The original name was "The Big Game" and was
|
|
rebranded to Mega Millions in May 2002.
|
|
|
|
However, each game has undergone rule changes that have altered the pool of numbers available for the main
|
|
(white) balls and their respective game balls as well. Due to this, the historical information used to
|
|
analyze the draws should start at the most recent rule change date.
|
|
|
|
**The most recent change for Powerball was on October 4, 2015, when the main ball pool increased from 59 to 69
|
|
numbers and the Powerball pool reduced from 35 to 26 numbers.**
|
|
|
|
**The most recent change for Mega Millions was on April 5, 2025, when the Megaball ball pool was decreased from
|
|
25 to 24 numbers as well as the addition of a 10x multiplier. The existing pool of 70 numbers for the main
|
|
game ball pool was part of changes made on October 28, 2017.**
|
|
|
|
Historical results can be scraped from the web and added to the database from the URLs below. The
|
|
results must be scraped by year. Changing the year in the URLs alters the resultset displayed.
|
|
|
|
Powerball: https://www.lotto.net/powerball/numbers/1992
|
|
Mega Millions: https://www.lotto.net/mega-millions/numbers/1996
|
|
|
|
### Historical Information Sources
|
|
|
|
- [Mega Millions Wikipedia](https://en.wikipedia.org/wiki/Mega_Millions)
|
|
- [Powerball Wikipedia](https://en.wikipedia.org/wiki/Powerball)
|
|
|
|
## Environment Variables
|
|
|
|
To facilitate environment variables for testing or execution, create a .env file in the root folder of
|
|
the project and add the following lines to it:
|
|
|
|
```bash
|
|
# General vars
|
|
BASE_SCRAPE_URL="https://www.lotto.net/"
|
|
RESULT_CONTAINER="div"
|
|
RESULT_CLASS="results-vsmall archive-list"
|
|
DRAW_DATE_CONTAINER="div"
|
|
DRAW_DATE_CLASS="date"
|
|
BALL_CONTAINER='li'
|
|
BALL_CLASS="ball ball"
|
|
DATE_INPUT_FORMAT="%B %d %Y"
|
|
|
|
# Powerball vars
|
|
POWERBALL_INCEPTION="1992"
|
|
POWERBALL_CLASS="ball powerball"
|
|
POWERBALL_MULTIPLIER_CLASS="ball power-play"
|
|
POWERBALL_RULE_CHANGE_DATE="2015-10-04"
|
|
POWERBALL_MAX_MAIN_BALL="69"
|
|
POWERBALL_MAX_POWERBALL="26"
|
|
|
|
# Mega Millions vars
|
|
MEGA_MILLIONS_INCEPTION="1996"
|
|
MEGABALL_CLASS="ball mega-ball"
|
|
MEGA_MILLIONS_MULTIPLIER_CLASS="ball megaplier"
|
|
MEGA_MILLIONS_RULE_CHANGE_DATE="2025-04-05"
|
|
MEGA_MILLIONS_MAX_MAIN_BALL="70"
|
|
MEGA_MILLIONS_MAX_MEGA_BALL="24"
|
|
|
|
# RegEx vars
|
|
DATE_CLEAN_REGEX="r'(st|nd|rd|th)'"
|
|
|
|
# Datbase vars
|
|
DATABASE_URL="sqlite:///predictor.db"
|
|
DATE_INSERT_FORMAT="%Y-%m-%d"
|
|
|
|
# For pytest clean output
|
|
PYTHONWARNINGS=ignore
|
|
```
|
|
## TO-DOs
|
|
|
|
1. ~~Review standard tests for sqlalchemy objects~~
|
|
2. ~~Decide which DBE to use for data storage~~
|
|
3. ~~Create tests with in-memory database~~
|
|
4. ~~Update local database schema (alembic)~~
|
|
5. Complete starter code review
|
|
6. Add code to analyze numbers
|
|
7. Add code to main.py
|