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

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. ARCHITECTURE.md +14 -14
  2. README.md +25 -31
ARCHITECTURE.md CHANGED
@@ -21,32 +21,32 @@ graph TD
21
 
22
  subgraph Client [Client Application / Next.js 16]
23
  direction TB
24
- UI["React 19 Views<br/>[dashboard/page.tsx, etc]"]:::frontend
25
- WS_Client["WebSocket Context<br/>[TelemetryContext.tsx]"]:::frontend
26
- HTTP_Client["HTTP Data Fetching"]:::frontend
27
  end
28
 
29
  subgraph Core [FastAPI Core / Python 3.10+]
30
  direction TB
31
- WS_Server["Async 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 DB & aiosqlite<br/>[database.py]"]:::backend
35
  end
36
 
37
  subgraph ML_Layer [Intelligence Pipeline / Scikit-Learn]
38
  direction TB
39
- Inference["Inference & Preprocessing<br/>[inference.py, preprocessing.py]"]:::ml_node
40
- Ensemble["Soft-Voting Ensemble<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/ directory]"]:::data
48
- CSV["Patient Dataset<br/>[patient_dataset.csv]"]:::data
49
- MCU["Edge Silicon / Header<br/>[tinyml_model.h]"]:::edge_tech
50
  end
51
 
52
  %% Flows
 
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
README.md CHANGED
@@ -7,9 +7,9 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- # HEARTFLOW_OS // Edge-Native Cardiovascular Telemetry
11
 
12
- A production-grade, edge-optimized application for real-time cardiovascular telemetry and predictive diagnostics. HeartFlow OS bridges cloud-scale machine learning with low-level embedded constraints by transpiling soft-voting ensembles directly into zero-dependency, statically allocated C-code for microcontroller deployment.
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)
@@ -17,29 +17,23 @@ A production-grade, edge-optimized application for real-time cardiovascular tele
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
- ---
21
-
22
- ## πŸš€ Overview
23
-
24
- HeartFlow OS is engineered for high-frequency clinical telemetry. It ingests live patient vitals via WebSockets, evaluates telemetry against an ensemble of distributed classifiers to compute diagnostic probability distributions, and physically compresses these complex mathematical models into raw C-code headers ready to be flashed onto constrained edge silicon (e.g., ESP32, Cortex-M series).
25
 
26
- ### Key Engineering Features
27
 
28
- - **High-Throughput Telemetry Interface:** A highly optimized Next.js 16 dashboard utilizing native WebSockets and React 19 to render 60fps SVG telemetry sweeps with near-zero latency or dropped frames.
29
- - **Edge Inference & TinyML:** Transpiles sophisticated `scikit-learn` models into highly optimized, dependency-free C-code. Designed with strict spatial and temporal constraints in mind, bypassing dynamic memory allocation entirely (`malloc`-free).
30
- - **INT8 Quantization Engine:** Algorithmically scales 64-bit floating-point weights and biases down to 8-bit integers, effectively shrinking the flashed payload memory footprint by ~75% without significant accuracy degradation.
31
- - **Soft-Voting Ensemble:** Fuses predictions from five discrete model architectures (Random Forest, SVM, KNN, Logistic Regression, MLP Neural Network) to generate resilient probability distributions, mitigating the variance and biases of individual black-box models.
32
- - **Zero-Downtime MLOps:** Integrated `/retrain` pipeline allowing for real-time schema validation, data imputation, and background ensemble retraining. Hot-swaps the underlying intelligence engine globally without interrupting active clinical WebSocket streams.
33
 
34
- ---
35
-
36
- ## πŸ— System Architecture
 
 
37
 
38
- The architecture adheres to a strictly decoupled, service-oriented design pattern split across the Client (React), the Core (FastAPI), and the Edge (C-Compiler).
39
 
40
- For a deep-dive into system topography, data flows, and design rationale, see [ARCHITECTURE.md](./ARCHITECTURE.md).
41
 
42
- ### Repository Topology
43
 
44
  ```text
45
  HEARTFLOW_OS/
@@ -54,33 +48,33 @@ HEARTFLOW_OS/
54
  └── data/ # Immutable patient cohort datasets for MLOps
55
  ```
56
 
57
- ---
58
 
59
- ## πŸ›  Quickstart Guide
 
 
60
 
61
- ### 1. Initialize the Core (Backend)
62
- Requires Python 3.10+
63
  ```bash
64
  cd backend
65
  python -m venv .venv
66
- source .venv/bin/activate # Windows: `.\.venv\Scripts\activate`
67
  pip install -r requirements.txt
68
- python models.py # Initialize database and train the baseline ensemble
69
  uvicorn main:app --reload --port 8000
70
  ```
71
 
72
- ### 2. Initialize the Client (Frontend)
73
- Requires Node.js 18+
 
 
74
  ```bash
75
  cd frontend
76
  npm install
77
  npm run dev
78
  ```
79
 
80
- The system will boot on `localhost:3000`. Navigate to the dashboard to monitor live telemetry streams, access MLOps pipelines, and export INT8 TinyML headers.
81
-
82
- ---
83
 
84
- ## πŸ“„ License
85
 
86
  Distributed under the MIT License. See `LICENSE` for more information.
 
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)
 
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/
 
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
72
  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.