Brownfield AI
How do you build an AI data pipeline from outside sources?
The model can only be as consistent as the records underneath it.
Short answer
Build the AI data pipeline before the AI feature. Research every source, agree a reviewed data model, and write ETL that resolves records from each source to the same real-world entities, such as one person, one place or one product. Plan for sources that can only be scraped or that change shape, keep manual mappings for the edge cases automation will never cover, and record where every value came from so the AI can cite it.
On this page
01Why outside data is the real work
Many SaaS products depend on data they do not control: government sources, partner feeds, vendor APIs and public websites. Each arrives in its own format, on its own schedule, with its own idea of what an identifier is. Before any model can summarize, score or answer questions, those records have to agree with each other. This is part of our larger guide, AI integration for SaaS: add AI without a rebuild.
This work is easy to underrate. Google researchers who interviewed AI practitioners working on high-stakes systems found that data cascades, chains of problems that start with poor data and surface late, were close to universal in their sample. The pattern is familiar: the team rushes to the model, the outputs look plausible, and months later someone finds that two sources disagreed about which record was which.
An AI layer makes this worse, not better. A model fed inconsistent records will still write fluent answers. The inconsistency simply becomes harder to see.
02Start with source research and a reviewed schema
We do not start with a user interface or a prompt. We start with two documents the client can read and correct.

The first is a source map. For each source: what it contains, how it is accessed (API, bulk file or scraping), how often it changes, what identifiers it uses, what its terms allow and what is known to be missing or wrong.
The second is the data model: the real-world entities the product is about and how every source maps onto them. This is where the hard questions surface early. Is a person in one source the same person in another? Does a place mean a postal code, a legal boundary or a coordinate? Which source wins when two disagree?
| Decision | Question to answer | Why it matters for AI |
|---|---|---|
| Entity definition | What is one real-world thing in this product? | Answers and scores must refer to one record, not three near-duplicates |
| Identifier strategy | Which key links records across sources? | Without it, the model mixes facts about different entities |
| Source of truth per field | Which source wins on conflict? | Answers stay stable instead of changing with load order |
| Access method | API, bulk file or scraping? | Scraped sources break without notice and need monitoring |
| Provenance | Where did each value come from, and when? | The AI can cite sources and users can check them |
| Manual mappings | Which cases will never fit the rules? | A small table of exceptions beats a fragile rule that is wrong |
Have the client's domain experts review the schema before the ETL is written. Changing a diagram is cheap. Changing a loaded database with links between millions of rows is not.
03Build the AI data pipeline in a fixed order
Once the model is agreed, we build the pipeline in steps that each have a check.
- 01
Land the raw data as it arrives.
Keep an untouched copy of every source pull, so a mapping mistake can be fixed and replayed without fetching again.
- 02
Standardize each source on its own.
Rename fields, cast types and normalize units and codes, one source at a time. Do not join yet.
- 03
Resolve entities.
Link each source's records to the shared entities using the agreed keys, then fuzzy matching where keys are missing, then the manual mapping table.
- 04
Record provenance.
Store the source, the date pulled and the rule that produced each value.
- 05
Validate.
Check counts, required fields, value ranges and links between entities after every run.
- 06
Expose a clean layer to the product and the AI.
Features read only from this layer, never from raw source tables.
Geography is a good example of step three. Mapping an address to the right area often means a point-in-polygon search against official boundaries, such as the U.S. Census Bureau's TIGER/Line files, which carry geographic entity codes and legal boundaries as of the start of each year, plus a geocoding fallback when an address is incomplete.
04Plan for sources that fight back
Some sources only exist as web pages. Some change their format without notice. Some limit how often you can pull. Plan for these from the first week.
- Scraped sources need monitoring. Alert when record counts drop, when required fields come back empty or when page structure changes.
- Start with a few sources. Map, extract and check a small set of high-value sources before adding the long tail. Each new source then follows a known pattern.
- Keep manual mappings on purpose. Edge cases such as special regions, merged entities or renamed records are often few in number. A reviewed table of exceptions is cheaper and more reliable than a clever rule that is wrong for them.
- Separate data from formulas. If scores or reports depend on formulas that the client's experts are still defining, keep those formulas outside the ingestion code so they can change without reloading data.
05Where the AI fits once the data is ready
With a clean, linked layer, the AI can do the parts it is good at. It can phrase answers, summarize long records, classify text and explain a score. It should not compute the numbers. Keep calculations in code over the clean data, and let the model read the results and describe them. That way every figure a user sees can be traced to a source and a rule.

This is also what lets a product cite its answers. If provenance is stored with the data, the AI can show where each fact came from. If it is not, citations become guesses. For more on why this matters in production, see why AI agents fail in production.
06What we see in production
For a U.S. civic transparency platform that scores elected representatives, we started with the data model and the data sources before the interface. Our business analyst studied the client's scoring method and wrote it up, and the team explored sources, drafted the entity relationship diagram and SQL for client review, and documented the ETL flow. Votes, bills, financial disclosures and campaign finance arrived in different shapes from different government sources, some only scrapable, and all had to be linked to the same representative and bill.
Address lookup was built on Census district geometry with a geocoding fallback. Special cases such as at-large states, the capital district and territories needed handling of their own, and 12 representatives needed a manual mapping. In a final round of fixes, score views gained explainability, data quality notes and source attribution, because trust depended on showing where every number came from.
On that civic transparency platform, our plan put LLM bill summaries after the core data milestones and AI assisted scoring in the last one, once votes, bills and finance were linked, and we moved the production database into the client's own database partway through the build.
For a trade and economic research company planning an intelligence portal, we pushed for a paid discovery phase before any build estimate. Some sources held around 1,600 indicators for almost 250 countries over 50 years, and each needed its own mapping and standardization. We proposed starting with a few selected sources, standardizing each programmatically, and agreeing a centralized data store and interchange structure before adding more.
For a nutrition planning app, the same principle applied at a smaller scale: calories, ingredient weights and daily values came from food data and code calculations, and the model only phrased the result.
Frequently asked questions
Should the AI compute the numbers in a data product?
No. Keep calculations in code over the clean data, and let the model read the results and describe them. The model can phrase answers, summarize long records, classify text and explain a score. That way every figure a user sees can be traced to a source and a rule, and citations are not guesses.
How do you handle sources that can only be scraped?
Plan for them from the first week. Scraped sources break without notice, so alert when record counts drop, when required fields come back empty or when page structure changes. Keep an untouched copy of every source pull, so a mapping mistake can be fixed and replayed without fetching again.
When are manual mappings better than automated rules?
When the edge cases are few in number, such as special regions, merged entities or renamed records. A reviewed table of exceptions is cheaper and more reliable than a clever rule that is wrong for them. On a civic transparency platform, 12 representatives needed a manual mapping.
Why review the data model before writing the ETL?
Because the hard questions surface there early: whether a person in one source is the same person in another, what a place means, and which source wins when two disagree. Have the client's domain experts review the schema first. Changing a diagram is cheap. Changing a loaded database with links between millions of rows is not.
How Datics helps
Datics specializes in brownfield AI: bringing production AI into the product you already operate, without forcing a rebuild.
Related work
Case studies from our projects on the same subject.
CivicQ
Government, Legal & Defense · Civic transparency platform
Voters see how their representatives vote, trade and fundraise, each number sourced
The record was public but spread across many government sites. Now one profile links votes, bills, trades and campaign money, sources shown.
Peret
Financial Services · Prediction market analytics
Traders see AI forecast edges in an inherited app, finished without a rebuild
Peret had another developer's half finished build. We proved what worked, fixed the rest for beta and delivered its prediction network.
TrailBlaze Innovations
Healthcare & Wellness · AI meal planning chat
Dieters get meal plans with every calorie computed from food data, not guessed
Chat assistants make up nutrition numbers. Here code computes every calorie from food data, and the model only phrases the plan.
More on Brownfield AI
Brownfield AI
AI integration for SaaS: add AI without a rebuild
AI integration for an existing SaaS product: keep your core as the system of record, reuse your APIs and auth, and ship one AI workflow without a rebuild.
Brownfield AI
Is vibe coding enough for mature SaaS?
Vibe coding in SaaS is fast for prototypes. Mature products need server-side permissions, regression tests, evaluation and review before AI code ships.
Brownfield AI
Entity matching: how do you map supplier data to a catalog?
Entity matching for product data works when you agree on mapping rules first, normalize before you compare, and route uncertain matches to people.
Brownfield AI
AI data integration: connect AI without a new platform
AI data integration without a migration: leave customer data where it lives, give AI governed paths to it, and index only what retrieval really needs.
Brownfield AI
Brownfield vs greenfield: retrofit AI or start fresh?
Brownfield vs greenfield for AI: what a mature SaaS platform has that an AI startup lacks, where legacy code slows it down, and how to move just as fast.
Brownfield AI
AI product strategy: embed AI or launch a separate product?
An AI product strategy for an established SaaS: when to build AI into the product you have, when a separate AI product makes sense, and how to decide.
Your customers already expect AI from your product.
Let us make it real without rebuilding what already works.
