feat: P1-5/6/7 — AI KPI targets, website tech audit, dynamic clinic profile

- P1-5: Add kpiTargets schema to AI prompt, use AI-generated goals instead of hardcoded multipliers
- P1-6: Extend website channelAnalysis with trackingPixels, snsLinksOnSite, additionalDomains, mainCTA
- P1-7: ClinicProfilePage fetches data from DB by report ID instead of hardcoded VIEW clinic data

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-02 14:30:03 +09:00
1 parent 7ea9972c7e
commit 200497fa1e
3 files changed
+126 -20

No files matched your search

+38 -13
View File
@@ -24,6 +24,10 @@ interface ApiReport {
reviews?: number;
issues?: string[];
recommendation?: string;
trackingPixels?: { name: string; installed: boolean }[];
snsLinksOnSite?: boolean;
additionalDomains?: { domain: string; purpose: string }[];
mainCTA?: string;
}>;
competitors?: {
name: string;
@@ -51,6 +55,12 @@ interface ApiReport {
asIs?: string;
toBe?: string;
}[];
kpiTargets?: {
metric?: string;
current?: string;
target3Month?: string;
target12Month?: string;
}[];
marketTrends?: string[];
}
@@ -252,10 +262,16 @@ export function transformApiReport(
websiteAudit: {
primaryDomain: new URL(metadata.url).hostname,
additionalDomains: [],
snsLinksOnSite: false,
trackingPixels: [],
mainCTA: '',
additionalDomains: (r.channelAnalysis?.website?.additionalDomains || []).map(d => ({
domain: (d as { domain?: string }).domain || '',
purpose: (d as { purpose?: string }).purpose || '',
})),
snsLinksOnSite: r.channelAnalysis?.website?.snsLinksOnSite ?? false,
trackingPixels: (r.channelAnalysis?.website?.trackingPixels || []).map(p => ({
name: (p as { name?: string }).name || '',
installed: (p as { installed?: boolean }).installed ?? false,
})),
mainCTA: r.channelAnalysis?.website?.mainCTA || '',
},
problemDiagnosis: buildDiagnosis(r),
@@ -304,15 +320,24 @@ export function transformApiReport(
.map(rec => ({ task: rec.title || rec.description || '', completed: false })),
})),
kpiDashboard: [
{ metric: '종합 점수', current: `${r.overallScore ?? '-'}`, target3Month: `${Math.min((r.overallScore ?? 50) + 15, 100)}`, target12Month: `${Math.min((r.overallScore ?? 50) + 30, 100)}` },
...(r.channelAnalysis?.instagram ? [
{ metric: 'Instagram 팔로워', current: `${r.channelAnalysis.instagram.followers ?? 0}`, target3Month: `${Math.round((r.channelAnalysis.instagram.followers ?? 0) * 1.3)}`, target12Month: `${Math.round((r.channelAnalysis.instagram.followers ?? 0) * 2)}` },
] : []),
...(r.channelAnalysis?.youtube ? [
{ metric: 'YouTube 구독자', current: `${r.channelAnalysis.youtube.subscribers ?? 0}`, target3Month: `${Math.round((r.channelAnalysis.youtube.subscribers ?? 0) * 1.5)}`, target12Month: `${Math.round((r.channelAnalysis.youtube.subscribers ?? 0) * 3)}` },
] : []),
],
kpiDashboard: r.kpiTargets?.length
? r.kpiTargets
.filter((k): k is { metric?: string; current?: string; target3Month?: string; target12Month?: string } => !!k?.metric)
.map(k => ({
metric: k.metric || '',
current: k.current || '-',
target3Month: k.target3Month || '-',
target12Month: k.target12Month || '-',
}))
: [
{ metric: '종합 점수', current: `${r.overallScore ?? '-'}`, target3Month: `${Math.min((r.overallScore ?? 50) + 15, 100)}`, target12Month: `${Math.min((r.overallScore ?? 50) + 30, 100)}` },
...(r.channelAnalysis?.instagram ? [
{ metric: 'Instagram 팔로워', current: `${r.channelAnalysis.instagram.followers ?? 0}`, target3Month: '-', target12Month: '-' },
] : []),
...(r.channelAnalysis?.youtube ? [
{ metric: 'YouTube 구독자', current: `${r.channelAnalysis.youtube.subscribers ?? 0}`, target3Month: '-', target12Month: '-' },
] : []),
],
screenshots: [],
};