Skip to content

Repository files navigation

Quality Control Batch Analysis

A Flask-based web application for monitoring and analyzing chemical purity metrics with interactive visualization and statistical quality control analysis.

Overview

This application monitors ethanol purity batches in real-time, calculating rolling averages and control limits using 3-Sigma statistical methods. It provides an interactive web dashboard to visualize production data against quality thresholds.

Features

  • Real-time Monitoring: Tracks daily batch purity percentages
  • Statistical Analysis: Calculates rolling averages and 3-Sigma lower control limits
  • Interactive Dashboard: Visual chart representation of quality metrics
  • Quality Status Alerts: Flags batches that fall below control limits as "SYSTEM FAILURE"
  • Database Integration: Connects to MySQL for persistent data storage

Project Structure

quality_control_analysis/
├── app.py              # Main Flask application
├── .env                # Environment variables (not in repo)
├── .gitignore          # Git ignore rules
└── README.md           # This file

Requirements

  • Python 3.8+
  • Flask
  • MySQL Connector
  • Python-dotenv

Installation

  1. Clone or navigate to the project directory

    cd quality_control_analysis
  2. Create a virtual environment (recommended)

    python -m venv .venv
  3. Activate the virtual environment

    • Windows:
      .venv\Scripts\activate
    • macOS/Linux:
      source .venv/bin/activate
  4. Install dependencies

    pip install -r requirements.txt

    Or manually install:

    pip install flask mysql-connector-python python-dotenv

Configuration

Create a .env file in the project root with the following variables:

DB_HOST=your_mysql_host
DB_USER=your_mysql_user
DB_PASSWORD=your_mysql_password
DB_NAME=your_database_name

Database Setup

Ensure your MySQL database contains a chemical_purity table with columns:

  • batch_id (INT)
  • purity_percentage (FLOAT)
  • production_date (DATE)

Running the Application

  1. Start the Flask development server

    python app.py
  2. Access the dashboard

    • Open your browser and navigate to: http://localhost:5000/

The dashboard will display:

  • Blue line: Actual batch purity percentages
  • Red dashed line: 3-Sigma lower control limit

How It Works

The application:

  1. Connects to MySQL and retrieves chemical purity data
  2. Calculates a 7-period rolling average
  3. Computes the standard deviation and 3-Sigma lower control limit
  4. Marks batches as "STABLE" or "SYSTEM FAILURE" based on control limits
  5. Visualizes the data using Chart.js

API Endpoints

  • GET / - Returns the interactive quality control dashboard

Technologies Used

  • Backend: Flask (Python web framework)
  • Database: MySQL
  • Frontend: HTML5, Chart.js
  • Styling: CSS3

License

This project is for internal quality control monitoring.

Author

Quality Control Analytics Team

Support

For issues or questions, please contact your system administrator.

About

Batch Control Analysis quality control monitoring of manufacturing process

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages