Skip to content

mitzen-mark/Databases-Final-Project

Repository files navigation

Prerequisites

  • Python 3.11 (or higher)
  • PostgreSQL 15 (or higher)
  • pgAdmin 4 (Not strictly necessary but its what I used to manage the database)

Included files

  • app.py : The Streamlit web application and UI logic
  • database.py : SQLAlchemy DatabaseConnector class and engine
  • models.py : ORM classes defining the database schema
  • nfl_data_import.py : Script to fetch and load NFL roster data in database
  • stat_import.py : Script to fetch and load weekly box scores in database
  • database_schema.sql: pg_dump file containing the database schema only
  • data.sql : pg_dump file containing the database data only
  • requirements.txt : List of required Python libraries
  • .env : Database connection credentials

Database Initialization

  1. Open pgAdmin 4 (or your preferred method of acessing postgres)
  2. Create a new, empty database named: fantasy_football

Environment Setup

The included .env file contains the credential variables for the application to interact with the database. It currently has my local environment credentials but update the user and pass fields to match your local setup.

DB_HOST=localhost DB_NAME=fantasy_football DB_USER=postgres // change to your local postgres username DB_PASS=admin // change to your local postgres password

Dependencies

Dependencies for the project can be installed with pip through requirements.txt:

pip install -r requirements.txt

Populating the Database

  1. Build the database tables via SQLAlchemy: python database.py

  2. Download and insert the NFL team and player rosters into the database: python nfl_data_import.py

  3. Download, clean, and insert the historical weekly statistics: python stat_import.py

Running the application

Application can be run and acessed in your browser through the streamlit run command in terminal:

streamlit run app.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages