GitHunt
MO

Moose0621/you-ai-yourself

A repository to test out building a novel website to graphically display Phish song statistics.

Phish Statistics Dashboard

A modern web application for exploring Phish song statistics, tour data, and performance analytics using the Phish.net API with interactive circular tour visualizations and comprehensive data analysis tools.

โœจ Features

๐Ÿ“Š Song Statistics

  • Comprehensive Analytics: Song play counts, average lengths, and gap analysis
  • Longest Jam Tracking: Historical longest jam performances with dates and venues
  • Interactive Filtering: Search and filter by song name, length, play count
  • Smart Autocomplete: Intelligent song suggestions with metadata

๐ŸŽช Tours Explorer

  • Interactive Circular Visualization: Tour data displayed in engaging circular layouts
  • Year-by-Year Navigation: Explore Phish's touring history by year
  • Hover Tooltips: Detailed tour information on hover
  • Show Details: Click-through to individual show listings
  • Size-Coded Tours: Visual representation of tour sizes by show count

๐ŸŽฏ Modern UI/UX

  • Tabbed Navigation: Seamless switching between Statistics and Tours
  • Responsive Design: Optimized for desktop, tablet, and mobile
  • Real-time Filtering: Instant search and filter results
  • Professional Styling: Clean, modern interface with Tailwind CSS

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 21+ (LTS recommended)
  • Python 3.12+ (for data processing scripts)
  • npm or yarn
  • Phish.net API key (Get one here)

Quick Installation

# Clone the repository
git clone https://github.com/Moose0621/you-ai-yourself.git
cd you-ai-yourself

# Install Node.js dependencies
npm install

# Set up Python environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt

# Configure environment
cp .env.local.example .env.local
# Edit .env.local and add your Phish.net API key

# Generate initial data
npm run data:refresh

# Start development server
npm run dev

Open http://localhost:3000 to view the application.

๐Ÿ“ Project Structure

โ”œโ”€โ”€ .github/workflows/     # CI/CD and maintenance workflows
โ”œโ”€โ”€ .azure/               # Azure deployment configuration
โ”œโ”€โ”€ scripts/              # Maintenance and data processing scripts
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/             # Next.js 13+ app directory
โ”‚   โ”œโ”€โ”€ components/      # React components
โ”‚   โ”‚   โ”œโ”€โ”€ Navigation.tsx      # Tab navigation system
โ”‚   โ”‚   โ”œโ”€โ”€ ToursExplorer.tsx   # Circular tour visualization
โ”‚   โ”‚   โ”œโ”€โ”€ FilterControls.tsx  # Search and filtering
โ”‚   โ”‚   โ”œโ”€โ”€ SongChart.tsx       # Chart components
โ”‚   โ”‚   โ”œโ”€โ”€ SongTable.tsx       # Data table display
โ”‚   โ”‚   โ””โ”€โ”€ TourStats.tsx       # Statistics overview
โ”‚   โ”œโ”€โ”€ lib/             # API and utility functions
โ”‚   โ”‚   โ””โ”€โ”€ simpleLocalPhishApi.ts  # Enhanced API with tour support
โ”‚   โ””โ”€โ”€ types/           # TypeScript definitions
โ”œโ”€โ”€ data/                # Raw and processed data files
โ”œโ”€โ”€ public/              # Static assets and processed data
โ”œโ”€โ”€ tests/               # Test suites (Jest & Pytest)
โ””โ”€โ”€ backups/             # Automated data backups

๐Ÿ”ง Available Scripts

Development

npm run dev              # Start development server
npm run build            # Build for production
npm run start            # Start production server
npm run type-check       # TypeScript type checking

Testing & Quality

npm run test             # Run Jest tests
npm run test:coverage    # Run tests with coverage
npm run test:python      # Run Python tests
npm run test:all         # Run all tests
npm run lint             # Lint code
npm run lint:fix         # Fix linting issues

Data Management

npm run data:refresh     # Refresh Phish.net data
npm run data:backup      # Create data backup
npm run health-check     # System health check

Maintenance

npm run clean            # Clean build artifacts
npm run clean:full       # Full clean and reinstall
npm run security:audit   # Security vulnerability scan
npm run deps:check       # Check for outdated dependencies
npm run deps:update      # Update dependencies

๐Ÿ—„๏ธ Data Architecture

Data Sources

  • Phish.net API v5: Live show and song data
  • Local JSON Cache: Optimized for fast loading
  • Processed Data: Enhanced with jam analysis and statistics

Data Processing Pipeline

  1. Fetch: Download raw data from Phish.net API
  2. Filter: Remove non-Phish shows and future dates
  3. Enhance: Add longest jam calculations and metadata
  4. Cache: Store processed data for fast access
  5. Backup: Automated daily backups with retention

Data Structure

interface Song {
  name: string
  slug: string
  timesPlayed: number
  averageLength: number
  longestJam?: JamPerformance
  tags: string[]
}

interface Show {
  showid: number
  date: string
  venue: string
  city: string
  state: string | null
  country: string
  tourid?: number
  tour_name?: string
}

๐Ÿ—๏ธ API Integration

Enhanced Local API

The application uses an enhanced local API that provides:

// Song statistics and search
getSongStats(): Promise<Song[]>
searchSongs(query: string): Promise<Song[]>
getTopSongsByLongestJam(limit?: number): Promise<Song[]>

// Tour exploration
getToursByYear(): Promise<Record<number, Tour[]>>
getAvailableYears(): Promise<number[]>
getShowsByYear(year: number): Promise<Show[]>

// Utility methods
getMetadata(): Promise<Metadata>
getAllTags(): Promise<string[]>

Phish.net API Endpoints

  • GET /v5/shows.json - All shows
  • GET /v5/songs.json - Song catalog
  • GET /v5/shows/year/{year}.json - Shows by year
  • GET /v5/songdata/slug/{slug}.json - Detailed song data

๐ŸŽจ UI Components

  • Tab-based Interface: Smooth transitions between sections
  • Active State Indicators: Clear visual feedback
  • Mobile Responsive: Collapsible navigation on small screens

Tours Explorer

  • Circular Layout: Tours arranged in visually appealing circles
  • Interactive Elements: Hover effects and click handlers
  • Color Coding: Unique colors for each tour
  • Size Scaling: Circle size represents tour magnitude
  • Autocomplete: Real-time suggestions as you type
  • Rich Previews: Show metadata in suggestions
  • Intelligent Sorting: Exact matches and starts-with prioritized

๐Ÿšข Deployment

Azure Web App Deployment

Prerequisites

  • Azure subscription
  • Azure CLI installed
  • GitHub repository with secrets configured

Required Secrets

AZURE_WEBAPP_NAME              # Production app name
AZURE_WEBAPP_PUBLISH_PROFILE   # Production publish profile
AZURE_WEBAPP_NAME_STAGING      # Staging app name
AZURE_WEBAPP_PUBLISH_PROFILE_STAGING  # Staging publish profile
AZURE_STORAGE_ACCOUNT          # Storage account for backups
AZURE_STORAGE_KEY              # Storage account key

Deployment Process

  1. Automatic: Push to main triggers production deployment
  2. Staging: Push to develop deploys to staging environment
  3. Manual: Use GitHub Actions workflow dispatch

CI/CD Pipeline

  • Quality Gates: Automated testing, linting, type checking
  • Security Scanning: Dependency vulnerability checks
  • Health Monitoring: Post-deployment verification
  • Automated Backups: Daily data backups to Azure Storage

๐Ÿงช Testing

Test Coverage

  • Frontend: Jest + React Testing Library
  • Backend: Python pytest with coverage
  • Integration: End-to-end API testing
  • Quality: ESLint, TypeScript strict mode

Running Tests

# Quick test run
npm test

# Full test suite with coverage
npm run test:all

# Python-specific tests
npm run test:python

# Watch mode for development
npm run test:watch

๐Ÿ”’ Security

Security Measures

  • API Key Protection: Environment variable security
  • Dependency Scanning: Automated vulnerability detection
  • Content Security: Input validation and sanitization
  • HTTPS Only: Secure communication protocols

Security Scripts

npm run security:audit    # Check for vulnerabilities
npm run security:fix      # Auto-fix security issues

๐Ÿ“ˆ Monitoring & Maintenance

Automated Maintenance

  • Daily Health Checks: System integrity verification
  • Weekly Dependency Updates: Automated security patches
  • Data Freshness Monitoring: Automatic data refresh
  • Performance Monitoring: Response time tracking

Health Monitoring

npm run health-check      # Manual health check

Backup Strategy

  • Daily Backups: Automated data preservation
  • 7-day Retention: Local backup cleanup
  • Cloud Storage: Azure Blob Storage integration
  • Recovery Testing: Periodic backup validation

๐Ÿค Contributing

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • TypeScript: Strict mode enabled
  • ESLint: Enforced code quality
  • Prettier: Consistent formatting
  • Conventional Commits: Structured commit messages

Testing Requirements

  • Unit Tests: Required for new components
  • Integration Tests: Required for API changes
  • Coverage: Minimum 80% coverage threshold
  • Type Safety: No TypeScript errors allowed

๐Ÿ“Š Performance

Optimization Features

  • Static Generation: Pre-built pages for faster loading
  • Data Caching: Local JSON cache for instant access
  • Code Splitting: Lazy loading of components
  • Image Optimization: Next.js automatic optimization

Performance Metrics

  • First Contentful Paint: < 1.5s
  • Largest Contentful Paint: < 2.5s
  • Time to Interactive: < 3.5s
  • Cumulative Layout Shift: < 0.1

๐Ÿ› Troubleshooting

Common Issues

Data Loading Issues

# Refresh data cache
npm run data:refresh

# Check health status
npm run health-check

# Clear cache and rebuild
npm run clean:full

Development Issues

# Type checking errors
npm run type-check

# Linting issues
npm run lint:fix

# Test failures
npm run test:coverage

Deployment Issues

# Check build locally
npm run build

# Verify environment variables
cat .env.local

# Test production build
npm run start

๐Ÿ“ Changelog

Version 0.2.0 (Latest)

  • โœจ Added interactive Tours Explorer with circular visualization
  • ๐Ÿ” Enhanced search with autocomplete functionality
  • ๐ŸŽช Year-by-year tour navigation
  • ๐Ÿ“Š Improved data processing and caching
  • ๐Ÿ—๏ธ Complete CI/CD pipeline setup
  • ๐Ÿ”ง Comprehensive maintenance scripts

Version 0.1.0

  • ๐ŸŽต Basic song statistics and filtering
  • ๐Ÿ“ˆ Chart.js integration for data visualization
  • ๐ŸŽฏ Responsive design with Tailwind CSS
  • ๐Ÿ”Œ Phish.net API integration
  • โœ… Initial test coverage

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Phish.net and the Mockingbird Foundation for providing comprehensive Phish data
  • The Phish Community for ongoing documentation and preservation efforts
  • Contributors to the open-source packages that make this project possible

Built with โค๏ธ for the Phish community

Moose0621/you-ai-yourself | GitHunt