Repository navigation
feat: 인사이트맵 그래프 데이터 모델 및 API 추가 - #92
Merged
Merged
Conversation
…zation
Add ontology_concepts/ontology_edges/soap_case_indexes/patient_metric_trends
tables, seed data derived from the existing RAG ontology, Graph API
(GET /insight-map, POST /insight-map/search, GET /soap-case-indexes/{id}/source-link),
a shared object-level authorization helper, and automatic SOAP case-index
tagging when a report is finalized.
…ex browsing
Add GET /insight-map/concepts/{concept_key}/evidence proxying the AI
service's RAG search so concept nodes can show related paper/guide
citations. Also let "my_soap" mode work without a report_draft_id by
listing every SOAP case index owned by the current therapist across
all patients (list_case_indexes_by_therapist), with session dates
attached to node labels for disambiguation.
wonzz
self-requested a review
July 2, 2026 01:42
wonzz
approved these changes
Jul 2, 2026
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.
Summary
근거 기반 임상 인사이트맵 기능의 백엔드 부분을 구현했다. 온톨로지 개념/관계 그래프, 환자 지표 추이, SOAP Case Index를 저장하는 데이터 모델과 이를 조회/검색하는 Graph API를 추가한다.
Changes
ontology_concepts,ontology_edges,soap_case_indexes,patient_metric_trends4개 테이블 및 alembic 마이그레이션 추가scripts/seed_ontology.py+scripts/ontology_seed.yaml: 기존 RAG 온톨로지(UtterAI_AI/app/rag/ontology.yaml)를 기반으로 concept 38개, 관계(edge) 55개 시드 (idempotent upsert)GET /api/v1/insight-map,POST /api/v1/insight-map/search,GET /api/v1/soap-case-indexes/{id}/source-linkapp/core/authorization.py: report/session/patient_ref/case_index 소유권 검증 공용 헬퍼 (기존 서비스마다 중복돼 있던 로직을 재사용 가능하게 추출)FINALIZED로 전환될 때soap_case_indexes를 자동 생성 (app/services/case_index_builder.py) — SOAP 원문은 저장하지 않고 concept 태깅 + 라벨 조합 요약만 저장Why
03. 온톨로지맵 별도 창 설계서에 따라, 리포트 수정 챗봇에서 링크만 걸려 있던 인사이트맵(create_ontology_map_link툴)의 실제 백엔드 구현체가 필요했다. AgentCore/Strands agent가 아니라 그래프 데이터 모델 + API가 메인 구현체여야 한다는 설계 원칙에 따라 이 레포에 핵심 로직을 둔다.Impact
soap_case_indexes조회는 항상therapist_id == current_user.id로 강제 필터링 (본인 SOAP 기록만 노출, IDOR 방지)python scripts/seed_ontology.py를 배포 후 1회 실행해야 온톨로지 데이터가 채워짐Test
pytest tests/unit126개 전부 통과)Checklist
main이다 (레포의 실질 통합 브랜치,dev는 방치 상태)References
03. 인사이트용 온톨로지맵: 별도 창 구현 설계서UtterAI_AI/docs/ADR-003-insight-map-agent-runtime.md