# s4n1dhy4/disastersense architecture

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

- Interactive diagram: https://gitdiagram.com/s4n1dhy4/disastersense
- Repository: https://github.com/s4n1dhy4/disastersense

## Overview

This repository contains three separate products: a blockchain cause-fundraising app, a disaster-message analysis web app, and a bulk-email management app. The main user workflows are creating or donating to causes, submitting disaster text for classification and location extraction, and managing contacts and sending or scheduling email. The disaster app also includes data ingestion and classifier-training modules. Edges reflect shown calls or imports; links to disaster guidance and unsampled ingestion/training behavior are omitted where their runtime wiring is not evidenced.

Main entry points: [`mma/app.py`](https://github.com/s4n1dhy4/disastersense/blob/main/mma/app.py) (Email dashboard), [`disasense/app/run.py`](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/run.py) (Analysis web app), [`mma/services/bulk_email.py`](https://github.com/s4n1dhy4/disastersense/blob/main/mma/services/bulk_email.py) (Bulk email dispatch), [`DeSenseRescue/src/App.js`](https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/App.js) (Causes UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rescue["DeSenseRescue fundraising"]
  node_rescue_ui["Causes UI<br/>[App.js]"]
  node_web3["Web3 provider<br/>[web3.js]"]
  node_cause_factory["Cause registry"]
  node_cause_contract["Cause instance"]
end

subgraph group_disaster["Disaster analysis"]
  node_disaster_web["Analysis web app<br/>[run.py]"]
  node_location["Location extraction<br/>[location.py]"]
  node_classifier_training["Classifier training"]
  node_message_processing["Message processing<br/>[process_data.py]"]
  node_data_ingestion["Disaster data ingestion"]
  node_disease_guidance["Disease guidance<br/>[disease.py]"]
  node_response_db[("Response database")]
  node_merged_data[("Merged reports<br/>[merged_data.csv]")]
end

subgraph group_mail["Email management"]
  node_mail_ui["Email dashboard<br/>[app.py]"]
  node_users[("User accounts<br/>[user_db.py]")]
  node_contacts_templates[("Contacts and templates<br/>[email_db.py]")]
  node_csv_import["CSV contact import<br/>[csv_import.py]"]
  node_bulk_send["Bulk email dispatch<br/>[bulk_email.py]"]
  node_scheduler["Email scheduler<br/>[scheduler.py]"]
  node_email_logs[("Delivery logs<br/>[logs_db.py]")]
  node_gmail_auth["Gmail integration<br/>[gmail_auth.py]"]
  node_outlook_auth["Outlook integration<br/>[outlook_win32.py]"]
  node_genai["AI email generation<br/>[genai_email.py]"]
end

node_donor(("Fundraising user"))
node_chain[("Ethereum network")]
node_disaster_user(("Disaster analyst"))
node_mail_user(("Email manager"))
node_gmail["Gmail"]

node_donor -->|"uses"| node_rescue_ui
node_rescue_ui -->|"uses provider"| node_web3
node_rescue_ui -->|"starts causes"| node_cause_factory
node_rescue_ui -->|"loads and donates"| node_cause_contract
node_cause_factory -->|"creates contract"| node_web3
node_cause_contract -->|"creates contract"| node_web3
node_web3 -->|"connects"| node_chain
node_disaster_user -->|"submits query"| node_disaster_web
node_disaster_web -->|"extracts locations"| node_location
node_disaster_web -->|"reads messages"| node_response_db
node_disaster_web -->|"reads descriptions"| node_merged_data
node_disaster_web -.->|"uses guidance"| node_disease_guidance
node_classifier_training -.->|"uses processed data"| node_message_processing
node_data_ingestion -.->|"prepares datasets"| node_message_processing
node_mail_user -->|"manages email"| node_mail_ui
node_mail_ui -->|"registers and checks"| node_users
node_mail_ui -->|"manages contacts"| node_contacts_templates
node_mail_ui -->|"imports contacts"| node_csv_import
node_csv_import -->|"adds contacts"| node_contacts_templates
node_mail_ui -->|"sends bulk mail"| node_bulk_send
node_mail_ui -->|"manages schedules"| node_scheduler
node_mail_ui -->|"reads statistics"| node_email_logs
node_mail_ui -->|"generates email"| node_genai
node_bulk_send -->|"sends via Gmail"| node_gmail_auth
node_bulk_send -->|"sends via Outlook"| node_outlook_auth
node_bulk_send -->|"records outcomes"| node_email_logs
node_bulk_send -->|"schedules sends"| node_scheduler
node_gmail_auth -->|"sends message"| node_gmail

click node_rescue_ui "https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/App.js"
click node_web3 "https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/web3.js"
click node_cause_factory "https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/contracts/DeSenseRescueInstance.js"
click node_cause_contract "https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/contracts/TheCauseInstance.js"
click node_disaster_web "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/run.py"
click node_location "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/location.py"
click node_classifier_training "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/models/train_classifier.py"
click node_message_processing "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/data/process_data.py"
click node_data_ingestion "https://github.com/s4n1dhy4/disastersense/tree/main/disasense/data"
click node_disease_guidance "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/disease.py"
click node_response_db "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/data/DisasterResponse.db"
click node_merged_data "https://github.com/s4n1dhy4/disastersense/blob/main/disasense/data/merged_data.csv"
click node_mail_ui "https://github.com/s4n1dhy4/disastersense/blob/main/mma/app.py"
click node_users "https://github.com/s4n1dhy4/disastersense/blob/main/mma/database/user_db.py"
click node_contacts_templates "https://github.com/s4n1dhy4/disastersense/blob/main/mma/database/email_db.py"
click node_csv_import "https://github.com/s4n1dhy4/disastersense/blob/main/mma/utils/csv_import.py"
click node_bulk_send "https://github.com/s4n1dhy4/disastersense/blob/main/mma/services/bulk_email.py"
click node_scheduler "https://github.com/s4n1dhy4/disastersense/blob/main/mma/scheduler.py"
click node_email_logs "https://github.com/s4n1dhy4/disastersense/blob/main/mma/database/logs_db.py"
click node_gmail_auth "https://github.com/s4n1dhy4/disastersense/blob/main/mma/auth/gmail_auth.py"
click node_outlook_auth "https://github.com/s4n1dhy4/disastersense/blob/main/mma/auth/outlook_win32.py"
click node_genai "https://github.com/s4n1dhy4/disastersense/blob/main/mma/genai_email.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_rescue_ui,node_web3,node_cause_factory,node_cause_contract,node_donor toneBlue
class node_disaster_web,node_location,node_classifier_training,node_message_processing,node_data_ingestion,node_disease_guidance,node_response_db,node_merged_data,node_chain toneAmber
class node_mail_ui,node_users,node_contacts_templates,node_csv_import,node_bulk_send,node_scheduler,node_email_logs,node_gmail_auth,node_outlook_auth,node_genai toneMint
class node_disaster_user,node_mail_user,node_gmail toneIndigo
```

## Components

### DeSenseRescue fundraising

- [Causes UI](https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/App.js): `DeSenseRescue/src/App.js`
- [Web3 provider](https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/web3.js): `DeSenseRescue/src/web3.js`
- [Cause registry](https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/contracts/DeSenseRescueInstance.js): `DeSenseRescue/src/contracts/DeSenseRescueInstance.js`
- [Cause instance](https://github.com/s4n1dhy4/disastersense/blob/main/DeSenseRescue/src/contracts/TheCauseInstance.js): `DeSenseRescue/src/contracts/TheCauseInstance.js`

### Disaster analysis

- [Analysis web app](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/run.py): `disasense/app/run.py`
- [Location extraction](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/location.py): `disasense/app/location.py`
- [Classifier training](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/models/train_classifier.py): `disasense/models/train_classifier.py`
- [Message processing](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/data/process_data.py): `disasense/data/process_data.py`
- [Disaster data ingestion](https://github.com/s4n1dhy4/disastersense/tree/main/disasense/data): `disasense/data`
- [Disease guidance](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/app/disease.py): `disasense/app/disease.py`
- [Response database](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/data/DisasterResponse.db): `disasense/data/DisasterResponse.db`
- [Merged reports](https://github.com/s4n1dhy4/disastersense/blob/main/disasense/data/merged_data.csv): `disasense/data/merged_data.csv`

### Email management

- [Email dashboard](https://github.com/s4n1dhy4/disastersense/blob/main/mma/app.py): `mma/app.py`
- [User accounts](https://github.com/s4n1dhy4/disastersense/blob/main/mma/database/user_db.py): `mma/database/user_db.py`
- [Contacts and templates](https://github.com/s4n1dhy4/disastersense/blob/main/mma/database/email_db.py): `mma/database/email_db.py`
- [CSV contact import](https://github.com/s4n1dhy4/disastersense/blob/main/mma/utils/csv_import.py): `mma/utils/csv_import.py`
- [Bulk email dispatch](https://github.com/s4n1dhy4/disastersense/blob/main/mma/services/bulk_email.py): `mma/services/bulk_email.py`
- [Email scheduler](https://github.com/s4n1dhy4/disastersense/blob/main/mma/scheduler.py): `mma/scheduler.py`
- [Delivery logs](https://github.com/s4n1dhy4/disastersense/blob/main/mma/database/logs_db.py): `mma/database/logs_db.py`
- [Gmail integration](https://github.com/s4n1dhy4/disastersense/blob/main/mma/auth/gmail_auth.py): `mma/auth/gmail_auth.py`
- [Outlook integration](https://github.com/s4n1dhy4/disastersense/blob/main/mma/auth/outlook_win32.py): `mma/auth/outlook_win32.py`
- [AI email generation](https://github.com/s4n1dhy4/disastersense/blob/main/mma/genai_email.py): `mma/genai_email.py`

### Other components

- **Fundraising user**
- **Ethereum network**
- **Disaster analyst**
- **Email manager**
- **Gmail**

## Connections

- Fundraising user → Causes UI: uses
- Causes UI → Web3 provider: uses provider (evidence: `DeSenseRescue/src/App.js`)
- Causes UI → Cause registry: starts causes (evidence: `DeSenseRescue/src/App.js`)
- Causes UI → Cause instance: loads and donates (evidence: `DeSenseRescue/src/App.js`)
- Cause registry → Web3 provider: creates contract (evidence: `DeSenseRescue/src/contracts/DeSenseRescueInstance.js`)
- Cause instance → Web3 provider: creates contract (evidence: `DeSenseRescue/src/contracts/TheCauseInstance.js`)
- Web3 provider → Ethereum network: connects (evidence: `DeSenseRescue/src/web3.js`)
- Disaster analyst → Analysis web app: submits query
- Analysis web app → Location extraction: extracts locations (evidence: `disasense/app/run.py`)
- Analysis web app → Response database: reads messages (evidence: `disasense/app/run.py`)
- Analysis web app → Merged reports: reads descriptions (evidence: `disasense/app/run.py`)
- Analysis web app → Disease guidance: uses guidance
- Classifier training → Message processing: uses processed data
- Disaster data ingestion → Message processing: prepares datasets
- Email manager → Email dashboard: manages email
- Email dashboard → User accounts: registers and checks (evidence: `mma/app.py`)
- Email dashboard → Contacts and templates: manages contacts (evidence: `mma/app.py`)
- Email dashboard → CSV contact import: imports contacts (evidence: `mma/app.py`)
- CSV contact import → Contacts and templates: adds contacts (evidence: `mma/utils/csv_import.py`)
- Email dashboard → Bulk email dispatch: sends bulk mail (evidence: `mma/app.py`)
- Email dashboard → Email scheduler: manages schedules (evidence: `mma/app.py`)
- Email dashboard → Delivery logs: reads statistics (evidence: `mma/app.py`)
- Email dashboard → AI email generation: generates email (evidence: `mma/app.py`)
- Bulk email dispatch → Gmail integration: sends via Gmail (evidence: `mma/services/bulk_email.py`)
- Bulk email dispatch → Outlook integration: sends via Outlook (evidence: `mma/services/bulk_email.py`)
- Bulk email dispatch → Delivery logs: records outcomes (evidence: `mma/services/bulk_email.py`)
- Bulk email dispatch → Email scheduler: schedules sends (evidence: `mma/services/bulk_email.py`)
- Gmail integration → Gmail: sends message (evidence: `mma/auth/gmail_auth.py`)
