Skip to content

smitpatil06/Hybrid_Web_Application

Repository files navigation

ChemLabWizard β€” Chemical Equipment Parameter Visualizer

FOSSEE Web-Hybrid Application | Internship Submission

A hybrid application featuring independent Web (React) and Desktop (PyQt5) frontends integrated with a Django REST API backend for visualization and analysis of chemical equipment operational data.


πŸ“‹ Table of Contents


🎯 Overview

ChemLabWizard is a data analysis platform for chemical equipment parameter visualization and reporting. Users upload CSV files containing equipment operational data (flowrate, pressure, temperature) and receive:

  • Real-time visualization via interactive charts (Bar & Pie)
  • Statistical analysis with automated calculations
  • Historical data management with per-user isolation (last 5 datasets)
  • PDF reports with embedded visualizations
  • Multi-platform access (Web and Desktop)
  • Secure token-based authentication

πŸ“Έ Screenshots

Platform Screenshot
Web Application Web Application
Web Login Web Login
Desktop Application Desktop Application
Desktop Login Desktop Login

✨ Features

  • βœ… CSV file upload with drag-and-drop (Web)
  • βœ… Bar and Pie chart visualizations
  • βœ… Statistical analysis (count, average flowrate, average pressure, type distribution)
  • βœ… User registration and token-based authentication
  • βœ… Per-user data isolation
  • βœ… Upload history (last 5 datasets per user with auto-delete)
  • βœ… PDF report generation with embedded charts
  • βœ… Cross-platform (Web React + Desktop PyQt5)
  • βœ… Sample data included (sample_equipment_data.csv)

πŸ› οΈ Technology Stack

🌐 Frontend Technologies

Technology Version Description Official Link
React 19.2.0 UI framework for web application React Docs β†’
Vite 7.2.4 Fast build tool and dev server Vite Docs β†’
Chart.js 4.5.1 Data visualization library Chart.js Docs β†’
TailwindCSS 4.1.18 Utility-first CSS framework Tailwind Docs β†’
Axios 1.13.2 Promise-based HTTP client Axios Docs β†’
PyQt5 5.15.11 Cross-platform GUI framework (Desktop) PyQt5 Docs β†’

πŸ”§ Backend Technologies

Technology Version Description Official Link
Django 6.0.1 High-level Python web framework Django Docs β†’
DRF 3.16.1 Powerful REST API toolkit DRF Docs β†’
Pandas 3.0.0 Data manipulation and analysis Pandas Docs β†’
NumPy 2.4.1 Numerical computing library NumPy Docs β†’
Matplotlib 3.10.8 Plotting and visualization Matplotlib Docs β†’
ReportLab 4.4.9 PDF generation toolkit ReportLab Docs β†’
CORS 4.9.0 Cross-Origin Resource Sharing CORS Docs β†’

πŸ—„οΈ Database & Tools

Technology Version Description Official Link
SQLite 3.0+ Embedded SQL database (default) SQLite Docs β†’
PostgreSQL 12+ Advanced relational database (optional) PostgreSQL Docs β†’
Python 3.10+ Core programming language Python Docs β†’
Requests 2.32.3 HTTP library for Python Requests Docs β†’
Pillow 12.1.0 Python Imaging Library Pillow Docs β†’

πŸš€ Installation

Prerequisites

  • Python 3.10 or higher
  • Node.js 18+ and npm/pnpm (for web frontend)
  • Git (for cloning repository)

πŸͺŸ Windows Installation

Step 1: Install Prerequisites

# Install Python 3.10+ from https://www.python.org/downloads/
# Install Node.js 18+ from https://nodejs.org/

# Verify installations
python --version
node --version
npm --version

Step 2: Clone Repository

git clone https://github.com/smitpatil06/FOSSEE-Hybrid_Web_Application.git
cd FOSSEE-Hybrid_Web_Application

Step 3: Backend Setup

cd chemical_project

# Create and activate virtual environment
python -m venv venv
.\venv\Scripts\Activate.ps1

# Install dependencies
pip install django==6.0.1 djangorestframework==3.16.1 django-cors-headers==4.9.0 pandas==3.0.0 matplotlib==3.10.8 reportlab==4.4.9 pillow==12.1.0 requests==2.32.3

# Setup database (SQLite by default)
$env:USE_SQLITE = 'True'

# Run migrations
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

# Start backend server
python manage.py runserver

Backend runs at: http://localhost:8000

Step 4: Web Frontend Setup

Open a new PowerShell terminal

cd frontend-web

# Install dependencies (using npm or pnpm)
npm install
# OR
pnpm install

# Start development server
npm run dev
# OR
pnpm run dev

Web app runs at: http://localhost:5173

Step 5: Desktop Frontend Setup

Open a new PowerShell terminal

cd frontend-desktop

# Activate backend virtual environment
..\chemical_project\venv\Scripts\Activate.ps1

# Install dependencies
pip install PyQt5==5.15.11 matplotlib==3.10.8 requests==2.32.3

# Run desktop application
python desktop_app.py

🐧 Ubuntu/Linux Installation

Step 1: Install Prerequisites

# Update package list
sudo apt update

# Install Python 3.10+
sudo apt install python3 python3-pip python3-venv

# Install Node.js 18+ (via NodeSource)
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs

# Install Git
sudo apt install git

# Verify installations
python3 --version
node --version
npm --version

Step 2: Clone Repository

git clone https://github.com/smitpatil06/FOSSEE-Hybrid_Web_Application.git
cd FOSSEE-Hybrid_Web_Application

Step 3: Backend Setup

cd chemical_project

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install django==6.0.1 djangorestframework==3.16.1 django-cors-headers==4.9.0 pandas==3.0.0 matplotlib==3.10.8 reportlab==4.4.9 pillow==12.1.0 requests==2.32.3

# Setup database (SQLite by default)
export USE_SQLITE=True

# Run migrations
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser

# Start backend server
python manage.py runserver

Backend runs at: http://localhost:8000

Step 4: Web Frontend Setup

Open a new terminal

cd frontend-web

# Install dependencies (using npm or pnpm)
npm install
# OR
pnpm install

# Start development server
npm run dev
# OR
pnpm run dev

Web app runs at: http://localhost:5173

Step 5: Desktop Frontend Setup

Open a new terminal

cd frontend-desktop

# Activate backend virtual environment
source ../chemical_project/venv/bin/activate

# Install dependencies
pip install PyQt5==5.15.11 matplotlib==3.10.8 requests==2.32.3

# Run desktop application
python desktop_app.py

Optional: PostgreSQL Setup

If you prefer PostgreSQL over SQLite:

Ubuntu/Linux:

# Install PostgreSQL
sudo apt-get install postgresql postgresql-contrib

# Install Python adapter
pip install psycopg2-binary

# Run setup script
cd chemical_project
chmod +x setup_postgres.sh
./setup_postgres.sh

# Configure and migrate
export USE_POSTGRESQL=True
python manage.py migrate

Windows:

# Download and install PostgreSQL from https://www.postgresql.org/download/windows/

# Install Python adapter
pip install psycopg2-binary

# Configure and migrate
$env:USE_POSTGRESQL = 'True'
python manage.py migrate

πŸ“ Project Structure

ChemLabWizard/
β”œβ”€β”€ chemical_project/          # Django REST Backend
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ models.py         # Database models (UploadBatch, EquipmentData)
β”‚   β”‚   β”œβ”€β”€ serializers.py    # DRF serializers
β”‚   β”‚   β”œβ”€β”€ views.py          # REST API views (upload, stats, PDF)
β”‚   β”‚   β”œβ”€β”€ auth_views.py     # Authentication endpoints
β”‚   β”‚   └── urls.py           # API routing
β”‚   β”œβ”€β”€ chemical_project/
β”‚   β”‚   β”œβ”€β”€ settings.py       # Django configuration
β”‚   β”‚   └── urls.py           # Main URL routing
β”‚   β”œβ”€β”€ manage.py
β”‚   └── db.sqlite3            # SQLite database
β”‚
β”œβ”€β”€ frontend-web/             # React Web Client
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx     # Authentication page
β”‚   β”‚   β”‚   └── Upload.jsx    # Data upload & visualization
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Charts.jsx    # Bar & Pie charts
β”‚   β”‚   β”‚   └── History.jsx   # Upload history
β”‚   β”‚   β”œβ”€β”€ api.js            # Axios HTTP client
β”‚   β”‚   └── App.jsx           # Main component
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ frontend-desktop/         # PyQt5 Desktop Client
β”‚   β”œβ”€β”€ desktop_app.py        # Entry point
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   └── api_client.py     # HTTP client
β”‚   └── ui/
β”‚       β”œβ”€β”€ views/
β”‚       β”‚   β”œβ”€β”€ login_window.py
β”‚       β”‚   └── upload_window.py
β”‚       └── components/
β”‚           └── history_widget.py
β”‚
└── sample_equipment_data.csv # Test dataset

πŸ”— API Endpoints

Authentication

  • POST /api/auth/register/ - Register new user
  • POST /api/auth/login/ - Login and receive token
  • POST /api/auth/logout/ - Logout
  • GET /api/auth/profile/ - Get user profile

Data Operations

  • POST /api/upload/ - Upload CSV file
  • GET /api/history/ - Get user's upload history
  • GET /api/summary/<batch_id>/ - Get statistics for a dataset
  • GET /api/report/<batch_id>/ - Download PDF report

πŸ’Ύ Database Configuration

SQLite (Default)

Zero configuration required. Database file created at chemical_project/db.sqlite3.

export USE_SQLITE=True
python manage.py migrate

PostgreSQL (Optional)

For production or multi-user scenarios:

# Install PostgreSQL
sudo apt-get install postgresql postgresql-contrib  # Linux

# Install Python adapter
pip install psycopg2-binary

# Run setup script
cd chemical_project
chmod +x setup_postgres.sh
./setup_postgres.sh

# Configure and migrate
export USE_POSTGRESQL=True
python manage.py migrate

πŸ”§ Troubleshooting

Module not found errors:

pip install django djangorestframework django-cors-headers pandas matplotlib reportlab pillow

Database errors:

export USE_SQLITE=True
python manage.py migrate

CORS errors:

  • Ensure backend runs at http://localhost:8000
  • Verify CORS settings in chemical_project/chemical_project/settings.py

Desktop app not starting:

pip install PyQt5 matplotlib requests

Port already in use:

# Backend (port 8000)
python manage.py runserver 8001

# Web frontend (port 5173)
npm run dev -- --port 5174

πŸ‘¨β€πŸ’» Author

Smit Patil


πŸ“„ License

Submitted as part of FOSSEE internship application.


πŸ™ Acknowledgments

Built for FOSSEE (Free/Libre and Open Source Software for Education)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors