fix: gangnamUnni always-try + leadDoctor in Perplexity prompt

- collect-channel-data: gangnamUnni scraping no longer requires
  verified=true. Fallback: Firecrawl search for gangnamunni.com URL
  when discover-channels failed to verify. Solves empty ratings/reviews.
- generate-report: Perplexity prompt now explicitly requests leadDoctor
  (name, specialty, rating, reviewCount) and staffCount in clinicInfo.
- transformReport: clinicInfo type extended with leadDoctor + staffCount;
  transformation prefers clinic.leadDoctor over doctors[0] fallback.

Root cause: clinic_registry table not yet in DB → discover-channels
always falls back to API search → gangnamUnni URL not found →
collect-channel-data skips gangnamUnni → all clinic metrics empty.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Opus 4.6 committed 2026-04-07 10:29:10 +09:00
1 parent 2cda26a649
commit 6e8f6940bf
3 files changed
+47 -12

No files matched your search

+7 -5
View File
@@ -12,7 +12,9 @@ interface ApiReport {
address?: string;
phone?: string;
services?: string[];
doctors?: { name: string; specialty: string }[];
doctors?: { name: string; specialty: string; rating?: number; reviews?: number }[];
leadDoctor?: { name: string; specialty: string; rating?: number; reviewCount?: number };
staffCount?: number;
};
newChannelProposals?: { channel?: string; priority?: string; rationale?: string }[];
executiveSummary?: string;
@@ -516,7 +518,7 @@ export function transformApiReport(
): MarketingReport {
const r = apiReport;
const clinic = r.clinicInfo || {};
const doctor = clinic.doctors?.[0];
const doctor = clinic.leadDoctor || clinic.doctors?.[0];
return {
id: reportId,
@@ -530,12 +532,12 @@ export function transformApiReport(
// Registry foundedYear takes priority over AI-generated value (Registry = human-verified)
established: clinic.established || '',
yearsInBusiness: clinic.established ? new Date().getFullYear() - parseInt(clinic.established) : 0,
staffCount: 0,
staffCount: typeof clinic.staffCount === 'number' ? clinic.staffCount : (clinic.doctors?.length ?? 0),
leadDoctor: {
name: doctor?.name || '',
credentials: doctor?.specialty || '',
rating: 0,
reviewCount: 0,
rating: doctor?.rating ?? 0,
reviewCount: doctor?.reviewCount ?? doctor?.reviews ?? 0,
},
// 강남언니 is 10-point scale. AI sometimes gives 5-point — auto-correct.
overallRating: (() => {