Skip to content

Commit 97f7fe9

Browse files
improvement(enrichments): limit company-info to fields both providers return (#4817)
Hunter's company dataset returns null industry/foundedYear for many large companies (verified against the live API for Microsoft, Amazon, Google), so under the first-non-empty-wins cascade those columns appeared inconsistently across rows. Limit company-info outputs to employee count and description — the fields Hunter and PDL both reliably return — so every row is consistent. employeeCount is a string so Hunter's range bucket and PDL's exact count share the column.
1 parent 1ae1afb commit 97f7fe9

1 file changed

Lines changed: 25 additions & 33 deletions

File tree

apps/sim/enrichments/company-info/company-info.ts

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,55 @@ import { Building2 } from 'lucide-react'
33
import { normalizeDomain, str, toolProvider } from '@/enrichments/providers'
44
import type { EnrichmentConfig } from '@/enrichments/types'
55

6-
/** Returns the value when it's a finite number, else `undefined`. */
7-
function num(value: unknown): number | undefined {
8-
return typeof value === 'number' && Number.isFinite(value) ? value : undefined
9-
}
10-
116
/**
12-
* Company Info enrichment. Looks up firmographics for a company domain, trying
13-
* People Data Labs first (richest record, incl. employee count) then Hunter as
14-
* a fallback.
7+
* Company Info enrichment. Looks up a company by domain, trying Hunter first
8+
* (free) then People Data Labs as a fallback. Outputs are limited to the fields
9+
* both providers reliably return — employee count and description — so the
10+
* result stays consistent regardless of which provider fills the cell.
11+
* `employeeCount` is a string so Hunter's range bucket (e.g. `"11-50"`) and
12+
* PDL's exact count map onto the same column.
1513
*/
1614
export const companyInfoEnrichment: EnrichmentConfig = {
1715
id: 'company-info',
1816
name: 'Company Info',
19-
description:
20-
"Look up a company's industry, size, founding year, and description from its domain.",
17+
description: "Look up a company's size and description from its domain.",
2118
icon: Building2,
2219
inputs: [{ id: 'domain', name: 'Company domain', type: 'string', required: true }],
2320
outputs: [
24-
{ id: 'industry', name: 'industry', type: 'string' },
25-
{ id: 'employeeCount', name: 'employee count', type: 'number' },
26-
{ id: 'foundedYear', name: 'founded year', type: 'number' },
21+
{ id: 'employeeCount', name: 'employee count', type: 'string' },
2722
{ id: 'description', name: 'description', type: 'string' },
2823
],
2924
providers: [
3025
toolProvider({
31-
id: 'pdl',
32-
label: 'People Data Labs',
33-
toolId: 'pdl_company_enrich',
26+
id: 'hunter',
27+
label: 'Hunter',
28+
toolId: 'hunter_companies_find',
3429
buildParams: (inputs) => {
35-
const website = normalizeDomain(inputs.domain)
36-
if (!website) return null
37-
return { website }
30+
const domain = normalizeDomain(inputs.domain)
31+
if (!domain) return null
32+
return { domain }
3833
},
3934
mapOutput: (output) => {
40-
const company = output.company as Record<string, unknown> | undefined
4135
return filterUndefined({
42-
industry: str(company?.industry) || undefined,
43-
employeeCount: num(company?.employee_count),
44-
foundedYear: num(company?.founded),
45-
description: str(company?.summary) || undefined,
36+
employeeCount: str(output.size) || undefined,
37+
description: str(output.description) || undefined,
4638
})
4739
},
4840
}),
4941
toolProvider({
50-
id: 'hunter',
51-
label: 'Hunter',
52-
toolId: 'hunter_companies_find',
42+
id: 'pdl',
43+
label: 'People Data Labs',
44+
toolId: 'pdl_company_enrich',
5345
buildParams: (inputs) => {
54-
const domain = normalizeDomain(inputs.domain)
55-
if (!domain) return null
56-
return { domain }
46+
const website = normalizeDomain(inputs.domain)
47+
if (!website) return null
48+
return { website }
5749
},
5850
mapOutput: (output) => {
51+
const company = output.company as Record<string, unknown> | undefined
5952
return filterUndefined({
60-
industry: str(output.industry) || undefined,
61-
foundedYear: num(output.founded_year),
62-
description: str(output.description) || undefined,
53+
employeeCount: str(company?.employee_count) || undefined,
54+
description: str(company?.summary) || undefined,
6355
})
6456
},
6557
}),

0 commit comments

Comments
 (0)