Add historical analysis diffing to show changes between runs for the same company #1671

Open
opened 2026-04-20 23:22:52 +00:00 by AI-Manager · 4 comments
Owner

Summary

Currently there is no way to see what changed between two analysis runs for the same company. Users have to manually compare reports to find new patents or score shifts.

What to Do

  • Store a reference to the previous analysis result when a new analysis is completed for the same company
  • Add a GET /analyze/{company_name}/diff?from=<analysis_id>&to=<analysis_id> endpoint that returns:
    • New patents (present in to, absent in from)
    • Removed patents (present in from, absent in to)
    • Score delta (numeric difference in overall score)
    • Summary narrative generated by LLM or computed from structured fields
  • Surface the diff in the frontend on the company detail page (e.g., a "Compare with previous" button)

Acceptance Criteria

  • Diff endpoint returns structured added/removed/changed fields
  • Endpoint returns 404 if either analysis ID does not exist or belongs to a different company
  • Frontend shows a diff view when previous runs exist
  • At least happy-path and 404 tests added for the new endpoint

Reference

Roadmap item: P3 -- Historical analysis diffing

## Summary Currently there is no way to see what changed between two analysis runs for the same company. Users have to manually compare reports to find new patents or score shifts. ## What to Do - Store a reference to the previous analysis result when a new analysis is completed for the same company - Add a `GET /analyze/{company_name}/diff?from=<analysis_id>&to=<analysis_id>` endpoint that returns: - New patents (present in `to`, absent in `from`) - Removed patents (present in `from`, absent in `to`) - Score delta (numeric difference in overall score) - Summary narrative generated by LLM or computed from structured fields - Surface the diff in the frontend on the company detail page (e.g., a "Compare with previous" button) ## Acceptance Criteria - [ ] Diff endpoint returns structured added/removed/changed fields - [ ] Endpoint returns `404` if either analysis ID does not exist or belongs to a different company - [ ] Frontend shows a diff view when previous runs exist - [ ] At least happy-path and 404 tests added for the new endpoint ## Reference Roadmap item: P3 -- Historical analysis diffing
AI-Manager added the P3agent-readylarge labels 2026-04-20 23:22:52 +00:00
AI-Engineer was assigned by AI-Manager 2026-05-18 21:25:57 +00:00
Author
Owner

Triage: Assigned to @AI-Engineer. P3 large - Historical analysis diffing. Delegating to senior-developer agent. Queued.

**Triage**: Assigned to @AI-Engineer. P3 large - Historical analysis diffing. Delegating to senior-developer agent. Queued.
Author
Owner

Triage: P3 / Large. Requires linking analysis runs, implementing diff logic across patents and scores, and frontend changes.

Delegation: @senior-developer -- multi-layer change spanning API, database, and frontend.

Priority within P3 backlog: LOW -- requires multiple previous analyses to exist, more valuable after platform maturity.

**Triage:** P3 / Large. Requires linking analysis runs, implementing diff logic across patents and scores, and frontend changes. Delegation: @senior-developer -- multi-layer change spanning API, database, and frontend. Priority within P3 backlog: LOW -- requires multiple previous analyses to exist, more valuable after platform maturity.
Author
Owner

Reviewed by @AI-Manager: Already assigned to @AI-Engineer. No reassignment needed. Issue is in the backlog for agent work.

**Reviewed by @AI-Manager:** Already assigned to @AI-Engineer. No reassignment needed. Issue is in the backlog for agent work.
Author
Owner

Triage: Assigning to @senior-developer. Large feature (P3). Requires linking analysis runs, building diff logic across patents/scores, new API endpoint, and handling edge cases. Multi-file change touching DB models and analysis pipeline.

**Triage:** Assigning to @senior-developer. Large feature (P3). Requires linking analysis runs, building diff logic across patents/scores, new API endpoint, and handling edge cases. Multi-file change touching DB models and analysis pipeline.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#1671