// ----------------------------------------------------------------------------- // House-Ka — Homes-for-sale aggregator (Canada outside Québec, Ontario first) // Author: Simon-Pierre Boucher — contact@spboucher.ai // pages/Stats.tsx : market & platform statistics — totals, per-source volumes, // data quality (completeness, quarantine), recent syncs. // ----------------------------------------------------------------------------- import { useEffect, useState } from "react"; import { Stats, fetchSources, fetchStats, registerSourceNames, sourceName, } from "../api"; const n = (v: number | null | undefined) => v == null ? "—" : Math.round(v).toLocaleString("en-CA"); export default function StatsPage() { const [stats, setStats] = useState(null); const [error, setError] = useState(null); useEffect(() => { document.title = "Canadian housing market statistics | House-Ka"; fetchSources().then((r) => registerSourceNames(r.sources)).catch(() => {}); fetchStats().then(setStats).catch((e) => setError(String(e))); }, []); if (error) return

Could not load the stats

{error}

; if (!stats) return
Loading…
; const q = stats.qualite; const syncs = (stats.recent_syncs ?? []).slice(0, 20); return (
Live data

Platform statistics

Homes for sale {n(stats.total)} published, deduplicated
Cities & towns {n(stats.cities)}
Average price ${n(stats.avg_price)} from ${n(stats.min_price)} to ${n(stats.max_price)}
Sources {n(stats.sources)} CREA DDF brokerage sites
{q && (

Data quality

Every listing gets a completeness score (photos, description, specs, coordinates). Listings without a plausible price or a known city are quarantined until the next enrichment pass completes them.

Active listings {n(q.actives)}
Published {n(q.publiees)}
In quarantine {n(q.quarantaine)}
Avg. completeness {q.completude_moyenne ?? "—"} score /100
{q.par_source.length > 0 && (
{q.par_source.map((s) => ( ))}
SourceListingsPublishedCompletenessFlags
{sourceName(s.source)} {n(s.n)} {n(s.publiees)} {s.completude ?? "—"} {n(s.anomalies)}
)}
)} {syncs.length > 0 && (

Recent syncs

{syncs.map((s, i) => ( ))}
SourceWhenFoundAddedUpdatedRemoved
{sourceName(s.source)} {new Date((s.ts > 1e12 ? s.ts : s.ts * 1000)).toLocaleString("en-CA")} {n(s.found)} {n(s.added)} {n(s.updated)} {n(s.removed)}

The connectors re-sync on their own, around the clock. A failed sync never wipes data — the last valid state is kept.

)}
); }