Skip to content

Replace fictional insurance claim with public FEMA appeal - #225

Open
svonava wants to merge 7 commits into
mainfrom
feat/real-nfip-appeal-example
Open

Replace fictional insurance claim with public FEMA appeal#225
svonava wants to merge 7 commits into
mainfrom
feat/real-nfip-appeal-example

Conversation

@svonava

@svonava svonava commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What changed

  • replaces the fictional insurance claim with FEMA Flood Insurance Appeal Decision B8 and the controlling Standard Flood Insurance Policy
  • runs Docling, GLiNER2, BGE reranking, and Qwen through SIE
  • records a verified July 26, 2026 run with publisher URLs, checksums, model outputs, timings, and deterministic evaluation
  • removes the generated claim form, estimate, photo, Grounding DINO stage, and invented claim facts

Verification

  • uv run ruff check .
  • uv run pytest -q
  • real NVIDIA L4 run through SIE on Modal
  • all ten factual evaluation checks passed

The example summarizes a completed public FEMA appeal. It does not decide a live claim.

Summary by CodeRabbit

  • New Features
    • Updated the insurance example to review published FEMA flood-insurance appeal decisions and policy evidence.
    • Added SHA-256 integrity checking and manifest artifact verification for verified runs.
  • Documentation
    • Reworked the example READMEs, evidence bundle contents, and self-hosted generation endpoint guidance for the new appeal workflow.
  • Bug Fixes
    • Tightened evaluation checks for the updated appeal-review output and enforced stronger PDF-only source validation.
  • Tests
    • Updated and expanded tests for the new appeal-review schema, scoring/finding expectations, and path-based artifact exclusions; removed the old claim-preparation test coverage.

@svonava

svonava commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@svonava

svonava commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@svonava

svonava commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Review update:\n\n- Added SHA-256 hashes for every saved model output and derived artifact.\n- Added tests that verify the bundled FEMA PDFs against the source manifest and recompute the saved evaluation from review.json.\n- Updated the gallery entry so it describes the real FEMA appeal instead of the removed fictional claim.\n- Reran 8 locked offline tests plus Ruff lint and format.\n\nThe factual model outputs remain unchanged.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0224ead1-3376-403d-8b72-74817ef3d9b3

📥 Commits

Reviewing files that changed from the base of the PR and between fa75992 and 9b5bd36.

📒 Files selected for processing (2)
  • examples/insurance-claims-agent/insurance_claims/evaluate.py
  • examples/insurance-claims-agent/tests/test_review.py

📝 Walkthrough

Walkthrough

The insurance claims example now reviews FEMA Flood Insurance Appeal Decision B8 and related policy documents. Claim-packet preparation, vision processing, and image fixtures were removed; appeal fact extraction, policy retrieval, structured review generation, scope evaluation, and artifact hashing were added.

Changes

FEMA appeal review

Layer / File(s) Summary
Appeal sources and configuration
examples/README.md, examples/insurance-claims-agent/config.yaml, examples/insurance-claims-agent/insurance_claims/config.py, examples/insurance-claims-agent/insurance_claims/fetch.py, examples/insurance-claims-agent/pyproject.toml, examples/insurance-claims-agent/tests/test_config.py
Configuration now uses public appeal and policy documents, removes vision and claim-packet settings, narrows dependencies, and validates source fixtures and PDF payloads.
Appeal review pipeline
examples/insurance-claims-agent/README.md, examples/insurance-claims-agent/insurance_claims/review.py, examples/insurance-claims-agent/tests/test_review.py
The staged pipeline extracts appeal facts, retrieves policy evidence, generates the revised structured review, and documents the updated execution flow.
Evaluation and artifact integrity
examples/insurance-claims-agent/insurance_claims/evaluate.py, examples/insurance-claims-agent/tests/test_review.py
Evaluation checks target appeal scope and evidence fields, while manifests record SHA-256 hashes for run artifacts and verified-run tests recompute evaluations and hashes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReviewCLI
  participant DefaultStage
  participant GenerationStage
  ReviewCLI->>DefaultStage: parse appeal and policy sources
  DefaultStage->>DefaultStage: extract claim facts and retrieve policy chunks
  ReviewCLI->>GenerationStage: start generation stage
  GenerationStage->>GenerationStage: generate structured appeal review
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Clear and specific summary of the main change: the example swaps a fictional insurance claim for a public FEMA appeal.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/real-nfip-appeal-example

Comment @coderabbitai help to get the list of available commands.

@svonava

svonava commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 49 minutes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
examples/insurance-claims-agent/tests/test_review.py (1)

69-91: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a failure-path test for evaluate_review.

Every test here only feeds evaluate_review fully-correct data and asserts all checks pass. There's no test that a check correctly reports passed=False on bad input (wrong amount, missing scope keyword, missing finding category), so a logic bug in any individual Check (wrong tolerance, inverted condition, wrong field name) wouldn't be caught.

As per path instructions, "Check that commands match the implementation and that tests cover failure paths."

✅ Example negative-case test
def test_evaluation_fails_when_proof_of_loss_amount_is_wrong() -> None:
    review = {
        "route": "scope_review_required",
        "appeal_summary": {
            "proof_of_loss_amount": 1,  # wrong
            "removal_estimate": 49500,
            "barge_estimate": 181832.94,
            "debris_cubic_yards_min": 12,
            "debris_cubic_yards_max": 15,
        },
        "decision": {
            "covered_scope": "Remove flood-borne stones from underneath the insured building to its perimeter.",
            "excluded_scope": "Barge transport, handling, disposal, and yard removal.",
            "evidence_needed": "Other contractor estimates.",
            "prior_claim_check": "Proof of repairs from previous claims.",
        },
        "findings": [
            {"category": "covered_removal"},
            {"category": "excluded_transport"},
            {"category": "price_support"},
            {"category": "prior_claim_overlap"},
        ],
    }
    checks = {check.name: check for check in evaluate_review(review)}
    assert checks["proof-of-loss-amount"].passed is False

Also applies to: 96-105

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/insurance-claims-agent/tests/test_review.py` around lines 69 - 91,
Add failure-path coverage for evaluate_review by introducing a negative-case
test with otherwise valid review data and one deliberately invalid field, such
as an incorrect proof_of_loss_amount. Collect checks by name and assert the
corresponding check’s passed value is False; add analogous coverage for missing
scope keywords or finding categories if needed to exercise each check’s failure
behavior.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/insurance-claims-agent/README.md`:
- Line 37: Update the sentence describing the verified-run directory to add a
comma after “2026,” preserving the existing date and surrounding wording.

---

Nitpick comments:
In `@examples/insurance-claims-agent/tests/test_review.py`:
- Around line 69-91: Add failure-path coverage for evaluate_review by
introducing a negative-case test with otherwise valid review data and one
deliberately invalid field, such as an incorrect proof_of_loss_amount. Collect
checks by name and assert the corresponding check’s passed value is False; add
analogous coverage for missing scope keywords or finding categories if needed to
exercise each check’s failure behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a290268-6b8c-4d52-a645-5ff63c8dc80b

📥 Commits

Reviewing files that changed from the base of the PR and between 2ac128c and 7f50fa3.

⛔ Files ignored due to path filters (22)
  • .coderabbit.yaml is excluded by none and included by none
  • examples/insurance-claims-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/insurance-claims-agent/fixtures/claim-note.txt is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/claim.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/sources/flooded-house-interior.jpg is excluded by !**/*.jpg, !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/sources/nfip-appeal-b8.pdf is excluded by !**/*.pdf, !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/sources/nfip-proof-of-loss.pdf is excluded by !**/*.pdf, !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/insurance-claims-agent/verified-run/README.md is excluded by !examples/**/verified-run/** and included by examples/**, examples/**/verified-run/README.md
  • examples/insurance-claims-agent/verified-run/claim-facts.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/markdown/appeal_decision.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/markdown/policy.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/policy-evidence.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/appeal_decision-parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/claim-facts.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/policy-parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/policy-rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/review-completion.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/source-manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
📒 Files selected for processing (12)
  • examples/README.md
  • examples/insurance-claims-agent/README.md
  • examples/insurance-claims-agent/config.yaml
  • examples/insurance-claims-agent/insurance_claims/config.py
  • examples/insurance-claims-agent/insurance_claims/evaluate.py
  • examples/insurance-claims-agent/insurance_claims/fetch.py
  • examples/insurance-claims-agent/insurance_claims/prepare.py
  • examples/insurance-claims-agent/insurance_claims/review.py
  • examples/insurance-claims-agent/pyproject.toml
  • examples/insurance-claims-agent/tests/test_config.py
  • examples/insurance-claims-agent/tests/test_prepare.py
  • examples/insurance-claims-agent/tests/test_review.py
💤 Files with no reviewable changes (3)
  • examples/insurance-claims-agent/tests/test_prepare.py
  • examples/insurance-claims-agent/insurance_claims/prepare.py
  • examples/insurance-claims-agent/insurance_claims/config.py

Comment thread examples/insurance-claims-agent/README.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
examples/insurance-claims-agent/tests/test_review.py (1)

107-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Exclusion set diverges from evaluate.py's own artifact-hashing logic.

This test excludes README.md and manifest.json from expected_paths, but evaluate_run() in evaluate.py only excludes manifest.json when building manifest["artifacts"]. It currently passes only because verified-run/README.md wasn't present when the recorded manifest's artifact list was generated. If evaluate_run is ever rerun against verified-run to refresh the pinned manifest, README.md would get hashed into artifacts and this test would start failing for a reason unrelated to a real regression.

Consider sharing one exclusion set (e.g., a _DOC_FILENAMES = {"README.md"} constant importable from evaluate.py) between the production artifact-hashing loop and this test, or having evaluate_run itself skip documentation files by name.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/insurance-claims-agent/tests/test_review.py` around lines 107 - 118,
The artifact exclusion rules in
test_verified_manifest_pins_every_recorded_artifact diverge from evaluate_run.
Define and reuse a shared documentation exclusion set, such as _DOC_FILENAMES
from evaluate.py, in both the production artifact-hashing loop and the test,
ensuring README.md and manifest.json are handled consistently when regenerating
the manifest.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@examples/insurance-claims-agent/tests/test_review.py`:
- Around line 107-118: The artifact exclusion rules in
test_verified_manifest_pins_every_recorded_artifact diverge from evaluate_run.
Define and reuse a shared documentation exclusion set, such as _DOC_FILENAMES
from evaluate.py, in both the production artifact-hashing loop and the test,
ensuring README.md and manifest.json are handled consistently when regenerating
the manifest.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cf9e6b61-ace8-485b-8a6b-13576b305ad9

📥 Commits

Reviewing files that changed from the base of the PR and between 2ac128c and 7f50fa3.

⛔ Files ignored due to path filters (22)
  • .coderabbit.yaml is excluded by none and included by none
  • examples/insurance-claims-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/insurance-claims-agent/fixtures/claim-note.txt is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/claim.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/sources/flooded-house-interior.jpg is excluded by !**/*.jpg, !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/sources/nfip-appeal-b8.pdf is excluded by !**/*.pdf, !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/fixtures/sources/nfip-proof-of-loss.pdf is excluded by !**/*.pdf, !examples/**/fixtures/** and included by examples/**
  • examples/insurance-claims-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/insurance-claims-agent/verified-run/README.md is excluded by !examples/**/verified-run/** and included by examples/**, examples/**/verified-run/README.md
  • examples/insurance-claims-agent/verified-run/claim-facts.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/markdown/appeal_decision.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/markdown/policy.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/policy-evidence.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/appeal_decision-parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/claim-facts.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/policy-parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/policy-rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/raw/review-completion.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/insurance-claims-agent/verified-run/source-manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
📒 Files selected for processing (12)
  • examples/README.md
  • examples/insurance-claims-agent/README.md
  • examples/insurance-claims-agent/config.yaml
  • examples/insurance-claims-agent/insurance_claims/config.py
  • examples/insurance-claims-agent/insurance_claims/evaluate.py
  • examples/insurance-claims-agent/insurance_claims/fetch.py
  • examples/insurance-claims-agent/insurance_claims/prepare.py
  • examples/insurance-claims-agent/insurance_claims/review.py
  • examples/insurance-claims-agent/pyproject.toml
  • examples/insurance-claims-agent/tests/test_config.py
  • examples/insurance-claims-agent/tests/test_prepare.py
  • examples/insurance-claims-agent/tests/test_review.py
💤 Files with no reviewable changes (3)
  • examples/insurance-claims-agent/tests/test_prepare.py
  • examples/insurance-claims-agent/insurance_claims/prepare.py
  • examples/insurance-claims-agent/insurance_claims/config.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
examples/insurance-claims-agent/insurance_claims/evaluate.py (1)

24-96: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reject unsupported finding categories.

The category check accepts the expected categories as a subset, so a model can add arbitrary unsupported findings and still pass evaluation. Require an exact category set, or explicitly validate/document an allowlist for additional categories; otherwise undocumented synthetic findings are certified as valid.

As per path instructions, undocumented synthetic results in runnable examples must be flagged.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/insurance-claims-agent/insurance_claims/evaluate.py` around lines 24
- 96, Update the “finding-categories” check in evaluate_review to require
categories to exactly match the documented expected set, rejecting any
unsupported or synthetic finding categories. Preserve the existing required
category names and diagnostic output while replacing the subset-only validation
with exact-set validation.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/insurance-claims-agent/insurance_claims/evaluate.py`:
- Line 14: Update the artifact filtering associated with
ARTIFACT_EXCLUDED_FILENAMES and rglob("*") to compare each file’s path relative
to the run root, excluding only top-level README.md and manifest.json. Preserve
nested files with those names, and add a nested-name fixture and corresponding
assertion so the test verifies this behavior rather than duplicating the
production filtering rule.

In `@examples/insurance-claims-agent/tests/test_review.py`:
- Around line 120-121: Update the assertions around evaluate_review in
test_review.py to verify that the failed check names are exactly
{"proof-of-loss-amount"}, while preserving the existing assertion that this
check is not passed.

---

Outside diff comments:
In `@examples/insurance-claims-agent/insurance_claims/evaluate.py`:
- Around line 24-96: Update the “finding-categories” check in evaluate_review to
require categories to exactly match the documented expected set, rejecting any
unsupported or synthetic finding categories. Preserve the existing required
category names and diagnostic output while replacing the subset-only validation
with exact-set validation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 21b8a795-5d5f-463b-bf6b-b579eb88eb75

📥 Commits

Reviewing files that changed from the base of the PR and between 7f50fa3 and fa75992.

📒 Files selected for processing (3)
  • examples/insurance-claims-agent/README.md
  • examples/insurance-claims-agent/insurance_claims/evaluate.py
  • examples/insurance-claims-agent/tests/test_review.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/insurance-claims-agent/README.md

Comment thread examples/insurance-claims-agent/insurance_claims/evaluate.py Outdated
Comment thread examples/insurance-claims-agent/tests/test_review.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant