# aahmeddev/dapp2_mol_group_f-myowave architecture

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

- Interactive diagram: https://gitdiagram.com/aahmeddev/dapp2_mol_group_f-myowave
- Repository: https://github.com/aahmeddev/dapp2_mol_group_f-myowave

## Overview

MYOWAVE acquires uterine EHG signals, turns contractions into spectral and temporal event features, stores longitudinal records, and presents them to researchers and participants. The principal workflow runs from a researcher-managed session through serial acquisition, local buffering, feature extraction, and cloud synchronization, then into cohort, patient, and export views. The README also documents patient cycle and pain logging, synthetic cohort generation, and remote tunnels. Some links rely on README statements or the source index because the relevant implementation was not excerpted.

Main entry points: [`nicegui_site/background_service.py`](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/background_service.py) (Serial DAQ Service), [`nicegui_site/dashboard.py`](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/dashboard.py) (Researcher Portal), [`nicegui_site/config_db.py`](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/config_db.py) (Firebase Records), [`nicegui_site/launcher.py`](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/launcher.py) (Platform Launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Acquisition &amp; DSP"]
  node_daq["Serial DAQ Service"]
  node_hardware{{"EHG Hardware"}}
  node_feature_engine["Feature Extraction<br/>[dsp_math.py]"]
end

subgraph group_data["Research Data"]
  node_local_store[("Local SQLite Store<br/>[config_db.py]")]
  node_cloud_store[("Firebase Records<br/>[config_db.py]")]
  node_synthetic_cohort["Synthetic Cohort Generator"]
end

subgraph group_researcher["Researcher Portal"]
  node_researcher_portal["Researcher Portal<br/>[dashboard.py]"]
  node_shared_layout["Shared Navigation<br/>[layout.py]"]
  node_session_manager["Session Manager<br/>[page_manager.py]"]
  node_cohort_analysis["Cohort Analysis<br/>[page_cohort.py]"]
  node_patient_analysis["Patient Analysis<br/>[page_patient.py]"]
  node_data_export["Dataset Export<br/>[page_export.py]"]
end

subgraph group_participant["Participant &amp; Access"]
  node_launcher["Platform Launcher<br/>[launcher.py]"]
  node_patient_portal["Patient Portal<br/>[patient_app.py]"]
  node_tunnel_service{{"Cloudflare Tunnels"}}
end

node_researcher_actor(("Researcher"))
node_participant_actor(("Participant"))

node_researcher_actor -->|"starts platform"| node_launcher
node_launcher -->|"starts service"| node_daq
node_launcher -->|"launches portal"| node_researcher_portal
node_launcher -->|"launches portal"| node_patient_portal
node_launcher -.->|"configures tunnels"| node_tunnel_service
node_daq -->|"reads serial"| node_hardware
node_daq -->|"stores raw samples"| node_local_store
node_daq -->|"reads pending events"| node_local_store
node_daq -.->|"extracts features"| node_feature_engine
node_daq -->|"syncs event features"| node_cloud_store
node_synthetic_cohort -.->|"populates cohort"| node_cloud_store
node_researcher_portal -->|"routes to"| node_session_manager
node_researcher_portal -->|"routes to"| node_cohort_analysis
node_researcher_portal -->|"routes to"| node_patient_analysis
node_researcher_portal -->|"routes to"| node_data_export
node_session_manager -->|"reads patient data"| node_cloud_store
node_cohort_analysis -->|"loads cohort events"| node_cloud_store
node_patient_analysis -.->|"loads patient records"| node_cloud_store
node_data_export -.->|"loads export data"| node_cloud_store
node_researcher_portal -.->|"renders navigation"| node_shared_layout
node_patient_portal -.->|"syncs cycle and pain"| node_cloud_store
node_participant_actor -->|"uses portal"| node_patient_portal

click node_launcher "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/launcher.py"
click node_daq "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/background_service.py"
click node_feature_engine "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/dsp_math.py"
click node_local_store "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/config_db.py"
click node_cloud_store "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/config_db.py"
click node_synthetic_cohort "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/generate_synthetic_data.py"
click node_researcher_portal "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/dashboard.py"
click node_shared_layout "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/layout.py"
click node_session_manager "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_manager.py"
click node_cohort_analysis "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_cohort.py"
click node_patient_analysis "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_patient.py"
click node_data_export "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_export.py"
click node_patient_portal "https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/patient_app.py"

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_daq,node_hardware,node_feature_engine toneBlue
class node_local_store,node_cloud_store,node_synthetic_cohort toneAmber
class node_researcher_portal,node_shared_layout,node_session_manager,node_cohort_analysis,node_patient_analysis,node_data_export toneMint
class node_launcher,node_patient_portal,node_tunnel_service toneRose
class node_researcher_actor,node_participant_actor toneIndigo
```

## Components

### Acquisition & DSP

- [Serial DAQ Service](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/background_service.py): `nicegui_site/background_service.py`
- **EHG Hardware**
- [Feature Extraction](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/dsp_math.py): `nicegui_site/dsp_math.py`

### Research Data

- [Local SQLite Store](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/config_db.py): `nicegui_site/config_db.py`
- [Firebase Records](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/config_db.py): `nicegui_site/config_db.py`
- [Synthetic Cohort Generator](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/generate_synthetic_data.py): `nicegui_site/generate_synthetic_data.py`

### Researcher Portal

- [Researcher Portal](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/dashboard.py): `nicegui_site/dashboard.py`
- [Shared Navigation](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/layout.py): `nicegui_site/layout.py`
- [Session Manager](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_manager.py): `nicegui_site/page_manager.py`
- [Cohort Analysis](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_cohort.py): `nicegui_site/page_cohort.py`
- [Patient Analysis](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_patient.py): `nicegui_site/page_patient.py`
- [Dataset Export](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/page_export.py): `nicegui_site/page_export.py`

### Participant & Access

- [Platform Launcher](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/launcher.py): `nicegui_site/launcher.py`
- [Patient Portal](https://github.com/aahmeddev/dapp2_mol_group_f-myowave/blob/master/nicegui_site/patient_app.py): `nicegui_site/patient_app.py`
- **Cloudflare Tunnels**

### Other components

- **Researcher**
- **Participant**

## Connections

- Researcher → Platform Launcher: starts platform (evidence: `README.md`)
- Platform Launcher → Serial DAQ Service: starts service (evidence: `README.md`)
- Platform Launcher → Researcher Portal: launches portal (evidence: `README.md`)
- Platform Launcher → Patient Portal: launches portal (evidence: `README.md`)
- Platform Launcher → Cloudflare Tunnels: configures tunnels (evidence: `README.md`)
- Serial DAQ Service → EHG Hardware: reads serial (evidence: `nicegui_site/background_service.py`)
- Serial DAQ Service → Local SQLite Store: stores raw samples (evidence: `nicegui_site/background_service.py`)
- Serial DAQ Service → Local SQLite Store: reads pending events (evidence: `nicegui_site/background_service.py`)
- Serial DAQ Service → Feature Extraction: extracts features (evidence: `nicegui_site/background_service.py`)
- Serial DAQ Service → Firebase Records: syncs event features (evidence: `nicegui_site/background_service.py`)
- Synthetic Cohort Generator → Firebase Records: populates cohort (evidence: `nicegui_site/generate_synthetic_data.py`)
- Researcher Portal → Session Manager: routes to (evidence: `nicegui_site/dashboard.py`)
- Researcher Portal → Cohort Analysis: routes to (evidence: `nicegui_site/dashboard.py`)
- Researcher Portal → Patient Analysis: routes to (evidence: `nicegui_site/dashboard.py`)
- Researcher Portal → Dataset Export: routes to (evidence: `nicegui_site/dashboard.py`)
- Session Manager → Firebase Records: reads patient data (evidence: `nicegui_site/page_manager.py`)
- Cohort Analysis → Firebase Records: loads cohort events (evidence: `nicegui_site/page_cohort.py`)
- Patient Analysis → Firebase Records: loads patient records (evidence: `nicegui_site/page_patient.py`)
- Dataset Export → Firebase Records: loads export data (evidence: `nicegui_site/page_export.py`)
- Researcher Portal → Shared Navigation: renders navigation
- Patient Portal → Firebase Records: syncs cycle and pain (evidence: `README.md`)
- Participant → Patient Portal: uses portal (evidence: `README.md`)
