# PlanitAI KPI 프로젝트 - 사용된 프롬프트 ## 1. 초기 기획 단계 ### 블로그 시리즈 작성 요청 ``` v1 ~ v16 블로그 포스트 작성 (Scale Cloud KPI Tree 분석, MVP 설계, 구현 계획 등) ``` --- ## 2. 코드 구현 단계 ### MVP 코드 작성 요청 ``` 좋습니다. 감사합니다. 이제 실제 코드를 작성해주세요. 역시 잘 부탁합니다. ``` --- ## 3. 디버깅 및 문제 해결 ### 데이터 로드 문제 확인 요청 ``` 다음의 실행결과를 봐주세요. (.venv) root@vm-23dceb1f-34:/var/www/tkim.planitai.co.jp/gemegg/20251207-make-pdf-report/project/planitai-kpi# planitai-kpi analyze -c config.yaml -p "2025-10" 🚀 PlanitAI KPI Starting... 📁 Loading configuration... ✅ Configuration loaded 📊 Fetching KPI data... ✅ Fetched data for 0 periods ⚠️ No data found for period: 2025-10 Available periods: [] (.venv) root@vm-23dceb1f-34:/var/www/tkim.planitai.co.jp/gemegg/20251207-make-pdf-report/project/planitai-kpi# config.yaml 의 내용이 잘못된 것일까요? 내용을 확인해주세요 ``` --- ## 4. 프로젝트 마무리 ### 진행상황 기록 요청 ``` 지금까지의 내용을 기록디렉토리의 progress.md 에 업데이트, 작업에 사용한 프롬프트들을 prompts.md 에 업데이트하고 종료합시다. ``` --- ## 내부적으로 사용된 디버깅 스크립트 ### 시트 구조 분석 ```python from src.sheets.client import GoogleSheetsClient client = GoogleSheetsClient("credentials.json") sheet_id = "17AUAHQQB0nZVje9QXtdISEPtMoa8RXKkuCk4R5iHbd4" data_range = "予実出力!A1:Z100" sheet_data = client.read_range(sheet_id, data_range) print("Headers:", sheet_data.headers[:10]) print("Number of rows:", len(sheet_data.rows)) ``` ### Raw 데이터 확인 ```python print("=== Raw data (first 15 rows) ===") for i, row in enumerate(sheet_data.raw[:15]): print(f"Row {i}: {row[:10]}") ``` ### 기간 및 항목 확인 ```python print("=== Row 3 (periods) ===") print(sheet_data.raw[3]) print("=== All item names (column B) ===") for i, row in enumerate(sheet_data.raw[5:25]): if len(row) > 1 and row[1]: print(f"Row {i+5}: {row[1]}") ``` --- ## 핵심 발견 사항 ### 시트 구조 (피봇 형태) ``` Row 0: ['', '予実管理'] Row 3: ['', 'period', '', '', '2025-04', '', '', '', '2025-05', ...] Row 4: ['', '項目', '', '', '予算', '実績', '差異', '達成率', ...] Row 5: ['', '売上高', '', '', '1,152,000', '1,267,940', ...] ``` ### 해결 방법 - 가로형 피봇 데이터를 파싱하는 `get_kpi_data_pivot()` 메서드 추가 - `config.yaml`에 `pivot` 섹션 추가하여 시트 구조 매핑 --- ## CLI 명령어 ### 분석 실행 ```bash # Mock 데이터로 테스트 planitai-kpi analyze -c config/example.yaml -p "2024-11" --mock-data config/mock_data.json --skip-ai # 실제 시트 데이터로 분석 planitai-kpi analyze -c config.yaml -p "2025-04" --skip-ai # AI 분석 포함 planitai-kpi analyze -c config.yaml -p "2025-04" ``` ### 기타 명령어 ```bash # 설정 검증 planitai-kpi validate -c config.yaml # KPI 트리 구조 표시 planitai-kpi tree -c config.yaml # 예제 설정 파일 생성 planitai-kpi init -o config.yaml ```