IDKHowToCodeFr commited on
Commit
a7697db
Β·
verified Β·
1 Parent(s): 3f4c90b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +46 -38
README.md CHANGED
@@ -7,65 +7,73 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- # HeartFlow OS
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- HeartFlow OS is a telemetry application for real-time cardiovascular inference. It ingests patient vitals and evaluates them against a machine-learning ensemble to compute diagnostic probabilities. It also compiles these models into C-code headers for edge devices.
13
 
14
- ![Next.js](https://img.shields.io/badge/Next.js-16+-black.svg?style=flat&logo=next.js)
15
- ![React](https://img.shields.io/badge/React-19-61DAFB.svg?style=flat&logo=react)
16
- ![FastAPI](https://img.shields.io/badge/FastAPI-0.111.0+-009688.svg?style=flat&logo=fastapi)
17
- ![Scikit-Learn](https://img.shields.io/badge/scikit--learn-1.5.1+-F7931E.svg?style=flat&logo=scikit-learn)
18
- ![License](https://img.shields.io/badge/license-MIT-green.svg)
19
 
20
- ## Overview
21
 
22
- HeartFlow OS runs clinical telemetry at 60Hz. It uses native WebSockets in a Next.js dashboard to render telemetry sweeps without dropping frames. The backend transpiles scikit-learn models into `malloc`-free C-code for constrained microcontrollers.
23
 
24
- ### Key features
25
 
26
- - **Telemetry interface**: A Next.js 16 dashboard renders 60fps SVG telemetry sweeps using React 19 and WebSockets.
27
- - **Edge inference**: The system transpiles `scikit-learn` models into dependency-free C-code. It avoids dynamic memory allocation.
28
- - **INT8 quantization**: The backend algorithmically scales 64-bit floating-point weights to 8-bit integers. This shrinks the flash memory footprint by 75%.
29
- - **Soft-voting ensemble**: Five model architectures (Random Forest, SVM, KNN, Logistic Regression, MLP) fuse predictions into a probability distribution.
30
- - **Zero-downtime MLOps**: You can upload CSVs to the `/retrain` pipeline. It imputes data and retrains the ensemble in the background without dropping WebSocket connections.
 
 
31
 
32
- ## System architecture
33
 
34
- The architecture uses a decoupled pattern split across the React client, FastAPI core, and C-compiler edge. Read the [architecture guide](./ARCHITECTURE.md) for data flows and design rationale.
 
 
 
 
35
 
36
- ### Repository topology
37
 
38
- ```text
39
- HEARTFLOW_OS/
40
- β”œβ”€β”€ backend/ # FastAPI core, aiosqlite, async ML pipelines, C-compiler
41
- β”‚ β”œβ”€β”€ ensemble.py # Core intelligence and soft-voting aggregations
42
- β”‚ β”œβ”€β”€ main.py # Websocket ingress, REST APIs, and background routines
43
- β”‚ └── preprocessing.py # State-preserving MLOps data imputation and scaling
44
- β”œβ”€β”€ frontend/ # Next.js 16 UI, React Context, Framer Motion
45
- β”‚ β”œβ”€β”€ src/app/ # Route segments (Dashboard, Simulator, Architecture)
46
- β”‚ └── src/components/ # Memoized, brutalist UI components for 60fps rendering
47
- β”œβ”€β”€ model/ # Local LRU cache of serialized model states (.pkl)
48
- └── data/ # Immutable patient cohort datasets for MLOps
49
- ```
50
 
51
- ## Quickstart
52
 
53
- ### 1. Initialize the core
54
 
55
- You need Python 3.10+ installed.
56
 
57
  ```bash
58
  cd backend
59
  python -m venv .venv
60
- source .venv/bin/activate
61
  pip install -r requirements.txt
 
 
62
  python models.py
 
 
63
  uvicorn main:app --reload --port 8000
64
  ```
65
 
66
- ### 2. Initialize the client
67
 
68
- You need Node.js 18+ installed.
69
 
70
  ```bash
71
  cd frontend
@@ -73,8 +81,8 @@ npm install
73
  npm run dev
74
  ```
75
 
76
- Navigate to `http://localhost:3000` to monitor telemetry streams, access MLOps pipelines, and export INT8 headers.
77
 
78
- ## License
79
 
80
  Distributed under the MIT License. See `LICENSE` for more information.
 
7
  pinned: false
8
  ---
9
 
10
+ <div align="center">
11
+ <h1>πŸ«€ HeartFlow OS</h1>
12
+ <p><strong>Edge-Native 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
+ ## πŸ“– Overview
 
 
 
 
26
 
27
+ HeartFlow OS is a production-grade telemetry application engineered for **real-time cardiovascular inference**. It bridges the gap between cloud-scale machine learning and low-power embedded devices.
28
 
29
+ By ingesting high-frequency patient vitals over WebSockets, evaluating them against a distributed machine-learning ensemble, and physically compiling these models into zero-dependency C-code, HeartFlow OS provides an end-to-end pipeline from clinical dashboard to microcontroller execution.
30
 
31
+ ## ⚑ Tech Stack
32
 
33
+ | Domain | Technologies Used | Purpose |
34
+ | :--- | :--- | :--- |
35
+ | **Frontend** | Next.js 16 (App Router), React 19, Framer Motion | High-throughput, 60fps telemetry rendering and UI |
36
+ | **Backend Core** | FastAPI, Python 3.10+, Uvicorn | Async WebSocket orchestration and RESTful MLOps APIs |
37
+ | **Machine Learning** | Scikit-Learn, SHAP | Soft-voting ensemble (RF, SVM, KNN, LogReg, MLP) |
38
+ | **Database** | SQLite, `aiosqlite` | Non-blocking, asynchronous prediction logging |
39
+ | **Edge Compiler** | Custom Python AST Transpiler | Generates `malloc`-free, INT8 quantized C-code for MCUs |
40
 
41
+ ## ✨ Key Features
42
 
43
+ - **60Hz Telemetry Interface**: A brutally fast Next.js dashboard leveraging React 19 and native WebSockets to render SVG telemetry sweeps without dropping frames.
44
+ - **Edge Inference & TinyML**: Transpiles complex `scikit-learn` decision boundaries into highly optimized, dependency-free C-code designed for constrained environments (bypassing dynamic memory allocation).
45
+ - **INT8 Quantization Engine**: Algorithmically scales 64-bit floating-point weights to 8-bit integers, shrinking the flash memory footprint by up to **75%** without meaningful accuracy loss.
46
+ - **Soft-Voting ML Ensemble**: Fuses predictions from five distinct model architectures to generate resilient probability distributions rather than opaque binary classifications.
47
+ - **Zero-Downtime MLOps**: Exposes a `/retrain` pipeline allowing for dynamic CSV uploads. It automatically imputes missing data, scales features, and retrains the entire ensemble in a background threadβ€”hot-swapping the intelligence engine without interrupting active WebSocket streams.
48
 
49
+ ## πŸ— System Architecture
50
 
51
+ The architecture adheres to a strictly decoupled design pattern split across the React client, FastAPI core, and C-compiler edge.
52
+
53
+ For a comprehensive deep-dive into data flows, system topography, and Mermaid diagrams, please read the [**Architecture Guide**](./ARCHITECTURE.md).
 
 
 
 
 
 
 
 
 
54
 
55
+ ## πŸš€ Quickstart
56
 
57
+ ### 1. Initialize the Core (Backend)
58
 
59
+ Requires Python 3.10 or higher.
60
 
61
  ```bash
62
  cd backend
63
  python -m venv .venv
64
+ source .venv/bin/activate # On Windows: .\.venv\Scripts\activate
65
  pip install -r requirements.txt
66
+
67
+ # Initialize the SQLite database and train the baseline ensemble
68
  python models.py
69
+
70
+ # Launch the async server
71
  uvicorn main:app --reload --port 8000
72
  ```
73
 
74
+ ### 2. Initialize the Client (Frontend)
75
 
76
+ Requires Node.js 18 or higher.
77
 
78
  ```bash
79
  cd frontend
 
81
  npm run dev
82
  ```
83
 
84
+ Navigate to `http://localhost:3000` to monitor live telemetry streams, access MLOps retraining pipelines, and export your INT8 TinyML headers.
85
 
86
+ ## πŸ“„ License
87
 
88
  Distributed under the MIT License. See `LICENSE` for more information.