# ossteam5/sagijeone architecture

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

- Interactive diagram: https://gitdiagram.com/ossteam5/sagijeone
- Repository: https://github.com/ossteam5/sagijeone

## Overview

사기전에 is a web service for reviewing second-hand-market chats and links, returning risk signals with quoted evidence and recommended actions rather than declaring a seller fraudulent. The main flow is browser input → FastAPI analysis endpoint → chat parsing → registered detectors → context filtering → risk scoring and advice → structured response. URL checks use local domain lists; the README also describes screenshot OCR as a roadmap capability, but the only OCR code is explicitly an experiment, so it is not shown as a production stage. The input extractors are present, but their runtime wiring is not evidenced in the excerpts.

Main entry points: [`backend/app/pipeline.py`](https://github.com/ossteam5/sagijeone/blob/main/backend/app/pipeline.py) (Analysis pipeline), [`backend/app/models.py`](https://github.com/ossteam5/sagijeone/blob/main/backend/app/models.py) (Request and result types), [`backend/app/main.py`](https://github.com/ossteam5/sagijeone/blob/main/backend/app/main.py) (Analysis API), [`backend/app/detectors/url.py`](https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/url.py) (URL detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_page["Web page<br/>[index.html]"]
  node_api["Analysis API<br/>[main.py]"]
end

subgraph group_input["Input handling"]
  node_parser["Chat parser<br/>[chat_parser.py]"]
  node_extractors["Input extractors<br/>[extractors.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
  node_payment["Payment detectors<br/>[payment.py]"]
  node_messenger["Messenger detector<br/>[messenger.py]"]
  node_url["URL detector<br/>[url.py]"]
  node_registry["Detector registry<br/>[registry.py]"]
  node_context["Context filter<br/>[context.py]"]
  node_risk["Risk engine<br/>[risk_engine.py]"]
  node_domain_data["Domain lists"]
end

subgraph group_contracts["API and data"]
  node_models["Request and result types<br/>[models.py]"]
end

node_user(("User"))

node_user -->|"enters input"| node_page
node_page -->|"submits analysis"| node_api
node_api -->|"invokes analysis"| node_pipeline
node_api -->|"validates request"| node_models
node_parser -->|"produces messages"| node_models
node_pipeline -->|"parses chat"| node_parser
node_pipeline -->|"invokes detectors"| node_payment
node_pipeline -->|"invokes detectors"| node_messenger
node_pipeline -->|"invokes detectors"| node_url
node_payment -->|"registers detectors"| node_registry
node_messenger -->|"registers detector"| node_registry
node_url -->|"registers detector"| node_registry
node_url -->|"reads domain lists"| node_domain_data
node_pipeline -->|"filters signals"| node_context
node_context -->|"uses message types"| node_models
node_pipeline -->|"builds result"| node_risk
node_risk -->|"uses signal type"| node_models
node_pipeline -->|"returns analysis data"| node_models
node_api -->|"serves page"| node_page

click node_page "https://github.com/ossteam5/sagijeone/blob/main/frontend/index.html"
click node_api "https://github.com/ossteam5/sagijeone/blob/main/backend/app/main.py"
click node_parser "https://github.com/ossteam5/sagijeone/blob/main/backend/app/input/chat_parser.py"
click node_extractors "https://github.com/ossteam5/sagijeone/blob/main/backend/app/input/extractors.py"
click node_pipeline "https://github.com/ossteam5/sagijeone/blob/main/backend/app/pipeline.py"
click node_payment "https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/payment.py"
click node_messenger "https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/messenger.py"
click node_url "https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/url.py"
click node_registry "https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/registry.py"
click node_context "https://github.com/ossteam5/sagijeone/blob/main/backend/app/context.py"
click node_risk "https://github.com/ossteam5/sagijeone/blob/main/backend/app/risk_engine.py"
click node_domain_data "https://github.com/ossteam5/sagijeone/tree/main/backend/data"
click node_models "https://github.com/ossteam5/sagijeone/blob/main/backend/app/models.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_page,node_api,node_user toneBlue
class node_parser,node_extractors toneAmber
class node_pipeline,node_payment,node_messenger,node_url,node_registry,node_context,node_risk,node_domain_data toneMint
class node_models toneRose
```

## Components

### Web interface

- [Web page](https://github.com/ossteam5/sagijeone/blob/main/frontend/index.html): `frontend/index.html`
- [Analysis API](https://github.com/ossteam5/sagijeone/blob/main/backend/app/main.py): `backend/app/main.py`

### Input handling

- [Chat parser](https://github.com/ossteam5/sagijeone/blob/main/backend/app/input/chat_parser.py): `backend/app/input/chat_parser.py`
- [Input extractors](https://github.com/ossteam5/sagijeone/blob/main/backend/app/input/extractors.py): `backend/app/input/extractors.py`

### Risk analysis

- [Analysis pipeline](https://github.com/ossteam5/sagijeone/blob/main/backend/app/pipeline.py): `backend/app/pipeline.py`
- [Payment detectors](https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/payment.py): `backend/app/detectors/payment.py`
- [Messenger detector](https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/messenger.py): `backend/app/detectors/messenger.py`
- [URL detector](https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/url.py): `backend/app/detectors/url.py`
- [Detector registry](https://github.com/ossteam5/sagijeone/blob/main/backend/app/detectors/registry.py): `backend/app/detectors/registry.py`
- [Context filter](https://github.com/ossteam5/sagijeone/blob/main/backend/app/context.py): `backend/app/context.py`
- [Risk engine](https://github.com/ossteam5/sagijeone/blob/main/backend/app/risk_engine.py): `backend/app/risk_engine.py`
- [Domain lists](https://github.com/ossteam5/sagijeone/tree/main/backend/data): `backend/data`

### API and data

- [Request and result types](https://github.com/ossteam5/sagijeone/blob/main/backend/app/models.py): `backend/app/models.py`

### Other components

- **User**

## Connections

- User → Web page: enters input (evidence: `README.md`)
- Web page → Analysis API: submits analysis (evidence: `README.md`)
- Analysis API → Analysis pipeline: invokes analysis (evidence: `backend/app/main.py`)
- Analysis API → Request and result types: validates request (evidence: `backend/app/main.py`)
- Chat parser → Request and result types: produces messages (evidence: `backend/app/input/chat_parser.py`)
- Analysis pipeline → Chat parser: parses chat (evidence: `backend/app/pipeline.py`)
- Analysis pipeline → Payment detectors: invokes detectors (evidence: `backend/app/pipeline.py`)
- Analysis pipeline → Messenger detector: invokes detectors (evidence: `backend/app/pipeline.py`)
- Analysis pipeline → URL detector: invokes detectors (evidence: `backend/app/pipeline.py`)
- Payment detectors → Detector registry: registers detectors (evidence: `backend/app/detectors/payment.py`)
- Messenger detector → Detector registry: registers detector (evidence: `backend/app/detectors/messenger.py`)
- URL detector → Detector registry: registers detector (evidence: `backend/app/detectors/url.py`)
- URL detector → Domain lists: reads domain lists (evidence: `backend/app/detectors/url.py`)
- Analysis pipeline → Context filter: filters signals (evidence: `backend/app/pipeline.py`)
- Context filter → Request and result types: uses message types (evidence: `backend/app/context.py`)
- Analysis pipeline → Risk engine: builds result (evidence: `backend/app/pipeline.py`)
- Risk engine → Request and result types: uses signal type (evidence: `backend/app/risk_engine.py`)
- Analysis pipeline → Request and result types: returns analysis data (evidence: `backend/app/pipeline.py`)
- Analysis API → Web page: serves page (evidence: `backend/app/main.py`)
