Skip to content

feat: 5-agent 리포트 생성 트리거/조회 엔드포인트 추가 - #99

Closed
gpffh20 wants to merge 1 commit into
mainfrom
feat/report-generation-trigger-endpoint
Closed

gpffh20 wants to merge 1 commit into
mainfrom
feat/report-generation-trigger-endpoint

Conversation

@gpffh20

@gpffh20 gpffh20 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

개요

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로 라우트가 의도한 경로에 정확히 등록되는 것 확인
  • unit 테스트 130개 통과

참고

  • Integration 테스트(tests/conftest.py가 로컬 5432 포트를 하드코딩)는 이 작업 환경에 이미 떠있던 무관한 native postgres와 충돌해서 로컬 재현이 안 됐습니다 - 이 PR의 변경과 무관한 기존 테스트(test_report_chat.py)이고, CI 환경에서는 정상 실행될 것으로 예상합니다.

Test plan

  • 라우트 등록 확인
  • unit 테스트 130 passed
  • CI에서 integration 테스트 통과 확인

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.
@gpffh20 gpffh20 closed this Jul 4, 2026
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