# anaghabl/nayana_pec architecture

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

- Interactive diagram: https://gitdiagram.com/anaghabl/nayana_pec
- Repository: https://github.com/anaghabl/nayana_pec

## Overview

Nayana.ai is a tele-ophthalmology screening application: patients describe symptoms, submit eye images, receive AI-assisted results, and can review reports and longitudinal records; doctors review cases. The repository also includes a distinct prototype EOG workflow. The README documents Raspberry Pi capture and image delivery, while sampled code confirms encrypted case storage, blockchain updates, and EOG acquisition and analysis. Some app-to-module wiring and unsampled feature implementations are not visible, so uncertain links are omitted.

Main entry points: [`app.py`](https://github.com/anaghabl/nayana_pec/blob/main/app.py) (Screening App), [`database.py`](https://github.com/anaghabl/nayana_pec/blob/main/database.py) (Case and Record Data), [`eog/ui.py`](https://github.com/anaghabl/nayana_pec/blob/main/eog/ui.py) (EOG Interface), [`patient_records.py`](https://github.com/anaghabl/nayana_pec/blob/main/patient_records.py) (Patient Records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screening["Patient Screening"]
  node_pi_camera["Pi Capture<br/>[capture.py]"]
  node_receiver["Image Receiver<br/>[receiver.py]"]
  node_app["Screening App<br/>[app.py]"]
  node_symptoms["Symptom Chat<br/>[chatbot_flow.py]"]
  node_voice["Voice Input<br/>[voice_input.py]"]
  node_optical["Optical Analysis"]
  node_disease_info["Disease Guidance<br/>[disease_info.py]"]
  node_screen_report["Screening Reports"]
end

subgraph group_care["Clinical Records"]
  node_dashboard["Doctor Dashboard"]
  node_patient_records["Patient Records<br/>[patient_records.py]"]
  node_patient_results["Patient Results<br/>[patient_results.py]"]
  node_medical_history["Medical History<br/>[medical_history.py]"]
  node_database[("Case and Record Data<br/>[database.py]")]
end

subgraph group_security["Identity and Integrity"]
  node_auth["Authentication<br/>[auth.py]"]
  node_encryption["Encryption<br/>[encryption.py]"]
  node_blockchain["Result Ledger<br/>[blockchain.py]"]
end

subgraph group_eog["EOG Prototype"]
  node_eog_ui["EOG Interface<br/>[ui.py]"]
  node_eog_acquisition["Serial Acquisition<br/>[acquisition.py]"]
  node_eog_analysis["Signal Analysis<br/>[analysis.py]"]
  node_eog_demo["Demo Signal<br/>[demo.py]"]
  node_eog_report["EOG Report<br/>[report.py]"]
end

node_patient(("Patient"))
node_doctor(("Doctor"))
node_eog_user(("EOG User"))

node_patient -->|"uses screening"| node_app
node_patient -->|"triggers capture"| node_pi_camera
node_pi_camera -->|"posts images"| node_receiver
node_receiver -->|"delivers images"| node_app
node_app -->|"runs symptom flow"| node_symptoms
node_symptoms -->|"records speech"| node_voice
node_app -->|"analyzes eyes"| node_optical
node_app -->|"shows guidance"| node_disease_info
node_app -->|"loads cases"| node_database
node_app -->|"generates PDF"| node_screen_report
node_doctor -->|"reviews cases"| node_dashboard
node_dashboard -->|"updates cases"| node_database
node_patient -->|"views history"| node_patient_records
node_patient -->|"views results"| node_patient_results
node_patient_records -->|"reads history"| node_database
node_patient_records -->|"requests reports"| node_screen_report
node_medical_history -->|"reads records"| node_database
node_patient -->|"authenticates"| node_auth
node_doctor -->|"authenticates"| node_auth
node_database -->|"encrypts data"| node_encryption
node_database -->|"adds case blocks"| node_blockchain
node_eog_user -->|"runs test"| node_eog_ui
node_eog_ui -->|"reads serial data"| node_eog_acquisition
node_eog_acquisition -->|"provides samples"| node_eog_analysis
node_eog_ui -->|"analyzes samples"| node_eog_analysis
node_eog_ui -.->|"uses demo mode"| node_eog_demo
node_eog_ui -->|"generates report"| node_eog_report

click node_pi_camera "https://github.com/anaghabl/nayana_pec/blob/main/capture.py"
click node_receiver "https://github.com/anaghabl/nayana_pec/blob/main/receiver.py"
click node_app "https://github.com/anaghabl/nayana_pec/blob/main/app.py"
click node_symptoms "https://github.com/anaghabl/nayana_pec/blob/main/chatbot_flow.py"
click node_voice "https://github.com/anaghabl/nayana_pec/blob/main/voice_input.py"
click node_optical "https://github.com/anaghabl/nayana_pec/blob/main/optical_health_scan.py"
click node_disease_info "https://github.com/anaghabl/nayana_pec/blob/main/disease_info.py"
click node_screen_report "https://github.com/anaghabl/nayana_pec/blob/main/report_generator.py"
click node_dashboard "https://github.com/anaghabl/nayana_pec/blob/main/doctor_dashboard.py"
click node_patient_records "https://github.com/anaghabl/nayana_pec/blob/main/patient_records.py"
click node_patient_results "https://github.com/anaghabl/nayana_pec/blob/main/patient_results.py"
click node_medical_history "https://github.com/anaghabl/nayana_pec/blob/main/medical_history.py"
click node_database "https://github.com/anaghabl/nayana_pec/blob/main/database.py"
click node_auth "https://github.com/anaghabl/nayana_pec/blob/main/auth.py"
click node_encryption "https://github.com/anaghabl/nayana_pec/blob/main/encryption.py"
click node_blockchain "https://github.com/anaghabl/nayana_pec/blob/main/blockchain.py"
click node_eog_ui "https://github.com/anaghabl/nayana_pec/blob/main/eog/ui.py"
click node_eog_acquisition "https://github.com/anaghabl/nayana_pec/blob/main/eog/acquisition.py"
click node_eog_analysis "https://github.com/anaghabl/nayana_pec/blob/main/eog/analysis.py"
click node_eog_demo "https://github.com/anaghabl/nayana_pec/blob/main/eog/demo.py"
click node_eog_report "https://github.com/anaghabl/nayana_pec/blob/main/eog/report.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_pi_camera,node_receiver,node_app,node_symptoms,node_voice,node_optical,node_disease_info,node_screen_report,node_eog_user toneBlue
class node_dashboard,node_patient_records,node_patient_results,node_medical_history,node_database toneAmber
class node_auth,node_encryption,node_blockchain toneMint
class node_eog_ui,node_eog_acquisition,node_eog_analysis,node_eog_demo,node_eog_report toneRose
class node_patient,node_doctor toneIndigo
```

## Components

### Patient Screening

- [Pi Capture](https://github.com/anaghabl/nayana_pec/blob/main/capture.py): `capture.py`
- [Image Receiver](https://github.com/anaghabl/nayana_pec/blob/main/receiver.py): `receiver.py`
- [Screening App](https://github.com/anaghabl/nayana_pec/blob/main/app.py): `app.py`
- [Symptom Chat](https://github.com/anaghabl/nayana_pec/blob/main/chatbot_flow.py): `chatbot_flow.py`
- [Voice Input](https://github.com/anaghabl/nayana_pec/blob/main/voice_input.py): `voice_input.py`
- [Optical Analysis](https://github.com/anaghabl/nayana_pec/blob/main/optical_health_scan.py): `optical_health_scan.py`
- [Disease Guidance](https://github.com/anaghabl/nayana_pec/blob/main/disease_info.py): `disease_info.py`
- [Screening Reports](https://github.com/anaghabl/nayana_pec/blob/main/report_generator.py): `report_generator.py`

### Clinical Records

- [Doctor Dashboard](https://github.com/anaghabl/nayana_pec/blob/main/doctor_dashboard.py): `doctor_dashboard.py`
- [Patient Records](https://github.com/anaghabl/nayana_pec/blob/main/patient_records.py): `patient_records.py`
- [Patient Results](https://github.com/anaghabl/nayana_pec/blob/main/patient_results.py): `patient_results.py`
- [Medical History](https://github.com/anaghabl/nayana_pec/blob/main/medical_history.py): `medical_history.py`
- [Case and Record Data](https://github.com/anaghabl/nayana_pec/blob/main/database.py): `database.py`

### Identity and Integrity

- [Authentication](https://github.com/anaghabl/nayana_pec/blob/main/auth.py): `auth.py`
- [Encryption](https://github.com/anaghabl/nayana_pec/blob/main/encryption.py): `encryption.py`
- [Result Ledger](https://github.com/anaghabl/nayana_pec/blob/main/blockchain.py): `blockchain.py`

### EOG Prototype

- [EOG Interface](https://github.com/anaghabl/nayana_pec/blob/main/eog/ui.py): `eog/ui.py`
- [Serial Acquisition](https://github.com/anaghabl/nayana_pec/blob/main/eog/acquisition.py): `eog/acquisition.py`
- [Signal Analysis](https://github.com/anaghabl/nayana_pec/blob/main/eog/analysis.py): `eog/analysis.py`
- [Demo Signal](https://github.com/anaghabl/nayana_pec/blob/main/eog/demo.py): `eog/demo.py`
- [EOG Report](https://github.com/anaghabl/nayana_pec/blob/main/eog/report.py): `eog/report.py`

### Other components

- **Patient**
- **Doctor**
- **EOG User**

## Connections

- Patient → Screening App: uses screening
- Patient → Pi Capture: triggers capture
- Pi Capture → Image Receiver: posts images
- Image Receiver → Screening App: delivers images
- Screening App → Symptom Chat: runs symptom flow
- Symptom Chat → Voice Input: records speech
- Screening App → Optical Analysis: analyzes eyes
- Screening App → Disease Guidance: shows guidance
- Screening App → Case and Record Data: loads cases
- Screening App → Screening Reports: generates PDF
- Doctor → Doctor Dashboard: reviews cases
- Doctor Dashboard → Case and Record Data: updates cases
- Patient → Patient Records: views history
- Patient → Patient Results: views results
- Patient Records → Case and Record Data: reads history
- Patient Records → Screening Reports: requests reports
- Medical History → Case and Record Data: reads records
- Patient → Authentication: authenticates
- Doctor → Authentication: authenticates
- Case and Record Data → Encryption: encrypts data
- Case and Record Data → Result Ledger: adds case blocks
- EOG User → EOG Interface: runs test
- EOG Interface → Serial Acquisition: reads serial data
- Serial Acquisition → Signal Analysis: provides samples
- EOG Interface → Signal Analysis: analyzes samples
- EOG Interface → Demo Signal: uses demo mode
- EOG Interface → EOG Report: generates report
