종합부동산웹앱 5단계 목표가·급매 플래그 구현
질의 원문
다음 단계 차례로 진행해줘.
수집 경로와 시점
- 수집시점: 2026-08-11 19:54 KST
- 기준 설계:
docs/plans/2026-08-11-watchlist-action-flags-design.mddocs/plans/2026-08-11-watchlist-action-flags.mddocs/analysis/2026-08-11-종합부동산웹앱-5단계-목표가-급매플래그설계.md- 확인 코드:
src/realestate/webapp/watchlist.pysrc/realestate/webapp/app.pysrc/realestate/webapp/templates/watchlist.htmlsrc/realestate/webapp/static/app.css
데이터 등급
| 항목 | 등급 | 설명 |
|---|---|---|
| 플래그 계산 | 로컬 파생 지표 | 저장된 목표가·현재가·metric source만 사용 |
| 현재가 | 입력값 또는 수집값 등급 승계 | metric_sources.current_price.data_grade와 함께 해석 |
| 출처 신뢰도 | 메타데이터 기반 | collected_at, original_verified를 사용 |
구현 내용
action_flags_for_item()을 추가해 워치리스트 후보의 행동 플래그를 계산한다.- 현재가가 목표가 이하이면
target_hit, 목표가보다 5% 이상 낮으면bargain, 목표가보다 높지만 3% 이내이면near_target을 표시한다. - 현재가 출처 수집시점이 7일을 초과하면
stale_source를 표시한다. - 현재가 출처가 있고 원본 확인이 아니면
needs_original_check를 표시한다. /api/watchlist와 워치리스트 페이지 응답에action_flags를 추가했다.- 후보 카드에 플래그 뱃지와
data-watch-flag-target-hit,data-watch-flag-bargain,data-watch-flag-near-target속성을 렌더링했다. - 플래그는 JSON 저장소에 쓰지 않고 매 응답 시 파생한다.
가정
- 가격 플래그는 목표가와 현재가가 모두 0보다 클 때만 계산한다.
- 급매 플래그는 목표가 대비 5% 이상 낮은 경우로 정의한다.
- 오래된 출처 기준은 7일 초과다.
collected_at이 해석되지 않으면 stale 여부를 확정하지 않는다.
한계
- 급매 여부는 목표가 대비 단순 할인율이며, 같은 단지의 호가 분포·층·향·수리상태는 반영하지 않는다.
- 원본 확인 필요 플래그는 위험 제거가 아니라 확인 과제 표시다.
- 경매·재개발 특유의 권리 리스크와 분담금 변동성은 별도 플래그가 필요하다.
검증
- RED:
action_flags_for_itemimport 실패로 신규 플래그 테스트가 실패하는 것을 확인했다. - GREEN:
python -m pytest tests/test_webapp_watchlist.py::test_watchlist_action_flags_identify_target_hit_bargain_and_near_target tests/test_webapp_watchlist.py::test_watchlist_action_flags_identify_stale_and_unverified_sources tests/test_webapp_watchlist.py::test_watchlist_api_includes_action_flags tests/test_webapp_watchlist.py::test_watchlist_page_renders_action_flags -q-> 4 passed - REVIEW: 코드 리뷰에서 실행계획 문서의 pytest node id 불일치를 지적받아
docs/plans/2026-08-11-watchlist-action-flags.md명령을 실제 테스트명으로 수정했다. - focused:
python -m pytest tests/test_webapp_watchlist.py tests/test_webapp_static_js.py -q-> 48 passed - focused+E2E+현황판:
python -m pytest tests/test_webapp_watchlist.py tests/test_webapp_static_js.py tests/test_investment_board.py tests/test_webapp_watchlist_e2e.py -q-> 57 passed, 2 warnings - Node:
node --test tests/webapp_watchlist_logic.test.js-> 6 passed - JS 문법:
node --check src/realestate/webapp/static/app.js-> 통과 - JS 문법:
node --check src/realestate/webapp/static/watchlist_logic.js-> 통과 - 전체 테스트:
python -m pytest -q-> 261 passed, 2 warnings - whitespace:
git diff --check-> whitespace error 없음(CRLF 경고만 출력) - 투자 현황판:
python -m realestate.cli invest-board->reports/investment_board.html재생성
다음 단계
- 경매 사건번호·재개발 원천 식별자를 실제 원본 수집기와 연결한다.
- 경매·재개발 전용 플래그를 추가하되, 원본 미확인 한계를 항상 함께 표시한다.
원문 Markdown: docs/analysis/2026-08-11-종합부동산웹앱-5단계-목표가-급매플래그구현.md