🌐 Cloud-Native Architecture: - Firebase Functions deployment (no Docker) - Supabase database (replacing local PostgreSQL) - Google Cloud Storage integration - Document AI + Agentic RAG processing pipeline - Claude-3.5-Sonnet LLM integration ✅ Full BPCP CIM Review Template (7 sections): - Deal Overview - Business Description - Market & Industry Analysis - Financial Summary (with historical financials table) - Management Team Overview - Preliminary Investment Thesis - Key Questions & Next Steps 🔧 Cloud Migration Improvements: - PostgreSQL → Supabase migration complete - Local storage → Google Cloud Storage - Docker deployment → Firebase Functions - Schema mapping fixes (camelCase/snake_case) - Enhanced error handling and logging - Vector database with fallback mechanisms 📄 Complete End-to-End Cloud Workflow: 1. Upload PDF → Document AI extraction 2. Agentic RAG processing → Structured CIM data 3. Store in Supabase → Vector embeddings 4. Auto-generate PDF → Full BPCP template 5. Download complete CIM review 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
62 lines
2.2 KiB
JavaScript
62 lines
2.2 KiB
JavaScript
const { getSupabaseServiceClient } = require('./dist/config/supabase.js');
|
|
|
|
async function checkRecentDocument() {
|
|
console.log('🔍 Checking most recent document processing...');
|
|
|
|
const supabase = getSupabaseServiceClient();
|
|
|
|
// Get the most recent completed document
|
|
const { data: documents, error } = await supabase
|
|
.from('documents')
|
|
.select('*')
|
|
.eq('status', 'completed')
|
|
.order('processing_completed_at', { ascending: false })
|
|
.limit(1);
|
|
|
|
if (error) {
|
|
console.log('❌ Error fetching documents:', error.message);
|
|
return;
|
|
}
|
|
|
|
if (!documents || documents.length === 0) {
|
|
console.log('📭 No completed documents found');
|
|
return;
|
|
}
|
|
|
|
const doc = documents[0];
|
|
console.log('📄 Most recent document:');
|
|
console.log('- ID:', doc.id);
|
|
console.log('- Original filename:', doc.original_file_name);
|
|
console.log('- Status:', doc.status);
|
|
console.log('- Processing completed:', doc.processing_completed_at);
|
|
console.log('- Summary length:', doc.generated_summary?.length || 0);
|
|
|
|
console.log('');
|
|
console.log('📊 Analysis Data Type:', typeof doc.analysis_data);
|
|
|
|
if (doc.analysis_data) {
|
|
if (typeof doc.analysis_data === 'object') {
|
|
console.log('📋 Analysis Data Keys:', Object.keys(doc.analysis_data));
|
|
|
|
// Check if it's the BPCP schema
|
|
if (doc.analysis_data.dealOverview) {
|
|
console.log('✅ Found BPCP CIM schema (dealOverview exists)');
|
|
console.log('- Target Company:', doc.analysis_data.dealOverview?.targetCompanyName);
|
|
console.log('- Industry:', doc.analysis_data.dealOverview?.industrySector);
|
|
} else if (doc.analysis_data.companyName !== undefined) {
|
|
console.log('⚠️ Found simple schema (companyName exists)');
|
|
console.log('- Company Name:', doc.analysis_data.companyName);
|
|
console.log('- Industry:', doc.analysis_data.industry);
|
|
} else {
|
|
console.log('❓ Unknown schema structure');
|
|
console.log('First few keys:', Object.keys(doc.analysis_data).slice(0, 5));
|
|
}
|
|
} else {
|
|
console.log('📄 Analysis data is string, length:', doc.analysis_data.length);
|
|
}
|
|
} else {
|
|
console.log('❌ No analysis_data found');
|
|
}
|
|
}
|
|
|
|
checkRecentDocument(); |