A complete Python-based web dashboard for monitoring Omnitool usage analytics. Built with Streamlit for rapid development and FastAPI for backend services.
- Real-time Analytics: Usage statistics, user activity, and system health monitoring
- Interactive Visualizations: Charts and graphs powered by Plotly
- User Management: Track individual user engagement and session data
- Department Analytics: Filter and analyze usage by department
- System Health: Monitor database connections and service status
- Export Capabilities: Download reports and data exports
┌─────────────────────────────────────────────────────────────┐
│ Omnitool Clients │
│ (Local installations on PCs) │
└──────────────────────┬──────────────────────────────────────┘
│
│ Authenticate via AD
│ Send usage events
│
┌──────────────────────▼──────────────────────────────────────┐
│ Microsoft Active Directory │
│ (Authentication & Authorization) │
└──────────────────────┬──────────────────────────────────────┘
│
│ User identity & groups
│
┌──────────────────────▼──────────────────────────────────────┐
│ PostgreSQL Database │
│ - users, sessions, usage_events, auth_logs │
└──────────────────────┬──────────────────────────────────────┘
│
│ Query data
│
┌──────────────────────▼──────────────────────────────────────┐
│ FastAPI Backend (Optional) │
│ REST API endpoints for dashboard │
└──────────────────────┬──────────────────────────────────────┘
│
│ Serve data
│
┌──────────────────────▼──────────────────────────────────────┐
│ Streamlit Dashboard │
│ Interactive web interface │
└─────────────────────────────────────────────────────────────┘
- Python 3.9 or higher
- pip (Python package manager)
-
Navigate to the dashboard directory:
cd C:\Users\jperez\omnitool-python-dashboard
-
Create a virtual environment (recommended):
python -m venv venv .\venv\Scripts\Activate.ps1 -
Install dependencies:
pip install -r requirements.txt -
Run the dashboard:
streamlit run app.py
-
Open your browser to the URL shown (typically
http://localhost:8501)
omnitool-python-dashboard/
├── app.py # Main Streamlit dashboard application
├── config.py # Configuration settings
├── data/
│ ├── models.py # Data models and schemas
│ └── generator.py # Mock data generator
├── api/
│ └── backend.py # FastAPI backend (optional)
├── utils/
│ └── database.py # PostgreSQL connection utilities
├── requirements.txt # Python dependencies
├── README.md # This file
└── schema.sql # Database schema reference
Edit config.py to configure:
- Database connection settings (when connecting to PostgreSQL)
- Active Directory settings (for authentication)
- API endpoints
- Dashboard preferences
- Overview: Key metrics and recent activity
- Usage Statistics: Detailed analytics and trends
- User Activity: Individual user engagement
- System Health: Infrastructure status
By default, the dashboard runs with realistic mock data. This allows you to:
- Demo the interface to stakeholders
- Test visualizations and features
- Develop without database access
To connect to a real PostgreSQL database:
- Update
config.pywith your database credentials - Ensure the database schema matches
schema.sql - The dashboard will automatically switch to live data
The FastAPI backend provides REST endpoints for programmatic access:
uvicorn api.backend:app --reload --port 8000Available endpoints:
GET /health- Health checkGET /api/stats/overview- Overview statisticsGET /api/stats/usage- Usage analyticsGET /api/users/activity- User activity dataGET /api/system/health- System health status
See schema.sql for the complete database schema. Key tables:
users- User information synced from Active Directorysessions- User session recordsusage_events- Feature usage and interaction eventsauthentication_logs- Login/logout events
The dashboard is designed to work with Microsoft Active Directory:
- Authentication: Users authenticate via AD credentials
- Authorization: Admin access controlled by AD group membership
- User Identity: Uses
userPrincipalName(UPN) orobjectGUIDas stable identifiers
- Add data models in
data/models.py - Update mock data generator in
data/generator.py - Add new dashboard pages in
app.py - Update API endpoints in
api/backend.pyif needed
The dashboard includes mock data generation for testing. To test with different scenarios, modify the seed or parameters in data/generator.py.
- Set up PostgreSQL database
- Configure environment variables or
config.py - Set up reverse proxy (Nginx) for HTTPS
- Configure Active Directory authentication
- Deploy using:
streamlit run app.py --server.port 8501
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]If port 8501 is busy, Streamlit will automatically use the next available port. Check the terminal output for the actual URL.
- Verify PostgreSQL is running
- Check connection credentials in
config.py - Ensure network access to database server
- Verify database schema matches
schema.sql
If you see import errors:
pip install -r requirements.txt --upgradeCorporate internal tool. All rights reserved.
For questions or issues, refer to:
config.py- Configuration optionsschema.sql- Database structure- This README - General documentation