This is a custom project showcasing the development of a Shiny application that includes interactive analytics and continuous intelligence elements to display and compare various NBA players and their career stats.
This project includes the following files and directories:
- dashboard: Root directory containing the project files.
- app.py: Main script for running the dashboard application.
- careers.csv: Dataset containing career statistics for NBA players.
- careers_all.csv: Extended dataset containing additional career details.
- etl.py: Script for performing data extraction, transformation, and loading.
- players.csv: Dataset containing information about NBA players.
- plots.py: Helper functions for generating plots and visualizations.
- shared.py: Module for shared variables and functions used across scripts.
- styles.css: CSS file for customizing the appearance of the dashboard.
- .gitignore: File specifying which files and directories to ignore in version control.
- README.md: Markdown file providing an overview of the project.
- requirements.txt: File listing all Python dependencies for the project.
- faicons
- pandas
- numpy
- plotly
- shiny
- shinylive
- shinywidgets
- scipy
Go to PyShiny Playground at https://shinylive.io/py/examples/#basic-app. Copy and paste content from dashboard/app.py and run. The PyShiny Playground includes these packages already, so you won't need requirements.txt:
Fork this project into your own GitHub account and/or just borrow code from app.py. Clone your GitHub repo down to your local machine. Use your GitHub username in place of dgraves4 and your GitHub repo name in place of cintel-06-custom. GitHub CLI may work better on some machines.
git clone https://github.com/dgraves4/cintel-06-custom
After cloning your project down to your Documents folder, open the project folder for editing in VS Code.
Create a local project virtual environment named .venv, activate it, and install the requirements.
When VS Code asks to use it for the workspace, select Yes. If you miss the window, after installing, select from the VS Code menu, View / Command Palette, and type "Python: Select Interpreter" and select the .venv folder.
Open a terminal (VS Code menu "View" / "Terminal") in the root project folder and run these commands (for Windows - the activate command is slightly different Linux/Mac).
py -m venv .venv
source .venv\Scripts\Activate
py -m pip install --upgrade pip setuptools
py -m pip install --upgrade -r requirements.txt
Open a terminal (VS Code menu "View" / "Terminal") in the root project folder and run these commands.
shiny run --reload --launch-browser dashboard/app.py
Open a browser to http://127.0.0.1:8000/ and test the app.
Open a terminal (VS Code menu "View" / "Terminal") in the root project folder and run these commands.
source .venv\Scripts\Activate
shiny run --reload --launch-browser dashboard/app.py
Export to docs folder and test GitHub Pages locally.
Open a terminal (VS Code menu "Terminal" / "New Terminal") in the root project folder and run these commands.
shiny static-assets remove
shinylive export dashboard docs
py -m http.server --directory docs --bind localhost 8000
Open a browser to http://[::1]:8000 and test the Pages app.
Open a terminal (VS Code menu "Terminal" / "New Terminal") in the root project folder and run these commands.
git add .
git commit -m "Useful commit message"
git push origin main
Go to your GitHub repo settings and enable GitHub Pages for the docs folder.
- Data from NBA_API: https://developer.geniussports.com/nbangss/stream/
- Shiny Express theme and code: https://shiny.posit.co/py/templates/nba-dashboard/
- Shiny for Python: https://shiny.posit.co/py/
- Favicon generator: https://favicon.io/