# yongchoooon/tradar architecture

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

- Interactive diagram: https://gitdiagram.com/yongchoooon/tradar
- Repository: https://github.com/yongchoooon/tradar

## Overview

T-RADAR is an interactive trademark-clearance interface: users submit text and/or logo queries with goods scope, inspect retrieved candidates, select pairs, and run an examination simulation whose results can be streamed back for comparison. Its main product branches are multimodal retrieval, examination simulation, and supporting goods/media and worker services. README documents the retrieval methods and simulation protocol; some backend dispatch details and unsampled subsystems are represented conservatively because their implementation was not excerpted.

Main entry points: [`app/pipelines/search_pipeline.py`](https://github.com/yongchoooon/tradar/blob/main/app/pipelines/search_pipeline.py) (Multimodal retrieval), [`frontend/src/App.jsx`](https://github.com/yongchoooon/tradar/blob/main/frontend/src/App.jsx) (Interactive UI), [`app/main.py`](https://github.com/yongchoooon/tradar/blob/main/app/main.py) (FastAPI application), [`app/services/worker_bridge.py`](https://github.com/yongchoooon/tradar/blob/main/app/services/worker_bridge.py) (GPU worker bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_frontend["Interactive UI<br/>[App.jsx]"]
  node_api["FastAPI application<br/>[main.py]"]
  node_search_routes["Search endpoints<br/>[routes_search.py]"]
  node_simulation_routes["Simulation endpoints"]
  node_goods_routes["Goods endpoints<br/>[routes_goods.py]"]
  node_media_routes["Media endpoints<br/>[routes_media.py]"]
end

subgraph group_retrieval["Candidate retrieval"]
  node_retrieval_pipeline["Multimodal retrieval<br/>[search_pipeline.py]"]
  node_embedding["Embedding services<br/>[embedding_utils.py]"]
  node_image_embedding["Image embeddings"]
  node_text_embedding["Text embeddings"]
  node_variants["Query variants"]
  node_bm25["BM25 retrieval<br/>[bm25_client.py]"]
  node_vector["Vector search<br/>[vector_client.py]"]
  node_catalog[("Trademark catalog<br/>[catalog.py]")]
  node_goods_search["Goods search<br/>[goods_search.py]"]
  node_worker_bridge["GPU worker bridge<br/>[worker_bridge.py]"]
  node_worker["Desktop GPU worker<br/>[main.py]"]
end

subgraph group_simulation["Examination simulation"]
  node_job_manager["Simulation jobs<br/>[simulation_jobs.py]"]
  node_simulation_engine["Simulation engine"]
  node_agent_protocol["Examiner-agent protocol"]
  node_kipris["KIPRIS records<br/>[kipris_client.py]"]
end

subgraph group_platform["Supporting services"]
  node_search_cache[("Search context<br/>[search_cache.py]")]
  node_r2_images[("R2 image storage<br/>[r2_storage.py]")]
  node_logs[("Usage log storage<br/>[log_storage.py]")]
  node_admin["Admin log views<br/>[routes_admin.py]"]
  node_worker_registry[("Worker registry<br/>[worker_registry.py]")]
  node_worker_settings["Worker settings<br/>[worker_settings.py]"]
end

node_user(("Trademark user"))

node_user -->|"submits query"| node_frontend
node_frontend -->|"requests search"| node_search_routes
node_frontend -->|"starts simulation"| node_simulation_routes
node_frontend -->|"searches goods"| node_goods_routes
node_frontend -->|"requests upload URL"| node_media_routes
node_api -->|"registers routes"| node_search_routes
node_api -->|"registers routes"| node_simulation_routes
node_api -->|"registers routes"| node_goods_routes
node_api -->|"registers routes"| node_media_routes
node_search_routes -->|"dispatches search"| node_worker_bridge
node_worker_bridge -.->|"dispatches jobs"| node_worker
node_worker -->|"runs search"| node_retrieval_pipeline
node_retrieval_pipeline -->|"encodes images"| node_image_embedding
node_retrieval_pipeline -->|"encodes text"| node_text_embedding
node_retrieval_pipeline -->|"generates variants"| node_variants
node_retrieval_pipeline -->|"retrieves terms"| node_bm25
node_retrieval_pipeline -->|"queries vectors"| node_vector
node_retrieval_pipeline -->|"loads catalog"| node_catalog
node_goods_routes -->|"searches goods"| node_goods_search
node_media_routes -->|"stores images"| node_r2_images
node_simulation_routes -->|"loads context"| node_search_cache
node_simulation_routes -->|"creates job"| node_job_manager
node_job_manager -.->|"runs simulation"| node_simulation_engine
node_simulation_engine -->|"fetches records"| node_kipris
node_simulation_engine -->|"runs protocol"| node_agent_protocol
node_simulation_engine -->|"writes logs"| node_logs
node_admin -->|"reads logs"| node_logs
node_worker_bridge -->|"tracks workers"| node_worker_registry
node_worker_bridge -->|"loads settings"| node_worker_settings

click node_frontend "https://github.com/yongchoooon/tradar/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/yongchoooon/tradar/blob/main/app/main.py"
click node_search_routes "https://github.com/yongchoooon/tradar/blob/main/app/api/routes_search.py"
click node_simulation_routes "https://github.com/yongchoooon/tradar/blob/main/app/api/routes_simulation.py"
click node_goods_routes "https://github.com/yongchoooon/tradar/blob/main/app/api/routes_goods.py"
click node_media_routes "https://github.com/yongchoooon/tradar/blob/main/app/api/routes_media.py"
click node_retrieval_pipeline "https://github.com/yongchoooon/tradar/blob/main/app/pipelines/search_pipeline.py"
click node_embedding "https://github.com/yongchoooon/tradar/blob/main/app/services/embedding_utils.py"
click node_image_embedding "https://github.com/yongchoooon/tradar/blob/main/app/services/image_embed_service.py"
click node_text_embedding "https://github.com/yongchoooon/tradar/blob/main/app/services/text_embed_service.py"
click node_variants "https://github.com/yongchoooon/tradar/blob/main/app/services/text_variant_service.py"
click node_bm25 "https://github.com/yongchoooon/tradar/blob/main/app/services/bm25_client.py"
click node_vector "https://github.com/yongchoooon/tradar/blob/main/app/services/vector_client.py"
click node_catalog "https://github.com/yongchoooon/tradar/blob/main/app/services/catalog.py"
click node_goods_search "https://github.com/yongchoooon/tradar/blob/main/app/services/goods_search.py"
click node_worker_bridge "https://github.com/yongchoooon/tradar/blob/main/app/services/worker_bridge.py"
click node_worker "https://github.com/yongchoooon/tradar/blob/main/worker/main.py"
click node_job_manager "https://github.com/yongchoooon/tradar/blob/main/app/services/simulation_jobs.py"
click node_simulation_engine "https://github.com/yongchoooon/tradar/blob/main/app/services/simulation_engine.py"
click node_agent_protocol "https://github.com/yongchoooon/tradar/blob/main/app/services/langgraph_orchestrator.py"
click node_kipris "https://github.com/yongchoooon/tradar/blob/main/app/services/kipris_client.py"
click node_search_cache "https://github.com/yongchoooon/tradar/blob/main/app/services/search_cache.py"
click node_r2_images "https://github.com/yongchoooon/tradar/blob/main/app/services/r2_storage.py"
click node_logs "https://github.com/yongchoooon/tradar/blob/main/app/services/log_storage.py"
click node_admin "https://github.com/yongchoooon/tradar/blob/main/app/api/routes_admin.py"
click node_worker_registry "https://github.com/yongchoooon/tradar/blob/main/app/services/worker_registry.py"
click node_worker_settings "https://github.com/yongchoooon/tradar/blob/main/app/services/worker_settings.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_frontend,node_api,node_search_routes,node_simulation_routes,node_goods_routes,node_media_routes,node_user toneBlue
class node_retrieval_pipeline,node_embedding,node_image_embedding,node_text_embedding,node_variants,node_bm25,node_vector,node_catalog,node_goods_search,node_worker_bridge,node_worker toneAmber
class node_job_manager,node_simulation_engine,node_agent_protocol,node_kipris toneMint
class node_search_cache,node_r2_images,node_logs,node_admin,node_worker_registry,node_worker_settings toneRose
```

## Components

### User interface

- [Interactive UI](https://github.com/yongchoooon/tradar/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [FastAPI application](https://github.com/yongchoooon/tradar/blob/main/app/main.py): `app/main.py`
- [Search endpoints](https://github.com/yongchoooon/tradar/blob/main/app/api/routes_search.py): `app/api/routes_search.py`
- [Simulation endpoints](https://github.com/yongchoooon/tradar/blob/main/app/api/routes_simulation.py): `app/api/routes_simulation.py`
- [Goods endpoints](https://github.com/yongchoooon/tradar/blob/main/app/api/routes_goods.py): `app/api/routes_goods.py`
- [Media endpoints](https://github.com/yongchoooon/tradar/blob/main/app/api/routes_media.py): `app/api/routes_media.py`

### Candidate retrieval

- [Multimodal retrieval](https://github.com/yongchoooon/tradar/blob/main/app/pipelines/search_pipeline.py): `app/pipelines/search_pipeline.py`
- [Embedding services](https://github.com/yongchoooon/tradar/blob/main/app/services/embedding_utils.py): `app/services/embedding_utils.py`
- [Image embeddings](https://github.com/yongchoooon/tradar/blob/main/app/services/image_embed_service.py): `app/services/image_embed_service.py`
- [Text embeddings](https://github.com/yongchoooon/tradar/blob/main/app/services/text_embed_service.py): `app/services/text_embed_service.py`
- [Query variants](https://github.com/yongchoooon/tradar/blob/main/app/services/text_variant_service.py): `app/services/text_variant_service.py`
- [BM25 retrieval](https://github.com/yongchoooon/tradar/blob/main/app/services/bm25_client.py): `app/services/bm25_client.py`
- [Vector search](https://github.com/yongchoooon/tradar/blob/main/app/services/vector_client.py): `app/services/vector_client.py`
- [Trademark catalog](https://github.com/yongchoooon/tradar/blob/main/app/services/catalog.py): `app/services/catalog.py`
- [Goods search](https://github.com/yongchoooon/tradar/blob/main/app/services/goods_search.py): `app/services/goods_search.py`
- [GPU worker bridge](https://github.com/yongchoooon/tradar/blob/main/app/services/worker_bridge.py): `app/services/worker_bridge.py`
- [Desktop GPU worker](https://github.com/yongchoooon/tradar/blob/main/worker/main.py): `worker/main.py`

### Examination simulation

- [Simulation jobs](https://github.com/yongchoooon/tradar/blob/main/app/services/simulation_jobs.py): `app/services/simulation_jobs.py`
- [Simulation engine](https://github.com/yongchoooon/tradar/blob/main/app/services/simulation_engine.py): `app/services/simulation_engine.py`
- [Examiner-agent protocol](https://github.com/yongchoooon/tradar/blob/main/app/services/langgraph_orchestrator.py): `app/services/langgraph_orchestrator.py`
- [KIPRIS records](https://github.com/yongchoooon/tradar/blob/main/app/services/kipris_client.py): `app/services/kipris_client.py`

### Supporting services

- [Search context](https://github.com/yongchoooon/tradar/blob/main/app/services/search_cache.py): `app/services/search_cache.py`
- [R2 image storage](https://github.com/yongchoooon/tradar/blob/main/app/services/r2_storage.py): `app/services/r2_storage.py`
- [Usage log storage](https://github.com/yongchoooon/tradar/blob/main/app/services/log_storage.py): `app/services/log_storage.py`
- [Admin log views](https://github.com/yongchoooon/tradar/blob/main/app/api/routes_admin.py): `app/api/routes_admin.py`
- [Worker registry](https://github.com/yongchoooon/tradar/blob/main/app/services/worker_registry.py): `app/services/worker_registry.py`
- [Worker settings](https://github.com/yongchoooon/tradar/blob/main/app/services/worker_settings.py): `app/services/worker_settings.py`

### Other components

- **Trademark user**

## Connections

- Trademark user → Interactive UI: submits query (evidence: `README.md`)
- Interactive UI → Search endpoints: requests search (evidence: `frontend/src/App.jsx`)
- Interactive UI → Simulation endpoints: starts simulation (evidence: `frontend/src/App.jsx`)
- Interactive UI → Goods endpoints: searches goods (evidence: `frontend/src/App.jsx`)
- Interactive UI → Media endpoints: requests upload URL (evidence: `frontend/src/App.jsx`)
- FastAPI application → Search endpoints: registers routes (evidence: `app/main.py`)
- FastAPI application → Simulation endpoints: registers routes (evidence: `app/main.py`)
- FastAPI application → Goods endpoints: registers routes (evidence: `app/main.py`)
- FastAPI application → Media endpoints: registers routes (evidence: `app/main.py`)
- Search endpoints → GPU worker bridge: dispatches search (evidence: `app/api/routes_search.py`)
- GPU worker bridge → Desktop GPU worker: dispatches jobs
- Desktop GPU worker → Multimodal retrieval: runs search (evidence: `worker/main.py`)
- Multimodal retrieval → Image embeddings: encodes images (evidence: `app/pipelines/search_pipeline.py`)
- Multimodal retrieval → Text embeddings: encodes text (evidence: `app/pipelines/search_pipeline.py`)
- Multimodal retrieval → Query variants: generates variants (evidence: `app/pipelines/search_pipeline.py`)
- Multimodal retrieval → BM25 retrieval: retrieves terms (evidence: `app/pipelines/search_pipeline.py`)
- Multimodal retrieval → Vector search: queries vectors (evidence: `app/pipelines/search_pipeline.py`)
- Multimodal retrieval → Trademark catalog: loads catalog (evidence: `app/pipelines/search_pipeline.py`)
- Goods endpoints → Goods search: searches goods (evidence: `app/api/routes_goods.py`)
- Media endpoints → R2 image storage: stores images (evidence: `app/api/routes_media.py`)
- Simulation endpoints → Search context: loads context (evidence: `app/api/routes_simulation.py`)
- Simulation endpoints → Simulation jobs: creates job (evidence: `app/api/routes_simulation.py`)
- Simulation jobs → Simulation engine: runs simulation
- Simulation engine → KIPRIS records: fetches records (evidence: `app/services/simulation_engine.py`)
- Simulation engine → Examiner-agent protocol: runs protocol (evidence: `app/services/simulation_engine.py`)
- Simulation engine → Usage log storage: writes logs (evidence: `app/services/simulation_engine.py`)
- Admin log views → Usage log storage: reads logs (evidence: `app/api/routes_admin.py`)
- GPU worker bridge → Worker registry: tracks workers (evidence: `app/services/worker_bridge.py`)
- GPU worker bridge → Worker settings: loads settings (evidence: `app/services/worker_bridge.py`)
