A full-stack application for visualizing and analyzing chemical equipment data with both web and desktop interfaces. Upload CSV files containing equipment parameters and get instant analytics with interactive charts, statistics, and PDF reports.
- CSV Data Upload - Import equipment data with parameters (Name, Type, Flowrate, Pressure, Temperature)
- Interactive Visualizations - Pie charts with percentage labels and grouped bar charts
- Real-time Analytics - Automatic calculation of averages, min/max values, and type distribution
- Dataset Management - Store and manage up to 5 datasets per user with dropdown selection
- PDF Report Generation - Download comprehensive reports with charts and data tables
- Sortable Data Tables - Client-side sorting and pagination for equipment details
- JWT Authentication - Secure token-based user authentication
- Theme Toggle - Light/dark mode support in both web and desktop apps
- Dual Interface - Access via modern web browser or native desktop application
- Responsive Design - Web interface works on desktop, tablet, and mobile devices
- CSV Validation - Automatic validation with detailed error messages
- Django 5.0 + Django REST Framework - RESTful API server
- JWT - Token-based authentication
- Pandas - CSV parsing and data analytics
- ReportLab - PDF report generation
- SQLite - Database for development and production
- React 19 + TypeScript - Modern web framework
- Vite - Fast build tool and dev server
- shadcn/ui - Beautiful UI components
- Tailwind CSS - Utility-first styling
- Chart.js - Interactive data visualizations
- TanStack Table - Advanced table features
- Axios - HTTP client for API calls
- PyQt5 - Native desktop GUI framework
- Matplotlib - Chart rendering
- Requests - HTTP client for API communication
chemical-visualizer/
├── backend/ # Django REST API
│ ├── api/ # Main API application
│ │ ├── models.py # Dataset and Equipment models
│ │ ├── views.py # API endpoints
│ │ ├── serializers.py # Data serialization
│ │ └── utils.py # PDF generation utilities
│ ├── config/ # Django configuration
│ │ ├── settings.py # Project settings
│ │ └── urls.py # URL routing
│ ├── manage.py
│ └── requirements.txt
│
├── web-frontend/ # React web application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── contexts/ # React contexts (Auth, Theme)
│ │ ├── lib/ # Utilities and API client
│ │ ├── pages/ # Page components
│ │ └── main.tsx # Application entry point
│ ├── package.json
│ └── vite.config.ts
│
├── desktop-app/ # PyQt5 desktop application
│ ├── main.py # Application entry point
│ ├── auth_window.py # Login/Register window
│ ├── main_window.py # Main application window
│ ├── api_client.py # API communication
│ ├── theme_manager.py # Theme management
│ └── requirements.txt
│
└── README.md
- Python 3.8 or higher
- Node.js 16 or higher
- npm or yarn
- pip (Python package manager)
# Navigate to backend directory
cd backend
# Create and activate virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create database tables
python manage.py makemigrations
python manage.py migrate
# (optional) Create admin user
python manage.py createsuperuser
# Start development server
python manage.py runserverBackend runs on: http://localhost:8000
# Navigate to web frontend directory
cd web-frontend
# Install dependencies
npm install
# Start development server
npm run devWeb app runs on: http://localhost:5173
# Navigate to desktop app directory
cd desktop-app
# Create and activate virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run application
python main.py- Access - Open
http://localhost:5173in your browser - Register - Create a new account or login with existing credentials
- Upload Data - Click "Upload CSV" and select your equipment data file
- Select Dataset - Choose from your uploaded datasets using the dropdown
- Analyze - View interactive pie and bar charts with statistics
- Sort & Filter - Click column headers in the data table to sort
- Download Report - Click "Download PDF" to generate a comprehensive report
- Toggle Theme - Use the sun/moon icon to switch between light and dark modes
- Launch - Run
python main.pyfrom the desktop-app directory - Login - Enter your credentials or register a new account
- Upload - Click "Upload CSV" button to import data
- Select Dataset - Choose from the dropdown menu
- View Charts - See pie and bar charts with your data
- Browse Table - Scroll through the equipment details table
- Download PDF - Click "Download PDF" to save a report
- Toggle Theme - Click the theme button (Light/Dark)
Your CSV file must include these exact column headers:
Equipment Name,Type,Flowrate,Pressure,Temperature
Reactor-A1,Reactor,150.5,25.3,180.2
Heat Exchanger-B2,Heat Exchanger,200.8,15.7,120.5
Pump-C3,Pump,180.2,30.1,95.8
Requirements:
- Column names must match exactly (case-sensitive)
- Flowrate, Pressure, and Temperature must be numeric values
- Empty rows will be automatically removed
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register/ |
Register new user |
| POST | /api/auth/login/ |
Login and receive JWT tokens |
| POST | /api/auth/refresh/ |
Refresh access token |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/datasets/ |
List user's datasets (last 5) |
| GET | /api/datasets/{id}/ |
Get dataset details with equipment |
| POST | /api/datasets/upload/ |
Upload new CSV file |
| DELETE | /api/datasets/{id}/ |
Delete dataset |
| GET | /api/datasets/{id}/summary/ |
Get statistics and type distribution |
| GET | /api/datasets/{id}/download_pdf/ |
Download PDF report |
Authentication: All dataset endpoints require JWT token in Authorization header:
Authorization: Bearer <access_token>
- Pie Chart - Shows equipment type distribution with percentage labels on each slice
- Bar Chart - Displays average, minimum, and maximum values for each parameter
- Interactive - Click legend items to show/hide data series
- Theme-Aware - Charts adapt colors based on light/dark theme
- Auto-Limit - System keeps only the 5 most recent datasets per user
- Auto-Cleanup - Older datasets are automatically deleted when limit is exceeded
- Quick Selection - Dropdown shows dataset name, upload date, and item count
- Sortable Columns - Click any column header to sort ascending/descending
- Pagination - Navigate through large datasets with Previous/Next buttons
- Responsive - Table adapts to different screen sizes
- Comprehensive - Includes all charts, statistics, and data tables
- Professional - Clean layout with proper formatting
- Downloadable - Save reports for offline viewing or sharing
Edit backend/config/settings.py to customize:
# CORS settings for web frontend
CORS_ALLOWED_ORIGINS = [
"http://localhost:5173", # Add your frontend URL
]
# JWT token expiration
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
}
# Dataset limit per user
MAX_DATASETS_PER_USER = 5 # Change in views.pyEdit web-frontend/src/lib/api.ts to change API URL:
const API_BASE_URL = 'http://localhost:8000/api';Edit desktop-app/api_client.py to change API URL:
self.base_url = 'http://localhost:8000/api'cd web-frontend
# Build for production
npm run build
# Output will be in dist/ folder
# Deploy dist/ folder to your web servercd desktop-app
# Install PyInstaller
pip install pyinstaller
# Create standalone executable
pyinstaller --onefile --windowed --name ChemicalVisualizer main.py
# Executable will be in dist/ folderFor production deployment:
- Set
DEBUG = Falsein settings.py - Configure
ALLOWED_HOSTS - Use a production WSGI server (Gunicorn, uWSGI)
- Set up a reverse proxy (Nginx, Apache)
- Use environment variables for secrets
- Consider PostgreSQL or MySQL for production database