Skip to content

feat(ops): wire claim detail view with full timeline data prefetching#96

Merged
AAdewunmi merged 2 commits intomainfrom
chore/add-claim-detail-query-loading
Feb 18, 2026
Merged

feat(ops): wire claim detail view with full timeline data prefetching#96
AAdewunmi merged 2 commits intomainfrom
chore/add-claim-detail-query-loading

Conversation

@AAdewunmi
Copy link
Owner

Summary

Wire claim_detail_view to load all timeline-related data in one deterministic query plan so the claim detail page renders consistently and with fewer DB round trips.

Changes

  • Updated policylens/apps/ops/views.py claim_detail_view to:
    • use select_related("policy", "policy__holder", "sla_clock", "ml_score")
    • use prefetch_related(...) with ordered Prefetch(...) querysets for:
      • documents ordered by uploaded_at
      • notes ordered by created_at
      • decisions ordered by decided_at
      • audit_events ordered by created_at
  • Added page_title to detail-page render context.
  • Kept route and template behavior intact (no template or URL changes in this PR).

Why

  • Reduces N+1 query risk on claim detail rendering.
  • Makes section ordering deterministic for timeline/document/note/decision displays.
  • Centralizes data-loading strategy in the view, keeping this PR focused on performance + determinism.

Scope / Non-goals

  • No UI/layout changes.
  • No routing changes (/ops/claims/<id>/ already exists).
  • No model/schema/API contract changes.

Validation

  • Confirmed claim detail route remains /ops/claims/<id>/.
  • Verified ordered related collections render through the existing template using preloaded data.

@AAdewunmi AAdewunmi self-assigned this Feb 18, 2026
@AAdewunmi AAdewunmi added the week-5-ui-db-claim-detail Add claim detail query loading label Feb 18, 2026
@AAdewunmi AAdewunmi linked an issue Feb 18, 2026 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AAdewunmi AAdewunmi merged commit e22a4c0 into main Feb 18, 2026
2 checks passed
@AAdewunmi AAdewunmi deleted the chore/add-claim-detail-query-loading branch February 18, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

week-5-ui-db-claim-detail Add claim detail query loading

Projects

Development

Successfully merging this pull request may close these issues.

Add claim detail query loading

1 participant

Comments