const { Pool } = require('pg'); const pool = new Pool({ connectionString: 'postgresql://postgres:password@localhost:5432/cim_processor' }); async function checkAnalysisContent() { try { console.log('šŸ” Checking Analysis Data Content'); console.log('================================'); // Find the STAX CIM document with analysis_data const docResult = await pool.query(` SELECT id, original_file_name, analysis_data FROM documents WHERE original_file_name = 'stax-cim-test.pdf' ORDER BY created_at DESC LIMIT 1 `); if (docResult.rows.length === 0) { console.log('āŒ No STAX CIM document found'); return; } const document = docResult.rows[0]; console.log(`šŸ“„ Document: ${document.original_file_name}`); if (!document.analysis_data) { console.log('āŒ No analysis_data found'); return; } console.log('āœ… Analysis data found!'); console.log('\nšŸ“‹ BPCP CIM Review Template Data:'); console.log('=================================='); const analysis = document.analysis_data; // Display Deal Overview console.log('\n(A) Deal Overview:'); console.log(` Company: ${analysis.dealOverview?.targetCompanyName || 'N/A'}`); console.log(` Industry: ${analysis.dealOverview?.industrySector || 'N/A'}`); console.log(` Geography: ${analysis.dealOverview?.geography || 'N/A'}`); console.log(` Transaction Type: ${analysis.dealOverview?.transactionType || 'N/A'}`); console.log(` CIM Pages: ${analysis.dealOverview?.cimPageCount || 'N/A'}`); // Display Business Description console.log('\n(B) Business Description:'); console.log(` Core Operations: ${analysis.businessDescription?.coreOperationsSummary?.substring(0, 100)}...`); console.log(` Key Products/Services: ${analysis.businessDescription?.keyProductsServices || 'N/A'}`); console.log(` Value Proposition: ${analysis.businessDescription?.uniqueValueProposition || 'N/A'}`); // Display Market Analysis console.log('\n(C) Market & Industry Analysis:'); console.log(` Market Size: ${analysis.marketIndustryAnalysis?.estimatedMarketSize || 'N/A'}`); console.log(` Growth Rate: ${analysis.marketIndustryAnalysis?.estimatedMarketGrowthRate || 'N/A'}`); console.log(` Key Trends: ${analysis.marketIndustryAnalysis?.keyIndustryTrends || 'N/A'}`); // Display Financial Summary console.log('\n(D) Financial Summary:'); if (analysis.financialSummary?.financials) { const financials = analysis.financialSummary.financials; console.log(` FY-1 Revenue: ${financials.fy1?.revenue || 'N/A'}`); console.log(` FY-1 EBITDA: ${financials.fy1?.ebitda || 'N/A'}`); console.log(` LTM Revenue: ${financials.ltm?.revenue || 'N/A'}`); console.log(` LTM EBITDA: ${financials.ltm?.ebitda || 'N/A'}`); } // Display Management Team console.log('\n(E) Management Team Overview:'); console.log(` Key Leaders: ${analysis.managementTeamOverview?.keyLeaders || 'N/A'}`); console.log(` Quality Assessment: ${analysis.managementTeamOverview?.managementQualityAssessment || 'N/A'}`); // Display Investment Thesis console.log('\n(F) Preliminary Investment Thesis:'); console.log(` Key Attractions: ${analysis.preliminaryInvestmentThesis?.keyAttractions || 'N/A'}`); console.log(` Potential Risks: ${analysis.preliminaryInvestmentThesis?.potentialRisks || 'N/A'}`); console.log(` Value Creation Levers: ${analysis.preliminaryInvestmentThesis?.valueCreationLevers || 'N/A'}`); // Display Key Questions & Next Steps console.log('\n(G) Key Questions & Next Steps:'); console.log(` Recommendation: ${analysis.keyQuestionsNextSteps?.preliminaryRecommendation || 'N/A'}`); console.log(` Critical Questions: ${analysis.keyQuestionsNextSteps?.criticalQuestions || 'N/A'}`); console.log(` Next Steps: ${analysis.keyQuestionsNextSteps?.proposedNextSteps || 'N/A'}`); console.log('\nšŸŽ‰ Full BPCP CIM Review Template data is available!'); console.log('šŸ“Š The frontend can now display this comprehensive analysis.'); } catch (error) { console.error('āŒ Error checking analysis content:', error.message); } finally { await pool.end(); } } checkAnalysisContent();