Files
cim_summary/backend/start-processing.js
Jon c67dab22b4 Add comprehensive CIM processing features and UI improvements
- Add new database migrations for analysis data and job tracking
- Implement enhanced document processing service with LLM integration
- Add processing progress and queue status components
- Create testing guides and utility scripts for CIM processing
- Update frontend components for better user experience
- Add environment configuration and backup files
- Implement job queue service and upload progress tracking
2025-07-27 20:25:46 -04:00

58 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { Pool } = require('pg');
const { jobQueueService } = require('./src/services/jobQueueService');
const pool = new Pool({
connectionString: 'postgresql://postgres:password@localhost:5432/cim_processor'
});
async function startProcessing() {
try {
console.log('🔍 Finding uploaded STAX CIM document...');
// Find the STAX CIM document
const result = await pool.query(`
SELECT id, original_file_name, status, user_id
FROM documents
WHERE original_file_name = 'stax-cim-test.pdf'
ORDER BY created_at DESC
LIMIT 1
`);
if (result.rows.length === 0) {
console.log('❌ No STAX CIM document found');
return;
}
const document = result.rows[0];
console.log(`📄 Found document: ${document.original_file_name} (${document.status})`);
if (document.status === 'uploaded') {
console.log('🚀 Starting document processing...');
// Start the processing job
const jobId = await jobQueueService.addJob('document_processing', {
documentId: document.id,
userId: document.user_id,
options: {
extractText: true,
generateSummary: true,
performAnalysis: true,
},
}, 0, 3);
console.log(`✅ Processing job started: ${jobId}`);
console.log('📊 The document will now be processed with LLM analysis');
console.log('🔍 Check the backend logs for processing progress');
} else {
console.log(` Document status is already: ${document.status}`);
}
} catch (error) {
console.error('❌ Error starting processing:', error.message);
} finally {
await pool.end();
}
}
startProcessing();