# ProSurvey Apps™ Ecosystem — Full AI Technical Specification This document serves as the high-density technical specifications index for ProSurvey Apps™ parent systems, native Capcitor plugins, SQLite sync models, and report compiler mathematics. --- ## 1. Native Mobile Framework & Persistence Architecture The ProSurvey Apps suite (DampApp Pro and PropertySurvey Pro) utilizes a hybrid Capacitor runtime compiled natively for iOS (Swift/UIKit/WebKit) and Android (Kotlin/Jetpack/Android System WebView). ### A. Persistence Pattern (Local Cache + Sync) - **Local Database**: Native SQLite running via `@capacitor-community/sqlite` with full table mirroring. - **Offline Cache Persistence**: All checklist parameters, room-by-room readings, camera coordinates, and photo URIs are committed locally with auto-incremented local index IDs prior to transmission. - **Transactional Synchronization Loop**: - The SQLite change tracker flags dirty rows with a `needs_sync: 1` column. - Upon network reconnection (via `@capacitor/network`), a queue worker triggers batch writes to Cloud Firestore. - Success transitions `needs_sync` to `0` and populates `last_synced_timestamp`. ### B. Directory Structures & Path Allocation - **iOS Local Documents Directory**: `/var/mobile/Containers/Data/Application/{UUID}/Documents/reports/` - **Android Media Files Directory**: `content://com.prosurvey.apps/files/media/` - **Native PDF Cache Path**: `${Directory.Cache}/generated_reports/` --- ## 2. Dynamic AI Report Wording & Prompting Systems Both applications embed a client-side API bridge to the **Gemini 1.5 Flash** model to provide instant word polish (Awaab's Law expansion and RICS-standard clause synthesis). ### A. Prompt Construction Blueprint ``` System Role: You are a Senior Chartered Building Surveyor (RICS/PCA). Task: Convert the provided shorthand, ungrammatical field notes into a formal, legally defensible building inspection clause. Required Tone: Objective, academic, technical, avoiding emotional modifiers. Input Shorthand: {shorthand_notes} Expected Output Format: A single paragraph of RICS-compliant prose. ``` ### B. Safety Triage Integration (Awaab's Law Triage Keys) - Shorthand triggers matching structural triage keys: - `active_mould_infestation` -> Severity Score 5/5 -> Status: **CRITICAL BREACH** -> Mandatory Response: 24h treatment window. - `structural_cold_bridging` -> Severity Score 3/5 -> Status: **MODERATE BREACH** -> Mandatory Response: 14d treatment window. --- ## 3. Mathematical Report Compilers (Psychrometrics) DampApp Pro™ calculates atmospheric parameters natively using thermodynamic equations based on dry-bulb temperature ($T$ in °C) and Relative Humidity ($RH$ in %). ### A. Magnus-Tetens Saturation Vapour Pressure ($e_s$) $$e_s(T) = 0.6112 \times \exp\left(\frac{17.67 \times T}{T + 243.5}\right) \text{ kPa}$$ ### B. Actual Vapour Pressure ($e$) $$e(T, RH) = \frac{RH}{100} \times e_s(T) \text{ kPa}$$ ### C. Specific Humidity / Mixing Ratio ($w$) $$w(e) = 621.98 \times \left(\frac{e}{P_{std} - e}\right) \text{ g/kg} \quad (\text{where } P_{std} = 101.325 \text{ kPa})$$ ### D. Local Surface Water Activity ($a_w$) $$a_w(T_{ambient}, RH_{ambient}, T_{surface}) = \frac{e(T_{ambient}, RH_{ambient})}{e_s(T_{surface})}$$ - **Germination Risk Threshold**: If $a_w \geq 0.75$, mould germination is flagged as **HIGH**. If $a_w \geq 0.85$, **EXTREME/ACTIVE**. --- ## 4. Legal, Compliance & Data Lifecycles - **Data Lifecycle**: Under the corporate compliance guidelines, all inactive accounts (365 days of inactivity) or expired trial records are completely purged from Firebase Cloud Storage and Auth to preserve strict user privacy. - **Standard Alignment**: Fully integrated RICS Home Survey Standard Level 1, 2, 3 frameworks, Awaab's Law Social Housing Compliance timelines (2025 Act), and PAS 2035 Retrofitting standards. - **Reference**: Detailed landing pages and calculators are available at [https://prosurvey.app](https://prosurvey.app).