IDKHowToCodeFr commited on
Commit
d6bc35a
·
verified ·
1 Parent(s): 0a4bd1a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. ARCHITECTURE.md +57 -102
ARCHITECTURE.md CHANGED
@@ -11,108 +11,63 @@ By aggressively decoupling the presentation layer (Client), the orchestration an
11
  ## 🏗 High-Level Architecture Diagram
12
 
13
  ```mermaid
14
- %% Generated by https://gitdiagram.com/idkhowtocodefr/heartflow_os
15
- flowchart TD
16
-
17
- subgraph group_client["Telemetry interface"]
18
- node_dashboard["Live dashboard<br/>[page.tsx]"]
19
- node_telemetry_context["Telemetry context"]
20
- node_history_ui["History view<br/>[page.tsx]"]
21
- node_analytics["Analytics view<br/>[page.tsx]"]
22
- node_simulator_ui["Simulator view<br/>[page.tsx]"]
23
- node_mlops_ui["MLOps view<br/>[page.tsx]"]
24
- node_edge_ui["Edge export view<br/>[page.tsx]"]
25
- node_architecture_ui["Architecture view<br/>[page.tsx]"]
26
- node_shap_chart["SHAP chart<br/>[ShapChart.tsx]"]
27
- end
28
-
29
- subgraph group_api["API orchestration"]
30
- node_api["FastAPI routes<br/>[main.py]"]
31
- node_simulator["Vitals simulator<br/>[simulator.py]"]
32
- end
33
-
34
- subgraph group_ml["Prediction and MLOps"]
35
- node_inference["Inference pipeline<br/>[inference.py]"]
36
- node_preprocessing["Feature preprocessing<br/>[preprocessing.py]"]
37
- node_ensemble["Soft-voting ensemble<br/>[ensemble.py]"]
38
- node_training["Model training<br/>[models.py]"]
39
- node_export["C code exporter<br/>[export.py]"]
40
- node_model_files["Trained model files"]
41
- node_dataset["Patient dataset"]
42
- end
43
-
44
- subgraph group_state["Persistence and sync"]
45
- node_database[("Prediction history<br/>[database.py]")]
46
- node_sqlite[("SQLite history store<br/>[patient_history.db]")]
47
- end
48
-
49
- node_clinician(("Clinical user"))
50
- node_hub["Hugging Face Hub"]
51
-
52
- node_clinician -.->|"monitors"| node_dashboard
53
- node_clinician -.->|"reviews"| node_history_ui
54
- node_clinician -.->|"explores"| node_analytics
55
- node_clinician -.->|"uses"| node_simulator_ui
56
- node_clinician -.->|"manages"| node_mlops_ui
57
- node_clinician -.->|"exports"| node_edge_ui
58
- node_clinician -.->|"views"| node_architecture_ui
59
- node_dashboard -->|"uses"| node_telemetry_context
60
- node_clinician -.->|"submits vitals"| node_api
61
- node_dashboard -.->|"streams telemetry"| node_api
62
- node_history_ui -.->|"requests history"| node_api
63
- node_analytics -.->|"requests data"| node_api
64
- node_mlops_ui -.->|"uploads retraining data"| node_api
65
- node_edge_ui -.->|"requests C export"| node_api
66
- node_api -->|"initializes and queries"| node_database
67
- node_api -->|"streams generated vitals"| node_simulator
68
- node_api -->|"evaluates vitals"| node_inference
69
- node_api -->|"prepares explanations"| node_preprocessing
70
- node_api -->|"generates C code"| node_export
71
- node_api -->|"loads and refreshes"| node_ensemble
72
- node_api -->|"starts background retraining"| node_training
73
- node_inference -->|"transforms features"| node_preprocessing
74
- node_inference -.->|"predicts probabilities"| node_ensemble
75
- node_ensemble -->|"resolves model directory"| node_preprocessing
76
- node_training -->|"splits and transforms data"| node_preprocessing
77
- node_training -->|"reads training data"| node_dataset
78
- node_training -->|"writes trained models"| node_model_files
79
- node_ensemble -->|"loads model artifacts"| node_model_files
80
- node_database -->|"reads and writes"| node_sqlite
81
- node_database -->|"syncs history"| node_hub
82
-
83
- click node_dashboard "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/dashboard/page.tsx"
84
- click node_telemetry_context "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/context/TelemetryContext.tsx"
85
- click node_history_ui "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/history/page.tsx"
86
- click node_analytics "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/analytics/page.tsx"
87
- click node_simulator_ui "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/simulator/page.tsx"
88
- click node_mlops_ui "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/mlops/page.tsx"
89
- click node_edge_ui "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/edge/page.tsx"
90
- click node_architecture_ui "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/app/architecture/page.tsx"
91
- click node_shap_chart "https://github.com/idkhowtocodefr/heartflow_os/blob/main/frontend/src/components/ShapChart.tsx"
92
- click node_api "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/main.py"
93
- click node_simulator "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/simulator.py"
94
- click node_inference "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/inference.py"
95
- click node_preprocessing "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/preprocessing.py"
96
- click node_ensemble "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/ensemble.py"
97
- click node_training "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/models.py"
98
- click node_export "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/export.py"
99
- click node_model_files "https://github.com/idkhowtocodefr/heartflow_os/tree/main/model"
100
- click node_dataset "https://github.com/idkhowtocodefr/heartflow_os/blob/main/data/patient_dataset.csv"
101
- click node_database "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/database.py"
102
- click node_sqlite "https://github.com/idkhowtocodefr/heartflow_os/blob/main/backend/patient_history.db"
103
-
104
- classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
105
- classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
106
- classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
107
- classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
108
- classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
109
- classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
110
- classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
111
- class node_dashboard,node_telemetry_context,node_history_ui,node_analytics,node_simulator_ui,node_mlops_ui,node_edge_ui,node_architecture_ui,node_shap_chart,node_clinician toneBlue
112
- class node_api,node_simulator toneAmber
113
- class node_inference,node_preprocessing,node_ensemble,node_training,node_export,node_model_files,node_dataset toneMint
114
- class node_database,node_sqlite toneRose
115
- class node_hub toneIndigo
116
  ```
117
 
118
  ---
 
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["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
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
  ---