ProductReportsResourcesPricingLoginBook a demo

Cookbook 08 ยท Data operations

Clean up the CRM export

Match messy company rows safely, add Dealroom fields, and send uncertain records to a review queue.

Python15 minutes2 API calls per matchIntermediate
python enrich_companies.pyCSV written
INPUT  company_name + website + country
MATCH  domain, then exact name + country
OUTPUT enriched_companies.csv

Loading the real match summary...

6safe matches
1needs review
1unmatched

The goal

Turn a rough export into a usable research list

CRM data drifts. Company names change, legal suffixes appear, domains move, and duplicate names point to different businesses. This workflow enriches only deterministic matches and keeps the evidence used for each decision.

Take a CSV of European technology accounts, reconcile each row to Dealroom, add operating and funding context, then calculate an editable research priority score.
terminal
python -m venv .venv
source .venv/bin/activate
pip install requests python-dotenv
python enrich_companies.py --input sample_companies.csv

Store DEALROOM_CLIENT_ID and DEALROOM_CLIENT_SECRET in a local .env file. Keep it out of version control.

Keep your own identifiers in the input

The example starts with five columns. The account ID and owner survive the round trip, so the enriched file can return to the source system without relying on row order.

sample_companies.csv
account_id,company_name,website,country,owner
CRM-001,Eleven Labs,https://elevenlabs.io,United Kingdom,Maya
CRM-006,Quantum Motion Technologies,https://quantummotion.tech,United Kingdom,Lena

A website and country make reconciliation safer. Rows can still be searched by name when the website is blank, but the fallback requires one exact normalized name in the same country.

Let strict rules accept search candidates

GET /data/search returns likely companies. The script applies stricter rules after retrieval.

DecisionRuleAction
High confidenceExact normalized website domainEnrich automatically
Medium confidenceOne exact normalized name in the same countryEnrich and retain the method
Low confidenceSimilar name and same countrySuggest a candidate for review
No matchNo candidate passes the rulesPreserve the row with blank enrichment fields

Why the review queue matters

The sample contains a stale Quantum Motion domain. Search finds the likely current company, but the script refuses to attach its UUID or data without a deterministic match.

Fetch detail only after the match is safe

For accepted UUIDs, GET /data/entities/{company_id} supplies company identity, funding, employee, hiring, taxonomy, and Signal fields.

enrich_companies.py
search = client.get(
    "/data/search",
    {"q": domain or company_name, "types": "company", "limit": 8},
)

match = pick_match(source_row, rows(search))
if match["matched"]:
    company = client.get(
        f"/data/entities/{match['candidate']['uuid']}",
        {"currency": "USD"},
    )["data"]

Batch the work row by row or with bounded concurrency. The downloadable script retries rate limits and temporary server errors, refreshes an expired token once, and writes unmatched rows instead of dropping them.

Make the score easy to replace

The example score prioritizes active, well-described companies for research. Dealroom Signal remains a separate API field. Rewrite the score for your own sales, sourcing, or portfolio workflow.

40Dealroom Signal
25Employee growth
15Hiring status
10Open roles
10Profile completeness

Null values earn no points. That keeps missing data visible instead of silently replacing it with an optimistic assumption.

Real output

Inspect the enriched CRM rows

The saved snapshot includes the original fields, match evidence, enrichment fields, and review status.

Loading the enriched rows...

Snapshot generated from the Dealroom API. Re-run the script before importing current data.

Review matches before writing back to the CRM

  • Keep the original account ID and matching evidence with every output row.
  • Inspect medium-confidence and duplicate-domain matches before an automated update.
  • Never attach enrichment from a low-confidence suggestion without human confirmation.
  • Choose overwrite rules field by field. A verified CRM value may be newer than the returned profile.
  • Use the priority score only as a queueing rule. It cannot predict an outcome or support an investment recommendation.

Complete example

Download the enrichment workflow

The files include OAuth2 authentication, bounded retries, deterministic matching, confidence flags, CSV output, optional JSON output, and an editable score.