# karthik2007832/momcare architecture

> Architecture diagram of the GitHub repository karthik2007832/momcare, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/karthik2007832/momcare
- Repository: https://github.com/karthik2007832/momcare

## Overview

Mom Care is an IoT maternal-health monitoring dashboard. ESP32 telemetry can arrive over Wi-Fi or USB serial, then the backend broadcasts connection and sensor events to browser clients; the dashboard presents monitoring and caregiver-facing views. The product also includes emergency notifications, an AI chat endpoint, and simulated edge-analysis functions. The excerpts establish telemetry ingress and some backend integrations, but do not show the full sensor-data handling or most browser request wiring, so unsupported links are omitted.

Main entry points: [`app.js`](https://github.com/karthik2007832/momcare/blob/main/app.js) (Live Dashboard UI), [`server.js`](https://github.com/karthik2007832/momcare/blob/main/server.js) (Telemetry Service), [`ARDUINO_CONNECTION.ino`](https://github.com/karthik2007832/momcare/blob/main/ARDUINO_CONNECTION.ino) (ESP32 Device), [`index.html`](https://github.com/karthik2007832/momcare/blob/main/index.html) (Dashboard Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Telemetry Ingestion"]
  node_esp32["ESP32 Device"]
  node_wifi_ingress["Wi-Fi Ingress<br/>[server.js]"]
  node_serial_ingress["Serial Ingress<br/>[server.js]"]
end

subgraph group_backend["Backend Services"]
  node_telemetry["Telemetry Service<br/>[server.js]"]
  node_history_api["History and Status API<br/>[server.js]"]
end

subgraph group_dashboard["Monitoring Dashboard"]
  node_web_shell["Dashboard Shell<br/>[index.html]"]
  node_dashboard_ui["Live Dashboard UI<br/>[app.js]"]
  node_doctor_view["Doctor View<br/>[app.js]"]
  node_mother_view["Mother View<br/>[app.js]"]
  node_relative_view["Caregiver View<br/>[app.js]"]
  node_hospital_view["Hospital View<br/>[index.html]"]
end

subgraph group_care["Care Features"]
  node_health_analysis["Edge Health Analysis<br/>[ai_core.js]"]
  node_ai_chat["AI Chat Endpoint<br/>[server.js]"]
  node_emergency_routes["Emergency Alert Routes<br/>[server.js]"]
end

node_web_client(("Browser Client"))
node_groq["Groq AI Service"]
node_telegram["Telegram"]
node_whatsapp["WhatsApp"]

node_esp32 -->|"POSTs telemetry"| node_wifi_ingress
node_esp32 -->|"streams serial"| node_serial_ingress
node_wifi_ingress -->|"parses and broadcasts"| node_telemetry
node_serial_ingress -->|"parses and broadcasts"| node_telemetry
node_web_client -->|"opens dashboard"| node_web_shell
node_web_shell -->|"loads UI logic"| node_dashboard_ui
node_telemetry -->|"emits status events"| node_dashboard_ui
node_dashboard_ui -->|"updates view"| node_doctor_view
node_dashboard_ui -->|"updates view"| node_mother_view
node_dashboard_ui -->|"updates view"| node_relative_view
node_web_client -.->|"requests history"| node_history_api
node_ai_chat -->|"requests completions"| node_groq
node_emergency_routes -->|"sends alert"| node_telegram
node_emergency_routes -->|"sends alert"| node_whatsapp

click node_esp32 "https://github.com/karthik2007832/momcare/blob/main/ARDUINO_CONNECTION.ino"
click node_wifi_ingress "https://github.com/karthik2007832/momcare/blob/main/server.js"
click node_serial_ingress "https://github.com/karthik2007832/momcare/blob/main/server.js"
click node_telemetry "https://github.com/karthik2007832/momcare/blob/main/server.js"
click node_history_api "https://github.com/karthik2007832/momcare/blob/main/server.js"
click node_web_shell "https://github.com/karthik2007832/momcare/blob/main/index.html"
click node_dashboard_ui "https://github.com/karthik2007832/momcare/blob/main/app.js"
click node_doctor_view "https://github.com/karthik2007832/momcare/blob/main/app.js"
click node_mother_view "https://github.com/karthik2007832/momcare/blob/main/app.js"
click node_relative_view "https://github.com/karthik2007832/momcare/blob/main/app.js"
click node_hospital_view "https://github.com/karthik2007832/momcare/blob/main/index.html"
click node_health_analysis "https://github.com/karthik2007832/momcare/blob/main/ai_core.js"
click node_ai_chat "https://github.com/karthik2007832/momcare/blob/main/server.js"
click node_emergency_routes "https://github.com/karthik2007832/momcare/blob/main/server.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_esp32,node_wifi_ingress,node_serial_ingress,node_web_client toneBlue
class node_telemetry,node_history_api toneAmber
class node_web_shell,node_dashboard_ui,node_doctor_view,node_mother_view,node_relative_view,node_hospital_view toneMint
class node_health_analysis,node_ai_chat,node_emergency_routes toneRose
class node_groq,node_telegram,node_whatsapp toneIndigo
```

## Components

### Telemetry Ingestion

- [ESP32 Device](https://github.com/karthik2007832/momcare/blob/main/ARDUINO_CONNECTION.ino): `ARDUINO_CONNECTION.ino`
- [Wi-Fi Ingress](https://github.com/karthik2007832/momcare/blob/main/server.js): `server.js`
- [Serial Ingress](https://github.com/karthik2007832/momcare/blob/main/server.js): `server.js`

### Backend Services

- [Telemetry Service](https://github.com/karthik2007832/momcare/blob/main/server.js): `server.js`
- [History and Status API](https://github.com/karthik2007832/momcare/blob/main/server.js): `server.js`

### Monitoring Dashboard

- [Dashboard Shell](https://github.com/karthik2007832/momcare/blob/main/index.html): `index.html`
- [Live Dashboard UI](https://github.com/karthik2007832/momcare/blob/main/app.js): `app.js`
- [Doctor View](https://github.com/karthik2007832/momcare/blob/main/app.js): `app.js`
- [Mother View](https://github.com/karthik2007832/momcare/blob/main/app.js): `app.js`
- [Caregiver View](https://github.com/karthik2007832/momcare/blob/main/app.js): `app.js`
- [Hospital View](https://github.com/karthik2007832/momcare/blob/main/index.html): `index.html`

### Care Features

- [Edge Health Analysis](https://github.com/karthik2007832/momcare/blob/main/ai_core.js): `ai_core.js`
- [AI Chat Endpoint](https://github.com/karthik2007832/momcare/blob/main/server.js): `server.js`
- [Emergency Alert Routes](https://github.com/karthik2007832/momcare/blob/main/server.js): `server.js`

### Other components

- **Browser Client**
- **Groq AI Service**
- **Telegram**
- **WhatsApp**

## Connections

- ESP32 Device → Wi-Fi Ingress: POSTs telemetry (evidence: `server.js`)
- ESP32 Device → Serial Ingress: streams serial (evidence: `server.js`)
- Wi-Fi Ingress → Telemetry Service: parses and broadcasts (evidence: `server.js`)
- Serial Ingress → Telemetry Service: parses and broadcasts (evidence: `server.js`)
- Browser Client → Dashboard Shell: opens dashboard
- Dashboard Shell → Live Dashboard UI: loads UI logic (evidence: `app.js`)
- Telemetry Service → Live Dashboard UI: emits status events (evidence: `server.js`)
- Live Dashboard UI → Doctor View: updates view (evidence: `app.js`)
- Live Dashboard UI → Mother View: updates view (evidence: `app.js`)
- Live Dashboard UI → Caregiver View: updates view (evidence: `app.js`)
- Browser Client → History and Status API: requests history
- AI Chat Endpoint → Groq AI Service: requests completions (evidence: `server.js`)
- Emergency Alert Routes → Telegram: sends alert (evidence: `server.js`)
- Emergency Alert Routes → WhatsApp: sends alert (evidence: `server.js`)
