# arjun1502919/gemma-hackathon-314 architecture

> Architecture diagram of the GitHub repository arjun1502919/gemma-hackathon-314, 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/arjun1502919/gemma-hackathon-314
- Repository: https://github.com/arjun1502919/gemma-hackathon-314

## Overview

M.E.R.C.Y is a Streamlit health-education companion with symptom triage, regional-language assistance, and image-based medical-report explanations. Users enter symptoms or a question, or upload a report; the app prepares the relevant prompt and context, calls Gemma, and presents the response with safety guidance. Triage results also update consultation and dashboard state. The README describes a reference CSV that is not present in the supplied tree, and APP2.py excerpts omit parts of the UI and handlers, so uncertain wiring is not shown.

Main entry points: [`gemma_client.py`](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/gemma_client.py) (Gemma API client), [`APP2.py`](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py) (Streamlit application), [`prompts.py`](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/prompts.py) (Safety prompts), [`rag.py`](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/rag.py) (Condition retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_app["Streamlit application<br/>[APP2.py]"]
  node_symptoms["Symptom intake<br/>[APP2.py]"]
  node_language["Language assistant<br/>[APP2.py]"]
  node_report["Report explainer<br/>[APP2.py]"]
  node_dashboard["Health dashboard<br/>[APP2.py]"]
end

subgraph group_triage["Triage and Safety"]
  node_emergency["Emergency check<br/>[APP2.py]"]
  node_retrieval["Condition retrieval<br/>[rag.py]"]
  node_prompts["Safety prompts<br/>[prompts.py]"]
  node_triage_result["Triage and urgency<br/>[APP2.py]"]
end

subgraph group_ai["Gemma Services"]
  node_gemma_client["Gemma API client<br/>[gemma_client.py]"]
end

subgraph group_state["Consultation State"]
  node_consultations[("Consultation history<br/>[APP2.py]")]
  node_doctor_summary["Doctor summary<br/>[APP2.py]"]
end

node_user(("Health companion user"))
node_gemma{{"Google Gemma API"}}

node_user -->|"enters symptoms"| node_symptoms
node_user -->|"asks question"| node_language
node_user -->|"uploads report"| node_report
node_symptoms -->|"checks urgency"| node_emergency
node_app -->|"retrieves context"| node_retrieval
node_app -->|"uses instructions"| node_prompts
node_app -->|"requests response"| node_gemma_client
node_language -->|"sets language"| node_prompts
node_report -->|"sends image request"| node_gemma_client
node_gemma_client -->|"calls model"| node_gemma
node_gemma -->|"returns response"| node_gemma_client
node_gemma_client -->|"returns explanation"| node_report
node_gemma_client -->|"returns answer"| node_triage_result
node_triage_result -->|"saves interaction"| node_consultations
node_consultations -->|"feeds metrics"| node_dashboard
node_consultations -->|"builds summary"| node_doctor_summary

click node_app "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_symptoms "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_language "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_report "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_dashboard "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_emergency "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_retrieval "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/rag.py"
click node_prompts "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/prompts.py"
click node_triage_result "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_consultations "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_doctor_summary "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py"
click node_gemma_client "https://github.com/arjun1502919/gemma-hackathon-314/blob/main/gemma_client.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_app,node_symptoms,node_language,node_report,node_dashboard,node_user toneBlue
class node_emergency,node_retrieval,node_prompts,node_triage_result toneAmber
class node_gemma_client,node_gemma toneMint
class node_consultations,node_doctor_summary toneRose
```

## Components

### User Experience

- [Streamlit application](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`
- [Symptom intake](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`
- [Language assistant](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`
- [Report explainer](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`
- [Health dashboard](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`

### Triage and Safety

- [Emergency check](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`
- [Condition retrieval](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/rag.py): `rag.py`
- [Safety prompts](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/prompts.py): `prompts.py`
- [Triage and urgency](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`

### Gemma Services

- [Gemma API client](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/gemma_client.py): `gemma_client.py`

### Consultation State

- [Consultation history](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`
- [Doctor summary](https://github.com/arjun1502919/gemma-hackathon-314/blob/main/APP2.py): `APP2.py`

### Other components

- **Health companion user**
- **Google Gemma API**

## Connections

- Health companion user → Symptom intake: enters symptoms
- Health companion user → Language assistant: asks question
- Health companion user → Report explainer: uploads report
- Symptom intake → Emergency check: checks urgency
- Streamlit application → Condition retrieval: retrieves context
- Streamlit application → Safety prompts: uses instructions
- Streamlit application → Gemma API client: requests response
- Language assistant → Safety prompts: sets language
- Report explainer → Gemma API client: sends image request
- Gemma API client → Google Gemma API: calls model
- Google Gemma API → Gemma API client: returns response
- Gemma API client → Report explainer: returns explanation
- Gemma API client → Triage and urgency: returns answer
- Triage and urgency → Consultation history: saves interaction
- Consultation history → Health dashboard: feeds metrics
- Consultation history → Doctor summary: builds summary
