# yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations architecture

> Architecture diagram of the GitHub repository yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations
- Repository: https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations

## Overview

This repository provides a healthcare e-consultation sentiment and urgency analysis product, with an interactive Streamlit dashboard as its main user entry point. The dashboard accepts consultation text or audio and can present sentiment, clinical urgency, and token-level SHAP explanations; the README also documents batch CSV triage and model benchmarking. The internal workflow detects language, translates to English, then runs urgency and sentiment analysis. Training and dataset preparation form a separate model-development branch. Source excerpts are partial, so unsampled subsystem links are included only where README or SOURCE INDEX evidence supports them.

Main entry points: [`app/dashboard.py`](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/app/dashboard.py) (Clinical dashboard), [`src/healthcare_sentiment/pipeline.py`](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/pipeline.py) (Inference coordinator), [`scripts/prepare_data.py`](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/scripts/prepare_data.py) (Dataset preparation), [`src/healthcare_sentiment/models/predict.py`](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/predict.py) (Sentiment prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Clinical experience"]
  node_dashboard["Clinical dashboard<br/>[dashboard.py]"]
  node_ui_language["UI translations<br/>[i18n.py]"]
end

subgraph group_inference["Clinical inference"]
  node_speech["Speech transcription<br/>[speech.py]"]
  node_pipeline["Inference coordinator<br/>[pipeline.py]"]
  node_language["Language detection<br/>[detect.py]"]
  node_translation["Clinical translation<br/>[translate.py]"]
  node_urgency["Urgency triage<br/>[detector.py]"]
  node_predictor["Sentiment prediction<br/>[predict.py]"]
end

subgraph group_modeling["Model development"]
  node_biobert["BioBERT model<br/>[biobert.py]"]
  node_config["Pipeline configuration<br/>[config.py]"]
  node_train["Model training<br/>[trainer.py]"]
end

subgraph group_data["Data preparation"]
  node_prepare["Dataset preparation<br/>[prepare_data.py]"]
  node_loaders["Dataset loading<br/>[loaders.py]"]
  node_preprocessing["Text preprocessing<br/>[preprocessing.py]"]
  node_splits["Dataset splits<br/>[splits.py]"]
end

subgraph group_explainability["Explanation and evaluation"]
  node_explainer["Token explanations<br/>[shap_explainer.py]"]
  node_evaluate["Model evaluation<br/>[evaluate.py]"]
  node_benchmark["Model benchmarks<br/>[benchmark.py]"]
end

node_patient(("Clinician or patient"))
node_external_speech["Speech recognition service"]
node_external_translation["Translation service"]

node_patient -->|"submits consultation"| node_dashboard
node_dashboard -->|"renders language UI"| node_ui_language
node_dashboard -->|"transcribes audio"| node_speech
node_dashboard -->|"requests analysis"| node_pipeline
node_pipeline -->|"detects language"| node_language
node_pipeline -->|"translates text"| node_translation
node_pipeline -->|"scores urgency"| node_urgency
node_pipeline -->|"predicts sentiment"| node_predictor
node_dashboard -->|"generates highlights"| node_explainer
node_explainer -->|"uses predictions"| node_predictor
node_predictor -->|"loads checkpoint model"| node_biobert
node_prepare -->|"loads settings"| node_config
node_prepare -->|"loads datasets"| node_loaders
node_prepare -->|"cleans records"| node_preprocessing
node_prepare -->|"creates splits"| node_splits
node_train -->|"uses training settings"| node_config
node_train -->|"fine-tunes model"| node_biobert
node_evaluate -.->|"compares models"| node_benchmark
node_speech -.->|"requests transcription"| node_external_speech
node_translation -.->|"may use service"| node_external_translation

click node_dashboard "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/app/dashboard.py"
click node_ui_language "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/app/i18n.py"
click node_speech "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/multilingual/speech.py"
click node_pipeline "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/pipeline.py"
click node_language "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/multilingual/detect.py"
click node_translation "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/multilingual/translate.py"
click node_urgency "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/urgency/detector.py"
click node_predictor "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/predict.py"
click node_biobert "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/biobert.py"
click node_explainer "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/explainability/shap_explainer.py"
click node_config "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/config.py"
click node_prepare "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/scripts/prepare_data.py"
click node_loaders "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/data/loaders.py"
click node_preprocessing "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/data/preprocessing.py"
click node_splits "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/data/splits.py"
click node_train "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/trainer.py"
click node_evaluate "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/evaluate.py"
click node_benchmark "https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/benchmark.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_dashboard,node_ui_language toneBlue
class node_speech,node_pipeline,node_language,node_translation,node_urgency,node_predictor toneAmber
class node_biobert,node_config,node_train toneMint
class node_prepare,node_loaders,node_preprocessing,node_splits toneRose
class node_explainer,node_evaluate,node_benchmark,node_patient,node_external_speech,node_external_translation toneIndigo
```

## Components

### Clinical experience

- [Clinical dashboard](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/app/dashboard.py): `app/dashboard.py`
- [UI translations](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/app/i18n.py): `app/i18n.py`

### Clinical inference

- [Speech transcription](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/multilingual/speech.py): `src/healthcare_sentiment/multilingual/speech.py`
- [Inference coordinator](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/pipeline.py): `src/healthcare_sentiment/pipeline.py`
- [Language detection](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/multilingual/detect.py): `src/healthcare_sentiment/multilingual/detect.py`
- [Clinical translation](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/multilingual/translate.py): `src/healthcare_sentiment/multilingual/translate.py`
- [Urgency triage](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/urgency/detector.py): `src/healthcare_sentiment/urgency/detector.py`
- [Sentiment prediction](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/predict.py): `src/healthcare_sentiment/models/predict.py`

### Model development

- [BioBERT model](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/biobert.py): `src/healthcare_sentiment/models/biobert.py`
- [Pipeline configuration](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/config.py): `src/healthcare_sentiment/config.py`
- [Model training](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/trainer.py): `src/healthcare_sentiment/models/trainer.py`

### Data preparation

- [Dataset preparation](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/scripts/prepare_data.py): `scripts/prepare_data.py`
- [Dataset loading](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/data/loaders.py): `src/healthcare_sentiment/data/loaders.py`
- [Text preprocessing](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/data/preprocessing.py): `src/healthcare_sentiment/data/preprocessing.py`
- [Dataset splits](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/data/splits.py): `src/healthcare_sentiment/data/splits.py`

### Explanation and evaluation

- [Token explanations](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/explainability/shap_explainer.py): `src/healthcare_sentiment/explainability/shap_explainer.py`
- [Model evaluation](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/evaluate.py): `src/healthcare_sentiment/models/evaluate.py`
- [Model benchmarks](https://github.com/yashmgp69420/domain-aware-sentiment-analysis-for-healthcare-e-consultations/blob/master/src/healthcare_sentiment/models/benchmark.py): `src/healthcare_sentiment/models/benchmark.py`

### Other components

- **Clinician or patient**
- **Speech recognition service**
- **Translation service**

## Connections

- Clinician or patient → Clinical dashboard: submits consultation (evidence: `README.md`)
- Clinical dashboard → UI translations: renders language UI (evidence: `app/dashboard.py`)
- Clinical dashboard → Speech transcription: transcribes audio (evidence: `app/dashboard.py`)
- Clinical dashboard → Inference coordinator: requests analysis (evidence: `app/dashboard.py`)
- Inference coordinator → Language detection: detects language (evidence: `src/healthcare_sentiment/pipeline.py`)
- Inference coordinator → Clinical translation: translates text (evidence: `src/healthcare_sentiment/pipeline.py`)
- Inference coordinator → Urgency triage: scores urgency (evidence: `src/healthcare_sentiment/pipeline.py`)
- Inference coordinator → Sentiment prediction: predicts sentiment (evidence: `src/healthcare_sentiment/pipeline.py`)
- Clinical dashboard → Token explanations: generates highlights (evidence: `app/dashboard.py`)
- Token explanations → Sentiment prediction: uses predictions (evidence: `src/healthcare_sentiment/explainability/shap_explainer.py`)
- Sentiment prediction → BioBERT model: loads checkpoint model (evidence: `src/healthcare_sentiment/models/predict.py`)
- Dataset preparation → Pipeline configuration: loads settings (evidence: `scripts/prepare_data.py`)
- Dataset preparation → Dataset loading: loads datasets (evidence: `scripts/prepare_data.py`)
- Dataset preparation → Text preprocessing: cleans records (evidence: `scripts/prepare_data.py`)
- Dataset preparation → Dataset splits: creates splits (evidence: `scripts/prepare_data.py`)
- Model training → Pipeline configuration: uses training settings (evidence: `src/healthcare_sentiment/models/trainer.py`)
- Model training → BioBERT model: fine-tunes model (evidence: `src/healthcare_sentiment/models/trainer.py`)
- Model evaluation → Model benchmarks: compares models
- Speech transcription → Speech recognition service: requests transcription
- Clinical translation → Translation service: may use service
