dp:contextualization:cdf_entity_matching) automates the contextualization of entities — typically time series — to a configurable target view (Asset, Tags, or Equipment) in Cognite Data Fusion. It deploys as a Cognite Toolkit module and uses a CDF Workflow to run two CDF Functions in sequence: a metadata update step that enriches aliases and applies NORSOK-based discipline classification, followed by an entity matching step that uses that enriched metadata to establish direct relationships in the data model.
The matching step ships production-tested code, combining manual expert mappings, rule-based matching with regex, and AI-powered entity matching in a single pipeline, with RAW-backed state for incremental runs.
CDF Entity Matching is a cherry-pickable module (
dp:contextualization:cdf_entity_matching) inside the Contextualization deployment pack (dp:contextualization). You can add it on its own or alongside the other contextualization modules.Who it’s for
Target personas:- Data engineers — deploy, configure, and tune the matching pipeline.
- Solution architects — design the contextualization approach across source systems.
- You need to match time series (or another entity view) to assets automatically, without building a custom matching pipeline from scratch.
- Your project combines data from multiple sources (for example, SAP assets and OSIsoft/AVEVA PI time series) and requires relationship discovery across them.
- You need a combination of manual expert mappings, rule-based logic, and AI-powered matching in a single orchestrated workflow.
- You need incremental processing — only new or updated entities should be matched on each run.
- You want a scalable foundation proven for 10,000+ time series per batch in production environments.
- If your assets and time series are already contextualized and you only need to maintain relationships — this pack is optimized for initial and incremental matching, not purely for maintenance.
- If your project requires document or P&ID annotation, use the P&ID Annotation deployment pack instead.
What’s included
Prerequisites
Verify all of the following before you start:- Cognite Toolkit version 0.8 or later is installed. See Setting up.
-
A
cdf.tomlfile exists in your project root. If it is missing, runcdf modules initand select Create toml file (required). -
The data plugin is enabled in
cdf.toml— required for thecdf data uploadstep after deployment: -
Authentication is configured and verified — run
cdf auth initandcdf auth verifyusing a local.envfile. See Authentication and authorization. -
A data model with the target view (for example,
Asset) and entity view (for example,TimeSeries) is deployed, and instances are already ingested. -
You have a service principal (app registration) in your identity provider (IdP) for the scheduled workflow to authenticate as. Have its client ID and client secret ready — these populate
IDP_CLIENT_ID/IDP_CLIENT_SECRETin your.env(mapped toworkflowClientId/workflowClientSecret). -
You have an IdP group for the processing access group, and you know its source ID — the group’s object ID in the IdP (populates
GROUP_SOURCE_ID, mapped toentity_matching_processing_group_source_id). The workflow’s service principal must be a member of this group.
Install and deploy
You can add the Entity Matching module to an existing Toolkit project or start a new project from scratch.- Add to an existing project
- Start a new project
Add the module from your project directory:
modules/contextualization/cdf_entity_matching/ and updates your config.<env>.yaml files. Before building, open config.dev.yaml and set at minimum project, the schema and instance spaces, the target and entity view external IDs and search properties, and the credentials (workflowClientId / workflowClientSecret and entity_matching_processing_group_source_id) — see Configuration reference. Then build and deploy:
1
Build deployment artifacts
build/ directory. If you need to change the project name or any variables marked <change_me>, edit config.<env>.yaml first — see Configure, build, and deploy modules.2
Dry-run the deployment
3
Deploy to CDF
4
Set up CI/CD (optional)
For governed production deployments, automate build, dry-run, and deploy in a pipeline. See Set up CI/CD pipelines.
The data plugin must be enabled in
cdf.toml (see Prerequisites) before running cdf data upload.Verify the deployment
After deploying, confirm success with these checks:- The
cdf deploycommand finishes without errors and reports successful deployment of Functions, Workflows, Extraction Pipelines, RAW, the data set, the access group, and the data modeling resources. - The
cdf data uploadcommand finishes without errors, andcontextualization_manual_inputandcontextualization_rule_inputare visible in Integrate > Staging (RAW) underdb_asset_entity_matching. - In CDF, navigate to Integrate > Data Workflows and verify that the
EntityMatchingworkflow is listed. - Trigger the workflow with Run (or wait for the daily
EntityMatching_trigger). Confirm that the metadata update task completes before the entity matching task, and that both finish without errors. - Navigate to Build Solutions > Functions, open
fn_dm_context_metadata_updateandfn_dm_context_timeseries_entity_matching, select View logs, and review the metrics (processed/updated counts, cache hit rate, match scores). - Navigate to Integrate > Staging (RAW) and verify that
contextualization_goodandcontextualization_badare populated. - Use CDF Search or Data Modeling to confirm that direct relationships exist between matched entities and the target view (when
dmUpdateis enabled).
Configuration reference
Module variables are set per environment inconfig.<env>.yaml. Update these before running cdf build.
Each variable takes its default unless you override it. Where the default is —, a placeholder (for example YourOrg, ORG), or a ${...} value read from .env, you must provide your own value before deploying.
When this module is installed as part of the Foundation Demo bundle, several of these values (for example, the target and entity view external IDs and search properties) are overridden to match the Quickstart data model. Follow the Foundation Demo instructions in that case.
Runtime parameters (extraction pipelines)
Matching behavior is controlled by the extraction pipeline configs, notconfig.<env>.yaml. Edit extraction_pipelines/ctx_timeseries_entity_matching.config.yaml to tune the matching run.
If you change
autoApprovalThreshold, clean up the relationships created by previous runs before re-running. Only matches created by this process are removed; manually created relationships are preserved.Architecture
The pack deploys two CDF Functions into a dedicated function space, orchestrated by theEntityMatching workflow and a daily trigger. Each function reads its runtime parameters from an extraction pipeline config. RAW holds the manual and rule inputs, the good and bad match results, and the incremental state.
Data flow
The workflow runs the metadata update function first (to improve alias quality), then the matching function. The matching function applies three methods in priority order — manual mappings, then rule-based regex, then ML matching — and splits results byautoApprovalThreshold.
Matching pipeline
The matching function (fn_dm_context_timeseries_entity_matching) executes in this order:
- Read configuration and the RAW input tables (manual mappings, rule mappings).
- Apply manual mappings from entity to target — these overwrite any existing mapping.
- Read the entities not yet matched (or all entities when
runAllistrue). - Read the target view instances (for example, assets).
- Run rule-based matching using the configured regex patterns.
- Run ML entity matching in CDF for the remaining candidates.
- Update entity→target relationships in the data model when
dmUpdateistrue. - Write results to
contextualization_good(score ≥autoApprovalThreshold) andcontextualization_bad(below threshold).
Incremental processing and state management
State is maintained incontextualization_state_store. With runAll: false, only entities updated since the last run are processed; previously matched entities are skipped. Set runAll: true (the shipped default) or clear the state table to reprocess everything.
Resilience
The metadata update and entity matching tasks each retry up to 3 times with a 9000-second timeout, and the workflow aborts if a task ultimately fails. The matching function processes entities in batches with bounded exponential-backoff retries on Data Modeling writes, and external IDs prevent duplicate relationships across runs.Troubleshooting
For issues not covered here, contact Cognite support.