ETL Method
How RAIA™ (Real estate Artificial Intelligence Agent) OS extracts, transforms, and loads data from any legacy PropTech application into a unified, AI-ready data layer — using a three-method extraction trio that cross-references itself for completeness and accuracy.
How RAIA™ (Real estate Artificial Intelligence Agent) OS extracts, transforms, and loads data from any legacy PropTech application into a unified, AI-ready data layer.
ETL Method — Legacy Data Extraction, Transformation & Loading
RAIA™ (Real estate Artificial Intelligence Agent) OS uses a three-method extraction trio that cross-references itself for completeness and accuracy — extracting, transforming, and loading data from any legacy PropTech application into a unified AI-ready data layer.
ETL Method
1.Why — Principles of Legacy Integration
Every Source Is Hostile Territory
Legacy PropTech systems were not designed to share data with competitors. APIs are partial, rate-limited, and quietly incomplete. We treat every source as a black box and verify independently rather than trusting vendor documentation.
Three Methods, One Truth
No single extraction method is sufficient. API, MCP, and browser scraping each have blind spots. The three run in parallel and cross-reference each other. Consensus between methods is the source of truth; divergence is a data quality signal.
Dry-Run Before Write, Always
Every extractor runs in two phases: dry-run (generates a plan with record counts and field mapping) then write (executes from the plan). The plan is reviewed before any data is committed. This is non-negotiable discipline that prevents silent partial-loads.
Idempotent, Auditable, Reversible
Loads are idempotent — re-running the same ETL never creates duplicates. Every load event writes to the audit log with timestamp, source, method, and record count. Data can be rolled back to any prior state from the audit trail.
This methodology was first fully articulated when building the RentProfile R2R Scraper. The API (Method A) could only retrieve records by request_id — with no list endpoint. We red-teamed the limitation, confirmed MCP was absent (Method B), then built a Playwright browser scraper (Method C) that could paginate the full R2R list without needing prior IDs. Both A and C now run together: the scraper extracts the bulk dataset; the API performs targeted status lookups. This combination is now the template for all legacy PropTech integrations.
2.How — The Three-Phase ETL Pipeline
Extract — Pull data from source using all available methods
Run Method A (API), Method B (MCP), and Method C (Browser) concurrently for each target application. Each method operates independently — no method waits for another. Each produces its own raw output file: /tmp/{source}-api-raw.json, /tmp/{source}-mcp-raw.json, /tmp/{source}-browser-raw.json. The Extract phase is always read-only. No writes to any source system ever occur during extraction.
Transform — Normalise, cross-reference, and deduplicate
The three raw outputs are merged into a single canonical record set. Fields are normalised to the RAIA™ (Real estate Artificial Intelligence Agent) unified schema (see config reference). Duplicates between methods are collapsed — the most complete record wins. Discrepancies between methods (e.g. API shows "active" but browser shows "expired") are flagged to the data_quality_issues table for human review. PII fields are pseudonymised before any AI scoring occurs. The Transform output is a clean, validated JSON plan: /tmp/{source}-etl-plan.json.
Load — Upsert into db_esoteric with full audit trail
The validated plan is loaded into db_esoteric (Supabase) via upsert — never raw INSERT. Upsert key is always the RAIA™ (Real estate Artificial Intelligence Agent) person_id or tenancy_id, never the source system's internal ID. Each loaded record writes an audit entry: {source, method, record_id, loaded_at, etl_run_id}. The Load phase is executed from the dry-run plan only — never re-scraped inline. After load, record count is verified against the plan; any shortfall triggers an alert.
Full Pipeline Architecture
Repository Code
The live codebase implementation for this specification sits within the following repository folder:
Method Decision Tree
Cross-Reference Protocol
When two or more methods both return data for the same record, the following resolution rules apply:
| Scenario | Resolution | Action |
|---|---|---|
| A and C agree on all fields | Consensus — load with confidence | Load |
| A has field, C missing it | A wins for that field | Load A field |
| C has field, A missing it | C wins for that field | Load C field |
| A and C disagree on same field value | Conflict — flag for human review | DQ Flag |
| A returns record; C misses it entirely | Likely paginated gap in C — check C completeness | Investigate C |
| C returns record; A misses it entirely | API gap confirmed — document in proptech registry | Update Registry |
| Neither A nor C returns expected record | Data not available — manual migration required | Escalate |
3.What — Infrastructure & Configuration
Infrastructure Overview
db_esoteric (Supabase)
All loaded data lands here. Project ID: bwrnydpssbudswttqbry. Key tables: tbl_persons, tbl_tenancies, tbl_tenancies_persons, data_quality_issues, etl_audit_log, tbl_agency_data_consents.
Google Cloud Storage
Binary assets (PDFs, photos, files) extracted from legacy systems are stored in gcf_public/. Avatars land at gcf_public/avatar/{person_id}.jpg. Documents at gcf_public/docs/{tenancy_id}/{doc_type}.pdf.
Hermes Cron Scheduler
All extractors run as Hermes cron jobs. Default schedule: nightly at 02:00 UTC. Self-healing: if a run fails, the scheduler retries with exponential backoff and alerts on persistent failure.
Playwright (Browser Scraper)
Headless Chromium via playwright-extra with stealth plugin. All browser sessions are read-only. URL allowlist enforced per scraper. Session cookies stored encrypted in Hermes vault, never in plaintext config.
Extractor Configuration Reference
Each extractor is configured via a source-specific JSON file at 03_technology/09_pipelines/config/{source}.json:
{
"source": "rentprofile",
"agency_id": "uuid",
"methods": {
"A_api": {
"enabled": true,
"base_url": "https://api.rentprofile.co.uk/v1",
"auth_header": "X-API-Key",
"endpoints": ["/status/request"],
"rate_limit_per_minute": 60
},
"B_mcp": {
"enabled": false,
"reason": "No MCP server detected as of 2025-06"
},
"C_browser": {
"enabled": true,
"login_url": "https://rentprofile.co.uk/agent/login",
"target_url": "https://rentprofile.co.uk/agent/r2r-reporting",
"pagination": true,
"stealth": true,
"read_only": true
}
},
"schedule": "0 2 * * *",
"dry_run_first": true,
"load_target": "db_esoteric",
"upsert_key": "person_id"
}
File Inventory
| File | Purpose | Location |
|---|---|---|
{source}-extractor.js |
Main extractor — runs all three methods | 03_technology/09_pipelines/programs/ |
{source}-api.js |
Method A — API probe and poller | 03_technology/09_pipelines/programs/ |
{source}-browser.js |
Method C — Playwright authenticated scraper | 03_technology/09_pipelines/programs/ |
{source}.json |
Extractor configuration (per agency, per source) | 03_technology/09_pipelines/config/ |
{source}-etl-plan.json |
Dry-run output — reviewed before write phase | /tmp/ (ephemeral) |
etl-load.js |
Shared load module — upsert + audit log writer | 03_technology/09_pipelines/programs/ |
cross-ref.js |
Shared cross-reference and dedup engine | 03_technology/09_pipelines/programs/ |
Pitfalls
Running --write without a prior dry-run makes data discrepancies invisible until after the database has been modified. The dry-run plan is the safety net. It costs at most 3 minutes; skipping it can cost hours of rollback work.
Any PropTech UI update can silently break a Playwright scraper. Use text-based selectors (e.g. text="Right to Rent") not class-based ones. Add record-count assertions at the end of every run so silent breakage becomes a loud alert.
When A and C disagree, never automatically pick one. Always write the conflict to data_quality_issues and surface it. Some conflicts reveal genuine data quality problems at the source that the estate agent needs to know about.
Source IDs (RentProfile request_id, Alto applicant_id, etc.) are not globally unique across systems. Always resolve to RAIA™ (Real estate Artificial Intelligence Agent) person_id first. If a person can't be matched, create a provisional record and flag for human review — never load against an unresolved key.
By the time data reaches the Upsert step it should already be pseudonymised for AI scoring purposes. Raw PII (names, emails, DOBs) is stored in encrypted columns only. Never pass raw PII to LLM APIs — anonymise before scoring. This is a GDPR hard requirement.
Vibe Check
Pre-ETL Run Gates
- Agency consent form signed (check
db_esoteric.tbl_agency_data_consents) - All three method probes documented in PropTech registry
- Extractor config validated against consent scope
- Dry-run plan reviewed and record count looks sane
- Browser scraper tested against target URL (not blocked)
- GCS credentials active and bucket writable
- Hermes cron scheduled with
notify_on_complete=true
Post-Load Verification
- Actual record count ≥ 95% of plan count
- Zero rows in
data_quality_issueswith severity = critical - Audit log has one entry per ETL run with correct timestamps
- No write operations detected in browser session logs
- RAIA™ (Real estate Artificial Intelligence Agent) dashboard shows populated historical data for agency
- Next nightly cron scheduled and showing in Hermes cron list
- Agency notified of any data gaps via onboarding wizard
Architecture Details
The data architecture is built on a layered pipeline model: raw ingestion → transformation → storage → access. Each layer enforces schema validation, data quality checks, and audit trails. The system uses PostgreSQL (Supabase) as the primary datastore with Redis for caching and S3-compatible storage for blobs.
- Core Component: Data pipeline engine with ETL orchestration
- Data Flow: Source → Ingestion → Validation → Transformation → Storage → Query
- Integration Points: Supabase PostgreSQL, Redis cache, S3 blob storage, event bus
Configuration Reference
Key configuration parameters for this system:
| Parameter | Type | Default | Description |
|---|---|---|---|
| batch_size | integer | 1000 | Number of records per batch operation |
| schema_version | string | v1 | Target schema version for data transformation |
| retention_days | integer | 90 | Data retention period in days |
Figure 2: Data pipeline architecture — component interaction and data flow.
Troubleshooting
| Issue | Cause | Resolution |
|---|---|---|
| Schema migration conflicts | Concurrent DDL operations on shared tables | Use migration scripts with 'IF NOT EXISTS' guards |
| Slow query performance | Missing index on join columns | Add composite indexes for common query patterns |
This component is part of the RAIA (Real estate Artificial Intelligence Agent) platform mono-repo. Implementation details, API contracts, and integration tests are available in the repository.