3 Commits (f5feffb80ef80f9fcfa75da308920bf94c318e40)

Author SHA1 Message Date
I Luk Kim 0c797ceb22 fix: attention zscore_20d null 3개 버그 수정 + 엔티티 오버라이드 API 추가
1. materialize_features identity-map 버그 수정
   - upsert commit 후 populate_existing=True로 재SELECT
   - resolve_entity와 동일 패턴 (SQLAlchemy async stale cache)

2. @with_cache 조건부 TTL — null 응답 캐시 단축
   - wiki.views=null → TTL 300s (5분)
   - 완전한 응답 → TTL 3600s (1시간)
   - 기존: null 응답이 1시간 캐시되어 재수집 영구 차단

3. 재실체화 조건 확장: wiki_zscore_20d is None도 재트리거
   - wiki_views는 있지만 lookback 부족으로 zscore만 null인 케이스 처리

4. POST /admin/entity/{ticker}/override 엔드포인트 추가
   - wiki_title 수동 지정 + is_manual_override=True 설정
   - CSCO→Cisco, DKNG→DraftKings 잘못된 매핑 수정용

5. entity_resolver: 소송 페이지 패턴 억제
   - "X v. Y" 형식 제목 score=0.05 (예: FSF v. Cisco Systems)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3 months ago
I Luk Kim 59f78cd3ee fix: OOM → zombie worker 근본 수정 + 대량 스캔 방어 벡터 추가
- docker-compose: uvicorn --reload 제거 (PID 1 직접 실행) + mem_limit 2g→3g
  → OOM 시 컨테이너 종료 → restart:unless-stopped가 자동 복구
- /attention/event: Semaphore(8) + 10s fast-fail + wiki collector rate limit
- wiki_collector: Semaphore(2) + 0.25s min-interval + 429 log-burst 억제
- /filings/events: Semaphore(4) + 10s fast-fail (SEC HTML 다운로드 벡터 차단)
- sec_http_client: CIK 조회 실패 negative cache (1h) — 10MB dict 반복 스캔 제거

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 months ago
I Luk Kim 8c9abe3e31 feat(attention): Attention 서브시스템 추가 — 이벤트 중심 Wikipedia/GDELT 관심도 피처
## 주요 기능
- Entity resolver: ticker → canonical name → Wikipedia 매칭
  - SEC company_tickers.json fallback으로 placeholder name 자동 수정
  - all-caps SEC 이름 title-case 변환, "Com" suffix 처리
- Wikipedia 페이지뷰 수집 + spike_10d / zscore_20d 피처 계산
- GDELT V2 DOC API 뉴스 기사 수집 (2017-01-01 이후)

## GDELT rate limit 제약 강제
- /event/{ticker} 온디맨드 GDELT 수집 제거 (IP ban 방지)
- 프로세스 전역 asyncio.Lock + 10초 최소 간격 강제
- 429 시 exponential backoff (30→60→120s)
- news.gdelt_status 필드로 클라이언트에 수집 상태 명시
  ('collected' | 'not_collected' | 'not_available')

## API
- GET  /api/v1/attention/event/{ticker}?event_date=YYYY-MM-DD
- GET  /api/v1/attention/entity/{ticker}
- POST /api/v1/attention/admin/resolve/{ticker}
- POST /api/v1/attention/admin/collect/wiki/{ticker}
- POST /api/v1/attention/admin/collect/gdelt/{ticker}  ← scheduler 전용

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5 months ago