A production-ready full-stack application for uploading, analyzing, and visualizing chemical equipment parameters from CSV files. Built with Django REST Framework backend, React.js frontend, and PyQt5 desktop client.
This application allows users to upload CSV files containing chemical equipment data (flow rate, pressure, temperature) and provides:
- Statistical analysis (averages, counts, type distribution)
- Interactive visualizations (bar charts, pie charts)
- PDF report generation
- RESTful API with authentication
- Multi-platform access (Web + Desktop)
- Production-ready with environment-based configuration
- Real data support with no test data dependencies
Developed for: Chemical Engineering Data Management
Purpose: Internship Project / Portfolio Demonstration
# Windows
start.bat
# Linux/Mac
chmod +x start.sh
./start.sh# Windows
scripts\start_backend.bat # API Server
scripts\start_frontend.bat # Web App
scripts\start_desktop.bat # Desktop App
# Linux/Mac
./scripts/start_backend.sh &
./scripts/start_frontend.sh &# Windows
scripts\start_production.bat
# Linux/Mac
./scripts/start_production.shπ For detailed instructions, see docs/DEPLOYMENT.md
- Django 4.2.7 - Web framework
- Django REST Framework - REST API
- pandas - Data processing
- ReportLab - PDF generation
- SQLite - Database
- React 18.2 - UI library
- Axios - HTTP client
- Chart.js - Data visualization
- React-Chart.js-2 - React wrapper for Chart.js
- PyQt5 - GUI framework
- Requests - API client
FOSSENN/
βββ π README.md # Main documentation
βββ π LICENSE # MIT License
βββ π§ .env.example # Environment template
βββ π start.bat / start.sh # Quick start launcher
βββ
βββ π chemical_visualizer/ # Django Backend
β βββ manage.py
β βββ desktop_app.py
β βββ config.py
β βββ requirements.txt
β βββ equipment_api/ # API application
β βββ ...
βββ
βββ π react_frontend/ # React Web App
β βββ package.json
β βββ src/
β β βββ App.js
β β βββ ...
β βββ ...
βββ
βββ π scripts/ # All startup & build scripts
β βββ start_backend.*
β βββ start_frontend.*
β βββ start_desktop.*
β βββ start_production.*
β βββ build_frontend.*
β βββ update_dependencies.*
βββ
βββ π docs/ # Documentation
βββ DEPLOYMENT.md # Complete deployment guide
βββ SETUP.md # Quick setup guide
βββ QUICK_REFERENCE.md # Command reference
βββ PROJECT_INFO.md # Project details
- Python 3.8+
- Node.js 14+ and npm
- Git
# Navigate to project directory
cd chemical_visualizer
# Install Python dependencies
pip install -r requirements.txt
# Apply database migrations
python manage.py migrate
# Create admin user (username: admin, password: admin123)
python create_test_user.py
# Start Django development server
python manage.py runserverBackend will run on: http://localhost:8000
# Navigate to React directory
cd react_frontend
# Install Node dependencies
npm install
# Start development server
npm startFrontend will run on: http://localhost:3000
# Navigate to backend directory
cd chemical_visualizer
# Install desktop dependencies
pip install PyQt5 requests
# Run desktop application
python desktop_app.pyAll API endpoints require HTTP Basic Authentication.
Default Credentials:
- Username:
admin - Password:
admin123
The React app and desktop app automatically include these credentials. Change them in production environments.
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /upload/ |
Upload CSV file and get analysis | β |
| GET | /history/ |
Get last 5 uploads | β |
| GET | /report/?upload_id={id} |
Generate PDF report | β |
{
"message": "CSV uploaded successfully",
"data": {
"id": 1,
"filename": "equipment.csv",
"equipment_count": 8,
"avg_flowrate": 94.16,
"avg_pressure": 50.73,
"avg_temperature": 26.50,
"type_distribution": {
"Centrifugal": 2,
"Reciprocating": 1,
"Rotary": 1
},
"equipment": [
{
"name": "Pump A",
"type": "Centrifugal",
"flowrate": 100.5,
"pressure": 50.2,
"temperature": 25.1
}
]
}
}Your CSV file must contain these columns:
Equipment Name,Type,Flowrate,Pressure,Temperature
Pump A,Centrifugal,100.5,50.2,25.1
Pump B,Reciprocating,85.3,45.8,26.5
Compressor X,Rotary,120.0,60.5,30.2Sample file: test_equipment.csv is included in the project
-
Terminal 1 - Django Backend:
cd chemical_visualizer python manage.py runserver -
Terminal 2 - React Frontend:
cd react_frontend npm start -
Browser: Opens automatically at http://localhost:3000
-
Upload Test File:
- Click "Choose CSV file"
- Select
test_equipment.csv - Click "Upload & Analyze"
- View charts and statistics
cd chemical_visualizer
python desktop_app.py- Click "Browse..." β Select CSV
- Click "Upload & Analyze"
- View statistics and details
- URL: http://localhost:8000/admin/
- Login: admin / admin123
- View uploaded data and manage users
β
CSV file upload with drag & drop
β
Real-time data validation
β
Interactive bar charts (average metrics)
β
Pie charts (equipment type distribution)
β
Responsive design (mobile-friendly)
β
Upload history tracking
β
Equipment data table view
β
Native PyQt5 GUI
β
Non-blocking file upload
β
Statistics display panel
β
Detailed results viewer
β
Error handling with dialogs
β
Structured for future chart integration
β
RESTful API design
β
Basic authentication
β
CSV parsing with pandas
β
Statistical analysis
β
PDF report generation
β
CORS support
β
Comprehensive error handling
# Upload CSV
curl -u admin:admin123 \
-F "csv_file=@test_equipment.csv" \
http://localhost:8000/api/upload/
# Get history
curl -u admin:admin123 \
http://localhost:8000/api/history/
# Download PDF report
curl -u admin:admin123 \
http://localhost:8000/api/report/ \
-o report.pdfimport requests
auth = ('admin', 'admin123')
# Upload
with open('test_equipment.csv', 'rb') as f:
response = requests.post(
'http://localhost:8000/api/upload/',
files={'csv_file': f},
auth=auth
)
print(response.json())- Upload Interface: Clean file selection with upload button
- Statistics Cards: Total count, equipment types, averages
- Bar Chart: Visual comparison of average metrics
- Pie Chart: Equipment type distribution
- Data Table: Detailed equipment listing
- Main Window: Professional PyQt5 interface
- Upload Section: File browser and upload controls
- Statistics Panel: Real-time data display
- Details View: Scrollable text area with formatted results
This application is production-ready with environment-based configuration:
Step 1: Copy environment templates
# Backend
cp chemical_visualizer/.env.example chemical_visualizer/.env
# Frontend
cp react_frontend/.env.example react_frontend/.envStep 2: Update critical settings in .env files
# Backend: chemical_visualizer/.env
SECRET_KEY=generate-a-long-random-secret-key
DEBUG=False
ALLOWED_HOSTS=yourdomain.com,your-server-ip
API_USERNAME=your_admin
API_PASSWORD=strong-secure-password
# Frontend: react_frontend/.env
REACT_APP_API_URL=https://your-api-domain.com
REACT_APP_API_USERNAME=your_admin
REACT_APP_API_PASSWORD=strong-secure-passwordAll Components (Development):
# Windows
start_all.bat
# Linux/Mac
./start_backend.sh &
./start_frontend.sh &
./start_desktop.sh &Production Server (Gunicorn/Waitress):
# Windows
start_production.bat
# Linux/Mac
./start_production.shNo test data required! This application is ready for production data:
-
CSV Format Requirements:
equipment_id- Unique identifierequipment_type- Type of equipmentflowrate,pressure,temperature- Numeric valuestimestamp- Date/time of measurement
-
Upload Methods:
- Web interface (http://your-domain:3000)
- Desktop application
- Direct API calls with curl/scripts
-
Automatic Admin Creation:
- Production scripts automatically create admin user
- Change default credentials in
.envfiles
- Local Network: Update IP addresses in
.envfiles - Cloud (AWS, DigitalOcean): Use production scripts with Nginx/Apache
- Windows Service: Use NSSM for background operation
- Docker: See
DEPLOYMENT.mdfor containerization options
π For comprehensive deployment guide, see docs/DEPLOYMENT.md
"Module not found" errors:
pip install -r requirements.txt"Authentication credentials were not provided":
python create_test_user.pyPort 3000 already in use:
# Kill process or use different port
npm start -- --port 3001CORS errors:
- Ensure Django server is running
- Check CORS settings in
settings.py
PyQt5 import error:
pip install PyQt5Connection error:
- Verify Django server is running on port 8000
- Check firewall settings
- Django REST Framework documentation
- React.js community
- Chart.js library
- PyQt5 tutorials
- Stack Overflow community