Skip to content

Scratchpad

Revant Nandgaonkar edited this page Jun 30, 2026 · 1 revision
graph TD
    %% Styling
    classDef client fill:#e1f5fe,stroke:#0288d1,stroke-width:2px;
    classDef api fill:#efebe9,stroke:#5d4037,stroke-width:2px;
    classDef storage fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
    classDef worker fill:#fff3e0,stroke:#ef6c00,stroke-width:2px;
    
    %% Client Tier
    subgraph Client_Tier [Offline-First Field Client PWA]
        A[Field Operator Input] --> B[In-Memory RAM Cryptography<br/>AES-GCM 256 / PBKDF2 Isolation]
        B --> C[(Local IndexedDB Cache<br/>protected_persons)]
        B --> D[(Append-Only Log<br/>operation_log + Vector Clocks)]
    end
    class A,B,C,D client;

    %% Network Sync Barrier
    D -->|HTTPS POST RPC / Service Worker Sync| E[Bulk Ingestion RPC Endpoint<br/>bulk_receive_staging_payload]

    %% Ingestion Tier
    subgraph Ingestion_Tier [High-Velocity Ingestion Engine]
        E -->|1. Bypass Frappe ORM Loops| F[Session Optimization<br/>SET unique_checks/foreign_key_checks = 0]
        F -->|2. Raw JSON Multi-Row Insert<br/>Chunks of 1,000| G[(MariaDB Staging Table<br/>tabStaging Case Intake)]
        
        %% Table Maintenance
        subgraph Partition_Mgmt [Storage Window Management]
            H[Daily Sliding-Window Event] -->|DROP PARTITION<br/>Fast Metadata Purge| G
            I[ShadowSwapTruncateStaging] -->|Atomic Table Rename Swap| G
        end
    end
    class E,F,G api;
    class H,I storage;

    %% Async Worker Queue
    G -->|3. Enqueue Background Task| J[Asynchronous Background Worker Pool<br/>long queue / process_staging_batch]
    class J worker;

    %% Processing & Identity Validation Pipeline
    subgraph Core_Processing [Hardened Processing & Match Scoring Engine]
        J --> K[In-Memory Structure Schema Pre-Validation]
        K -->|Pass| L[Soundex Block Candidate Extraction]
        L --> M[Multi-Factor Match Weight Calculation<br/>First/Last Name + DOB + Location]
        
        %% Routing Decision Matrix
        M --> N{Is Match Weight<br/>W >= 0.35?}
        
        N -->|Yes: Amber/Red Zone| O[(Draft Isolation Zone<br/>tabDraft Case Intake Sandbox)]
        N -->|No: Green Zone| P[(Authorized Master Ledger<br/>tabProtected Person Master)]
    end
    class K,L,M,N worker;
    class O,P storage;

    %% Operations Dashboard
    O -->|Quarantine Desk Review| Q[Quarantine Desk Dashboard for Manual Review]
    class Q api;
Loading

Clone this wiki locally