CPK Track - Incremental Data Import & Capability Computation
Import new manufacturing test data and compute process capability indices incrementally.
When to Use
- New production test data CSV files are available
- Running periodic CPK updates (daily/weekly/monthly)
- Adding data from new stations or channels to an existing project
- After
cpk-inithas been run to set up the project
Prerequisites
- Project must be initialized — Run
cpk-initfirst to create.auto_cpk/config.json - New CSV files in the configured
data_folder
How to Invoke
from auto_cpk.skills.cpk_track import run_track
result = run_track(
config_path=".auto_cpk/config.json",
)
That's it — the track skill automatically:
- Loads your project configuration
- Scans the data folder for new or updated CSV files
- Detects changes (new files, appended data, unchanged files)
- Computes capability indices per target/group/period
- Saves results to the SQLite database
Output
Returns a TrackResult with:
| Field | Description |
|-------|-------------|
| files_imported | Number of new/updated files processed |
| files_unchanged | Files with no changes since last run |
| files_suspicious | Files where size or mtime decreased (may indicate corruption) |
| results_count | Number of capability results computed |
| skipped_count | Results skipped (insufficient data or no spec limits) |
| diagnostics | Warning/info messages per target/group |
| skip_reasons | Detailed reasons for skipped targets |
Incremental Change Detection
The track skill detects 4 types of file changes:
| Category | Behavior | |----------|----------| | New | File not seen before — full import | | Appended | File grew (larger size, newer mtime) — import only new rows | | Unchanged | Same size and mtime — skip | | Suspicious | File shrunk or mtime decreased — log warning, still process |
Capability Index Computation
Overall Mode (Pp/Ppk)
Uses overall standard deviation across all data in the group:
Pp = (USL - LSL) / (6 * sigma_overall)
Ppk = min[(USL - mean) / (3 * sigma_overall), (mean - LSL) / (3 * sigma_overall)]
Within-Subgroup Mode (Cp/Cpk)
When grouped by Station ID + Channel ID:
sigma_within = pooled within-subgroup sigma (R-bar/d2 equivalent)
Cp = (USL - LSL) / (6 * sigma_within)
Cpk = min[(USL - mean) / (3 * sigma_within), (mean - LSL) / (3 * sigma_within)]
What Gets Computed
For each tracked target, per group and time period:
- Sample size (n)
- Mean and standard deviation
- Pp, Ppk (always computed from overall sigma)
- Cp, Cpk (computed when grouped, using pooled within-subgroup sigma)
- Wrose side (upper or lower — which spec limit is closer)
Data Format Requirements
CSV files must match the source profile accepted during cpk-init:
- Same header/data row contract saved in
.auto_cpk/config.json - Same metadata aliases and tracked item names after profile mapping
StartTimecolumn must be parseable as datetime
cpk-track does not infer new CSV formats or update parser logic. If a new
supplier/station exports a different shape, run cpk-init again to converge and
persist a new source profile before tracking.
Diagnostics
The track skill produces diagnostic messages for common issues:
| Diagnostic | Meaning |
|-----------|---------|
| NON_NUMERIC_VALUES | Some values could not be parsed as numbers — skipped |
| LOW_SAMPLE_COUNT | Fewer than min_sample_count data points in a group |
| ZERO_VARIANCE | All values are identical — cannot compute indices |
| missing spec limits | Target item has no USL or LSL in this CSV file |
| not in file | Target item column not found in this CSV file |
Edge Cases
- PASS/FAIL data in measurement columns: Automatically filtered out
- Sentinel spec values: Treated as no bound — single-sided specs are skipped
- Missing StartTime: File is marked as error, not processed
- Empty appended data: Skipped without error
- Mixed data types: Non-numeric values in measurement columns are silently removed
Period Bucketing
Data is bucketed into time periods for trend analysis:
| Period | Key Format | Example |
|--------|-----------|---------|
| daily | YYYY-MM-DD | 2026-04-27 |
| weekly | YYYY-WNN | 2026-W17 |
| monthly | YYYY-MM | 2026-04 |
| quarterly | YYYY-QN | 2026-Q2 |
Next Steps
After tracking, use cpk-analyze to evaluate rules, generate HTML reports, and trigger alerts.

Scan to join WeChat group