feat: Sprint 1 — 7 data quality quick wins
WP-1: YouTube channel ID regex {20,} → {22} (exactly 24 chars)
WP-2: Naver Place category filtering in enrich-channels (성형/피부)
WP-3: Google Maps stores mapsUrl separately from clinicWebsite
WP-4: Naver Blog separates officialBlogUrl from search results
WP-5: 강남언니 rawRating + normalized rating (≤5 → ×2), Firecrawl
prompt explicitly states "out of 10, NOT out of 5"
WP-6: Perplexity model centralized in _shared/config.ts (env override)
WP-7: Apify Instagram timeout 30s → 45s
Frontend: transformReport uses mapsUrl and officialBlogUrl when available
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1071328574
commit
80c57147e7
8 files changed
+80
-39
No files matched your search
@@ -168,7 +168,8 @@ Deno.serve(async (req) => {
|
||||
reviewCount: place.reviewsCount,
|
||||
address: place.address,
|
||||
phone: place.phone,
|
||||
website: place.website,
|
||||
clinicWebsite: place.website,
|
||||
mapsUrl: place.url || (place.title ? `https://www.google.com/maps/search/${encodeURIComponent(String(place.title))}` : ''),
|
||||
category: place.categoryName,
|
||||
openingHours: place.openingHours,
|
||||
topReviews: ((place.reviews as Record<string, unknown>[]) || [])
|
||||
@@ -233,7 +234,7 @@ Deno.serve(async (req) => {
|
||||
url: hospitalUrl,
|
||||
formats: ["json"],
|
||||
jsonOptions: {
|
||||
prompt: "Extract: hospital name, overall rating (out of 10), total review count, doctors with names/ratings/review counts/specialties, procedures offered, address, certifications/badges",
|
||||
prompt: "Extract: hospital name, overall rating (강남언니 rating is always out of 10, NOT out of 5), total review count, doctors with names/ratings/review counts/specialties, procedures offered, address, certifications/badges",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
@@ -267,7 +268,8 @@ Deno.serve(async (req) => {
|
||||
if (hospital?.hospitalName) {
|
||||
enrichment.gangnamUnni = {
|
||||
name: hospital.hospitalName,
|
||||
rating: hospital.rating,
|
||||
rawRating: hospital.rating,
|
||||
rating: typeof hospital.rating === 'number' && hospital.rating > 0 && hospital.rating <= 5 ? hospital.rating * 2 : hospital.rating,
|
||||
ratingScale: "/10",
|
||||
totalReviews: hospital.totalReviews,
|
||||
doctors: (hospital.doctors || []).slice(0, 10),
|
||||
@@ -316,27 +318,39 @@ Deno.serve(async (req) => {
|
||||
})()
|
||||
);
|
||||
|
||||
// 4b. Local search — Naver Place
|
||||
// 4b. Local search — Naver Place (with category filtering to avoid same-name clinics)
|
||||
tasks.push(
|
||||
(async () => {
|
||||
const query = encodeURIComponent(clinicName);
|
||||
const res = await fetch(
|
||||
`https://openapi.naver.com/v1/search/local.json?query=${query}&display=5&sort=comment`,
|
||||
{ headers: naverHeaders }
|
||||
);
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
const place = (data.items || [])[0];
|
||||
if (place) {
|
||||
enrichment.naverPlace = {
|
||||
name: (place.title || "").replace(/<[^>]*>/g, ""),
|
||||
category: place.category,
|
||||
address: place.roadAddress || place.address,
|
||||
telephone: place.telephone,
|
||||
link: place.link,
|
||||
mapx: place.mapx,
|
||||
mapy: place.mapy,
|
||||
};
|
||||
const queries = [`${clinicName} 성형외과`, `${clinicName} 성형`, clinicName];
|
||||
for (const q of queries) {
|
||||
const query = encodeURIComponent(q);
|
||||
const res = await fetch(
|
||||
`https://openapi.naver.com/v1/search/local.json?query=${query}&display=5&sort=comment`,
|
||||
{ headers: naverHeaders }
|
||||
);
|
||||
if (!res.ok) continue;
|
||||
const data = await res.json();
|
||||
const items = (data.items || []) as Record<string, string>[];
|
||||
// Prefer category matching 성형 or 피부
|
||||
const match = items.find(i =>
|
||||
(i.category || '').includes('성형') || (i.category || '').includes('피부')
|
||||
) || items.find(i => {
|
||||
const name = (i.title || '').replace(/<[^>]*>/g, '').toLowerCase();
|
||||
return name.includes(clinicName.replace(/성형외과|병원|의원/g, '').trim().toLowerCase());
|
||||
}) || null;
|
||||
|
||||
if (match) {
|
||||
enrichment.naverPlace = {
|
||||
name: (match.title || "").replace(/<[^>]*>/g, ""),
|
||||
category: match.category,
|
||||
address: match.roadAddress || match.address,
|
||||
telephone: match.telephone,
|
||||
link: match.link,
|
||||
mapx: match.mapx,
|
||||
mapy: match.mapy,
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
})()
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user