# Read SPC

A check can pass every time and still show a problem coming. **Statistical Process Control (SPC)** looks at many results
over time, so you can spot a drift before a part goes out of spec. This lesson shows you how to open **Check Details**,
read a chart and recognize a rule violation.

:::note
SPC only uses checks that are **Approved**. A check that is still Submitted, or has been rejected, isn't in the chart.
:::

## Open Check Details

1. Open **Quality → Analysis → Check Details**.
2. Select the check sheet whose results you want to see, such as a measurement check that runs every shift. Filter by asset
   or item if you need to, and choose a date range. At CoreForge, `Coating SPC Checks` is a good one to try.
3. Get the data. Each timestamp is one time the check sheet was performed.

![Check Details](https://docs.kanoa.ai/img/quality/checkDetails.png)

Turn on these options to see more:

- **Statistics** shows the min, max, average, standard deviation and calculated control limits.
- **Show Production Info** adds the item, asset and shift.
- **Show Item Spec** shows the spec limits, if they're set.

You can show check items as columns or rows. Columns are faster for large amounts of data and add the min, max, average and
standard deviation.

{/*
TODO: Confirm on a gateway the exact name of the get-data control.
*/}

## Read the Trend Chart

1. Select a check item in the table.
2. Click the trend icon to open the **Trend View**.
3. Switch between **Time Series**, **Histogram**, **Bar Chart** and **Tabular**.

![Trend View, time series](https://docs.kanoa.ai/img/quality/spcChart.png)

The time series shows your readings over time with the calculated upper and lower control limits. The histogram shows how
the values are spread, so you can see whether they're centered and whether there are outliers.

Choose a rule set from the rules dropdown: `Nelson`, `WECO` (Western Electric) or `Custom`. Rule violations are
highlighted on the chart.

![Trend View, histogram](https://docs.kanoa.ai/img/quality/trendChart.png)

## Recognize a Rule Violation

A rule violation means the points show a pattern that is unlikely to be chance. It can happen while every value is still
in spec. The rules fall into three kinds.

| Kind | What it means | Examples |
| --- | --- | --- |
| Limit | A point is beyond a control or spec limit. | Above UCL, Below LCL, Beyond 3σ |
| Pattern | A run of points shows the process has shifted, is drifting or is unstable. | 8 on one side, 6 trending, 2 of 3 beyond 2σ |
| Variation | The points hug the center line, with too little variation. | 15 within 1σ |

For example, six points that keep climbing are a **6 trending** violation. A run of points all on one side of the average
is a shift, even if none crosses a limit.

When you see a violation:

1. Note which rule fired and when.
2. Look at the item, asset and shift for those points. **Show Production Info** helps here.
3. Tell your supervisor or follow your plant's procedure.

## Open a Control Chart

For a numeric check item you can also open the **Control Chart** from the table, using the control chart icon.

1. Pick a chart type. For single readings, choose **Individual Readings (I-MR)**.
2. Optionally choose a rule set: Western Electric, Nelson or both. Violations show as red points on the **Control Chart** tab.
3. Optionally enter the spec limits. This adds a **Capability** tab.

![Control chart](https://docs.kanoa.ai/img/quality/univariate.png)

:::tip
Being in control and being capable are different. A stable chart with no violations can still produce scrap if the process
is wider than the tolerance. Ask your quality engineer how to read the **Capability** tab.
:::

{/*
TODO: Confirm on a gateway that the standard Control Chart screen opens with the same Rule Set options, and how a violated point is marked on the Trend View time series (the docs only say violations are highlighted).
*/}

::embed-section{src="../../kanoa-quality/checkDetails.md#applying-spc-rules" collapsed="true" summary="Reference Materials: Applying SPC Rules - Rule sets and chart types in the Trend View."}

## Check Your Understanding

1. Does a rule violation mean a part is out of spec?
2. Which checks does SPC use?
3. Which three kinds of rule violation can you see?

<details>
<summary>Answers</summary>

1. Not necessarily. It means the points show a pattern unlikely to be chance, even if every value is in spec.
2. Only checks that are **Approved**.
3. Limit, pattern and variation.

</details>
