# Week 3 Day 4 — Policy Retrieval API + Refusal Thresholds

## What Day 4 does

Day 4 builds the retrieval layer for ClaimFlow AI.

It does not generate the final coverage answer yet.

Instead, it answers this question:

> “Do we have enough relevant policy evidence to safely generate an answer?”

The full flow is:

```txt
user question
+ optional claim context
→ query planner
→ multiple focused retrieval queries
→ vector search
→ retrieved policy chunks
→ merge duplicate chunks
→ evaluate retrieval strength
→ return structured retrieval result

1. Input: user asks a policy question

Example request:

{
  "question": "Is this theft claim ready for approval if FIR number is missing?",
  "claimContext": {
    "lossType": "theft",
    "missingEvidence": ["FIR number"]
  },
  "topKFinal": 5
}

The user question is natural language.

But policy documents are written as structured clauses:

EV-TH-001: Theft claim evidence requirements
COV-TH-001: Theft coverage
EX-LIC-001: Invalid license exclusion

So the system should not rely only on the raw user question.


2. Query planner: convert the question into focused search queries

The query planner reads:

question + claimContext

and checks for important signals.

For this input:

Is this theft claim ready for approval if FIR number is missing?

It detects:

theft
FIR
missing evidence
approval/readiness

So it creates this query plan:

[
  {
    "intent": "general",
    "query": "Is this theft claim ready for approval if FIR number is missing?",
    "topK": 4
  },
  {
    "intent": "evidence",
    "query": "theft claim FIR missing police report required evidence approval police station vehicle registration",
    "topK": 3
  },
  {
    "intent": "coverage",
    "query": "theft stolen vehicle coverage insured private vehicle reported to police auto policy",
    "topK": 3
  }
]