fix(report): ClinicSnapshot/YouTubeAudit/Instagram*/Facebook* Optional 완화
required로 두면 LLM 응답이나 수집 데이터 누락 시 pydantic ValidationError로 리포트 endpoint 전체가 500으로 죽음. 실제 테스트(청담오라클)에서 LLM이 weekly_view_growth, established 등 10개 필드를 null 반환하는 케이스 확인. - ClinicSnapshot/YouTubeAudit: schemas + models 양쪽 모두 Optional (LLM 입력 검증 + FastAPI 응답 검증 둘 다 통과 필요) - InstagramAccount/InstagramAudit/FacebookPage/FacebookAudit: models만 (인스타·페북 빈 계정/페이지 케이스 대응) - list[T] 필드는 기본값 [] 부여 트레이드오프: 스키마 레벨 데이터 완결성 보장 약화. 운영하며 자주 비는 필드 패턴 보고 collection 단계 보강 필요. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
71b605eaa6
commit
5dbc7d7ffe
2 files changed
+94
-84
No files matched your search
@@ -68,16 +68,18 @@ class RegistryData(BaseModel):
|
||||
|
||||
|
||||
class ClinicSnapshot(BaseModel):
|
||||
name: str
|
||||
name_en: str
|
||||
staff_count: int
|
||||
lead_doctor: LeadDoctor
|
||||
overall_rating: float
|
||||
total_reviews: int
|
||||
certifications: list[str]
|
||||
location: str
|
||||
phone: str
|
||||
domain: str
|
||||
# _build_clinic_snapshot은 source 데이터 있을 때만 채움 (`if x:` 가드).
|
||||
# required면 강남언니/홈페이지 누락 병원에서 ValidationError로 리포트 실패.
|
||||
name: str | None = None
|
||||
name_en: str | None = None
|
||||
staff_count: int | None = None
|
||||
lead_doctor: LeadDoctor | None = None
|
||||
overall_rating: float | None = None
|
||||
total_reviews: int | None = None
|
||||
certifications: list[str] = []
|
||||
location: str | None = None
|
||||
phone: str | None = None
|
||||
domain: str | None = None
|
||||
logo_images: LogoImages | None = None
|
||||
brand_colors: BrandColors | None = None
|
||||
source: DataSource | None = None
|
||||
@@ -121,21 +123,23 @@ class TopVideo(BaseModel):
|
||||
|
||||
|
||||
class YouTubeAudit(BaseModel):
|
||||
channel_name: str
|
||||
handle: str
|
||||
subscribers: int
|
||||
total_videos: int
|
||||
total_views: int
|
||||
weekly_view_growth: WeeklyViewGrowth
|
||||
estimated_monthly_revenue: EstimatedRevenue
|
||||
avg_video_length: str
|
||||
upload_frequency: str
|
||||
channel_created_date: str
|
||||
channel_description: str
|
||||
linked_urls: list[LinkedUrl]
|
||||
playlists: list[str]
|
||||
top_videos: list[TopVideo]
|
||||
diagnosis: list[DiagnosisItem]
|
||||
# YouTube 미수집 병원에서 _build_youtube_audit가 채울 수 없는 필드 빔.
|
||||
# required면 ValidationError로 리포트 실패 → Optional로 받아 부분 응답 허용.
|
||||
channel_name: str | None = None
|
||||
handle: str | None = None
|
||||
subscribers: int | None = None
|
||||
total_videos: int | None = None
|
||||
total_views: int | None = None
|
||||
weekly_view_growth: WeeklyViewGrowth | None = None
|
||||
estimated_monthly_revenue: EstimatedRevenue | None = None
|
||||
avg_video_length: str | None = None
|
||||
upload_frequency: str | None = None
|
||||
channel_created_date: str | None = None
|
||||
channel_description: str | None = None
|
||||
linked_urls: list[LinkedUrl] = []
|
||||
playlists: list[str] = []
|
||||
top_videos: list[TopVideo] = []
|
||||
diagnosis: list[DiagnosisItem] = []
|
||||
|
||||
|
||||
# --- Instagram ---
|
||||
|
||||
Reference in new issue
Block a user