Skip to content

one-year-gap/intelligence-server

Repository files navigation

counseling-analytics

ν•˜μ΄ FastAPI 개발 μ„œλ²„ μ‹€ν–‰ κ°€μ΄λ“œμž…λ‹ˆλ‹€.

Prerequisites

  • Python 3.9+
  • pip μ‚¬μš© κ°€λŠ₯ ν™˜κ²½

1) ν”„λ‘œμ νŠΈ 루트둜 이동

cd /Users/kimdoyeon/PycharmProjects/counseling-analytics

2) κ°€μƒν™˜κ²½ 생성

macOS / Linux

python3 -m venv .venv

Windows (PowerShell)

py -m venv .venv

3) κ°€μƒν™˜κ²½ ν™œμ„±ν™”

macOS / Linux

source .venv/bin/activate

Windows (PowerShell)

.venv\Scripts\Activate.ps1

Windowsμ—μ„œ μ‹€ν–‰ μ •μ±… 였λ₯˜κ°€ λ‚˜λ©΄(졜초 1회):

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

4) μ˜μ‘΄μ„± μ„€μΉ˜

pip install -r requirements.txt

5) FastAPI μ„œλ²„ μ‹€ν–‰

python -m uvicorn app.realtime.main:app --reload --host 0.0.0.0 --port 8000

5-1) 배치 1회 μ‹€ν–‰

python -m app.batch.main

6) 접속 확인

7) νŒ€ λ¬Έμ„œ

  • μ‹œμŠ€ν…œ ν”Œλ‘œμš°: docs/FLOW.md
  • Spring/FastAPI/EFS 연동 κ°€μ΄λ“œ: docs/TEAM_API_EFS_GUIDE.md
  • Team2 μ•Œκ³ λ¦¬μ¦˜ κ΅¬ν˜„ κ°€μ΄λ“œ: docs/TEAM2_KEYWORD_MAPPING_GUIDE.md

Directory Structure

python-analysis/
β”œβ”€ app/
β”‚  β”œβ”€ main.py                      # FastAPI μ•± μ—”νŠΈλ¦¬ν¬μΈνŠΈ
β”‚  β”œβ”€ api/
β”‚  β”‚  β”œβ”€ deps.py                   # 곡톡 μ˜μ‘΄μ„± μ£Όμž…
β”‚  β”‚  β”œβ”€ router.py                 # APIRouter 톡합
β”‚  β”‚  └─ v1/
β”‚  β”‚     β”œβ”€ analyze.py             # POST /analyze
β”‚  β”‚     β”œβ”€ health.py              # /health, /ready
β”‚  β”‚     └─ ops.py                 # 운영/μƒνƒœ 쑰회용 API
β”‚  β”‚
β”‚  β”œβ”€ core/
β”‚  β”‚  β”œβ”€ config.py                 # ν™˜κ²½λ³€μˆ˜, μ„€μ •(Pydantic Settings)
β”‚  β”‚  β”œβ”€ logging.py                # λ‘œκΉ… μ„€μ •
β”‚  β”‚  β”œβ”€ enums.py                  # 곡톡 Enum
β”‚  β”‚  β”œβ”€ constants.py              # 경둜, 파일 suffix, μž¬μ‹œλ„ μƒμˆ˜
β”‚  β”‚  └─ exceptions.py             # μ»€μŠ€ν…€ μ˜ˆμ™Έ
β”‚  β”‚
β”‚  β”œβ”€ schemas/
β”‚  β”‚  β”œβ”€ analyze_request.py        # μš”μ²­ DTO
β”‚  β”‚  β”œβ”€ analyze_response.py       # 응닡 DTO
β”‚  β”‚  β”œβ”€ callback_request.py       # Spring 콜백 DTO
β”‚  β”‚  β”œβ”€ counsel_record.py         # 상담 JSONL λ ˆμ½”λ“œ μŠ€ν‚€λ§ˆ
β”‚  β”‚  β”œβ”€ alias_record.py           # 별칭 JSONL λ ˆμ½”λ“œ μŠ€ν‚€λ§ˆ
β”‚  β”‚  β”œβ”€ result_record.py          # κ²°κ³Ό JSONL λ ˆμ½”λ“œ μŠ€ν‚€λ§ˆ
β”‚  β”‚  └─ aggregate_record.py       # κ°œμΈλ³„ 집계 JSONL μŠ€ν‚€λ§ˆ
β”‚  β”‚
β”‚  β”œβ”€ services/
β”‚  β”‚  β”œβ”€ analyze_service.py        # 전체 뢄석 흐름 orchestration
β”‚  β”‚  β”œβ”€ alias_loader_service.py   # 별칭 파일 λ‘œλ”©/캐싱
β”‚  β”‚  β”œβ”€ result_writer_service.py  # κ²°κ³Ό 파일 μ €μž₯(tmpβ†’rename)
β”‚  β”‚  β”œβ”€ callback_service.py       # Spring κ²°κ³Ό 전솑
β”‚  β”‚  └─ idempotency_service.py    # requestId 쀑볡 처리 λ°©μ§€
β”‚  β”‚
β”‚  β”œβ”€ pipeline/
β”‚  β”‚  β”œβ”€ normalizer.py             # ν…μŠ€νŠΈ μ •κ·œν™”
β”‚  β”‚  β”œβ”€ extractor.py              # spaCy 기반 ν‚€μ›Œλ“œ μΆ”μΆœ
β”‚  β”‚  β”œβ”€ mapper.py                 # Damerau-Levenshtein λ§€ν•‘
β”‚  β”‚  β”œβ”€ scorer.py                 # match score 계산
β”‚  β”‚  └─ aggregator.py             # member_id κΈ°μ€€ ν‚€μ›Œλ“œ 집계
β”‚  β”‚
β”‚  β”œβ”€ infra/
β”‚  β”‚  β”œβ”€ efs/
β”‚  β”‚  β”‚  β”œβ”€ reader.py              # EFS 파일 읽기
β”‚  β”‚  β”‚  β”œβ”€ writer.py              # EFS 파일 μ“°κΈ°
β”‚  β”‚  β”‚  β”œβ”€ jsonl.py               # JSONL stream read/write
β”‚  β”‚  β”‚  └─ paths.py               # req/ref/result 경둜 μœ ν‹Έ
β”‚  β”‚  β”‚
β”‚  β”‚  β”‚
β”‚  β”‚  β”œβ”€ cache/
β”‚  β”‚  β”‚  └─ alias_cache.py         # jobInstanceId별 alias μΊμ‹œ
β”‚  β”‚  β”‚
β”‚  β”‚  └─ state/
β”‚  β”‚     β”œβ”€ request_registry.py    # 처리 μƒνƒœ 기둝(파일/redis/sqlite λ“±)
β”‚  β”‚     └─ lock.py                # 쀑볡 μ‹€ν–‰ λ°©μ§€ 락
β”‚  β”‚
β”‚  β”‚
β”‚  └─ utils/
β”‚     β”œβ”€ time.py
β”‚     β”œβ”€ hashing.py
β”‚     └─ retry.py
β”‚
β”œβ”€ tests/
β”‚  β”œβ”€ api/
β”‚  β”œβ”€ services/
β”‚  β”œβ”€ pipeline/
β”‚  └─ infra/
β”‚
β”œβ”€ requirements.txt
β”œβ”€ Dockerfile
└─ .env**b**

About

πŸ‘¨πŸΌβ€πŸš€HOLLIVESE ANALYSIS/RECOMMEND REPOπŸ‘¨πŸΌβ€πŸš€

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Generated from one-year-gap/dummy-data