Skip to content

Conversation

@twq110
Copy link
Contributor

@twq110 twq110 commented Oct 30, 2025

용어 일관성 수정 및 불필요한 파일 삭제 (transform이 아니라 transformer 임.)
pipeline config dict로 타입 변경
transformer/models에 서브패키지 작성
경제지표 계산정의 수정(obv,mfi)
리포트 db 키 컨피그 작성
불필요한 utils/data 삭제, fetch_ohlcv는 utils 직속으로 옮김.
get_db_conn 구현
pipeline.py에 생성된 리포트 report_db에 저장 구현

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 보고서 데이터베이스 설정 옵션이 추가되었습니다.
    • 데이터 처리 파이프라인에 향상된 기술적 지표 엔지니어링이 포함되었습니다.
    • 생성된 분석 보고서를 데이터베이스에 저장하는 기능이 추가되었습니다.
  • Refactor

    • 데이터 연결 및 처리 모듈이 재구성되었습니다.
    • 파이프라인 조직화 및 로깅이 개선되었습니다.

@twq110 twq110 requested a review from Kosw6 as a code owner October 30, 2025 08:05
@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Caution

Review failed

The pull request is closed.

개요

이 PR은 데이터 파이프라인을 재구조화하며, Transformer 용어로 API를 통일하고, 데이터베이스 연결을 추상화하고, XAI 보고서 저장 기능을 추가합니다. 또한 새로운 특성 공학 유틸리티를 포함한 Transformer 구현을 복원합니다.

변경사항

코호트 / 파일 변경 요약
설정 및 인프라
AI/configs/config.json
기존 db 블록과 동일한 구조를 가진 새로운 최상위 JSON 속성 report_DB 추가 (host, user, password, dbname, port 필드 포함)
데이터베이스 유틸리티
AI/libs/utils/get_db_conn.py
새로운 모듈: psycopg2 데이터베이스 연결을 반환하는 단일 유틸리티 함수 get_db_conn(config: dict) 제공
데이터 조회 리팩토링
AI/libs/utils/fetch_ohlcv.py
로컬 get_db_conn() 정의 제거 및 외부 모듈에서 가져온 구현으로 변경; 공개 API 인터페이스는 유지
모듈 초기화 및 공개 API
AI/finder/__init__.py,
AI/transformer/__init__.py,
AI/transformer/models/__init__.py
각 모듈에 __all__ 내보내기 추가: run_finder, run_transformer, build_transformer_classifier 공개 API 노출
파이프라인 오케스트레이션
AI/libs/core/pipeline.py
Transform → Transformer 용어 통일; 설정 로드 에러 처리 강화; fetch_ohlcv()가 이제 db_config 사용; save_reports_to_db() 함수 추가로 XAI 보고서를 데이터베이스에 저장; run_pipeline() 재구조화
Transformer 구현 확장
AI/transformer/main.py
run_transformrun_transformer로 함수명 변경; 포괄적인 특성 공학 유틸리티 추가 (EMA, RSI Wilder, MACD, ATR, OBV, Stochastic, MFI); build_features() 파이프라인 추가; 모델 로깅 메시지에 [TRANSFORMER] 태그 추가; NaN 처리 및 데이터 유형 안정성 개선
Transformer 모델 활성화
AI/transformer/models/models.py
이전에 주석 처리된 positional_encodingbuild_transformer_classifier 함수 복원 및 활성화

시퀀스 다이어그램

sequenceDiagram
    participant Pipeline as Pipeline Orchestrator
    participant Config as Config Manager
    participant Finder as Weekly Finder
    participant Transformer as Signal Transformer
    participant DBUtil as DB Connection Utility
    participant ReportDB as Report Database

    Pipeline->>Config: config.json 로드
    Config-->>Pipeline: 구성 객체 반환
    
    Pipeline->>Finder: run_weekly_finder() 호출
    Finder-->>Pipeline: finder_df 반환
    
    Pipeline->>DBUtil: get_db_conn(config["db"]) 호출
    DBUtil->>DBUtil: psycopg2 연결 생성
    DBUtil-->>Pipeline: DB 연결 반환
    
    Pipeline->>Finder: fetch_ohlcv(ticker, db_config) 호출
    Finder->>Finder: 조회 데이터 가져오기
    Finder-->>Pipeline: 원본 OHLCV 데이터 반환
    
    Pipeline->>Transformer: run_signal_transformer() 호출
    Transformer->>Transformer: 특성 공학 (EMA, RSI, MACD, ATR 등)
    Transformer->>Transformer: 시퀀스 생성 및 스케일링
    Transformer->>Transformer: 모델 로드/구축 및 추론
    Transformer-->>Pipeline: 예측 결과 및 XAI 로그 반환
    
    Pipeline->>DBUtil: get_db_conn(config["report_DB"]) 호출
    DBUtil-->>Pipeline: Report DB 연결 반환
    
    Pipeline->>ReportDB: save_reports_to_db(reports, config)
    ReportDB->>ReportDB: 각 보고서를 타임스탬프와 함께 삽입
    ReportDB-->>Pipeline: 저장 완료
Loading

코드 리뷰 예상 난도

🎯 3 (중간) | ⏱️ ~25분

추가 검토 필요 영역:

  • AI/libs/core/pipeline.py: 새로운 데이터베이스 설정 및 보고서 저장 로직 통합; report_DB 설정 올바른 접근 확인
  • AI/transformer/main.py: 새로운 특성 공학 유틸리티 (EMA, RSI, MACD, ATR, OBV, Stochastic, MFI)의 통계적 정확성; NaN 처리 및 데이터 타입 안정성
  • AI/libs/utils/get_db_conn.py: 새로운 데이터베이스 연결 추상화의 모든 호출 지점에서 올바른 사용 검증
  • 설정 통합: 기존 db 및 새로운 report_DB 설정 병행 사용의 정확성

관련 가능성 있는 PR

추천 검토자

  • Kosw6

🐰 Transformer의 깃발을 들고,
특성들이 춤을 추며 흐르고,
보고서는 데이터베이스에 안전히 담아,
파이프라인은 우아하게 정제되어,
새로운 기능들이 피어나누나! 🌸

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch SISC2-36-AI-석재빈-최종-리포트-저장-구현

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1358ca6 and b5f8a1a.

📒 Files selected for processing (9)
  • AI/configs/config.json (1 hunks)
  • AI/finder/__init__.py (1 hunks)
  • AI/libs/core/pipeline.py (7 hunks)
  • AI/libs/utils/fetch_ohlcv.py (1 hunks)
  • AI/libs/utils/get_db_conn.py (1 hunks)
  • AI/transformer/__init__.py (1 hunks)
  • AI/transformer/main.py (1 hunks)
  • AI/transformer/models/__init__.py (1 hunks)
  • AI/transformer/models/models.py (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@twq110 twq110 merged commit 0bea46a into main Oct 30, 2025
1 of 2 checks passed
@twq110 twq110 deleted the SISC2-36-AI-석재빈-최종-리포트-저장-구현 branch October 30, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant