Repository navigation
Conversation
Wires the missing trigger for the 5-agent report generation feature - until now, the DB tables (PR #97) and the AI service's endpoint existed but nothing in BE ever called it. POST /api/v1/sessions/{session_id}/reports/generate - resolves patient_ref_id/therapist_id from the session row itself (caller only needs session_id + optional selected_analysis/history_session_count), then proxies to AI's POST /internal/ai/sessions/{session_id}/reports/generate. GET /api/v1/report-generation-runs/{run_id} - proxies to AI's status endpoint. Follows report_chat.py's established ReportChatService pattern exactly: _get_accessible_session() authorization check (ADMIN or owning SLP only), sync httpx client with the same single-retry-on-RequestError policy for ai-service's spot-node connection drops. Verified: routes register at the expected paths (checked via app.routes), unit tests (130) pass. Integration tests need a local Postgres on port 5432 per tests/conftest.py's hardcoded URL; this machine has an unrelated native postgres already bound there, so those specific tests (test_report_chat.py, pre-existing, unrelated to this change) couldn't be exercised locally - not caused by this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
개요
5-Agent 리포트 생성 기능의 마지막 빠진 조각입니다 - DB 테이블(#97)과 AI 서비스 엔드포인트는 이미 있었지만, BE에서 이걸 실제로 호출하는 곳이 전혀 없었습니다.
POST /api/v1/sessions/{session_id}/reports/generate-session_id로 세션을 조회해patient_ref_id/therapist_id(=slp_id)를 서버가 직접 채우고, AI의POST /internal/ai/sessions/{session_id}/reports/generate로 프록시GET /api/v1/report-generation-runs/{run_id}- AI의 상태 조회 엔드포인트로 프록시기존
report_chat.py/ReportChatService의 확립된 패턴을 그대로 따랐습니다:_get_accessible_session()(ADMIN 또는 소유 SLP만 허용) 권한 체크, ai-service의 spot 노드 연결 끊김에 대한 동일한 단일 재시도 정책의 동기 httpx 클라이언트.검증
app.routes로 라우트가 의도한 경로에 정확히 등록되는 것 확인참고
tests/conftest.py가 로컬 5432 포트를 하드코딩)는 이 작업 환경에 이미 떠있던 무관한 native postgres와 충돌해서 로컬 재현이 안 됐습니다 - 이 PR의 변경과 무관한 기존 테스트(test_report_chat.py)이고, CI 환경에서는 정상 실행될 것으로 예상합니다.Test plan