← back to Re Flyer Aggregator
DTT daily cron: launchd com.steve.dtt-import runs ingest-la-sales.mjs daily + new-closed-deal detection (out/new-la-deals-*.json) for 'first to tell' (TK-10708)
38d5d5a28e2d5ddc4f87ac4a035f173b602c2c31 · 2026-08-19 11:36:38 -0700 · Steve Abrams
Files touched
A scripts/dtt-cron.shM scripts/ingest-la-sales.mjs
Diff
commit 38d5d5a28e2d5ddc4f87ac4a035f173b602c2c31
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Aug 19 11:36:38 2026 -0700
DTT daily cron: launchd com.steve.dtt-import runs ingest-la-sales.mjs daily + new-closed-deal detection (out/new-la-deals-*.json) for 'first to tell' (TK-10708)
---
scripts/dtt-cron.sh | 10 ++++++++++
scripts/ingest-la-sales.mjs | 11 +++++++++++
2 files changed, 21 insertions(+)
diff --git a/scripts/dtt-cron.sh b/scripts/dtt-cron.sh
new file mode 100755
index 0000000..e556ae7
--- /dev/null
+++ b/scripts/dtt-cron.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# TK-10708 Daily Documentary-Transfer-Tax import wrapper (launchd com.steve.dtt-import).
+# Baked PATH so bare `node`/`psql` resolve under launchd's minimal env (bare-node lesson).
+export PATH="/opt/homebrew/bin:/opt/homebrew/opt/postgresql@14/bin:/usr/bin:/bin:/usr/sbin:/sbin"
+cd "$(dirname "$0")/.." || exit 1
+LOG="data/dtt-cron.log"
+mkdir -p data
+echo "=== $(date '+%Y-%m-%d %H:%M:%S') DTT import run ===" >> "$LOG"
+node scripts/ingest-la-sales.mjs >> "$LOG" 2>&1
+echo "--- exit $? ---" >> "$LOG"
diff --git a/scripts/ingest-la-sales.mjs b/scripts/ingest-la-sales.mjs
index 9424a07..378d5bd 100644
--- a/scripts/ingest-la-sales.mjs
+++ b/scripts/ingest-la-sales.mjs
@@ -58,6 +58,17 @@ console.log('sample:', rows.slice(0, 3).map(r => `${r.addr||'(no addr)'} $${r.pr
if (DRY) { console.log('DRY -- no writes.'); process.exit(0); }
+// "be first": detect NEW deals vs what we already have, BEFORE reloading.
+const prior = new Set(psql(`SELECT source_id||'|'||event_date||'|'||amount::bigint FROM parcel_event WHERE county_fips='06037' AND source='assessor_dtt_inferred'`).split('\n').filter(Boolean));
+const fresh = rows.filter(r => !prior.has(`${r.ain}|${r.date}|${r.price}`));
+if (fresh.length) {
+ const stamp = new Date().toISOString().slice(0, 10);
+ execFileSync('bash', ['-c', `cat > "${process.cwd()}/out/new-la-deals-${stamp}.json"`], { input: JSON.stringify(fresh, null, 2) });
+ console.log(`NEW closed LA deals this run: ${fresh.length} (written to out/new-la-deals-${stamp}.json) -> feed 'tell people first'`);
+} else {
+ console.log(`NEW closed LA deals this run: 0 (source frozen at 2024-06 until a fresher DTT feed is connected).`);
+}
+
// reversible reload: clear prior DTT-inferred LA events, then bulk insert in chunks
psql(`DELETE FROM parcel_event WHERE county_fips='06037' AND source='assessor_dtt_inferred'`);
let n = 0;
← 4cf0ddf LA upstream fix: ingest-la-sales.mjs loads 2662 LA C/I sales
·
back to Re Flyer Aggregator
·
be-first, FREE: SEC EDGAR CRE 8-K acquisition monitor (same- effdba0 →