File size: 2,360 Bytes
50231a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d0ef3b
50231a8
 
 
 
 
 
2d0ef3b
50231a8
2d0ef3b
50231a8
 
 
 
 
2d0ef3b
50231a8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2d0ef3b
50231a8
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Architecture Decisions (ADR-style)

## ADR-001: Use modular FastAPI layout for classifier backend
- Status: Accepted
- Type: Explicit
- Evidence:
  - `app/main.py`
  - `app/api/router.py`
  - `app/routers/`
  - `app/services/`
  - `app/pipelines/`
- Rationale:
  - Clear separation between transport, orchestration, and integrations.

## ADR-002: Preserve endpoint contracts from prior service behavior
- Status: Accepted
- Type: Explicit
- Evidence:
  - `app/routers/classification.py`
  - `tests/test_routes.py`
- Rationale:
  - Keep clients functional while refactoring internals.

## ADR-003: Use local Hugging Face zero-shot NLI model for classification
- Status: Accepted
- Type: Explicit
- Evidence:
  - `app/core/config.py`
  - `app/services/classifier_service.py`
- Rationale:
  - Perform true runtime-label zero-shot classification with local inference control.

## ADR-004: Use local `langdetect` library for language detection
- Status: Accepted
- Type: Explicit
- Evidence:
  - `app/services/language_service.py`
- Rationale:
  - Remove external dependency and keep language inference local.

## ADR-005: Keep labels in in-memory mutable config
- Status: Accepted (current), Needs review
- Type: Explicit
- Evidence:
  - `app/models/label_config.py`
  - `app/services/label_service.py`
  - `app/routers/classification.py` (`/configlabel`, `/labels`)
- Rationale:
  - Simple runtime tuning without DB migration.
- Tradeoff:
  - No persistence across restarts, no cross-instance consistency.

## ADR-006: Store uploaded files on local filesystem under static mount
- Status: Accepted
- Type: Explicit
- Evidence:
  - `app/services/file_storage_service.py`
  - `app/main.py`
  - `docker-compose.yml`
- Rationale:
  - Enables document/image extraction workflow with minimal infrastructure.

## ADR-007: Map errors into contract-friendly HTTP statuses
- Status: Accepted
- Type: Explicit
- Evidence:
  - `app/routers/classification.py`
  - `app/core/exceptions.py`
- Rationale:
  - Differentiate local validation issues (`400`) from inference failures (`502`).

## ADR-008: No built-in auth layer for this API
- Status: Accepted (current), Needs review
- Type: Inferred
- Evidence:
  - `app/routers/classification.py`
  - absence of auth dependencies/middleware in `app/main.py`
- Rationale:
  - likely positioned as internal or early-stage service.