An open API service indexing awesome lists of open source software.

https://github.com/drkenreid/steam-stats-visualized

๐ŸŽฎ Spotify Wrapped, but for your Steam library. Paste your profile, get roasted.
https://github.com/drkenreid/steam-stats-visualized

data-science data-visualization gaming plotly portfolio python steam steam-api streamlit

Last synced: about 1 month ago
JSON representation

๐ŸŽฎ Spotify Wrapped, but for your Steam library. Paste your profile, get roasted.

Awesome Lists containing this project

README

          

# ๐ŸŽฎ Steam Stats Visualized

**Spotify Wrapped, but for your Steam library.** Paste your profile, get roasted.

> *"You own 665 games. You've played 344. The other 321 are just... vibes."*

![Python](https://img.shields.io/badge/Python-3.11+-blue?logo=python&logoColor=white)
![Streamlit](https://img.shields.io/badge/Streamlit-1.55-FF4B4B?logo=streamlit&logoColor=white)
![License](https://img.shields.io/badge/License-MIT-green)

---

## โœจ Features

| Feature | Description |
|---------|-------------|
| ๐ŸŽญ **Gaming Personality** | Are you "The Hoarder", "The Completionist", or "The One-Game Andy"? |
| ๐Ÿ† **Top 10 Games** | Interactive bar chart of your most-played games with roast commentary |
| ๐ŸŽฎ **Game Meme References** | ~50 game-specific memes (Factorio: "The factory must grow" ๐Ÿญ) |
| ๐Ÿ’ป **Platform Breakdown** | Windows / Mac / Linux / Steam Deck playtime donut chart |
| ๐Ÿ’€ **Backlog of Shame** | How many games you've never touched, with appropriate judgment |
| ๐Ÿ“Š **Playtime Distribution** | Histogram showing the classic "200 games under 1 hour" pattern |
| ๐ŸŽฏ **Genre Breakdown** | Treemap of your library by genre |
| ๐Ÿ’ฐ **Cost Per Hour** | Best and worst value games in your library |
| ๐Ÿ’ธ **Most Expensive Unplayed** | The priciest game you've never opened |
| ๐Ÿ… **Achievement Stats** | Completion rates across your top games |
| ๐Ÿ•น๏ธ **Recently Played** | What you've been up to in the last 2 weeks |
| ๐Ÿ“ค **Social Sharing** | Share buttons (Twitter, Reddit, Facebook, LinkedIn) on every section |

## ๐Ÿ“ธ Screenshots

Click to expand

### Gaming Personality + Profile
![Profile](assets/screenshots/v2_01_personality.png)

### Top 10 Games + Platform Breakdown
![Top 10](assets/screenshots/v2_02_top10_platform.png)

### Backlog of Shame + Playtime Distribution
![Backlog](assets/screenshots/v2_03_backlog_histogram.png)

### Genre Breakdown + Cost Analysis
![Genre](assets/screenshots/v2_04_genre_cost_expensive.png)

### Achievement Stats + Recently Played
![Achievements](assets/screenshots/v2_05_achievements_recent.png)

## ๐Ÿš€ Try It

Or run locally:

```bash
# Clone
git clone https://github.com/drkenreid/steam-stats-visualized.git
cd steam-stats-visualized

# Install dependencies
pip install -r requirements.txt

# Add your Steam API key (free: https://steamcommunity.com/dev/apikey)
cp .streamlit/secrets.toml.example .streamlit/secrets.toml
# Edit .streamlit/secrets.toml with your key

# Run
streamlit run app.py
```

Or with Docker:

```bash
docker build -t steam-stats .
docker run -p 8501:8501 steam-stats
```

Or with Make:

```bash
make run # Start the app
make test # Run tests
```

## ๐Ÿ—๏ธ Architecture

```
steam-stats-visualized/
โ”œโ”€โ”€ app.py # Streamlit UI โ€” layout, sections, share buttons
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ steam_api.py # Steam API client (Web API + Store API), caching
โ”‚ โ”œโ”€โ”€ analytics.py # Data processing, metrics, commentary, personality
โ”‚ โ””โ”€โ”€ charts.py # Plotly chart builders (dark theme)
โ”œโ”€โ”€ notebooks/
โ”‚ โ””โ”€โ”€ exploration.ipynb # Data science EDA walkthrough
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_analytics.py # Unit tests for analytics functions
โ”œโ”€โ”€ .streamlit/
โ”‚ โ”œโ”€โ”€ config.toml # Dark theme configuration
โ”‚ โ””โ”€โ”€ secrets.toml.example # API key template
โ”œโ”€โ”€ assets/screenshots/ # App screenshots
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ Makefile
โ””โ”€โ”€ LICENSE (MIT)
```

### Design Decisions

- **Streamlit** over Flask/React: Zero-friction deployment, Python-native, free hosting via Streamlit Community Cloud. The app IS the repo.
- **Plotly** over Matplotlib: Interactive charts that users can hover, zoom, and explore. Dark theme consistency.
- **No database**: All data fetched live from Steam APIs. Caching via `@st.cache_data` (1-hour TTL) to avoid hammering rate limits.
- **No OAuth**: Users paste a profile URL โ€” no login required. Works with any public Steam profile.
- **Humor-driven**: The goal is shareability. People share things that make them laugh, not bar charts.

### Steam APIs Used

| Endpoint | Purpose |
|----------|---------|
| `ISteamUser/ResolveVanityURL` | Convert vanity name โ†’ Steam ID |
| `ISteamUser/GetPlayerSummaries` | Profile info, avatar, account age |
| `IPlayerService/GetOwnedGames` | Full game list with playtime + platform breakdown |
| `IPlayerService/GetRecentlyPlayedGames` | Last 2 weeks activity |
| `ISteamUserStats/GetPlayerAchievements` | Per-game achievement progress |
| `store.steampowered.com/api/appdetails` | Genre tags, pricing (rate-limited) |

## ๐Ÿงช Testing

```bash
pytest tests/ -v
```

10 unit tests covering analytics functions (stats calculation, commentary generation, cost-per-hour, account age formatting).

## ๐Ÿ““ Data Science Notebook

The `notebooks/exploration.ipynb` notebook walks through the data exploration process:
- Fetching and cleaning Steam API data
- Statistical observations about gaming patterns
- Genre analysis methodology
- Playtime distribution analysis

This is the "portfolio piece" โ€” showing the data science thinking behind the visualizations.

## ๐Ÿค Contributing

PRs welcome! Some ideas:
- Add more game meme references (see `GAME_MEMES` dict in `analytics.py`)
- Friend comparison (side-by-side stats)
- Gaming timeline (scatter plot of when games were last played)
- Shareable summary card (PNG export)
- More gaming personalities

## ๐Ÿ“„ License

MIT โ€” do whatever you want with it.

---

*Built with [Streamlit](https://streamlit.io), [Plotly](https://plotly.com), and questionable life choices.*

## Related

- [Letterboxd Roasted](https://github.com/DrKenReid/Letterboxd-Roasted) โ€” Spotify Wrapped for your Letterboxd
- [Debt Payoff Simulator](https://github.com/DrKenReid/Debt-Payoff-Simulator) โ€” compare debt repayment strategies
- [kenreid.co.uk/data_science](https://www.kenreid.co.uk/data_science.html) โ€” all projects, publications, and CV

## Author

**Ken Reid** โ€” Data Scientist, photographer, and avid reader.

- [kenreid.co.uk](https://www.kenreid.co.uk) โ€” Portfolio & blog
- [@kenreid.co.uk](https://bsky.app/profile/kenreid.co.uk) โ€” Bluesky
- [@DrKenReid](https://github.com/DrKenReid) โ€” GitHub