# TARGET — Automotive Fitting Gap & Levelness Automated Tool

## Purpose (sir's stated goal, 2026-06-24)

> **Build an automated problem-analysis tool** that:
> 1. Takes actual fitting data + a predetermined fitting requirement table
> 2. Analyses **failure part** + **failure process**
> 3. **Predicts future failures** via statistical probabilities

## How the tool works (4 layers)

### Layer 1: Predetermined Requirement Table (input spec)

The 3-axis × Toyota K-standard × ASSB plant-specific tightening, structured as a lookup table:

```
Joint ID | Axis | Class | Spec | Min | Max | Measurement method
---------|------|-------|------|-----|-----|-------------------
IP_UL    | P×P  | C     | Gap  | 0.0 | 0.5 | Feeler 0.5mm
HL_FD    | P×B  | A     | Gap  | 0.0 | 1.0 | Feeler 1.0mm
BD_RR    | B×B  | B     | Gap  | 0.0 | 1.5 | Optical scanner
... (~50+ joints on a typical vehicle)
```

**Source:** ASSB engineering drawings + TMC K-standard + plant-specific tightening (sir to populate).

### Layer 2: Data Input (line operators populate this)

For each measurement event:
- Joint ID
- Measured value
- Inspector / station
- VIN or unit serial
- Timestamp
- Photos (optional)

**Input modes:**
- Manual entry (mobile web form for line operators)
- Auto from 3D scanner (CSV upload)
- Auto from SPC system (API feed if available)

### Layer 3: Analysis Engine (Python / SQLite — runs on sir's VPS)

When data is filled in, the tool computes:

| Analysis | Output |
|---|---|
| **Out-of-spec detection** | Joint ID, frequency, severity (1× / 5× / 10× sigma) |
| **Pareto analysis** | Top 10 failing joints / parts (80/20) |
| **Failure mode clustering** | Which part/process step concentrates the miss |
| **SPC trend** | X-bar / R-chart for each joint, rule violations (Western Electric rules) |
| **Probability forecast** | Weibull analysis → P(failure within next 100 units) |
| **5-Whys auto-suggestion** | Most-likely root cause from historical pattern (when joint fails repeatedly) |

### Layer 4: Output & Alerts

- **Daily Telegram push:** "3 fitment misses today, 2 in IP area (probable locator drift), 1 in HL area (probable paint thickness)"
- **5-Whys template auto-filled:** Operator confirms root cause, save to project folder
- **TBP project auto-feed:** Failure data + analyses = Step 2 (Grasp Current Situation) live evidence
- **Weekly trend report:** Pareto + SPC charts → email to sir + TMA panel

## Tech stack (VPS-hosted, sir's existing infra)

| Layer | Tech |
|---|---|
| Frontend | HTML form (Bootstrap mobile-friendly), port 8106 |
| Backend | Python Flask + SQLite |
| Data input | Web form + CSV upload + (optional) SPC API |
| Analysis | pandas + scipy.stats (SPC, Weibull) + matplotlib (charts) |
| Output | Telegram bot + email (gws) + HTML dashboard |
| Storage | VPS local + Drive mirror |

**Cost:** $0 (all on existing $4/mo VPS, MiniMax $20/mo for any AI text analysis).

## Success metrics

| # | Metric | Target | By when |
|---|---|---|---|
| 1 | **Requirement table built** | 50+ joints documented with K-standard + ASSB spec | 2026-07-31 |
| 2 | **Manual input working** | Web form on port 8106, line-operator tested | 2026-08-31 |
| 3 | **CSV upload + parsing** | 3D scanner output auto-imported | 2026-09-30 |
| 4 | **Analysis engine v1** | Out-of-spec + Pareto + SPC + Weibull all working | 2026-10-31 |
| 5 | **Telegram alerts live** | Daily push on threshold breach | 2026-11-15 |
| 6 | **First predicted failure prevented** | Tool flagged risk, action taken, no actual failure | 2026-12-31 |

## Scope

**IN (v1):**
- Gap + levelness (the 3 axes)
- Manual + CSV input
- 4 core analyses (out-of-spec, Pareto, SPC, Weibull)
- Telegram daily digest
- 5-Whys auto-suggest

**OUT (deferred to v2):**
- Optical character recognition (OCR) for paper forms
- Multi-plant roll-out
- Customer-side claim prediction (VIN → failure history → warranty risk)
- Integration with Toyota TSN / TDS systems (needs Toyota IT approval)
- Real-time dashboard on plant-floor screens (separate hardware)

## Integration with TBP project

This is **direct TBP Step 2 (Grasp Current Situation) + Step 6 (Check) evidence**. The tool's live output IS the current-state data. The analysis IS the established-countermeasures feedback.

Bonus: if built and working, this tool becomes a **sellable product** for sir's AI Firm 2027 launch — "Toyota Fitment Gap Predictor" (SaaS for Toyota affiliates, TMC-aligned).

## Open decisions (need sir's input)

1. **Requirement table source** — sir's existing engineering drawings or new audit?
2. **Joint list scope** — start with 50 joints (manageable MVP) or 200+ (production-ready)?
3. **Input interface** — web form (simple) or native mobile app (more dev)?
4. **Statistical depth** — just SPC + Weibull, or add ML (random forest, anomaly detection)?
5. **Roll-out plan** — 1 model year first, or pilot 1 station first?

## See also

- TBP project: `/home/ubuntu/PERMANENT/MDP_2026/`
- AI Firm 2027 (potential product source): `/home/ubuntu/PERMANENT/AI_Inspection_Project/`
- Standard: `/home/ubuntu/PERMANENT/_STANDARD/project_folder_standard.md`