Skip to content

Architecture

Garot Conklin edited this page Apr 24, 2026 · 1 revision

Architecture

Sift is a local-only desktop application composed of three main parts: a native host, a Node orchestrator, and a web UI. Together they form a polyglot sidecar architecture that keeps all clinical data processing on the local machine.

High-Level Diagram

flowchart LR
  subgraph host [Tauri host -- Rust]
    Tray[System tray]
    Watch[Folder watcher -- notify]
  end
  subgraph orch [Node orchestrator]
    API[Express REST]
    DB[(SQLite)]
    Pipes[FHIR / HL7 / PDF pipelines]
    LLM[OpenAI-compatible client]
  end
  subgraph ui [Vite React UI]
    Dash[Dashboard / Documents / Settings]
  end
  Watch -->|POST filePath| API
  Dash -->|HTTP| API
  API --> DB
  Pipes --> LLM
  Tray --> ui
Loading

Components

Tauri Host (src-tauri/)

  • Window + WebView: loads the built or dev UI (tauri.conf.jsondevUrl / frontendDist).
  • System tray: Show / Quit; uses the bundled window icon.
  • Folder watch: Uses notify with recursive watching on the user-selected path. On create/modify events for files, the host issues an HTTP POST to http://127.0.0.1:4000/api/ingest with { "filePath": "..." }.
  • Command: set_watch_folder — starts or replaces the watcher (previous watch is cancelled).
  • Sidecar lifecycle (production): Spawns the sift-backend Node.js executable and polls GET /health for up to 15 seconds before the UI loads. Kills the child process when Quit is triggered.

Node Orchestrator (backend/)

  • Express on 127.0.0.1 — health, settings, document listing, single-document fetch, ingest, document delete, scan.
  • SQLite (better-sqlite3) — settings, document rows, summaries, confidence scores, error messages.
  • Ingest pipeline:
    • Detects FHIR JSON, HL7-like text, or PDF (by extension and content hints).
    • Extracts a text preview and structured highlights.
    • Calls the LLM for a clinical-style narrative; on failure, stores a heuristic summary.
  • LLM client: OpenAI-compatible chat completions; base URL and model are user-configurable.

Frontend (frontend/)

  • React + Tailwind — dashboard status, document list and detail, printable report view, settings (folder dialog via @tauri-apps/plugin-dialog, LLM fields via API).
  • Tauri invokeset_watch_folder when a watch path is chosen or restored from settings (guarded so plain browser dev does not crash).
  • Print output — Tailwind print classes produce professional clinical document formatting.

Data Flow: Zero-Click Ingest

  1. User selects a watch folder in Settings (stored in SQLite).
  2. Tauri starts notify on that path.
  3. New file detected → host POSTs path to /api/ingest.
  4. Backend reads file, classifies pipeline (FHIR / HL7 / PDF), persists a document row with summary, confidence, and optional error_message.
  5. UI polls or refreshes and displays the new document card.

API Endpoints

Method Path Description
GET /health Liveness check
GET /api/settings Read all settings
POST /api/settings Write one or more settings
POST /api/ingest Trigger ingest for a file path
GET /api/documents List all document records
GET /api/documents/:id Get a single document
DELETE /api/documents/:id Delete a document record
POST /api/scan Manually scan the watch folder

Security Boundary

All network I/O for the product is loopback to the local orchestrator and (optionally) the local LLM HTTP server. No cloud service is required for core operation. See Security and Compliance.

Production Bundle Layout

In a production Windows installer, Tauri bundles the following together:

Sift_x.y.z_x64-setup.exe (NSIS installer)
  └── Sift.exe                            -- Tauri host
      ├── frontend/dist/                  -- Embedded React build
      └── sift-backend-x86_64-pc-windows-msvc.exe  -- Node.js sidecar (pkg'd)

Optionally, llama-server-x86_64-pc-windows-msvc.exe may be bundled as an additional sidecar for fully offline inference.

Related Docs

Clone this wiki locally