A pluggable diagnostics framework for running system-specific tests, plots, and reports.
Project description
Diagnostics Framework
A pluggable Python framework for running diagnostic tests, generating plots, and viewing reports for any system — all from a Streamlit dashboard.
Overview
The framework uses a plugin architecture: each "system" is a self-contained module that registers its own diagnostic tests, plots, and reports using simple decorators. Adding a new system is as easy as dropping a new Python file into the systems/ folder.
Built-in example systems:
| System | Description |
|---|---|
generic_example |
Basic tabular data checks (nulls, ranges, emptiness) |
sensor_monitoring |
IoT sensor diagnostics with battery health, temperature validation, and status tracking |
Quick Start
Install from PyPI
pip install diagnostics-framework
Install from source (for development)
git clone https://github.com/ppwadhwa/diagnostics-framework.git
cd diagnostics-framework
python -m venv .venv
source .venv/bin/activate
pip install -e .
Run the Dashboard
# If installed via pip:
diagnostics
# Or run directly from the repo:
streamlit run diagnostics_framework/app.py
Open http://localhost:8501, select a system, upload a data file, and click Run Diagnostics.
A sample dataset is included in the repo at sample_data.csv for testing the sensor_monitoring system.
Project Structure
diagnostics_framework/
├── models.py # Dataclasses: DiagnosticResult, DiagnosticStatus, etc.
├── registry.py # Singleton registry + decorator API
├── runner.py # Test execution engine with error isolation
├── app.py # Streamlit dashboard
└── systems/
├── __init__.py # Auto-discovers all system modules
├── generic_example.py # Example: generic tabular data checks
└── sensor_monitoring.py # Example: IoT sensor diagnostics
Adding a New System
Create a new file in diagnostics_framework/systems/ — it will be auto-discovered on import.
# diagnostics_framework/systems/my_system.py
from diagnostics_framework import (
register_system, register_test, register_plot, register_report,
DiagnosticResult, DiagnosticStatus,
)
SYSTEM_NAME = "my_system"
@register_system(SYSTEM_NAME, description="My custom system")
class MySystem:
pass
@register_test(SYSTEM_NAME, name="my_check", description="Validates something important")
def my_check(data):
# Your test logic here
return DiagnosticResult(
test_name="my_check",
status=DiagnosticStatus.PASS,
message="Everything looks good.",
)
@register_plot(SYSTEM_NAME, name="my_plot", description="Visualizes the data")
def my_plot(data):
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
# Your plotting logic here
return fig
@register_report(SYSTEM_NAME, name="my_report", description="Summary of findings")
def my_report(data):
return "# My Report\n\nEverything is fine."
That's it — the new system will appear in the dashboard dropdown automatically.
Decorator API
| Decorator | Purpose |
|---|---|
@register_system(name, description, version) |
Register a new system |
@register_test(system, name, description) |
Add a diagnostic test |
@register_plot(system, name, description) |
Add a plot generator |
@register_report(system, name, description) |
Add a report generator |
Diagnostic Result Statuses
| Status | Meaning |
|---|---|
PASS |
Test passed successfully |
FAIL |
Test found a problem |
WARNING |
Test found something worth noting |
ERROR |
Test itself crashed (caught automatically by the runner) |
Programmatic Usage
You can also use the framework without the dashboard:
import pandas as pd
from diagnostics_framework import run_diagnostics
data = pd.read_csv("sample_data.csv")
summary = run_diagnostics("sensor_monitoring", data)
for result in summary.results:
print(f"[{result.status.value}] {result.test_name}: {result.message}")
Dependencies
- Python >= 3.10
- streamlit
- pandas
- matplotlib
- seaborn
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diagnostics_framework-0.1.1.tar.gz.
File metadata
- Download URL: diagnostics_framework-0.1.1.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac5f2a59921ac5921991dde40f708bc3815ac0ae6a5ef176e1c392c34da1f6e4
|
|
| MD5 |
1c531278a4541ec462b1d4a2b9c59f0f
|
|
| BLAKE2b-256 |
7d83aa9d4239b81c095a7bdfc0097404f1c0e78ce0ceb05405066c5fa5810b25
|
File details
Details for the file diagnostics_framework-0.1.1-py3-none-any.whl.
File metadata
- Download URL: diagnostics_framework-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94c45daefed12d1d7062e91d2dd8bd90d54f331ae49780d575992a1c5d82ba1f
|
|
| MD5 |
23a7c5d836aa5e02d7db466bd9add899
|
|
| BLAKE2b-256 |
9dc0f37187294d9756ab29ab0a6f6719a39561276fb166c065219227068fbab3
|