Creating an operations dashboard for statistical process control (SPC) with the requirements you've outlined can be achieved using a combination of open-source tools. Below is a recommended solution using Python with libraries like Pandas, Matplotlib, and Dash (by Plotly). This setup is free, flexible, and can handle the folder structure and XML parsing you described.
Recommended Tool: Python with Dash
Dash is a Python framework for building analytical web applications. It’s ideal for creating interactive dashboards and integrates well with Pandas for data manipulation and Matplotlib/Plotly for visualizations.
Steps to Build the Dashboard
1. Install Required Libraries
pip install pandas lxml dash plotly
2. Parse XML Files and Extract Data
Write a Python script to traverse the folder structure, parse XML files, and extract the required data (metric, upper/lower spec limits, actual value).
import os
import xml.etree.ElementTree as ET
import pandas as pd
def parse_xml_files(root_folder):
data = []
for device_folder in os.listdir(root_folder):
device_path = os.path.join(root_folder, device_folder)
if os.path.isdir(device_path):
for testrun_folder in os.listdir(device_path):
testrun_path = os.path.join(device_path, testrun_folder)
if os.path.isdir(testrun_path):
for xml_file in os.listdir(testrun_path):
if xml_file.endswith(".xml"):
xml_path = os.path.join(testrun_path, xml_file)
tree = ET.parse(xml_path)
root = tree.getroot()
for test in root.findall(".//test"):
metric = test.get("name")
lower_spec = float(test.get("lower_spec"))
upper_spec = float(test.get("upper_spec"))
actual_value = float(test.get("actual_value"))
data.append({
"Device": device_folder,
"TestRun": testrun_folder,
"Metric": metric,
"LowerSpec": lower_spec,
"UpperSpec": upper_spec,
"ActualValue": actual_value
})
return pd.DataFrame(data)
# Example usage
df = parse_xml_files("path/to/your/folder")
print(df.head())
3. Build the Dash Dashboard
Create a Dash app to visualize the data with SPC charts (e.g., control charts).
import dash
from dash import dcc, html
from dash.dependencies import Input, Output
import plotly.express as px
# Assume df is the DataFrame created in step 2
app = dash.Dash(__name__)
app.layout = html.Div([
html.H1("Operations Dashboard for SPC"),
dcc.Dropdown(
id='device-dropdown',
options=[{'label': device, 'value': device} for device in df['Device'].unique()],
value=df['Device'].unique()[0],
placeholder="Select Device"
),
dcc.Graph(id='control-chart')
])
@app.callback(
Output('control-chart', 'figure'),
[Input('device-dropdown', 'value')]
)
def update_control_chart(selected_device):
filtered_df = df[df['Device'] == selected_device]
fig = px.scatter(filtered_df, x='TestRun', y='ActualValue',
title=f"Control Chart for {selected_device}",
labels={'TestRun': 'Test Run', 'ActualValue': 'Actual Value'},
range_y=[filtered_df['LowerSpec'].min(), filtered_df['UpperSpec'].max()])
fig.add_hline(y=filtered_df['LowerSpec'].min(), line_dash="dash", line_color="red", annotation_text="Lower Spec")
fig.add_hline(y=filtered_df['UpperSpec'].max(), line_dash="dash", line_color="red", annotation_text="Upper Spec")
return fig
if __name__ == '__main__':
app.run_server(debug=True)
4. Run the Dashboard
Run the Python script, and the dashboard will be accessible in your web browser (usually at http://127.0.0.1:8050/).
Features of This Solution
- Folder Traversal: Automatically collects XML files from the specified folder structure.
- XML Parsing: Extracts metrics, spec limits, and actual values.
- Interactive Dashboard: Allows users to select devices and view control charts.
- SPC Visualization: Displays actual values against upper and lower spec limits.
- Free and Open-Source: No licensing costs.
Alternative Tools
If you prefer a no-code/low-code solution, consider:
- Metabase: Free, open-source business intelligence tool (requires SQL database).
- Superset: Apache Superset is a powerful data exploration and visualization tool.
- Power BI (free version): Limited but can handle XML and folder structures with some scripting.
However, Python with Dash provides the most flexibility for custom SPC dashboards.