# 7 Metrics Pipeline

This workspace builds Quranic 7-metric outputs from normalized XLSX inputs.

## What To Upload

Place your 10 normalized input files in the workspace root with this naming pattern:

- `*_normalized.xlsx`

Example:

- `Bazzi_normalized.xlsx`
- `Doori_normalized.xlsx`
- `Hafs_normalized.xlsx`
- `Qaloon_normalized.xlsx`
- `Qumball_normalized.xlsx`
- `Shouba_normalized.xlsx`
- `Soosi_normalized.xlsx`
- `Submission_normalized.xlsx`
- `The_Criterion_normalized.xlsx`
- `Warsh_normalized.xlsx`

Each file must have the first three headers:

- `sura`
- `verse`
- `text`

## One Command Run

From workspace root:

```powershell
.\.venv\Scripts\python.exe build_7_metrics.py --mode batch
```

## Outputs

The script writes only inside `organized_outputs`:

- `organized_outputs/json/<Name>_7Metrics.json`
- `organized_outputs/xlsx/<Name>_7Metrics.xlsx`
- `organized_outputs/txt/<Name>_7Metrics.txt`
- `organized_outputs/txt/7Metrics_summary.txt`

## XLSX Rules (Current Contract)

Every generated XLSX is strict:

- Exactly one worksheet only
- Sheet name is `Sheet1`
- No summary worksheet inside XLSX
- Yellow highlight is applied for values divisible by 19 in `M1` through `M7`
- No boolean summary columns in XLSX

## Optional Single-File Mode

```powershell
.\.venv\Scripts\python.exe build_7_metrics.py --mode single --input-xlsx .\The_Criterion_normalized.xlsx
```

## Notes

- Batch mode discovers files using `*_normalized.xlsx` under the current folder.
- Output folders are auto-created under `organized_outputs`.
- Output paths are protected so the script will not write outside `organized_outputs`.

## Registry And Hashes

Generate a full hash registry for script, root inputs, and generated outputs:

```powershell
.\.venv\Scripts\python.exe build_hash_registry.py
```

Registry files are written to:

- `organized_outputs/registry/repro_hash_registry.json`
- `organized_outputs/registry/repro_hash_registry.sha256`
