Public Access
1
0

feat: add deep research planning and postal batch runs

Add a dedicated Deep Research view with postal-area preview overlays, batch execution, and bundled map results.

Also add postal dataset import tooling and fix local API networking and research insert issues needed to support the new workflow.
This commit is contained in:
pguerrerox
2026-04-05 18:05:04 +00:00
parent a1ba5ee093
commit cc00a439bf
29 changed files with 1860 additions and 82 deletions
+32
View File
@@ -0,0 +1,32 @@
import { getDbPool } from '../../server/src/db/pool.js';
async function run() {
const pool = getDbPool();
const client = await pool.connect();
try {
await client.query('begin');
await client.query('truncate table public.postal_area_neighbors');
await client.query(`
insert into public.postal_area_neighbors (postal_area_id, neighbor_postal_area_id)
select source.id, neighbor.id
from public.postal_areas source
join public.postal_areas neighbor
on source.country_code = neighbor.country_code
and source.id <> neighbor.id
and ST_Touches(source.geom, neighbor.geom)
`);
await client.query('commit');
const summary = await client.query<{ count: string }>('select count(*)::text as count from public.postal_area_neighbors');
console.log(`Built ${summary.rows[0]?.count ?? '0'} postal adjacency links.`);
} catch (error) {
await client.query('rollback');
throw error;
} finally {
client.release();
await pool.end();
}
}
await run();