# Shopfloor Dashboard GE Aerospace West Jefferson shopfloor events and notifications dashboard. ## Overview Real-time display dashboard for showing current and upcoming events on the shopfloor. Designed for TV displays with large, readable text and GE Aerospace branding. ## Features - **Live Data Updates**: Auto-refreshes every 10 seconds via AJAX (no page reload) - **72-Hour Window**: Shows current events and upcoming events within next 72 hours - **Shopfloor Filtering**: Only displays notifications marked for shopfloor display - **Type-Based Color Coding**: Visual severity indicators (Red=Incident, Yellow=Change, Green=Awareness) - **Priority Sorting**: Critical incidents always shown first - **Real-Time Clock**: Always-on clock display - **Connection Monitoring**: Visual indicator shows live connection status - **GE Aerospace Branding**: Official colors, fonts, and logo ## Technology Stack - **Backend**: Python 3 with Flask - **Database**: MySQL 5.6+ - **Frontend**: Vanilla JavaScript (no frameworks) - **Styling**: Custom CSS with GE Aerospace brand colors ## Installation ### Prerequisites - Python 3.8+ with pip - MySQL 5.6+ database - Access to ShopDB database ### Setup ```bash # Install dependencies pip install -r requirements.txt # Set environment variables (optional) export DB_HOST=localhost export DB_PORT=3306 export DB_USER=570005354 export DB_PASS=570005354 export DB_NAME=shopdb export PORT=3001 # Start the server python3 app.py ``` ## Configuration Environment variables: | Variable | Default | Description | |----------|---------|-------------| | `PORT` | 3000 | Server port | | `DB_HOST` | localhost | Database host | | `DB_PORT` | 3306 | Database port | | `DB_USER` | 570005354 | Database username | | `DB_PASS` | 570005354 | Database password | | `DB_NAME` | shopdb | Database name | ## Usage ### Access the Dashboard Open your browser to: ``` http://localhost:3001 ``` ### API Endpoints **Get Notifications:** ``` GET /api/notifications ``` Returns current and upcoming events in JSON format. **Health Check:** ``` GET /health ``` Returns server status. ## Display on TV 1. Open the dashboard URL in a web browser (Chrome recommended) 2. Press F11 for fullscreen mode 3. Dashboard will auto-refresh every 10 seconds 4. Connection status indicator shows "LIVE" when connected ## Project Structure ``` shopfloor-dashboard/ ├── app.py # Flask application ├── requirements.txt # Python dependencies ├── public/ │ ├── index.html # Dashboard UI │ └── ge-aerospace-logo.svg ├── .gitignore └── README.md ``` ## Database Schema Queries the `notifications` table in ShopDB with shopfloor filtering: ```sql SELECT n.notificationid, n.notification, n.starttime, n.endtime, n.ticketnumber, n.link, n.isactive, n.isshopfloor, nt.typename, nt.typecolor FROM notifications n LEFT JOIN notificationtypes nt ON n.notificationtypeid = nt.notificationtypeid WHERE n.isactive = 1 AND n.isshopfloor = 1 AND (conditions for 72-hour window) ORDER BY n.starttime ASC ``` **Key Fields:** - `isshopfloor`: Boolean flag (0/1) - only events with `1` appear on dashboard - `typecolor`: Used for visual severity indicators (danger/warning/success) ## Design ### Colors (GE Aerospace Brand) - **Deep Navy**: `#00003d` (background) - **Sky Blue**: `#4181ff` (accents, clock) - **Avionics Green**: `#0ad64f` (live indicator) - **Tungsten**: `#eaeaea` (secondary text) ### Typography - **Font**: Inter (sans-serif) - **Sizes**: Large for TV readability (38px-48px headers) ## Git Repository This project is version controlled with Git and hosted on Gitea. **Repository URL:** - SSH: `ssh://git@localhost:2222/cproudlock/shopfloor-dashboard.git` - HTTP: `http://localhost:3000/cproudlock/shopfloor-dashboard` **SSH Key Setup:** The repository uses SSH authentication. The SSH key is already configured: ```bash # SSH public key location ~/.ssh/id_ed25519.pub # Key is registered in Gitea as "AI Key" # User: cproudlock ``` **Common Git Commands:** ```bash # Clone the repository git clone ssh://git@localhost:2222/cproudlock/shopfloor-dashboard.git # Pull latest changes git pull # Commit and push changes git add . git commit -m "Your commit message" git push ``` ## Development ```bash # Install dependencies pip install -r requirements.txt # Run the Flask development server python3 app.py # The built-in Flask server auto-reloads on code changes when debug=True ``` ## Deployment For production deployment (no pip/npm required on production server): ### Option 1: Package with Dependencies (Recommended) 1. Package entire directory including installed Python packages 2. Copy to production server 3. Run directly with Python 3 4. Use a process manager (systemd, supervisor, or PM2) ### Option 2: Install on Production ```bash # Install dependencies on production pip install -r requirements.txt # Run with production WSGI server (recommended) pip install gunicorn gunicorn -w 4 -b 0.0.0.0:3001 app:app # Or use PM2 with Python pm2 start app.py --name shopfloor-dashboard --interpreter python3 pm2 save pm2 startup ``` **Note**: Flask's built-in server (`python3 app.py`) works for production if using a process manager, but gunicorn is recommended for higher traffic. ## Troubleshooting **Port already in use:** ```bash # Use a different port PORT=3001 python3 app.py ``` **Can't connect to database:** - Verify MySQL is running - Check credentials in environment variables or app.py - Ensure database exists and user has permissions - Verify `mysql-connector-python` is installed **Dashboard not updating:** - Check browser console for errors - Verify `/api/notifications` endpoint returns data - Check network connectivity - Ensure Flask server is running **Python module errors:** ```bash # Reinstall dependencies pip install -r requirements.txt # Or install individually pip install Flask mysql-connector-python ``` ## License Internal GE Aerospace project - West Jefferson facility ## Support Contact: IT Support - West Jefferson