From 28418b9f5d394f8e8209b0f9461369e76f9f9048 Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 10 Jul 2026 00:55:23 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20naver=20=EC=9B=8C=EC=BB=A4=20internal?= =?UTF-8?q?=20=EC=97=94=EB=93=9C=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=B9=B4?= =?UTF-8?q?=ED=83=88=EB=A1=9C=EA=B7=B8(=C2=A75/=C2=A79)=20+=20=EC=8A=A4?= =?UTF-8?q?=ED=8E=99=20matched=20=EB=AC=B8=EA=B5=AC=20=EC=A0=95=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CLAUDE.md | 8 ++++++-- .../specs/2026-07-09-naver-listing-worker-design.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index aa61bfe..6c3f329 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -114,6 +114,7 @@ Synology NAS 기반의 개인 웹 플랫폼 백엔드 모노레포. | `/api/internal/music/` | `music-lab:8000` | Windows 워커 webhook (IP 화이트리스트 + `X-Internal-Key`) | | `/api/internal/video/` | `video-lab:8000` | Windows 워커 webhook (IP 화이트리스트 + `X-Internal-Key`) | | `/api/internal/image/` | `image-lab:8000` | Windows 워커 webhook (IP 화이트리스트 + `X-Internal-Key`) | +| `/api/internal/realestate/` | `realestate-lab:8000` | naver-fetch 워커 targets 조회 + 매물 ingest (IP 화이트리스트 + `X-Internal-Key`) | | `/api/webai/` | `stock:8000` | Windows AI 서버 프록시 (rate-limited 60r/m) | | `/webhook`, `/webhook/` | `deployer:9000` | Gitea Webhook | | `/ext/feargreed` | CNN API | 공포탐욕지수 외부 프록시 | @@ -334,9 +335,10 @@ docker compose up -d ### realestate-lab (realestate-lab/) 공공데이터포털 청약 분양정보 수집 + 자치구 5티어 매칭 + agent-office push 알림. **+ 매물 알림(전월세·매매) + 안전마진/매수 적정성 판정 + 재무·규제 예산 산정**(2026-07-09 추가). - 핵심 파일(청약): `main.py`, `db.py`, `collector.py`, `matcher.py`, `notifier.py`, `models.py` -- 핵심 파일(매물): `listing_collector.py`(국토부 실거래[합법]+네이버 호가[폴백]), `listing_matcher.py`(안전마진·적정성), `finance_rules.py`+`finance_rules_config.py`(전세대출·LTV·DSR·토허), `lawd_codes.py`(법정동코드) +- 핵심 파일(매물): `listing_collector.py`(국토부 실거래[합법, **collect은 MOLIT 전용**]), `listing_matcher.py`(안전마진·적정성), `finance_rules.py`+`finance_rules_config.py`(전세대출·LTV·DSR·토허), `lawd_codes.py`(5자리 시군구+10자리 법정동 `NAVER_CORTAR`), `internal_router.py`+`auth.py`(naver-fetch 워커 계약), `pipeline_lock.py`(매칭+알림 직렬화) - 매칭 100점: 지역35 / 주택유형10 / 면적15 / 가격15 / 자격25 -- 매물 판정: 임차 전세가율 ≤0.70🟢/≤0.80🟡/>0.80🔴, 매매 호가율 ≤0.97🟢/≤1.05🟡/>1.05🔴, 실거래 표본<3 ⚪보류. 네이버 차단돼도 실거래·안전마진·청약 무중단(`naver_ok`) +- 매물 판정: 임차 전세가율 ≤0.70🟢/≤0.80🟡/>0.80🔴, 매매 호가율 ≤0.97🟢/≤1.05🟡/>1.05🔴, 실거래 표본<3 ⚪보류 +- ⚠️ **네이버 호가는 NAS가 직접 안 긁음**(datacenter IP 차단) → **Windows `naver-fetch` 워커**(가정 IP, web-ai)가 `GET /api/internal/realestate/targets`로 대상 받고 네이버 fetch → `POST /listings-ingest`로 push. NAS `collect_listings`는 MOLIT 실거래 baseline만. 관측: node_monitor `fetcher` kind → `/infra` - 📌 상세(DB 스키마·스케줄러·매칭 모델·notifier 멱등·매물 4테이블·판정 경계·env): **`service_realestate.md`** | 메서드 | 경로 | 설명 | @@ -357,6 +359,8 @@ docker compose up -d | GET | `/api/realestate/listings/matches` | 매물 매칭+판정 결과 | | POST | `/api/realestate/safety-check` | 단건 안전마진/적정성 판정 (실거래 median 대비) | | POST | `/api/realestate/budget` | 전세/매수 예산·규제 산정 (전세대출·LTV·DSR·토허) | +| GET | `/api/internal/realestate/targets` | (naver-fetch 워커) 대상 동+10자리 cortarNo+거래유형 (X-Internal-Key) | +| POST | `/api/internal/realestate/listings-ingest` | (naver-fetch 워커) 네이버 raw 매물 push→파싱·upsert·매칭·알림 (X-Internal-Key) | ### agent-office (agent-office/) AI 에이전트 가상 오피스 — 기존 서비스 API를 프록시로 호출, 실시간 WebSocket + 텔레그램 봇. diff --git a/realestate-lab/docs/superpowers/specs/2026-07-09-naver-listing-worker-design.md b/realestate-lab/docs/superpowers/specs/2026-07-09-naver-listing-worker-design.md index 5f165f9..2b43edc 100644 --- a/realestate-lab/docs/superpowers/specs/2026-07-09-naver-listing-worker-design.md +++ b/realestate-lab/docs/superpowers/specs/2026-07-09-naver-listing-worker-design.md @@ -77,7 +77,7 @@ ``` - 각 batch의 각 article → `_parse_naver_article(article)` → `d["dong"] = batch.dong` → `upsert_listing(d)`. article별 try/except(불량 1건 skip). - 전체 upsert 후 `run_listing_matching()` + `notify_new_listings()` 호출(신규 매물만 알림, 멱등). -- 응답: `{"received": N, "new": M, "matched": K}` (received=처리 article 수, new=신규 upsert 수, matched=passed match 수). +- 응답: `{"received": N, "new": M, "matched": K}` (received=처리 article 수, new=신규 upsert 수, **matched=이번 호출에서 신규 텔레그램 발송 건수(`notify_new_listings().sent`)** — 누적 통과 매칭 수가 아님). - 인증 실패 → 401. `batches` 비면 no-op `{received:0,new:0,matched:0}`. - ⚠️ MVP는 인라인 처리(매물 수 수백 규모). 대량 시 upsert만 동기+매칭/알림 BackgroundTask로 분리 여지(§9).