Repository Public
1#!/bin/bash2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : KA Maps Engine8# File : server/pipeline/geo/06_addr_build.sh9# Module : server10# Repository : https://git.spboucher.ai/ka-maps-engine11# Created : 2026-12-0112# Last Modified : 2026-12-0113#14# Author : Simon-Pierre Boucher15# Position : Professor of Finance16# Institution : Université du Québec en Outaouais (UQO)17# Organization : SP Boucher18# Website : https://spboucher.ai19# Git : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License : None specified (no license file in this repository)32#33# Do not embed credentials, private keys, access tokens,34# certificates or confidential personal information.35#36# =============================================================================37# END OF SP BOUCHER SOURCE HEADER38# =============================================================================3940# KA Maps — adresses et rues : rattachement municipal, normalisation des noms (km-geo norm),41# déduplication entre sources avec provenance → geo.street, geo.address, geo.street_seg.42set -euo pipefail43HERE=$(cd "$(dirname "$0")" && pwd); . "$HERE/env.sh"44KMGEO=${KMGEO:-$HERE/../../km-geo/target/release/km-geo}45W="$SRC/work"; mkdir -p "$W"4647$PSQL -f "$HERE/06a_assign.sql"48$PSQL -Atc "SELECT street FROM addr_m UNION SELECT street FROM aq_m UNION SELECT name FROM mun49 UNION SELECT name FROM boundary" > "$W/names.txt"50"$KMGEO" norm < "$W/names.txt" > "$W/names.tsv"51$PSQL <<SQL52DROP TABLE IF EXISTS name_norm;53CREATE TABLE name_norm (name text PRIMARY KEY, norm text NOT NULL, core text NOT NULL);54\\copy name_norm FROM '$W/names.tsv' WITH (FORMAT csv, DELIMITER E'\\t', QUOTE E'\\b')55ANALYZE name_norm;56SQL57$PSQL -f "$HERE/06b_build.sql"58echo ADDR_DONE59