feat: add analyze tab for review documents and deals#75
Conversation
ARDGBL-915 Designated views as App examples
Consider making a collateral checker view to highlight the functionality of uploading a deal or due diligence documents that then can highlight if that collateral seems related to other collateral already in the system. Potentially create a view as a deal analyzer where someone could upload a draft credit agreement and get feedback on how it compares to other credit agreements in the system. These views could probably take inspiration from the ingest UI |
|
Caution Review failedThe pull request is closed. WalkthroughThis change introduces a comprehensive document analysis feature for the credit system. New components enable document upload, viewing, and extraction result display with processing status tracking. The AnalyzePage integrates these components with document status polling and deal preview fetching. Navigation, routing, and existing pages (Dashboard, Portfolio, Management) are updated to support the analysis workflow. Type system enhancements add AnalyzeContext to the shared chat context. User ID handling is improved across multiple pages for consistency. Changes
Sequence DiagramsequenceDiagram
participant User
participant AnalyzePage
participant DocumentUploadSection
participant ingestionApi
participant DocumentViewer
participant ProcessingStatus
participant ExtractionResultsViewer
User->>AnalyzePage: Enter /credit/analyze
AnalyzePage->>AnalyzePage: Load processing queue from localStorage
rect rgb(200, 220, 255)
Note over User,AnalyzePage: Document Upload Phase
User->>DocumentUploadSection: Drag/Select file
DocumentUploadSection->>DocumentUploadSection: Validate file size
User->>DocumentUploadSection: Click Upload
DocumentUploadSection->>ingestionApi: uploadDocument(file, userId, userEmail)
ingestionApi-->>DocumentUploadSection: documentId, filename
DocumentUploadSection->>AnalyzePage: onUploadSuccess(documentId, filename)
AnalyzePage->>AnalyzePage: Add to processing queue, save to localStorage
end
rect rgb(220, 255, 220)
Note over AnalyzePage,ProcessingStatus: Status Polling Phase
AnalyzePage->>AnalyzePage: Poll document status (dynamic interval)
AnalyzePage->>ingestionApi: getDocumentStatus(documentId)
ingestionApi-->>AnalyzePage: status (uploading|processing|ocr|extracting|complete)
AnalyzePage->>ProcessingStatus: Pass status, filename, progress
ProcessingStatus-->>AnalyzePage: Render progress UI
DocumentViewer->>DocumentViewer: Display loading state while processing
end
rect rgb(255, 240, 200)
Note over AnalyzePage,ExtractionResultsViewer: Extraction Results Phase
AnalyzePage->>AnalyzePage: Document terminal state reached
AnalyzePage->>ingestionApi: getDealPreview(documentId)
ingestionApi-->>AnalyzePage: dealPreview (extraction data)
AnalyzePage->>DocumentViewer: Pass s3Url, filename
DocumentViewer-->>AnalyzePage: Render document preview
AnalyzePage->>ExtractionResultsViewer: Pass dealExtraction data
ExtractionResultsViewer-->>AnalyzePage: Render extraction results with validation
end
AnalyzePage->>AnalyzePage: Save analyzeContext to localStorage
User->>User: Review extraction results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Areas requiring extra attention:
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 📒 Files selected for processing (17)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Summary by CodeRabbit
New Features
✏️ Tip: You can customize this high-level summary in your review settings.