# 054. Monitoring outage duration

**Question:** How long are the longest consecutive missing runs in each monitoring channel?

## Result

The largest computed metric is 8,126 for nmhc_gt; the smallest is 76 for pt08_s1_co. Metric: longest_missing_hours (Consecutive hours).

This measures unavailable readings, not a verified device outage cause.

![Monitoring outage duration](outputs/chart.png)

| field | missing_hours | longest_missing_hours |
| --- | --- | --- |
| co_gt | 1683 | 173 |
| nmhc_gt | 8443 | 8126 |
| nox_gt | 1639 | 173 |
| no2_gt | 1642 | 173 |
| pt08_s1_co | 366 | 76 |
| pt08_s2_nmhc | 366 | 76 |
| pt08_s3_nox | 366 | 76 |
| pt08_s4_no2 | 366 | 76 |
| pt08_s5_o3 | 366 | 76 |

The chart shows 9 of 9 result rows; the table previews the first 9 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

Complete hourly timeline and consecutive missing-run lengths.

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

Distinguish short intermittent gaps from extended periods unsuitable for calibration.

The -200 sentinel is treated as missing. Reference instruments have incomplete coverage; comparisons use paired observations. Sensor calibration is retrospective, not a health or regulatory compliance assessment. 

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/054-monitoring-outage-duration/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

[Air Quality](https://archive.ics.uci.edu/dataset/360/air+quality), De Vito (2008). [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Source data are transformed and aggregated in this study. [Source provenance](../../data/provenance/air.json) and [prepared-data audit](../../data/provenance/air_prepared.json) record the downloaded files, field coverage and hashes.
