# Accountability Gateway for Genie-Style Analytics Answers

## PURPOSE
Barracuda's CIO Siroui Mushegian states plainly: "AI will never be accountable. I will be accountable. Humans will be accountable." This project builds a FastAPI service that turns that quote into an enforced technical control. When an employee asks an analytics question in plain language, the gateway retrieves a candidate answer (a deterministic stand-in for Databricks Genie) and refuses to release it until a named human reviewer signs off — recording who accepted responsibility. It solves the "people must provide the answer at the end of the day" problem with code, not policy slides.

## WHY THIS MATTERS
The transcript frames AI as delivering "speed and scale" while people supply "judgment calls" and "decisions." The gateway makes that division of labour explicit and auditable: every answer carries an `status` (pending_review / approved / rejected) and an `accountable_person`. It also encodes the shadow-AI concern — an unapproved question cannot silently become a production answer.

## HOW TO BUILD
Use FastAPI + Pydantic + Uvicorn. Three endpoints: `POST /ask` (returns a draft answer with status `pending_review`), `POST /review/{id}` (a human approves or rejects, stamping their name and timestamp), and `GET /answers` (list by status). The NL-to-SQL engine is a deterministic keyword router so the project runs with zero external services.

```python
@app.post("/ask", response_model=AnswerDraft)
def ask(payload: AskRequest) -> AnswerDraft:
    sql = route_question_to_sql(payload.question)   # deterministic Genie stand-in
    draft = AnswerDraft(question=payload.question, sql=sql,
                        answer=f"Rows returned by: {sql}",
                        status="pending_review", accountable_person=None)
    STORE[draft.id] = draft
    return draft
```

## WHEN TO USE IN PRODUCTION
Use it when executives consume AI-generated answers that touch finance, security posture, or customer commitments — anywhere an incorrect number carries consequences. It fits internal analytics copilots, BI chat surfaces, and regulated reporting. Do **not** use it for low-stakes exploratory queries, ad-hoc developer notebooks, or high-volume real-time dashboards where human review per answer destroys the latency benefits the transcript praises. It is a governance layer for consequential answers, not a general-purpose proxy.

## HOW IT HELPS STUDENTS
Students learn FastAPI request/response modelling, in-memory state, status state-machines, and how to convert a governance principle into an enforceable API contract. They practise designing endpoints where the *human* is a required actor, which is exactly the pattern enterprise AI governance roles hire for.

## STARTER CODE
`starter/main.py` contains the FastAPI app, Pydantic models, the deterministic SQL router, and review endpoints, with `# TODO` markers for persistence, auth, and audit logging.
