# 090. Inspection geometry integrity

**Question:** Do image measurements contain impossible bounds or nonpositive areas?

## Result

The largest computed metric is 0 for Reversed X bounds; the smallest is 0 for Reversed X bounds. Metric: flagged_rows (Rows flagged).

These rules check internal consistency only; passing them does not certify source labels or image quality.

![Inspection geometry integrity](outputs/chart.png)

| rule | flagged_rows | checked_rows | flagged_share |
| --- | --- | --- | --- |
| Reversed X bounds | 0 | 1941 | 0 |
| Reversed Y bounds | 0 | 1941 | 0 |
| Nonpositive area | 0 | 1941 | 0 |
| Negative X perimeter | 0 | 1941 | 0 |
| Reversed luminosity bounds | 0 | 1941 | 0 |
| Steel type flags not one-hot | 0 | 1941 | 0 |

The chart shows 6 of 6 result rows; the table previews the first 6 in the analysis-defined order. [Download the full result table](outputs/results.csv). Numerical values are computed from the source; missing results stay unavailable.

## Method

Explicit geometry validation rules with counts and denominators.

The study uses shared source preparation and reusable statistical routines. Its specific transformations are in [analysis.py](analysis.py), and common model/evaluation code is in [portfolio/methods.py](../../portfolio/methods.py). The [notebook](analysis.ipynb) executes the study and displays the saved results.

## Decision and limitations

Review flagged records against original images before correcting measurements.

Every source row is a recorded fault. The data cannot estimate a production defect rate or distinguish healthy plates. Batch and machine IDs are absent, so grouped exact-input holdouts do not prove factory transfer. 

Related studies may share observations or holdouts. These are focused analytical studies, not independent replications or deployed business systems. Any model refinements informed by these results need new untouched evaluation data. No commercial impact is inferred from an association or backtest.

## Reproduce

From the repository root, after installing `requirements.txt`:

```powershell
python projects/090-inspection-geometry-integrity/analysis.py
```

Source data are downloaded automatically if absent. Original archives are retained unchanged and checked by SHA-256. The cleaned cache normalizes column names; field-specific changes are visible in [data preparation](../../portfolio/data.py). Runtime evidence is in [receipt.json](outputs/receipt.json).

## Source

[Steel Plates Faults](https://archive.ics.uci.edu/dataset/198/steel+plates+faults), Buscema, Terzi and Tastle (2010). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/steel.json) and [prepared-data audit](../../data/provenance/steel_prepared.json) record the downloaded files, field coverage and hashes.
