RAIA™ Specification

Documentation

This guide explains where we collect and enter data in our application, and what types of data we should use on the frontend. By keeping our frontend inputs strictly matched with our database, we prev

← Back to Developer Hub TEXTBOOK SPECIFICATION
RAIA™ (Real estate Artificial Intelligence Agent) Specification

This guide explains where we collect and enter data in our application, and what types of data we should use on the frontend. By keeping our frontend inputs strictly matched with our database, we prev

🧩 Section A: In Plain English

Frontend Data Ingestion Typings Guide

This guide maps where we collect data in our application to the exact types expected by our database. Keeping frontend inputs strictly aligned with back-end schemas prevents messy data and maintains system integrity.

📘 SECTION 3.25 TECHNICAL SPECIFICATION & ARCHITECTURE BLUEPRINT
🧩 What this page is about

This guide explains where we collect and enter data in our application, and what types of data we should use on the frontend. By keeping our frontend inputs strictly matched with our database, we prevent messy data entries and keep our system perfectly clean.

2. How it works — operational workflow

In professional property management, data enters our system through two main doors: automatic background pipelines (like Companies House scrapes or bank syncs) and manual human inputs on the frontend UX (like staff members entering new landlords, tenancies, or contractor invoices). To guarantee data integrity, manual data entry must occur at specific designated surfaces, utilizing strict input typings (e.g., dropdowns instead of free text) to prevent spelling mismatches and garbage inputs.

Step-by-Step Data Entry & Flow

  • 1
    Operator Triggers Form

    An operator opens a designated modal (e.g., "Add New Landlord") to manually input record details.

  • 2
    Strict UI Type Enforcement

    The form fields enforce strict data constraints. Phone fields accept only numbers; email inputs must contain '@'; and names are split into separate first/last inputs to prevent formatting slop.

  • 3
    Programmatic Dropdown Enums

    Instead of manual text entry, the UI utilizes strict selection boxes linked directly to our database reference lists (like tbl_document_types or tbl_channels).

  • 4
    Human-In-The-Loop Validation

    For sensitive or high-risk edits (like changing banking details), the system triggers a mandatory out-of-band verification loop (like SMS OTP) and logs the event to the audit trail.

  • 5
    Real-Time Database Upsert

    The validated payload is sent to our Supabase backend API, updating the active tenant dashboards instantly and notifying connected agents.

A Day in the Life of Data Entry

The table below walks through real-life hourly moments of how an operator enters data on the frontend, which database table is updated, and what the user sees in real-time:

Time Operational Action Target Frontend UX Surface Data Types Applied Target Database Table
09:30 Onboard a New Landlord Landlords Dashboard $\rightarrow$ Add Landlord Form Split text (first/last), Email format, Country Code phone tbl_persons + tbl_persons_channels
10:15 Upload Sign-off Agreement Documents Section $\rightarrow$ File Dropzone Blob payload, Auto-extracted metadata JSONB tbl_documents + tbl_document_links
11:45 Draft Tenancy Contract Tenancies Dashboard $\rightarrow$ Draft Contract Form UUID reference, Numeric PCM rent, Date ISO strings tbl_tenancies + tbl_tenancies_persons
14:30 served Section 13 Notice Compliance Board $\rightarrow$ Serve Notice Modal Date (ISO 8601), Numeric Rent, Selection Enum list tbl_rent_reviews + tbl_audit_log
16:00 Audit Banking Change Admin Panel $\rightarrow$ Bank Details Modal AES-256-GCM Encrypted payload, SMS OTP Verification code tbl_api_credentials + tbl_audit_log

Operational Data Entry Flow

1. FRONTEND UX Input Fields Names, emails, numbers 2. CONSTRAINTS Strict Typings Types, selects, regex 3. VERIFICATION HITL / OTP Gate SMS OTP verification 4. PERSISTENCE Supabase DB Structured tables

3. Technical — how it works in code

In our Next.js/React portal codebase, all frontend data structures must mirror our Supabase PostgreSQL schemas bit-for-bit. We use TypeScript interfaces to model these payloads, and implement client-side schemas (such as zod) to enforce constraints before payloads leave the browser.

Repository Code

The live codebase implementation for this specification sits within the following repository folder:

092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.579.688.481C19.137 20.164 22 16.418 22 12c0-5.523-4.477-10-10-10z"/>

Repository Code

The primary directories and interfaces managing database synchronization and frontend form typings are:

Active Code Implementation (Zod & TS)

Below is an example of our standard frontend schema validator (Zod) enforcing strict typings before submission:

import { z } from "zod";

// Strict Zod schema enforcing database-compatible typings
export const landlordFormSchema = z.object({
  firstName: z.string().min(2, "First name is too short").max(50),
  lastName: z.string().min(2, "Last name is too short").max(50),
  email: z.string().email("Invalid email format"),
  phone: z.string().regex(/^\+?[1-9]\d{1,14}$/, "Phone number must be in E.164 format"),
  organizationId: z.string().uuid("Invalid organization reference UUID"),
  preferredChannel: z.enum(["whatsapp", "email", "sms", "phone"]),
});

export type LandlordFormInput = z.infer<typeof landlordFormSchema>;

Target Database Schema Alignment

The fields validated on the frontend maps directly to our strict PostgreSQL schema:

-- Structure for public.tbl_persons
CREATE TABLE public.tbl_persons (
    person_id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
    first_name text NOT NULL,
    last_name text NOT NULL,
    is_test_record boolean DEFAULT false,
    created_at timestamp with time zone DEFAULT now()
);

-- Structure for public.tbl_persons_channels
CREATE TABLE public.tbl_persons_channels (
    channel_id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
    person_id uuid REFERENCES public.tbl_persons(person_id) ON DELETE CASCADE,
    channel_type text CHECK (channel_type IN ('whatsapp', 'email', 'sms', 'phone')),
    channel_value text NOT NULL,
    is_preferred boolean DEFAULT false
);

Frontend Data Flow & API Integration

This sequence diagram shows the step-by-step path of data typed by an operator on the frontend UX, validated by the browser, and sent to Supabase:

Operator Forms Next.js API Route Supabase DB POST /api/landlords/create HTTP 400 (Bad Phone Format) Operator corrects input POST /api/landlords/create (Retry) INSERT into tbl_persons HTTP 200 { success: true, org_id: ... }

Cross-References & Connected Systems

This guide works hand-in-hand with our database typings and validation systems. See these related specifications for details:

🔧 Section C: Developer Guide

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
DATA PIPELINE — INGEST → TRANSFORM → STORE → ACCESS 1. INGESTION Raw Data Collection Schema Validation 📥 Ingest 2. TRANSFORMATION ETL Processing Enrichment & Cleanup 🔄 Transform 3. STORAGE & ACCESS PostgreSQL / Cache Query & API Layer 🗄️ Store & Serve Data pipeline: ingest → validate → transform → store → serve with audit trails at every stage Batch processing · Schema validation · Data quality checks · Retention policies Ingestion / Collection Transformation / ETL Storage / Query / Access Data flow →

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
Repo Reference RAIA

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.