# Strong Room CCTV Coverage & Compliance API

## PURPOSE
A FastAPI web service that registers strong-room centres (the secure premises in
Tekkali where ballot/EVM material is stored), tracks the CCTV cameras installed at
each centre, and reports whether every centre meets the SP-mandated 24-hour
surveillance requirement. It turns the video's instruction — "install CCTV cameras
at these centers to ensure constant, 24-hour surveillance" — into a machine-checkable
compliance rule that officials can query per centre.

## WHY THIS MATTERS
The transcript is a security directive: the Superintendent of Police (SP Maheshwar
Reddy) ordered continuous camera surveillance plus armed police protection at strong
room premises. The concept this project teaches is **policy-as-data**: encoding a
verbal security order as structured records (centre, camera, uptime window) so gaps
become visible instead of assumed. Students learn how an operations rule stated in a
press briefing becomes an API contract with validation and audit output.

## HOW TO BUILD
1. Model two entities: `Centre` (strong room) and `Camera` (with status, last-seen
   timestamp, coverage hours). Use Pydantic models plus in-memory stores.
2. Add POST endpoints to register centres and cameras; validate camera IDs and site
   codes.
3. Add a compliance endpoint computing 24-hour coverage per centre: a centre is
   COMPLIANT only if it has at least N active cameras whose coverage window spans
   all 24 hours.
4. Return a JSON audit summary suitable for an SP review meeting.

Key snippet:
```python
@app.get("/centres/{site_code}/compliance", response_model=ComplianceReport)
def compliance(site_code: str):
    cams = [c for c in CAMERAS if c.site_code == site_code and c.status == "active"]
    covered = sum(c.coverage_hours for c in cams)
    return ComplianceReport(site_code=site_code, cameras=len(cams),
                            covered_hours=min(covered, 24),
                            compliant=covered >= 24)
```

## WHEN TO USE IN PRODUCTION
Use it when multiple sites must be audited against one uptime mandate — election
strong rooms, evidence lockers, ammunition stores, cash vaults. It fits a control
room that needs a live compliance read per site. Do NOT use it as the video
recorder itself: it stores metadata, not footage, and it is not a substitute for the
NVR or physical armed deployment. Skip it for one-off manual checks where a
spreadsheet already suffices.

## HOW IT HELPS STUDENTS
Students practise FastAPI routing, Pydantic validation, REST design and translating
a real-world security policy into testable code — the exact skill of building
internal compliance tooling.

## STARTER CODE
See `starter/main.py` for a runnable FastAPI skeleton with in-memory stores, a
deterministic stub for any external camera-health lookup, and `# TODO` markers.
