Skip to main content
The CDF Entity Matching deployment pack (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.
Use this pack when:
  • 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.
When not to use this pack:
  • 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.toml file exists in your project root. If it is missing, run cdf modules init and select Create toml file (required).
  • The data plugin is enabled in cdf.toml — required for the cdf data upload step after deployment:
  • Authentication is configured and verified — run cdf auth init and cdf auth verify using a local .env file. 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_SECRET in your .env (mapped to workflowClientId / 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 to entity_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 the module from your project directory:
The Toolkit creates the module under 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

The Toolkit substitutes template variables and writes artifacts to the 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

Inspect the output and confirm that configurations look correct before deploying.
3

Deploy to CDF

The Toolkit deploys only configurations that have changed since the last run.
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.
After deploying, populate the RAW tables with the seed manual mappings and rule definitions:
The data plugin must be enabled in cdf.toml (see Prerequisites) before running cdf data upload.
After the upload, your project should include:

Verify the deployment

After deploying, confirm success with these checks:
  1. The cdf deploy command finishes without errors and reports successful deployment of Functions, Workflows, Extraction Pipelines, RAW, the data set, the access group, and the data modeling resources.
  2. The cdf data upload command finishes without errors, and contextualization_manual_input and contextualization_rule_input are visible in Integrate > Staging (RAW) under db_asset_entity_matching.
  3. In CDF, navigate to Integrate > Data Workflows and verify that the EntityMatching workflow is listed.
  4. 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.
  5. Navigate to Build Solutions > Functions, open fn_dm_context_metadata_update and fn_dm_context_timeseries_entity_matching, select View logs, and review the metrics (processed/updated counts, cache hit rate, match scores).
  6. Navigate to Integrate > Staging (RAW) and verify that contextualization_good and contextualization_bad are populated.
  7. Use CDF Search or Data Modeling to confirm that direct relationships exist between matched entities and the target view (when dmUpdate is enabled).
The deployment is successful when the workflow completes without errors, the good and bad match tables are populated, and direct relationships exist between matched entities.

Configuration reference

Module variables are set per environment in config.<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, not config.<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 the EntityMatching 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 by autoApprovalThreshold.

Matching pipeline

The matching function (fn_dm_context_timeseries_entity_matching) executes in this order:
  1. Read configuration and the RAW input tables (manual mappings, rule mappings).
  2. Apply manual mappings from entity to target — these overwrite any existing mapping.
  3. Read the entities not yet matched (or all entities when runAll is true).
  4. Read the target view instances (for example, assets).
  5. Run rule-based matching using the configured regex patterns.
  6. Run ML entity matching in CDF for the remaining candidates.
  7. Update entity→target relationships in the data model when dmUpdate is true.
  8. Write results to contextualization_good (score ≥ autoApprovalThreshold) and contextualization_bad (below threshold).

Incremental processing and state management

State is maintained in contextualization_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.

Support

Last modified on July 6, 2026