chore: sync with Gitea master and restore local-only files
Reset local main to gitea/master (new source of truth) and restored local-only files: web scrapers, admin dashboard, ChromaDB integration, debug scripts, and utility libraries that aren't tracked in Gitea. Gitea master adds: discovermass, buscarmisas-network, hk-parishes, bohosluzby, kerknet, gottesdienstzeiten, miserend importers, ClaimRequest model, forward geocoding, heartbeat healthcheck. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
78
scripts/debug/check-enrichment.ts
Normal file
78
scripts/debug/check-enrichment.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import { Pool } from 'pg';
|
||||
import * as dotenv from 'dotenv';
|
||||
import * as path from 'path';
|
||||
|
||||
// Load .env.local first (takes precedence), then .env
|
||||
dotenv.config({ path: path.resolve(process.cwd(), '.env.local') });
|
||||
dotenv.config({ path: path.resolve(process.cwd(), '.env') });
|
||||
|
||||
const pool = new Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
});
|
||||
|
||||
async function checkEnrichment() {
|
||||
try {
|
||||
console.log('Connecting to database...');
|
||||
|
||||
// Check total enriched churches
|
||||
const totalResult = await pool.query(`
|
||||
SELECT
|
||||
COUNT(*) as total_enriched,
|
||||
COUNT(CASE WHEN updated_at > NOW() - INTERVAL '24 hours' THEN 1 END) as enriched_last_24h,
|
||||
MAX(updated_at) as last_enrichment
|
||||
FROM churches
|
||||
WHERE google_place_id IS NOT NULL;
|
||||
`);
|
||||
|
||||
console.log('\n=== Google Enrichment Summary ===');
|
||||
console.log(`Total churches with Google Place ID: ${totalResult.rows[0].total_enriched}`);
|
||||
console.log(`Enriched in last 24 hours: ${totalResult.rows[0].enriched_last_24h}`);
|
||||
console.log(`Last enrichment: ${totalResult.rows[0].last_enrichment}`);
|
||||
|
||||
// Check by country
|
||||
const countryResult = await pool.query(`
|
||||
SELECT
|
||||
country,
|
||||
COUNT(*) as enriched_count,
|
||||
COUNT(CASE WHEN updated_at > NOW() - INTERVAL '24 hours' THEN 1 END) as enriched_last_24h
|
||||
FROM churches
|
||||
WHERE google_place_id IS NOT NULL
|
||||
GROUP BY country
|
||||
ORDER BY enriched_last_24h DESC
|
||||
LIMIT 10;
|
||||
`);
|
||||
|
||||
console.log('\n=== Top Countries Enriched (Last 24h) ===');
|
||||
countryResult.rows.forEach((row) => {
|
||||
console.log(`${row.country}: ${row.enriched_last_24h} new / ${row.enriched_count} total`);
|
||||
});
|
||||
|
||||
// Check recent enrichments with details
|
||||
const recentResult = await pool.query(`
|
||||
SELECT
|
||||
name,
|
||||
city,
|
||||
country,
|
||||
google_place_id,
|
||||
updated_at
|
||||
FROM churches
|
||||
WHERE google_place_id IS NOT NULL
|
||||
AND updated_at > NOW() - INTERVAL '24 hours'
|
||||
ORDER BY updated_at DESC
|
||||
LIMIT 20;
|
||||
`);
|
||||
|
||||
console.log('\n=== Recent Enrichments (Last 24h, sample) ===');
|
||||
recentResult.rows.forEach((row) => {
|
||||
const timestamp = row.updated_at ? new Date(row.updated_at).toISOString() : 'unknown';
|
||||
console.log(`${row.name}, ${row.city}, ${row.country} - ${timestamp}`);
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error checking enrichment:', error);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
checkEnrichment();
|
||||
Reference in New Issue
Block a user