# 2025-asais-serbestkategori/serbestkategori-medturk architecture

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

- Interactive diagram: https://gitdiagram.com/2025-asais-serbestkategori/serbestkategori-medturk
- Repository: https://github.com/2025-asais-serbestkategori/serbestkategori-medturk

## Overview

MedTürk combines a Turkish medical image-and-text assistant with a Turkish medical dataset workflow, model training, and evaluation. The user flow is consent and chat in the web app, optional image upload, then a chat request to the FastAPI service and a streamed or returned answer. Separately, PubMedVision data is converted and standardized, while translation/detection supports Turkish dataset preparation; the README also documents MedGemma fine-tuning and VLLM-based evaluation. Frontend and dataset relationships follow sampled source; model-serving internals were not inspected, so that connection is unverified.

Main entry points: [`website/medturk-frontend/src/js/router.js`](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/router.js) (Route views), [`website/medturk-frontend/src/js/api.js`](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/api.js) (API client), [`website/medturk-frontend/src/js/ui/chat.js`](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/chat.js) (Chat view), [`website/medturk-frontend/src/js/ui/components/ChatComposer.js`](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ChatComposer.js) (Message composer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_router["Route views<br/>[router.js]"]
  node_chat["Chat view<br/>[chat.js]"]
  node_composer["Message composer<br/>[ChatComposer.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_store[("Session state<br/>[store.js]")]
  node_message_views["Message rendering<br/>[MessageItem.js]"]
  node_attachment_view["Image attachment view<br/>[ImageAttachment.js]"]
  node_consent["Consent dialog<br/>[ConsentModal.js]"]
  node_settings["Settings<br/>[settings.js]"]
  node_profile["Profile view<br/>[profile.js]"]
  node_i18n["Language support<br/>[i18n.js]"]
  node_toast["Notifications<br/>[Toast.js]"]
  node_health["Connection check<br/>[HealthCheck.js]"]
end

subgraph group_service["Chat service"]
  node_api_server["FastAPI service<br/>[main.py]"]
end

subgraph group_data["Dataset preparation"]
  node_dataset_source["PubMedVision conversion"]
  node_dataset_pipeline["Dataset standardization<br/>[pipeline.py]"]
  node_translation["Turkish translation"]
  node_language_detection["Language detection<br/>[detect.py]"]
  node_dataset_merge["Translation merge<br/>[merge.py]"]
end

subgraph group_model["Model research"]
  node_training["MedGemma fine-tuning<br/>[MedGemma.ipynb]"]
  node_evaluation["Model evaluation"]
  node_model_runtime["MedTurk model"]
end

node_visitor(("User"))
node_browser_storage[("Browser local storage")]

node_visitor -->|"opens app"| node_router
node_router -->|"checks consent"| node_consent
node_router -->|"renders route"| node_chat
node_router -->|"renders route"| node_settings
node_router -->|"renders route"| node_profile
node_chat -->|"creates composer"| node_composer
node_chat -->|"renders messages"| node_message_views
node_message_views -->|"renders DICOM"| node_attachment_view
node_composer -->|"updates sessions"| node_store
node_composer -->|"uploads and chats"| node_api_client
node_api_client -->|"sends HTTP requests"| node_api_server
node_api_server -.->|"invokes model"| node_model_runtime
node_store -->|"persists state"| node_browser_storage
node_settings -->|"updates preferences"| node_store
node_settings -->|"renders ping"| node_health
node_health -->|"checks health"| node_api_client
node_api_client -->|"reports upload errors"| node_toast
node_visitor -.->|"provides source data"| node_dataset_source
node_dataset_source -->|"standardizes data"| node_dataset_pipeline
node_visitor -.->|"prepares translations"| node_translation
node_translation -.->|"supports dataset cleanup"| node_language_detection
node_language_detection -.->|"merges review results"| node_dataset_merge
node_dataset_pipeline -->|"supplies training data"| node_training
node_training -->|"produces fine-tuned model"| node_model_runtime
node_model_runtime -->|"evaluated with metrics"| node_evaluation

click node_router "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/router.js"
click node_chat "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/chat.js"
click node_composer "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ChatComposer.js"
click node_api_client "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/api.js"
click node_store "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/store.js"
click node_message_views "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/MessageItem.js"
click node_attachment_view "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ImageAttachment.js"
click node_consent "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ConsentModal.js"
click node_settings "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/settings.js"
click node_profile "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/profile.js"
click node_i18n "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/i18n.js"
click node_toast "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/Toast.js"
click node_health "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/HealthCheck.js"
click node_api_server "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/api/main.py"
click node_dataset_source "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/data_creation/PubMedVision/create_dataset_pubmebvision.py"
click node_dataset_pipeline "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/pipeline.py"
click node_translation "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/tree/main/dataset/translate/translate_tool"
click node_language_detection "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/translate/detect_non_turkish/detect.py"
click node_dataset_merge "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/translate/detect_non_turkish/merge.py"
click node_training "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/model/MedGemma.ipynb"
click node_evaluation "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/evaluate/evaluate_model.ipynb"
click node_model_runtime "https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/tree/main/model"

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_router,node_chat,node_composer,node_api_client,node_store,node_message_views,node_attachment_view,node_consent,node_settings,node_profile,node_i18n,node_toast,node_health,node_visitor toneBlue
class node_api_server,node_browser_storage toneAmber
class node_dataset_source,node_dataset_pipeline,node_translation,node_language_detection,node_dataset_merge toneMint
class node_training,node_evaluation,node_model_runtime toneRose
```

## Components

### Web experience

- [Route views](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/router.js): `website/medturk-frontend/src/js/router.js`
- [Chat view](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/chat.js): `website/medturk-frontend/src/js/ui/chat.js`
- [Message composer](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ChatComposer.js): `website/medturk-frontend/src/js/ui/components/ChatComposer.js`
- [API client](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/api.js): `website/medturk-frontend/src/js/api.js`
- [Session state](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/store.js): `website/medturk-frontend/src/js/store.js`
- [Message rendering](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/MessageItem.js): `website/medturk-frontend/src/js/ui/components/MessageItem.js`
- [Image attachment view](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ImageAttachment.js): `website/medturk-frontend/src/js/ui/components/ImageAttachment.js`
- [Consent dialog](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/ConsentModal.js): `website/medturk-frontend/src/js/ui/components/ConsentModal.js`
- [Settings](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/settings.js): `website/medturk-frontend/src/js/ui/settings.js`
- [Profile view](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/profile.js): `website/medturk-frontend/src/js/ui/profile.js`
- [Language support](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/i18n.js): `website/medturk-frontend/src/js/i18n.js`
- [Notifications](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/Toast.js): `website/medturk-frontend/src/js/ui/components/Toast.js`
- [Connection check](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/src/js/ui/components/HealthCheck.js): `website/medturk-frontend/src/js/ui/components/HealthCheck.js`

### Chat service

- [FastAPI service](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/website/medturk-frontend/api/main.py): `website/medturk-frontend/api/main.py`

### Dataset preparation

- [PubMedVision conversion](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/data_creation/PubMedVision/create_dataset_pubmebvision.py): `dataset/data_creation/PubMedVision/create_dataset_pubmebvision.py`
- [Dataset standardization](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/pipeline.py): `dataset/pipeline.py`
- [Turkish translation](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/tree/main/dataset/translate/translate_tool): `dataset/translate/translate_tool`
- [Language detection](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/translate/detect_non_turkish/detect.py): `dataset/translate/detect_non_turkish/detect.py`
- [Translation merge](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/dataset/translate/detect_non_turkish/merge.py): `dataset/translate/detect_non_turkish/merge.py`

### Model research

- [MedGemma fine-tuning](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/model/MedGemma.ipynb): `model/MedGemma.ipynb`
- [Model evaluation](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/blob/main/evaluate/evaluate_model.ipynb): `evaluate/evaluate_model.ipynb`
- [MedTurk model](https://github.com/2025-asais-serbestkategori/serbestkategori-medturk/tree/main/model): `model`

### Other components

- **User**
- **Browser local storage**

## Connections

- User → Route views: opens app (evidence: `README.md`)
- Route views → Consent dialog: checks consent (evidence: `website/medturk-frontend/src/js/router.js`)
- Route views → Chat view: renders route (evidence: `website/medturk-frontend/src/js/router.js`)
- Route views → Settings: renders route (evidence: `website/medturk-frontend/src/js/router.js`)
- Route views → Profile view: renders route (evidence: `website/medturk-frontend/src/js/router.js`)
- Chat view → Message composer: creates composer (evidence: `website/medturk-frontend/src/js/ui/chat.js`)
- Chat view → Message rendering: renders messages (evidence: `website/medturk-frontend/src/js/ui/chat.js`)
- Message rendering → Image attachment view: renders DICOM (evidence: `website/medturk-frontend/src/js/ui/components/MessageItem.js`)
- Message composer → Session state: updates sessions (evidence: `website/medturk-frontend/src/js/ui/components/ChatComposer.js`)
- Message composer → API client: uploads and chats (evidence: `website/medturk-frontend/src/js/ui/components/ChatComposer.js`)
- API client → FastAPI service: sends HTTP requests (evidence: `website/medturk-frontend/src/js/api.js`)
- FastAPI service → MedTurk model: invokes model
- Session state → Browser local storage: persists state (evidence: `website/medturk-frontend/src/js/store.js`)
- Settings → Session state: updates preferences (evidence: `website/medturk-frontend/src/js/ui/settings.js`)
- Settings → Connection check: renders ping (evidence: `website/medturk-frontend/src/js/ui/settings.js`)
- Connection check → API client: checks health (evidence: `website/medturk-frontend/src/js/ui/components/HealthCheck.js`)
- API client → Notifications: reports upload errors (evidence: `website/medturk-frontend/src/js/api.js`)
- User → PubMedVision conversion: provides source data
- PubMedVision conversion → Dataset standardization: standardizes data (evidence: `README.md`)
- User → Turkish translation: prepares translations
- Turkish translation → Language detection: supports dataset cleanup
- Language detection → Translation merge: merges review results
- Dataset standardization → MedGemma fine-tuning: supplies training data (evidence: `README.md`)
- MedGemma fine-tuning → MedTurk model: produces fine-tuned model (evidence: `README.md`)
- MedTurk model → Model evaluation: evaluated with metrics (evidence: `README.md`)
