← back to Bubbesblock
scripts/seed-home-history.js
46 lines
/**
* seed-home-history.js
* One-shot script: warm the home-history cache for all BubbesBlock seed addresses.
* Run: node scripts/seed-home-history.js
*/
'use strict';
const { getHomeHistory } = require('../lib/home-history');
const ADDRESSES = [
// Steve's home
'18406 Bessemer Street, Tarzana CA 91406',
// Opportunity leads from data/opportunities.json
'18722 Yolanda Ave, Tarzana CA 91356',
'18450 Bessemer St, Tarzana CA 91406',
'5210 Lindley Ave, Tarzana CA 91356',
'19010 Etiwanda Ave, Tarzana CA 91356',
'18633 Wells Dr, Tarzana CA 91356',
'18700 Ventura Blvd, Tarzana CA 91356',
'18211 Hart St, Tarzana CA 91335',
'18840 Crebs Ave, Tarzana CA 91356',
'18509 Clark St, Tarzana CA 91356',
'18320 Vanalden Ave, Tarzana CA 91356',
'18118 Oso Ave, Tarzana CA 91335',
'18555 Reseda Blvd, Tarzana CA 91335',
];
(async () => {
console.log(`Seeding ${ADDRESSES.length} addresses into home-history cache...`);
for (const addr of ADDRESSES) {
try {
const result = await getHomeHistory(addr);
const status = result.source === 'unavailable' ? 'UNAVAILABLE' : 'OK';
console.log(`[${status}] ${addr}`);
if (result.builtYear) {
console.log(` built=${result.builtYear} beds=${result.beds} baths=${result.baths} sqft=${result.sqft} apn=${result.apn}`);
}
} catch (e) {
console.error(`[ERROR] ${addr}: ${e.message}`);
}
// Throttle between addresses
await new Promise(r => setTimeout(r, 600));
}
console.log('Done. Cache written to data/home-history.json');
})();