IDKHowToCodeFr commited on
Commit
617ca3d
·
verified ·
1 Parent(s): 2b49295

Upload folder using huggingface_hub

Browse files
ARCHITECTURE.md CHANGED
@@ -1,100 +1,58 @@
1
- # HEARTFLOW_OS // System Architecture & Engineering Topography
2
 
3
- ## 📌 Executive Summary
4
 
5
- HeartFlow OS is a distributed, edge-optimized telemetry pipeline designed for clinical-grade cardiovascular inference. The architecture addresses the inherent tension between heavy-compute machine learning paradigms and the constrained environments of low-power microcontrollers (TinyML).
6
-
7
- By aggressively decoupling the presentation layer (Client), the orchestration and modeling engine (Core), and the physical target execution (Edge), the system achieves strict separation of concerns, high-throughput asynchronous concurrency, and near-zero downtime deployment of predictive models.
8
-
9
- ---
10
-
11
- ## 🏗 High-Level Architecture Diagram
12
 
13
  ```mermaid
14
  graph TD
15
- %% Define styles
16
- classDef frontend fill:#111,stroke:#111,stroke-width:2px,color:#fff,font-family:monospace;
17
- classDef backend fill:#fff,stroke:#111,stroke-width:2px,color:#111,font-family:monospace;
18
- classDef ml_node fill:#e61919,stroke:#e61919,stroke-width:2px,color:#fff,font-family:monospace;
19
- classDef edge_tech fill:#f3f3f2,stroke:#111,stroke-width:2px,color:#111,font-family:monospace;
20
- classDef data fill:#94a3b8,stroke:#475569,stroke-width:2px,color:#fff,font-family:monospace;
21
-
22
- subgraph Client [Client Application / Next.js 16]
23
- direction TB
24
- UI["Views<br/>(page.tsx)"]:::frontend
25
- WS_Client["WebSocket<br/>(TelemetryContext.tsx)"]:::frontend
26
- HTTP_Client["HTTP Fetch"]:::frontend
27
- end
28
-
29
- subgraph Core [FastAPI Core / Python 3.10+]
30
- direction TB
31
- WS_Server["WebSocket Broker<br/>(main.py)"]:::backend
32
- REST_API["REST API Router<br/>(main.py)"]:::backend
33
- Simulator["Vitals Simulator<br/>(simulator.py)"]:::backend
34
- DB["SQLite & aiosqlite<br/>(database.py)"]:::backend
35
- end
36
-
37
- subgraph ML_Layer [Intelligence Pipeline / Scikit-Learn]
38
- direction TB
39
- Inference["Inference<br/>(inference.py)"]:::ml_node
40
- Ensemble["Soft-Voting<br/>(ensemble.py)"]:::ml_node
41
- Training["Model Training<br/>(models.py)"]:::ml_node
42
- EdgeCompiler["C-Code Exporter<br/>(export.py)"]:::ml_node
43
- end
44
-
45
- subgraph Storage [Persistence & Hardware]
46
- direction TB
47
- ModelWeights["Model Artifacts<br/>(model/)"]:::data
48
- CSV["Patient Dataset<br/>(patient_dataset.csv)"]:::data
49
- MCU["Edge Silicon<br/>(tinyml_model.h)"]:::edge_tech
50
- end
51
-
52
- %% Flows
53
- UI --> WS_Client
54
- UI --> HTTP_Client
55
-
56
- WS_Client <--> WS_Server
57
- HTTP_Client --> REST_API
58
 
59
- WS_Server --> Inference
60
- Simulator --> WS_Server
61
- REST_API --> DB
62
- REST_API --> Training
63
- REST_API --> EdgeCompiler
64
 
65
- Inference --> Ensemble
66
- Training --> ModelWeights
67
- Training --> CSV
68
- Ensemble --> ModelWeights
69
- EdgeCompiler --> Ensemble
70
- EdgeCompiler -.-> MCU
71
  ```
72
 
73
- ---
74
-
75
- ## 1. The Presentation Layer (Client Plane)
76
- Engineered using **Next.js 16 (App Router)** and **React 19**.
77
-
78
- - **Rendering Strategy:** Heavily leverages React Server Components (RSC) where applicable, while isolating stateful, high-frequency telemetry updates to optimized Client Components.
79
- - **WebSocket Triage:** Bypasses standard HTTP overhead by multiplexing telemetry streams via native WebSockets (`ws://`). The stream is mapped into a React Context provider, aggressively memoized using `useMemo` and `useCallback` to prevent unnecessary DOM re-renders and React thrashing at 60Hz.
80
- - **Visual Engineering:** Implements an Industrial Brutalist design language. All animations and Layout Transitions are hardware-accelerated (`transform`/`opacity` driven) utilizing `framer-motion` to maintain 60fps even under heavy CPU charting loads.
81
-
82
- ## 2. The Orchestration Engine (Core Plane)
83
- Built entirely asynchronously on top of **FastAPI** (Python 3.10+).
84
-
85
- - **Asynchronous Throughput:** Utilizing the `asyncio` event loop and `uvicorn`, the backend comfortably supports multiple concurrent clinical WebSocket connections. I/O-bound operations (database writes) are completely non-blocking.
86
- - **Stateful Preprocessing:** Live data must match the exact multi-dimensional space the models were trained on. The backend retains a persistent `SimpleImputer` and `StandardScaler`, ensuring live inference vectors are identical in scale to the offline batch data without runtime data leakage.
87
- - **Event-Driven Database:** Implements `aiosqlite` for non-blocking audit logging of predictions, ensuring the primary telemetry event loop is never stalled by disk I/O.
88
-
89
- ## 3. Intelligence Pipeline & MLOps
90
- Designed for precision and zero-downtime deployment.
91
-
92
- - **Distributed Soft-Voting:** Rather than relying on a monolithic architecture, inference is distributed across five orthogonal models (`RandomForest`, `SVM`, `KNN`, `LogisticRegression`, `MLPClassifier`). A soft-voting aggregator calculates the weighted probability distribution, offering a confidence interval rather than a binary black-box output.
93
- - **Live Background Retraining:** The `/retrain` pipeline exposes an API for ingesting new clinical datasets. Upon payload validation, it spins up a `fastapi.BackgroundTasks` thread. The system dynamically updates imputers, recalculates decision boundaries across all 5 models, serializes the updated weights to disk (`.pkl`), and critically—hot-swaps the active `EnsembleModel` object in RAM. This ensures active patient telemetry sessions are never dropped during model redeployments.
94
-
95
- ## 4. The Edge Compilation Pipeline (TinyML)
96
- The most critical engineering bottleneck in telemetry is getting heavy Python models onto $2 silicon.
97
-
98
- - **AST-Based C-Transpilation:** Instead of running a heavyweight Python interpreter (like MicroPython) on the edge device, the backend parses the scikit-learn model's internal Abstract Syntax Trees (AST) and transpiles them directly into pure, statically typed `C` functions.
99
- - **Zero-Dependency Guarantee:** The resulting `tinyml_model.h` file requires no external libraries. It bypasses `malloc()` completely, relying entirely on static stack allocation, eliminating the risk of heap fragmentation or memory leaks in long-running embedded nodes.
100
- - **INT8 Quantization:** 64-bit floating point weights are mathematically clamped and scaled into 8-bit integers (`int8_t`). This quantization dramatically reduces flash storage requirements by up to ~75% and massively accelerates inference execution time on ALU architectures lacking dedicated floating-point hardware (FPU).
 
 
 
 
 
 
 
 
1
+ # HeartFlow OS Architecture
2
 
3
+ HeartFlow OS is a distributed Edge AI platform. It bridges the gap between high-level Python MLOps and low-level embedded systems (ESP32/Arduino) by orchestrating live telemetry, automated model training, and zero-dependency C transpilation.
4
 
5
+ ## System Topology
 
 
 
 
 
 
6
 
7
  ```mermaid
8
  graph TD
9
+ A[Patient Sensors / Simulator] -->|WebSocket: 60Hz| B(FastAPI Backend)
10
+ B <-->|Logs & State| C[(SQLite DB)]
11
+ B <-->|Inference| D[Scikit-Learn Ensemble]
12
+ B -->|Transpilation| E{AST Compiler}
13
+ E -->|Generates model.h| F[PlatformIO Firmware]
14
+ F -->|Flashed to| G[ESP32 Edge Device]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ H[React / Next.js UI] <-->|WebSocket Stream| B
17
+ H <-->|REST API| B
 
 
 
18
 
19
+ I[CSV Dataset] -->|Upload| H
20
+ H -->|/retrain endpoint| B
21
+ B -->|Train & Evaluate F1| D
 
 
 
22
  ```
23
 
24
+ ## Directory Structure
25
+
26
+ | Directory / File | Purpose |
27
+ | :--- | :--- |
28
+ | **`backend/`** | Python FastAPI application. |
29
+ | `backend/main.py` | WebSocket router, dependency injection, and REST endpoints. |
30
+ | `backend/models.py` | MLOps script: Loads dataset, trains ensemble, checks F1 score against `registry.json`, and saves `.pkl` files on success. |
31
+ | `backend/export.py` | AST Compiler: Parses Python decision trees into `if/else` C logic. Applies INT8 quantization. |
32
+ | `backend/ensemble.py` | Soft-voting runtime inference engine. |
33
+ | `backend/test_c_export.py` | Cross-language integrity test ensuring Python models and C-code outputs match. |
34
+ | **`frontend/`** | Next.js 16 Application. |
35
+ | `frontend/src/app/layout.tsx`| Root layout containing the global telemetry socket context and universal footer. |
36
+ | `frontend/src/context/` | Contains `TelemetryContext.tsx` which manages the WebSocket stream with exponential backoff. |
37
+ | **`firmware/`** | PlatformIO C++ Project for edge microcontrollers. |
38
+ | `firmware/platformio.ini` | Build configuration for `esp32dev` with `-O3` optimization flags. |
39
+ | `firmware/src/main.cpp` | Main Arduino wrapper that includes the generated `model.h` and executes `predict()`. |
40
+ | **`docker-compose.yml`** | Full-stack orchestration configuration. |
41
+
42
+ ## Data Flow: Background Retraining (MLOps)
43
+
44
+ 1. User uploads a CSV via the **MLOps UI**.
45
+ 2. FastAPI validates the schema and appends it to `patient_dataset.csv`.
46
+ 3. A background task invokes `train_models()`.
47
+ 4. A new Random Forest is trained. Its F1-score is evaluated against a test set.
48
+ 5. If the new score is $\ge$ the `active_version` score in `registry.json`, the `.pkl` files are overwritten and the live Ensemble model is hot-reloaded.
49
+ 6. If the new score degrades, the model is rejected (Automatic Rollback).
50
+
51
+ ## Data Flow: Edge Compilation (TinyML)
52
+
53
+ 1. User requests an export via the **Edge Compiler UI** (`/export_tinyml`).
54
+ 2. `export.py` loads the active `.pkl` models.
55
+ 3. The Scikit-Learn tree object is recursively traversed.
56
+ 4. Leaf nodes are identified and converted into raw `printf` or standard `return` C-strings.
57
+ 5. If `quantize=True`, 64-bit float thresholds are mapped to 8-bit integers.
58
+ 6. A self-contained `model.h` file is returned, containing a single `int predict(float features[])` function. No dynamic memory (`malloc`/`free`) is used, guaranteeing memory safety on embedded controllers.
README.md CHANGED
@@ -9,73 +9,78 @@ pinned: false
9
 
10
  <div align="center">
11
  <h1>HeartFlow OS</h1>
12
- <p><strong>Cardiovascular Telemetry & MLOps Engine</strong></p>
13
 
14
  <p>
15
  <img src="https://img.shields.io/badge/Next.js-16+-black.svg?style=for-the-badge&logo=next.js" alt="Next.js" />
16
  <img src="https://img.shields.io/badge/React-19-61DAFB.svg?style=for-the-badge&logo=react&logoColor=black" alt="React" />
17
  <img src="https://img.shields.io/badge/FastAPI-0.111.0+-009688.svg?style=for-the-badge&logo=fastapi" alt="FastAPI" />
18
- <img src="https://img.shields.io/badge/Scikit--Learn-1.5.1+-F7931E.svg?style=for-the-badge&logo=scikit-learn&logoColor=white" alt="Scikit-Learn" />
19
  <img src="https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge" alt="License" />
20
  </p>
21
  </div>
22
 
23
  ---
24
 
25
- HeartFlow OS takes real-time patient vitals via WebSockets, runs them through an scikit-learn ensemble, and outputs probability distributions for cardiovascular conditions. It also transpiles these models into standalone C headers you can flash directly to constrained edge devices like an ESP32.
26
 
27
- ## Components
28
 
29
  | Domain | Tech | Details |
30
  | :--- | :--- | :--- |
31
- | **Frontend** | Next.js 16, React 19 | Renders 60Hz telemetry streams using WebSockets and SVG |
32
- | **Backend** | FastAPI, Python 3.10 | Handles WebSocket routing and MLOps API endpoints |
33
- | **ML** | Scikit-Learn | Soft-voting ensemble (RF, SVM, KNN, LogReg, MLP) |
34
- | **Database** | SQLite, `aiosqlite` | Non-blocking telemetry and prediction logging |
35
- | **Compiler** | Custom AST Transpiler | Generates INT8 quantized, `malloc`-free C code |
36
 
37
- ## Features
38
 
39
- - **Live Telemetry**: Streams data at 60Hz via WebSockets to a React 19 dashboard.
40
- - **Edge Compilation**: Converts trained scikit-learn models into C headers. The generated code requires no dependencies and does not use dynamic memory allocation.
41
- - **Quantization**: Scales 64-bit float weights down to 8-bit integers, reducing flash memory usage by ~75%.
42
- - **Soft-Voting**: Combines predictions from 5 different models to output a probability distribution.
43
- - **Background Retraining**: Upload new CSV data to `/retrain` and the backend will impute missing values, retrain the models in a background thread, and update the live ensemble without dropping active socket connections.
44
 
45
- ## Architecture
46
 
47
- See [ARCHITECTURE.md](./ARCHITECTURE.md) for data flow diagrams and the file map.
48
 
49
- ## Quickstart
50
 
51
- ### 1. Backend
 
 
 
 
52
 
53
- Requires Python 3.10+.
54
 
 
55
  ```bash
56
  cd backend
57
  python -m venv .venv
58
  source .venv/bin/activate # Windows: .\.venv\Scripts\activate
59
  pip install -r requirements.txt
60
-
61
- # Train initial models and seed the DB
62
- python models.py
63
-
64
- # Start the server
65
  uvicorn main:app --reload --port 8000
66
  ```
67
 
68
- ### 2. Frontend
69
-
70
- Requires Node.js 18+.
71
-
72
  ```bash
73
  cd frontend
74
  npm install
75
  npm run dev
76
  ```
77
 
78
- Open `http://localhost:3000` to view the dashboard, upload new data, or export C headers.
 
 
 
 
 
 
 
 
79
 
80
  ## License
81
 
 
9
 
10
  <div align="center">
11
  <h1>HeartFlow OS</h1>
12
+ <p><strong>Cardiovascular Telemetry & Edge MLOps Engine</strong></p>
13
 
14
  <p>
15
  <img src="https://img.shields.io/badge/Next.js-16+-black.svg?style=for-the-badge&logo=next.js" alt="Next.js" />
16
  <img src="https://img.shields.io/badge/React-19-61DAFB.svg?style=for-the-badge&logo=react&logoColor=black" alt="React" />
17
  <img src="https://img.shields.io/badge/FastAPI-0.111.0+-009688.svg?style=for-the-badge&logo=fastapi" alt="FastAPI" />
18
+ <img src="https://img.shields.io/badge/PlatformIO-Edge-orange.svg?style=for-the-badge&logo=platformio&logoColor=white" alt="PlatformIO" />
19
  <img src="https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge" alt="License" />
20
  </p>
21
  </div>
22
 
23
  ---
24
 
25
+ HeartFlow OS is an end-to-end telemetry and inference platform designed to stream cardiovascular vitals, predict anomalies using a soft-voting ensemble model, and export those models to highly-constrained edge devices (like ESP32/Arduino).
26
 
27
+ ## System Architecture
28
 
29
  | Domain | Tech | Details |
30
  | :--- | :--- | :--- |
31
+ | **Frontend** | Next.js 16, Framer Motion | Industrial Brutalist UI with auto-healing WebSocket reconnections. |
32
+ | **Backend** | FastAPI, Python 3.10 | Real-time WebSocket routing, Telemetry simulator, and SHAP Explainability. |
33
+ | **MLOps Pipeline** | Scikit-Learn | Automated training pipelines with F1-Score evaluation and rollback protection. |
34
+ | **Edge Compiler** | Custom AST Transpiler | Exports trained ensembles to zero-dependency, INT8 quantized C headers. |
35
+ | **Firmware** | PlatformIO, C++ | Ready-to-deploy hardware wrapper for ESP32/Arduino execution. |
36
 
37
+ ## Core Features
38
 
39
+ - **Fault-Tolerant Telemetry**: Streams data via WebSockets to the React dashboard with exponential backoff and UI-level auto-reconnection.
40
+ - **Automated MLOps Registry**: Upload batch CSV data to `/retrain`. The system evaluates the new models against a test set and will automatically roll back if performance (F1-score) degrades.
41
+ - **Edge Compilation (TinyML)**: Converts trained models into standalone C code (`model.h`). The generated code requires no dynamic memory allocation (`malloc`-free) and uses integer quantization to cut memory footprint by 75%.
42
+ - **Cross-Language Assurance**: Built-in test pipelines verify that the exported C logic perfectly matches the Python models before flashing to hardware.
 
43
 
44
+ ## Quickstart
45
 
46
+ ### Option 1: Docker Compose (Recommended)
47
 
48
+ Run the entire full-stack platform (Frontend + Backend) with a single command:
49
 
50
+ ```bash
51
+ docker compose up --build
52
+ ```
53
+ - UI available at: `http://localhost:3000`
54
+ - API Docs available at: `http://localhost:8000/docs`
55
 
56
+ ### Option 2: Manual Local Setup
57
 
58
+ **Backend (Python)**
59
  ```bash
60
  cd backend
61
  python -m venv .venv
62
  source .venv/bin/activate # Windows: .\.venv\Scripts\activate
63
  pip install -r requirements.txt
64
+ python models.py # Seed initial models
 
 
 
 
65
  uvicorn main:app --reload --port 8000
66
  ```
67
 
68
+ **Frontend (Node)**
 
 
 
69
  ```bash
70
  cd frontend
71
  npm install
72
  npm run dev
73
  ```
74
 
75
+ ### Option 3: Hardware Firmware (Edge Deployment)
76
+
77
+ Once you export your `model.h` from the UI or API, deploy to your microcontroller:
78
+
79
+ ```bash
80
+ cd firmware
81
+ # Copy your exported model.h to firmware/src/model.h
82
+ pio run -t upload
83
+ ```
84
 
85
  ## License
86
 
frontend/src/app/analytics/page.tsx CHANGED
@@ -32,16 +32,6 @@ export default function Analytics() {
32
 
33
  return (
34
  <main className="min-h-[100dvh] relative overflow-hidden bg-canvas">
35
- <nav className="h-16 flex items-center px-8 border-b border-hairline bg-canvas/80 backdrop-blur-md sticky top-0 z-50">
36
- <div className="max-w-[1200px] mx-auto w-full flex justify-between items-center">
37
- <Link href="/" className="font-display text-xl text-ink font-light tracking-[-0.02em]">TinyML Core</Link>
38
- <div className="flex gap-6 items-center text-[15px] font-medium tracking-tight">
39
- <Link href="/dashboard" className="text-muted hover:text-ink transition-colors">Live Monitor</Link>
40
- <Link href="/history" className="text-muted hover:text-ink transition-colors">History</Link>
41
- <Link href="/mlops" className="text-muted hover:text-ink transition-colors">MLOps</Link>
42
- </div>
43
- </div>
44
- </nav>
45
 
46
  <div className="max-w-[1200px] mx-auto px-8 py-24 relative">
47
  <div className="absolute top-0 right-1/4 w-[30vw] h-[30vw] rounded-full bg-gradient-sky opacity-20 blur-[80px] -z-10" />
 
32
 
33
  return (
34
  <main className="min-h-[100dvh] relative overflow-hidden bg-canvas">
 
 
 
 
 
 
 
 
 
 
35
 
36
  <div className="max-w-[1200px] mx-auto px-8 py-24 relative">
37
  <div className="absolute top-0 right-1/4 w-[30vw] h-[30vw] rounded-full bg-gradient-sky opacity-20 blur-[80px] -z-10" />
frontend/src/app/architecture/page.tsx CHANGED
@@ -1,87 +1,78 @@
1
  "use client";
2
 
3
- import Link from "next/link";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  export default function Architecture() {
6
  return (
7
- <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
8
- {/* Top Nav (Mechanical) */}
9
- <nav className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50">
10
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
11
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase">
12
- [ HEARTFLOW_OS ]
13
- </Link>
14
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase hidden md:flex">
15
- <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
16
- <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
17
- <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
18
- <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
19
- <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
20
- </div>
21
- </div>
22
- </nav>
23
-
24
- <div className="max-w-[1000px] mx-auto w-full px-8 py-16 flex-1 flex flex-col">
25
- <header className="mb-12 border-b-4 border-ink pb-8 flex justify-between items-end">
26
  <div>
27
  <div className="text-[12px] text-hazard font-bold tracking-[0.1em] mb-4">
28
  /// DOCS_AND_SPECS
29
  </div>
30
- <h1 className="text-[clamp(3rem,6vw,6rem)]">
31
  SYSTEM<br />ARCHITECTURE
32
  </h1>
33
  </div>
34
- </header>
35
 
36
- <div className="border-2 border-ink bg-white p-8 mb-8">
37
- <h2 className="text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
38
  [ 01 ] Client Plane (Frontend)
39
  </h2>
40
- <p className="text-[14px] text-slate uppercase leading-relaxed mb-4">
41
- Engineered using Next.js 16 (App Router) and React 19. The UI adheres strictly to an Industrial Brutalist aesthetic utilizing hard grids, monochromatic blueprints, and high-contrast hazard states. Native WebSockets handle high-frequency telemetry without HTTP overhead, rendered via hardware-accelerated SVG paths in framer-motion.
42
  </p>
43
- </div>
44
 
45
- <div className="border-2 border-ink bg-white p-8 mb-8">
46
- <h2 className="text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
47
  [ 02 ] Core Plane (Backend)
48
  </h2>
49
- <p className="text-[14px] text-slate uppercase leading-relaxed mb-4">
50
- Built on FastAPI (Python 3.10+) maximizing async throughput. A state-machine driven data simulator generates correlated, volatile telemetry streams representing clinical episodes. Storage employs aiosqlite for non-blocking database writes to track historical classifications without stalling the event loop.
51
  </p>
52
- </div>
53
 
54
- <div className="border-2 border-ink bg-white p-8 mb-8">
55
- <h2 className="text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
56
  [ 03 ] Intelligence Pipeline (MLOps)
57
  </h2>
58
- <p className="text-[14px] text-slate uppercase leading-relaxed mb-4">
59
- Live patient data is standardized and imputed using a persistent SimpleImputer and StandardScaler. Clinical precision is achieved via a 5-model soft-voting ensemble. The `/retrain` pipeline allows dynamic CSV uploads, imputes missing data, trains models in background threads, and hot-swaps the EnsembleModel globally with zero downtime.
60
  </p>
61
- </div>
62
 
63
- <div className="border-2 border-ink bg-white p-8 mb-8">
64
- <h2 className="text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
65
  [ 04 ] Edge Compilation (TinyML)
66
  </h2>
67
- <p className="text-[14px] text-slate uppercase leading-relaxed mb-4">
68
- The backend transpiles trained SciKit-Learn tree models directly into standalone zero-dependency C-headers. Floating-point thresholds are mathematically quantized to INT8, effectively shrinking the flashed payload by ~75%. Designed to execute directly on MCU SRAM without dynamic memory allocation.
69
  </p>
70
- </div>
71
- </div>
72
-
73
- <footer className="w-full border-t-2 border-ink bg-white py-6 px-8 mt-auto">
74
- <div className="max-w-[1400px] mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
75
- <div className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink">
76
- © 2026 HEARTFLOW_OS. TELEMETRY_SYS.
77
- </div>
78
- <div className="flex items-center gap-8">
79
- <Link href="/architecture" className="text-[12px] font-bold tracking-[0.05em] uppercase text-hazard border-b border-hazard">ARCHITECTURE.MD</Link>
80
- <a href={`${process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000"}/docs`} target="_blank" rel="noopener noreferrer" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">API_DOCS</a>
81
- <a href="https://github.com/IDKHowToCodeFR/HEARTFLOW_OS" target="_blank" rel="noopener noreferrer" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">GITHUB_REPO</a>
82
- </div>
83
- </div>
84
- </footer>
85
  </main>
86
  );
87
  }
 
1
  "use client";
2
 
3
+ import { motion } from "framer-motion";
4
+
5
+ const easeFluid: [number, number, number, number] = [0.16, 1, 0.3, 1];
6
+
7
+ const staggerContainer = {
8
+ hidden: { opacity: 0 },
9
+ show: {
10
+ opacity: 1,
11
+ transition: { staggerChildren: 0.1, delayChildren: 0.1 }
12
+ }
13
+ };
14
+
15
+ const fadeUp = {
16
+ hidden: { opacity: 0, y: 20 },
17
+ show: { opacity: 1, y: 0, transition: { duration: 0.8, ease: easeFluid } }
18
+ };
19
 
20
  export default function Architecture() {
21
  return (
22
+ <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white pb-16">
23
+ <motion.div
24
+ variants={staggerContainer}
25
+ initial="hidden"
26
+ animate="show"
27
+ className="max-w-[1000px] mx-auto w-full px-4 md:px-8 py-8 md:py-16 flex-1 flex flex-col"
28
+ >
29
+ <motion.header variants={fadeUp} className="mb-8 md:mb-12 border-b-4 border-ink pb-8 flex justify-between items-end">
 
 
 
 
 
 
 
 
 
 
 
30
  <div>
31
  <div className="text-[12px] text-hazard font-bold tracking-[0.1em] mb-4">
32
  /// DOCS_AND_SPECS
33
  </div>
34
+ <h1 className="text-[clamp(2.5rem,6vw,6rem)] leading-tight">
35
  SYSTEM<br />ARCHITECTURE
36
  </h1>
37
  </div>
38
+ </motion.header>
39
 
40
+ <motion.div variants={fadeUp} className="border-2 border-ink bg-white p-6 md:p-8 mb-8 hover:border-hazard transition-colors">
41
+ <h2 className="text-[16px] md:text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
42
  [ 01 ] Client Plane (Frontend)
43
  </h2>
44
+ <p className="text-[13px] md:text-[14px] text-slate uppercase leading-relaxed mb-4">
45
+ Engineered using Next.js 16 (App Router). The UI adheres to an Industrial Brutalist aesthetic utilizing hard grids, monochromatic blueprints, and high-contrast hazard states. A global Telemetry Provider manages native WebSocket streams with exponential backoff and UI-level auto-reconnection, rendered via hardware-accelerated SVG paths.
46
  </p>
47
+ </motion.div>
48
 
49
+ <motion.div variants={fadeUp} className="border-2 border-ink bg-white p-6 md:p-8 mb-8 hover:border-hazard transition-colors">
50
+ <h2 className="text-[16px] md:text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
51
  [ 02 ] Core Plane (Backend)
52
  </h2>
53
+ <p className="text-[13px] md:text-[14px] text-slate uppercase leading-relaxed mb-4">
54
+ Built on FastAPI (Python 3.10+) maximizing async throughput. Full-stack orchestration is containerized via Docker Compose. A state-machine driven data simulator generates correlated, volatile telemetry streams. Storage employs aiosqlite for non-blocking database writes to track historical classifications without stalling the event loop.
55
  </p>
56
+ </motion.div>
57
 
58
+ <motion.div variants={fadeUp} className="border-2 border-ink bg-white p-6 md:p-8 mb-8 hover:border-hazard transition-colors">
59
+ <h2 className="text-[16px] md:text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
60
  [ 03 ] Intelligence Pipeline (MLOps)
61
  </h2>
62
+ <p className="text-[13px] md:text-[14px] text-slate uppercase leading-relaxed mb-4">
63
+ Clinical precision is achieved via a 5-model soft-voting ensemble (RF, KNN, SVM, LogReg, MLP). The `/retrain` pipeline implements a strict CI/CD gate: it evaluates newly uploaded datasets against a test holdout, and automatically rolls back if the F1-score degrades. Winning models are logged to a JSON registry and hot-swapped globally.
64
  </p>
65
+ </motion.div>
66
 
67
+ <motion.div variants={fadeUp} className="border-2 border-ink bg-white p-6 md:p-8 mb-8 hover:border-hazard transition-colors">
68
+ <h2 className="text-[16px] md:text-[18px] font-sans font-black tracking-[-0.02em] uppercase text-ink mb-6 border-b-2 border-ink pb-4">
69
  [ 04 ] Edge Compilation (TinyML)
70
  </h2>
71
+ <p className="text-[13px] md:text-[14px] text-slate uppercase leading-relaxed mb-4">
72
+ The backend transpiles trained SciKit-Learn tree models directly into standalone zero-dependency C-headers (`model.h`). Floating-point thresholds are quantized to INT8, shrinking payload footprints by ~75%. A PlatformIO firmware wrapper handles deployment to ESP32/Arduino, guaranteed by an automated structural integrity testing script.
73
  </p>
74
+ </motion.div>
75
+ </motion.div>
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  </main>
77
  );
78
  }
frontend/src/app/dashboard/page.tsx CHANGED
@@ -25,25 +25,6 @@ export default function Dashboard() {
25
  return (
26
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white pb-16">
27
  {/* Top Nav (Mechanical) */}
28
- <motion.nav
29
- initial={{ y: "-100%" }}
30
- animate={{ y: 0 }}
31
- transition={{ duration: 0.8, ease: easeFluid }}
32
- className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50"
33
- >
34
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
35
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase hover:text-hazard transition-colors">
36
- [ HEARTFLOW_OS ]
37
- </Link>
38
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase hidden md:flex">
39
- <Link href="/dashboard" className="text-hazard border-b-2 border-hazard pb-1">SYS.MONITOR</Link>
40
- <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
41
- <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
42
- <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
43
- <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
44
- </div>
45
- </div>
46
- </motion.nav>
47
 
48
  <motion.div
49
  variants={staggerContainer}
 
25
  return (
26
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white pb-16">
27
  {/* Top Nav (Mechanical) */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  <motion.div
30
  variants={staggerContainer}
frontend/src/app/edge/page.tsx CHANGED
@@ -45,20 +45,6 @@ export default function EdgeDeployment() {
45
  return (
46
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
47
  {/* Top Nav (Mechanical) */}
48
- <nav className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50">
49
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
50
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase">
51
- [ HEARTFLOW_OS ]
52
- </Link>
53
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase">
54
- <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
55
- <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
56
- <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
57
- <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
58
- <Link href="/edge" className="text-hazard border-b-2 border-hazard pb-1">EDGE.COMPILER</Link>
59
- </div>
60
- </div>
61
- </nav>
62
 
63
  <div className="max-w-[1400px] mx-auto w-full px-8 py-16 flex-1 flex flex-col">
64
  <header className="mb-12 border-b-4 border-ink pb-8 flex justify-between items-end">
 
45
  return (
46
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
47
  {/* Top Nav (Mechanical) */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  <div className="max-w-[1400px] mx-auto w-full px-8 py-16 flex-1 flex flex-col">
50
  <header className="mb-12 border-b-4 border-ink pb-8 flex justify-between items-end">
frontend/src/app/history/page.tsx CHANGED
@@ -37,20 +37,6 @@ export default function PatientHistory() {
37
  return (
38
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
39
  {/* Top Nav (Mechanical) */}
40
- <nav className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50">
41
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
42
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase">
43
- [ HEARTFLOW_OS ]
44
- </Link>
45
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase">
46
- <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
47
- <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
48
- <Link href="/history" className="text-hazard border-b-2 border-hazard pb-1">DATA.LOG</Link>
49
- <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
50
- <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
51
- </div>
52
- </div>
53
- </nav>
54
 
55
  <div className="max-w-[1400px] mx-auto w-full px-8 py-16 flex-1 flex flex-col">
56
  <header className="mb-12 border-b-4 border-ink pb-8 flex justify-between items-end">
 
37
  return (
38
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
39
  {/* Top Nav (Mechanical) */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  <div className="max-w-[1400px] mx-auto w-full px-8 py-16 flex-1 flex flex-col">
42
  <header className="mb-12 border-b-4 border-ink pb-8 flex justify-between items-end">
frontend/src/app/layout.tsx CHANGED
@@ -13,6 +13,8 @@ const geistMono = Geist_Mono({
13
  subsets: ["latin"],
14
  });
15
 
 
 
16
  export const metadata: Metadata = {
17
  title: "TinyML Heart Health",
18
  description: "Cardiovascular monitoring dashboard",
@@ -24,10 +26,42 @@ export default function RootLayout({ children }: { children: React.ReactNode })
24
  lang="en"
25
  className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
26
  >
27
- <body className="min-h-full flex flex-col">
28
  <TelemetryProvider>
29
- {children}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  </TelemetryProvider>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </body>
32
  </html>
33
  );
 
13
  subsets: ["latin"],
14
  });
15
 
16
+ import Link from "next/link";
17
+
18
  export const metadata: Metadata = {
19
  title: "TinyML Heart Health",
20
  description: "Cardiovascular monitoring dashboard",
 
26
  lang="en"
27
  className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
28
  >
29
+ <body className="min-h-full flex flex-col font-mono selection:bg-hazard selection:text-white bg-canvas-cream">
30
  <TelemetryProvider>
31
+ {/* Universal Nav */}
32
+ <nav className="flex items-center px-4 md:px-8 py-4 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50 overflow-x-auto">
33
+ <div className="max-w-[1400px] mx-auto w-full flex flex-col md:flex-row justify-between items-center gap-4 md:gap-0">
34
+ <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase hover:text-hazard transition-colors">
35
+ [ HEARTFLOW_OS ]
36
+ </Link>
37
+ <div className="flex gap-4 md:gap-8 items-center text-[12px] md:text-[13px] font-bold tracking-[0.05em] uppercase flex-wrap justify-center">
38
+ <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
39
+ <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
40
+ <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
41
+ <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
42
+ <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
43
+ </div>
44
+ </div>
45
+ </nav>
46
+
47
+ <div className="flex-1 flex flex-col">
48
+ {children}
49
+ </div>
50
  </TelemetryProvider>
51
+
52
+ {/* Universal Footer */}
53
+ <footer className="w-full border-t-2 border-ink bg-white py-6 px-8 mt-auto z-50">
54
+ <div className="max-w-[1400px] mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
55
+ <div className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink text-center md:text-left">
56
+ © 2026 HEARTFLOW_OS. TELEMETRY_SYS.
57
+ </div>
58
+ <div className="flex flex-wrap items-center justify-center gap-4 md:gap-8">
59
+ <Link href="/architecture" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">ARCHITECTURE.MD</Link>
60
+ <a href={`${process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000"}/docs`} target="_blank" rel="noopener noreferrer" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">API_DOCS</a>
61
+ <a href="https://github.com/IDKHowToCodeFR/HEARTFLOW_OS" target="_blank" rel="noopener noreferrer" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">GITHUB_REPO</a>
62
+ </div>
63
+ </div>
64
+ </footer>
65
  </body>
66
  </html>
67
  );
frontend/src/app/mlops/page.tsx CHANGED
@@ -54,25 +54,6 @@ export default function MLOps() {
54
  return (
55
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
56
  {/* Top Nav (Mechanical) */}
57
- <motion.nav
58
- initial={{ y: "-100%" }}
59
- animate={{ y: 0 }}
60
- transition={{ duration: 0.8, ease: easeFluid }}
61
- className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50"
62
- >
63
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
64
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase hover:text-hazard transition-colors">
65
- [ HEARTFLOW_OS ]
66
- </Link>
67
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase">
68
- <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
69
- <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
70
- <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
71
- <Link href="/mlops" className="text-hazard border-b-2 border-hazard pb-1">ML.OPS</Link>
72
- <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
73
- </div>
74
- </div>
75
- </motion.nav>
76
 
77
  <motion.div
78
  variants={staggerContainer}
 
54
  return (
55
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
56
  {/* Top Nav (Mechanical) */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
  <motion.div
59
  variants={staggerContainer}
frontend/src/app/page.tsx CHANGED
@@ -21,29 +21,8 @@ export default function Home() {
21
 
22
  return (
23
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
24
- {/* Top Nav (Mechanical) */}
25
- <motion.nav
26
- initial={{ y: "-100%" }}
27
- animate={{ y: 0 }}
28
- transition={{ duration: 0.8, ease: easeFluid }}
29
- className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50"
30
- >
31
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
32
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase hover:text-hazard transition-colors">
33
- [ HEARTFLOW_OS ]
34
- </Link>
35
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase hidden md:flex">
36
- <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
37
- <Link href="/simulator" className="text-ink hover:text-hazard transition-colors">AI.SIMULATOR</Link>
38
- <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
39
- <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
40
- <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
41
- </div>
42
- </div>
43
- </motion.nav>
44
-
45
  {/* Hero Section */}
46
- <section className="max-w-[1400px] mx-auto w-full px-8 pt-32 pb-24 grid grid-cols-1 lg:grid-cols-12 gap-16 flex-1 overflow-hidden">
47
  <motion.div
48
  variants={staggerContainer}
49
  initial="hidden"
@@ -61,13 +40,13 @@ export default function Home() {
61
  <span>INT8_QUANTIZED</span>
62
  </motion.div>
63
 
64
- <motion.h1 variants={fadeUp} className="text-[clamp(4rem,8vw,8rem)] mb-8">
65
  CLINICAL<br />
66
  INFERENCE<br />
67
  <span className="text-hazard">AT THE EDGE.</span>
68
  </motion.h1>
69
 
70
- <motion.p variants={fadeUp} className="text-[16px] text-ink max-w-lg leading-relaxed uppercase tracking-[0.02em] font-bold border-l-4 border-hazard pl-6 mb-12">
71
  An ensemble intelligence pipeline engineered for resource-constrained microcontrollers. Deploy robust cardiovascular telemetry analysis directly to the silicon.
72
  </motion.p>
73
 
@@ -77,7 +56,7 @@ export default function Home() {
77
  whileHover={{ scale: 1.02, backgroundColor: "var(--color-hazard)", borderColor: "var(--color-hazard)" }}
78
  whileTap={{ scale: 0.98 }}
79
  transition={{ duration: 0.2, ease: "easeOut" }}
80
- className="inline-flex items-center justify-center h-12 px-8 bg-ink text-white text-[14px] font-bold uppercase tracking-[0.1em] border-2 border-ink"
81
  >
82
  [ INITIATE_STREAM ]
83
  </motion.a>
@@ -87,7 +66,7 @@ export default function Home() {
87
  whileHover={{ scale: 1.02, backgroundColor: "var(--color-ink)", color: "var(--color-canvas-cream)" }}
88
  whileTap={{ scale: 0.98 }}
89
  transition={{ duration: 0.2, ease: "easeOut" }}
90
- className="inline-flex items-center justify-center h-12 px-8 bg-transparent text-ink text-[14px] font-bold uppercase tracking-[0.1em] border-2 border-ink"
91
  >
92
  C_COMPILER &gt;&gt;
93
  </motion.a>
@@ -105,10 +84,10 @@ export default function Home() {
105
  <motion.div variants={fadeUp} className="bg-white p-8 flex flex-col justify-between group cursor-default">
106
  <div className="text-[10px] text-slate font-bold tracking-[0.15em] mb-4 group-hover:text-hazard transition-colors duration-300">FEAT.01</div>
107
  <div>
108
- <h3 className="font-sans text-[24px] font-black uppercase tracking-[-0.02em] mb-2 text-ink">
109
  INT8 Quantization
110
  </h3>
111
- <p className="text-[13px] text-slate leading-relaxed uppercase">
112
  Weights scaled to 8-bit integers. 75% payload reduction for ESP32 constraint matrices.
113
  </p>
114
  </div>
@@ -117,10 +96,10 @@ export default function Home() {
117
  <motion.div variants={fadeUp} className="bg-canvas-cream p-8 flex flex-col justify-between group cursor-default">
118
  <div className="text-[10px] text-slate font-bold tracking-[0.15em] mb-4 group-hover:text-hazard transition-colors duration-300">FEAT.02</div>
119
  <div>
120
- <h3 className="font-sans text-[24px] font-black uppercase tracking-[-0.02em] mb-2 text-ink">
121
  Ensemble Architecture
122
  </h3>
123
- <p className="text-[13px] text-slate leading-relaxed uppercase">
124
  RF, KNN, and SVM combined with a meta-classifier for clinical-grade precision.
125
  </p>
126
  </div>
@@ -129,35 +108,16 @@ export default function Home() {
129
  <motion.div variants={fadeUp} className="bg-white p-8 flex flex-col justify-between group cursor-default">
130
  <div className="text-[10px] text-slate font-bold tracking-[0.15em] mb-4 group-hover:text-hazard transition-colors duration-300">FEAT.03</div>
131
  <div>
132
- <h3 className="font-sans text-[24px] font-black uppercase tracking-[-0.02em] mb-2 text-ink">
133
  Zero-Dep Export
134
  </h3>
135
- <p className="text-[13px] text-slate leading-relaxed uppercase">
136
  Compile trained models directly to standalone C headers. Zero dynamic allocation.
137
  </p>
138
  </div>
139
  </motion.div>
140
  </motion.div>
141
  </section>
142
-
143
- {/* Minimal Footer */}
144
- <motion.footer
145
- initial={{ opacity: 0 }}
146
- animate={{ opacity: 1 }}
147
- transition={{ duration: 1, delay: 0.8 }}
148
- className="w-full border-t-2 border-ink bg-white py-6 px-8"
149
- >
150
- <div className="max-w-[1400px] mx-auto flex flex-col md:flex-row items-center justify-between gap-4">
151
- <div className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink">
152
- © 2026 HEARTFLOW_OS. TELEMETRY_SYS.
153
- </div>
154
- <div className="flex items-center gap-8">
155
- <Link href="/architecture" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">ARCHITECTURE.MD</Link>
156
- <a href={`${process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000"}/docs`} target="_blank" rel="noopener noreferrer" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">API_DOCS</a>
157
- <a href="https://github.com/IDKHowToCodeFR/HEARTFLOW_OS" target="_blank" rel="noopener noreferrer" className="text-[12px] font-bold tracking-[0.05em] uppercase text-ink hover:text-hazard transition-colors">GITHUB_REPO</a>
158
- </div>
159
- </div>
160
- </motion.footer>
161
  </main>
162
  );
163
  }
 
21
 
22
  return (
23
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  {/* Hero Section */}
25
+ <section className="max-w-[1400px] mx-auto w-full px-8 pt-16 md:pt-32 pb-24 grid grid-cols-1 lg:grid-cols-12 gap-16 flex-1 overflow-hidden">
26
  <motion.div
27
  variants={staggerContainer}
28
  initial="hidden"
 
40
  <span>INT8_QUANTIZED</span>
41
  </motion.div>
42
 
43
+ <motion.h1 variants={fadeUp} className="text-[clamp(3rem,8vw,8rem)] mb-8 leading-tight">
44
  CLINICAL<br />
45
  INFERENCE<br />
46
  <span className="text-hazard">AT THE EDGE.</span>
47
  </motion.h1>
48
 
49
+ <motion.p variants={fadeUp} className="text-[14px] md:text-[16px] text-ink max-w-lg leading-relaxed uppercase tracking-[0.02em] font-bold border-l-4 border-hazard pl-6 mb-12">
50
  An ensemble intelligence pipeline engineered for resource-constrained microcontrollers. Deploy robust cardiovascular telemetry analysis directly to the silicon.
51
  </motion.p>
52
 
 
56
  whileHover={{ scale: 1.02, backgroundColor: "var(--color-hazard)", borderColor: "var(--color-hazard)" }}
57
  whileTap={{ scale: 0.98 }}
58
  transition={{ duration: 0.2, ease: "easeOut" }}
59
+ className="inline-flex items-center justify-center h-12 px-8 bg-ink text-white text-[14px] font-bold uppercase tracking-[0.1em] border-2 border-ink w-full md:w-auto"
60
  >
61
  [ INITIATE_STREAM ]
62
  </motion.a>
 
66
  whileHover={{ scale: 1.02, backgroundColor: "var(--color-ink)", color: "var(--color-canvas-cream)" }}
67
  whileTap={{ scale: 0.98 }}
68
  transition={{ duration: 0.2, ease: "easeOut" }}
69
+ className="inline-flex items-center justify-center h-12 px-8 bg-transparent text-ink text-[14px] font-bold uppercase tracking-[0.1em] border-2 border-ink w-full md:w-auto mt-2 md:mt-0"
70
  >
71
  C_COMPILER &gt;&gt;
72
  </motion.a>
 
84
  <motion.div variants={fadeUp} className="bg-white p-8 flex flex-col justify-between group cursor-default">
85
  <div className="text-[10px] text-slate font-bold tracking-[0.15em] mb-4 group-hover:text-hazard transition-colors duration-300">FEAT.01</div>
86
  <div>
87
+ <h3 className="font-sans text-[20px] md:text-[24px] font-black uppercase tracking-[-0.02em] mb-2 text-ink">
88
  INT8 Quantization
89
  </h3>
90
+ <p className="text-[12px] md:text-[13px] text-slate leading-relaxed uppercase">
91
  Weights scaled to 8-bit integers. 75% payload reduction for ESP32 constraint matrices.
92
  </p>
93
  </div>
 
96
  <motion.div variants={fadeUp} className="bg-canvas-cream p-8 flex flex-col justify-between group cursor-default">
97
  <div className="text-[10px] text-slate font-bold tracking-[0.15em] mb-4 group-hover:text-hazard transition-colors duration-300">FEAT.02</div>
98
  <div>
99
+ <h3 className="font-sans text-[20px] md:text-[24px] font-black uppercase tracking-[-0.02em] mb-2 text-ink">
100
  Ensemble Architecture
101
  </h3>
102
+ <p className="text-[12px] md:text-[13px] text-slate leading-relaxed uppercase">
103
  RF, KNN, and SVM combined with a meta-classifier for clinical-grade precision.
104
  </p>
105
  </div>
 
108
  <motion.div variants={fadeUp} className="bg-white p-8 flex flex-col justify-between group cursor-default">
109
  <div className="text-[10px] text-slate font-bold tracking-[0.15em] mb-4 group-hover:text-hazard transition-colors duration-300">FEAT.03</div>
110
  <div>
111
+ <h3 className="font-sans text-[20px] md:text-[24px] font-black uppercase tracking-[-0.02em] mb-2 text-ink">
112
  Zero-Dep Export
113
  </h3>
114
+ <p className="text-[12px] md:text-[13px] text-slate leading-relaxed uppercase">
115
  Compile trained models directly to standalone C headers. Zero dynamic allocation.
116
  </p>
117
  </div>
118
  </motion.div>
119
  </motion.div>
120
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  </main>
122
  );
123
  }
frontend/src/app/simulator/page.tsx CHANGED
@@ -67,25 +67,6 @@ export default function Analysis() {
67
  return (
68
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white pb-16">
69
  {/* Top Nav (Mechanical) */}
70
- <motion.nav
71
- initial={{ y: "-100%" }}
72
- animate={{ y: 0 }}
73
- transition={{ duration: 0.8, ease: easeFluid }}
74
- className="h-16 flex items-center px-8 border-b-2 border-ink bg-canvas-cream sticky top-0 z-50"
75
- >
76
- <div className="max-w-[1400px] mx-auto w-full flex justify-between items-center">
77
- <Link href="/" className="font-sans text-[18px] font-black tracking-[-0.04em] uppercase hover:text-hazard transition-colors">
78
- [ HEARTFLOW_OS ]
79
- </Link>
80
- <div className="flex gap-8 items-center text-[13px] font-bold tracking-[0.05em] uppercase">
81
- <Link href="/dashboard" className="text-ink hover:text-hazard transition-colors">SYS.MONITOR</Link>
82
- <Link href="/simulator" className="text-hazard border-b-2 border-hazard pb-1">AI.SIMULATOR</Link>
83
- <Link href="/history" className="text-ink hover:text-hazard transition-colors">DATA.LOG</Link>
84
- <Link href="/mlops" className="text-ink hover:text-hazard transition-colors">ML.OPS</Link>
85
- <Link href="/edge" className="text-ink hover:text-hazard transition-colors">EDGE.COMPILER</Link>
86
- </div>
87
- </div>
88
- </motion.nav>
89
 
90
  <motion.div
91
  variants={staggerContainer}
 
67
  return (
68
  <main className="min-h-[100dvh] bg-canvas-cream flex flex-col font-mono selection:bg-hazard selection:text-white pb-16">
69
  {/* Top Nav (Mechanical) */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  <motion.div
72
  variants={staggerContainer}