# Strong Room CCTV Audit CLI

## PURPOSE
A Click + Pandas command-line tool that ingests a CSV inventory of strong-room
centres and their CCTV cameras, then audits each centre against the SP's 24-hour
surveillance order. Given the raw camera register, it flags centres with coverage
gaps, offline cameras, and cameras whose recorded uptime window does not span the
full day — producing a printable compliance table for officials.

## WHY THIS MATTERS
The transcript reports a specific concrete action: SP Maheshwar Reddy directed that
CCTV cameras be installed at these centres to ensure constant, 24-hour
surveillance. Real command work means reconciling that instruction against an
actual hardware register. This project teaches **data-audit workflow**: load a
register, normalise it, apply a policy rule, and surface exceptions. It is the
unglamorous but essential step between an order and verified enforcement.

## HOW TO BUILD
1. Define a CSV schema: `site_code,centre_name,camera_id,status,hours_covered,installed_on`.
2. Build a Click group with subcommands: `audit` (per-centre compliance),
   `gaps` (list non-compliant centres only), and `summary` (district totals).
3. In Pandas, group by `site_code`, sum active coverage hours, mark COMPLIANT when
   total >= 24, and count offline cameras.
4. Add a `--format table|csv` option so output pipes cleanly into reports.

Key snippet:
```python
import click, pandas as pd

POLICY_HOURS = 24

@click.command()
@click.argument("register", type=click.Path(exists=True))
def audit(register):
    df = pd.read_csv(register)
    active = df[df["status"] == "active"]
    grouped = active.groupby("site_code")["hours_covered"].sum().reset_index()
    grouped["compliant"] = grouped["hours_covered"] >= POLICY_HOURS
    click.echo(grouped.to_string(index=False))
```

## WHEN TO USE IN PRODUCTION
Use it for periodic audits across many sites where a human reconciles hardware
records against a security mandate — election strong rooms, vaults, evidence rooms.
It fits batch jobs that run nightly and email a report. Do NOT use it for live
real-time monitoring (that needs the API or dashboard), and do not trust it as the
source of truth for camera health: the CSV is only as fresh as its last export.

## HOW IT HELPS STUDENTS
Students learn Click command design, Pandas groupby/aggregation, CSV I/O and
exception reporting — core data-engineering skills that map directly onto real
internal tooling.

## STARTER CODE
See `starter/main.py` for a Click CLI with `audit`, `gaps` and `summary`
subcommands, a deterministic in-memory sample register, and `# TODO` markers.
