Skip to content

Add AI peer review API client (types, service, hooks)#771

Draft
nicktytarenko wants to merge 1 commit intomainfrom
ai-peer-review-client
Draft

Add AI peer review API client (types, service, hooks)#771
nicktytarenko wants to merge 1 commit intomainfrom
ai-peer-review-client

Conversation

@nicktytarenko
Copy link
Copy Markdown
Contributor

@nicktytarenko nicktytarenko commented Apr 18, 2026

What?

  • Introduces a typed client for /api/ai_peer_review/: AiPeerReviewService for proposal review create/fetch, grant comparison, RFP summary, RFP refresh, and executive summary.
  • Adds types/aiPeerReview, transformers.
  • Adds hooks/useAiPeerReview for fetch, create, grant comparison, RFP summary, and proposal-review polling.
  • Editorial feedback is modeled minimally (read-only); no editorial upsert.(yet)

Endpoints

Method Path Purpose
POST /api/ai_peer_review/proposal-review/ Create or reuse a proposal AI review for a preregistration doc (optional grant_id), enqueue processing. Returns review row (pending / processing / completed / failed, etc.).
GET /api/ai_peer_review/proposal-review/<review_id>/ Fetch one proposal review by id (poll until completed or failed).
GET /api/ai_peer_review/proposal-review/grant/<grant_id>/ Grant-scoped comparison: all applications on that grant with per-proposal review summary, category scores when done, plus executive_summary from stored RFP summary when present.
GET /api/ai_peer_review/rfp/<grant_id>/ Read RFP brief/summary job state and content; 404-shaped body when no row exists yet.
POST /api/ai_peer_review/rfp/<grant_id>/executive-summary/ Generate/update the executive comparison text synchronously.

(Editorial feedback upsert was explicitly out of scope for this client.)

Main flow (short)

  1. Create peer review. POST …/proposal-review/ with unified_document_id (and optional grant_id). You get a review_id and usually 202 while work runs

  2. Get PRGET …/proposal-review/<review_id>/ on a timer until status is completed or failed, then use result_data.

  3. Run the RFP comparison. For the grant context: refresh the RFP brief with POST …/rfp/<grant_id>/

  4. Get the comparison. GET …/proposal-review/grant/<grant_id>/ returns every application row with review_id, status, scores when complete, and executive_summary for side-by-side / hub UI.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Apr 18, 2026 9:06pm

@sonarqubecloud
Copy link
Copy Markdown

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