Advanced Control Charting Tool

A comprehensive VBA-based quality control tool for trend analysis and control charting across multiple laboratory methods

Overview

This project involves the development of a sophisticated control charting tool using Visual Basic for Applications (VBA). The tool is designed to perform trend analysis across an entire laboratory process, encompassing over 70 different methods. It automatically generates and updates control charts, implements multiple Westgard rules for quality control, and provides immediate visual feedback through color-coded triggers and error messages.

An example of a Levy-Jennings plot generated by the tool shown with color coding of implemented Westgard rules.

Key Features

  1. Comprehensive Method Coverage: Capable of generating control charts for over 70 different laboratory methods, providing a unified quality control solution.

  2. Automated Control Charting: Automatically generates and updates control charts, significantly reducing manual effort and potential for human error.

  3. Advanced Statistical Process Control: Implements multiple Westgard rules for robust quality control, including:

    • 1-3s: One result exceeding 3 standard deviations
    • 2-2s: Two consecutive results exceeding 2 standard deviations
    • R-4s: Range of two consecutive results exceeding 4 standard deviations
    • 8x: Eight consecutive results on the same side of the mean

  4. Immediate Visual Feedback: Utilizes color-coded triggers for easy interpretation of control status, allowing quick identification of out-of-control scenarios.

  5. Levy-Jennings Plotting: Automatically plots data on Levy-Jennings charts, providing a clear visual representation of trends over time.

  6. Metadata Capture: Allows for the capture and association of multiple metadata points with each measurement, facilitating in-depth analysis of out-of-control scenarios.

  7. Data Integrity Compliance: Ensures compliance with data integrity standards through robust data handling and audit trail capabilities.

Technical Details

While specific code cannot be shared due to confidentiality, the tool leverages VBA’s powerful capabilities for data manipulation, statistical analysis, and user interface design. Key technical aspects include:

  • Data Management: Utilizes advanced data structures to efficiently manage large datasets across multiple methods.
  • Statistical Analysis: Implements complex statistical calculations for control limit determination and Westgard rule evaluation.
  • Dynamic Charting: Employs VBA’s charting capabilities to create and update Levy-Jennings plots in real-time.
  • User Interface: Features an intuitive interface for data input, chart visualization, and result interpretation.

Here’s a concise code snippet illustrating the approach to evaluating the 1:3s Westgard rule for control charting in VBA:

If Not bar.Cells(lastRowB + 1, colXb + 1).Value = "" Or lastRowB = 1 Then
    ' Check if new limits are in use, update lastRowB accordingly
    lastRowB = lastRowB + 1
End If

ucl = bar.Cells(lastRowB, colXb + 1).Value  ' Current UCL
lcl = bar.Cells(lastRowB, colXb + 7).Value  ' Current LCL

' Iterate through data cells to apply 1:3s rule
For Each dataCell In ent.Range(ent.Cells(row, 1), ent.Cells(lastRowD, 1))
    If dataCell.Value = "" Then
        Set avgCell = ent.Cells(dataCell.Row, posAvg.Column)
        batchValue = ent.Cells(dataCell.Row, posBatch.Column).Value

        ' Check if average value is outside limits
        If (avgCell.Value < lcl Or avgCell.Value > ucl) And avgCell.Value <> "N/A" Then
            avgCell.Font.Color = vbRed
            ent.Cells(dataCell.Row, posBatch.Column).Font.Color = vbRed
            ' Alert user of 1:3s rule failure for average
        ElseIf (avgCell.Value > lcl And avgCell.Value < ucl) And avgCell.Value <> "N/A" Then
            avgCell.Font.Color = vbBlack
            ent.Cells(dataCell.Row, posBatch.Column).Font.Color = vbBlack
        End If

        ' Check replicate values within the row
        For Each repCell In ent.Range(ent.Cells(dataCell.Row, 3), ent.Cells(dataCell.Row, posAvg.Column - 1))
            If repCell.Value <> "" And InStr(1, repCell.Value, "*") = 0 Then
                If repCell.Value < lcl Or repCell.Value > ucl Then
                    repCell.Font.Color = vbRed
                    If (avgCell.Value > lcl And avgCell.Value < ucl) Then
                        If avgCell.Value <> "N/A" And avgCell.Font.Color = vbBlack Then
                            ' Alert user of replicate outside limits but average within limits
                        End If
                    End If
                ElseIf repCell.Value > lcl And repCell.Value < ucl Then
                    repCell.Font.Color = vbBlack  ' Reset color if replicate is within limits
                End If
            End If
        Next repCell
    End If
Next dataCell

This code snippet demonstrates the general approach to evaluating the 1:3s Westgard rule, a critical component of the control charting process.

Impact and Future Directions

The development of this control charting tool has significantly enhanced the laboratory’s quality control processes:

  1. Efficiency: Drastically reduced the time required for control chart generation and interpretation.
  2. Accuracy: Minimized the risk of human error in data analysis and Westgard rule application.
  3. Responsiveness: Enabled quicker identification and response to out-of-control situations.
  4. Compliance: Ensured consistent application of quality control standards across all laboratory methods.

Future enhancements could include:

  1. Machine Learning Integration: Implementing predictive analytics to forecast potential quality control issues.
  2. Cloud Integration: Developing a cloud-based version for improved accessibility and real-time collaboration.
  3. Automated Instrument Integration: Direct connection to laboratory instruments for real-time data ingestion and analysis.

This project showcases my ability to develop complex, regulation-compliant software solutions that significantly improve laboratory quality control processes. It demonstrates my skills in statistical analysis, data visualization, and creating user-friendly interfaces for specialized scientific applications.