Financial services · Single customer record

Single base by CPF and CNPJ (tax IDs)

Each person or company appears only once, with what they bought in each system, whether they are active today and who the sales owner was on the date of each event.

UsageWidely used
EffortMedium
ForVehicle protection cooperatives and associations, insurance brokers, investment advisory firms and fintechs with the same customer in several systems.
Source

Core, policies, CRM, brokerage reports and spreadsheets

Rule

Normalized tax ID, active status per system and owner valid on the date

Outcome

One person, their contracts and objects, active or not

Activation

AI agent, lists, base count and files for partners

What it solves

  • The active base has a single number, the same for leadership, sales and finance.
  • Each customer appears once, with everything they bought across all systems and the source of each contract.
  • A lead who was already a customer stops counting as a new sale.

Business questions it answers

Ask your agent these questions once the case is live.

How many active customers do we have today, by region and by product?
Which contracts were activated this month?
Is this CPF already our customer in any system?
How many of this month's leads became contracts, and how many were already customers?
Who was the advisor on this account when the inflow happened?
Which customers have more than one vehicle or more than one active policy?

What you need

  • The systems where the customer lives connected to Nekt: core, policies, CRM and partner reports
  • A written definition of an active customer, per system and per product
  • An owner history per account, if the question is about the past

What you get

  • A table per person with normalized tax ID, source and active status
  • The person x contract x object detail, with activation date
  • A lead-to-contract link that states which key matched
  • An AI agent that counts the base with the active rule already applied

Where to activate

AI agent via MCP

Answers how many active customers exist and whether a tax ID is already a customer, with the active rule and the source of each contract.

Lists and reverse ETL

Active customers with license plate, product and due day for collections, roadside assistance and partner files, one row per person and object.

Base dashboard

Active base by region, consultant and product, with activations of the month and tax ID coverage per source.

Ready to build?

Normalization is mechanical. The work is agreeing with the business on what an active customer is in each system and keeping the owner history. The detailed view has the business rules, the pitfalls and the acceptance test. Or send everything straight to your agent with the Nekt MCP.

The problem

The same cooperative member is in the protection system, the policy system, a CRM pipeline and a spreadsheet, and in each one the tax ID was typed differently: with punctuation, without the leading zero, as a number with ".0" at the end. Adding up the bases counts the same person several times. Each team uses its own definition of active, and the lead who was already a customer becomes a conversion in the funnel.

How it is usually done, and the rule

Each row is a mistake that already happened in practice.

The common wayThe rule
01
Comparing the tax ID as it came, with punctuation, or converted to a number.
The normalized tax ID is the key

Strip everything that is not a digit. CPF has 11 digits and CNPJ has 14: pad with leading zeros when the source read the field as a number. If it comes with more than 14 digits (a system prefix), keep the last 14. Remove the ".0" from fields that went through a float before stripping non-digits, otherwise 8539905.0 becomes 85399050. Keep the original value alongside.

02
Linking records through a CPF 000.000.000-00 or a phone without area code.
Junk becomes null, never a key

A tax ID with a length other than 11 or 14, or with all digits equal (000..., 111...), becomes null. Phone: digits only, drop the 55 country code only when it has 12 or 13 digits, accept 10 or 11, the rest is null. License plate: uppercase without dash, valid in the old format and the Mercosur format (3 letters, 1 digit, 1 letter or digit, 2 digits). Chassis number: at least 8 characters and never all zeros.

03
Counting any existing contract as active, or using one system's rule for the others.
Active is a written rule, per system

State what counts as active in each source: in the core, a contract with status ATIVO; in the policy system, a policy with status active; for the product that only exists in the CRM, the deal in the Active stage of that pipeline. Then apply the agreed exclusions: anyone on the canceled list and, if the business decides so, anyone delinquent. Write down the decision on delinquent customers, because it changes the count.

04
Joining the bases by name and losing where each contract came from.
One row per source, with origin

Stack the sources in a common format (name, tax ID, object, contract, activation date) with source and source id columns. Count contracts by source + source id, because the detail may have one row per product. Only then consolidate by tax ID.

05
Using the contract creation date as the customer's start.
Activation is the first confirmed payment

A contract's activation date is the earliest payment date among its paid invoices. For a policy, the start of coverage. Contract or proposal creation date is not activation: some contracts are created and never paid.

06
Counting customers by the number of rows in the unified base.
The object is part of the grain

In vehicle protection and insurance, a person has several vehicles, equipment units or policies; in investments, several accounts at different institutions. The detail is person x contract x object, and the object can be a vehicle or a piece of equipment, never both. Count people by distinct tax ID and objects by the object key.

07
Adding customers and leads and showing the same person twice.
Customer wins over lead

In the base of people and leads, a lead only enters as type Lead when there is no active customer linked to it. If both exist, the customer stays. A person without a linked account remains in the base with a null account.

08
Flagging as converted every lead that matches any contract, from any date.
Lead to contract in a cascade, with dates

Match the lead to contracts using the strongest key first: tax ID, then license plate or chassis number, then phone, then the CRM contact. Store which key matched. Compare the contract registration date with the lead creation date: a contract older than the lead is a returning customer, not a conversion.

09
Attributing past inflows to today's advisor.
The owner is the one valid on the date

Advisor, consultant or broker changes over time. For inflows, sales or commissions, join with the book history where valid-from <= event date and (valid-to is null or valid-to > event date). The current owner only applies to today's lists.

10
Joining core tables without filtering deleted rows, or using the first version of the CRM deal.
Deleted rows and old versions go first

In the core, filter out records with deleted true in person, contract, region and consultant. In the CRM, keep the latest version of each id (latest modification date and, on ties, the most recent sync). In Open Finance data, check whether the event carries the platform user id instead of the customer id and translate it before joining.

Matching keys and how to normalize them

From strongest to weakest. An invalid key becomes null and links no records.

CPF (individual tax ID)Individualdigits only, 11 positions, not all digits equal
CNPJ (company tax ID)Companydigits only, 14 positions (last 14 if longer)
Contract, policy, account numberProduct linktext without ".0", digits only when numeric
License plateInsured vehicleuppercase, no dash, ^[A-Z]{3}[0-9][A-Z0-9][0-9]{2}$
Chassis numberVehicle or equipmentuppercase alphanumeric, 8+ characters, not all zeros
PhoneWeak signal, never alonedigits only, no 55 when it has 12 or 13, accepts 10 or 11
CRM contactLink stored in the CRMcontact_id not empty and not 0
NameValidates only, never linkslowercase, no accents, no suffix such as ltda

Definitions

Unique person
valid normalized tax ID (11-digit CPF or 14-digit CNPJ); 1 row per tax ID, with the list of sources where it appears
Active customer
person with at least one contract active under their source's rule on the reference date, outside the canceled list and, if stated, the delinquent list
Activation date
earliest payment date among the contract's paid invoices; for a policy, coverage start
Contracts activated in the month
distinct contracts (source + source id) whose activation date falls in the month
Active base by region
distinct active people by contract region on the reference date; a person with contracts in two regions counts once in each and once in the total
Lead conversion
lead linked to a contract registered on or after the lead creation date, using the strongest key available
Returning customer
lead linked to a contract registered before the lead creation date; not part of conversion
Tax ID coverage
rows with a valid tax ID / total rows, per source, on the run date

Pitfalls that already happened

The leading zero vanished

CNPJ and CPF read as numbers from a spreadsheet or CSV lost their leading zeros, and a CNPJ starting with 00 never matched the core.

Read tax IDs as text and pad with zeros to 11 or 14 digits.

A policy with one extra digit

The policy number came as a float, "8539905.0", and stripping non-digits produced 85399050, which matched nothing.

Remove the trailing ".0" before stripping non-digits.

The same member three times

Adding the protection core, the policy system and the CRM pipeline counted the same person once in each system.

Stack with a source column and consolidate by tax ID before counting.

A new sale who was already a customer

Campaign leads matched by phone to contracts from years earlier showed up as conversions of the month.

Compare the contract date with the lead creation date and separate returning customers.

Inflow credited to the wrong advisor

Inflows from previous months were credited to the account's current advisor after a book transfer.

Join on the book's validity history on the inflow date.

Works in the query, breaks in the pipeline

The query validated in the editor used 1-based array indexes and cardinality; once it became a Spark transformation, which indexes from 0 and uses size, it started picking the wrong item.

Test the rule on the engine where it will run before publishing the table.

Acceptance test

The case is done when every item passes.

Agent package

Paste into Claude, ChatGPT or any client with the Nekt MCP connected.

Full Markdown
Single base by CPF and CNPJ
- A person is identified by the normalized tax ID: digits only, CPF with 11 and CNPJ with 14, leading zeros preserved. A tax ID with another length or with all digits equal is invalid and links no records.
- To count people, use distinct tax IDs. Never count rows: the detail table has one row per contract, object (license plate, chassis number, policy, account) and sometimes per product.
- Active customer: ATIVO contract in the core, active policy in the policy system, or deal in the Active stage of pipeline <pipeline> in the CRM; and not on the canceled list. Delinquent: <included | not included> in the active base.
- Activation date = first confirmed payment of the contract. For a policy, coverage start.
- Customer wins over lead. A lead is only a conversion if the contract was registered on or after the lead creation date; an earlier contract is a returning customer.
- Always say which key made the link (tax ID, license plate, chassis number, phone, CRM contact). Phone alone is a weak signal.
- Owner (advisor, consultant, broker) in questions about the past: use the one valid on the event date, from the book history. For today's lists, use the current one.
- If the question does not name the product or system, answer with the consolidated total and break it down by source.
Exceptions per client:
- <client>: product <product> exists only in the CRM; active = stage <stage> of pipeline <id>.
- <client>: customers delinquent for more than <N> days leave the active base.

Variations

Investments

The person is the CPF and the object is the account at each institution. The advisor comes from the brokerage history by event date.

B2B pensions and benefits

Two levels: company (CNPJ) and employee (CPF), with the CRM contact linked to the company by the CNPJ root.

Financial planning

The planner's customers and leads in a single base, with balance per institution and a daily history per customer, account and date.