Who it’s for
Target personas:- Business and data owners — track contextualization progress and decide where to invest.
- Data engineers — deploy the backend and the app, and run and troubleshoot the metrics workflow.
- Subject matter experts — operations and reliability teams who use the lists of unlinked items to prioritize fixes.
- You want a repeatable, quantitative measure of how well your data is contextualized, with a baseline and a trend.
- You want to find gaps, such as time series with no asset, equipment that is not tied to an asset, or files that are not annotated.
- You want results per facility (an instance space) or per location filter.
- You need to create relationships rather than measure them. Use CDF Entity Matching or File Annotation first.
- You need to check instances against quality rules you define. Use Data quality validation.
What’s included
Prerequisites
Verify all of the following before you start:- The Records and Streams services are available in your CDF project. If the stream can’t be created, ask Cognite to enable these services for your project. Cognite Functions and data workflows must be available as well.
-
The Cognite Toolkit version 0.8 or later is installed, and a
cdf.tomlfile exists in your project root. See Setting up. -
The
record_viewsalpha flag is enabled incdf.toml, because the containers are record containers:cdf.toml - Authentication is configured and verified, and the deploying identity has the access it needs. See Authentication and authorization.
- Two identity provider groups, one for the function and one for the dashboard users, and a client that is a member of the function group, for the schedule.
-
Your project has data in the views you want to score. The defaults target the core data model (
cdf_cdm) and the process industries data model (cdf_idm). - To deploy the app: Node.js 20 or later and npm.
Install and deploy
Deployment at a glance:Backend
Add the module
cdf modules add and select Contextualization Quality Dashboard > Contextualization Quality Dashboard Backend.The Toolkit creates the module under modules/dashboards/context_quality/ and adds it to your config.<env>.yaml.Set the environment values
.env file. Don’t commit it: it contains the client secret.Configure the module
config.<env>.yaml, set at least metricsSourceSpaces: cdf_cdm and cdf_idm, plus the instance spaces that hold your assets, equipment, time series, files, and so on. The function can only read these spaces.cdf modules add copies every variable into this file. Keep them all, because cdf build leaves any missing variable as {{ ... }}. The other variables have working defaults. See Backend variables.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.Dry-run the deployment
Deploy to CDF
Set up CI/CD (optional)
dataModelingType: DATA_MODELING_ONLY), Cognite Functions stores function code in a data modeling space, so the function needs a space. Add the external ID of an existing space that the deploying identity can write to, to functions/context_quality.Function.yaml, and add it again after each module update, which overwrites the file:Run the backend once
The first scheduled run follows the next trigger time. To get data now, start the workflow manually:Open the workflow
wf_context_quality_metrics, and select Run.Start the run
"scope": "all", the run measures every built-in dimension, but not your own configured links. See Run some dimensions only.You can also start the run from the dashboard. See Start a run from the app.Wait for the finalize task
finalize task succeeds. Only then does the dashboard show it. The export task that follows only builds the Excel workbook. A failed run is never shown, and the previous run stays current.Dashboard app
Deploy the app after the backend.Add the module
cdf modules add and select Contextualization Quality Dashboard > Contextualization Quality Dashboard App. The Toolkit creates the module under modules/tools/apps/context_quality_dashboard/. You can also copy that folder from the Cognite Library repository.Move the app out of the modules folder
modules/ to the directory where you keep your Fusion apps, and go into it:modules/, cdf build also picks it up. The auth/ folder in the app contains a placeholder group that exists only so that the Toolkit accepts the module. Don’t deploy it. People get access to the dashboard from the backend’s dashboard users group. See Access.Point the app at your project
app.json, set the first entry in deployments:deployClientId and deploySecretName empty to deploy as yourself. For a non-interactive deploy, deploySecretName is the name of an environment variable that holds the client secret, never the secret itself.Tell the app which backend to read
.env.example to .env.local. The defaults match the backend’s defaults. If you renamed resources in the backend’s config.<env>.yaml, see Dashboard app variables.The build inlines these values, so set them before you build. An app built without them shows only a configuration screen.Build, deploy, publish, and activate
versionTag in app.json for each release.Verify the deployment
cdf deployfinishes without errors and reports the function, workflow, stream, containers, views, spaces, data set, and groups.- In CDF, go to Data fusion > Build solutions > Functions and confirm that
fn_context_quality_metricsshows Ready. It can take a few minutes after deploy. - A run of
wf_context_quality_metricsfinishes withfinalizesucceeded. npx @cognite/cli apps statusshows the app version as active, and the app opens in CDF.- The Overview page shows one card per dimension with a score and a trend.
Configuration reference
Backend variables
Set these in the module’s section ofconfig.<env>.yaml.
Divide a run into smaller calls
A run is divided into function calls, and a call can run for at most 10 minutes. If a call times out, start the run with smaller shards for that run only, without a deploy:planning object accepts shardTargetEntities (default 100,000), shardTargetTimeSeries (default 20,000), maxShards (default 150, at most 190), and maxConcurrentShards (default 2). If the calls would not fit a run, the plan makes the target larger until they do. For a very large project, run fewer dimensions at a time with scope. To make a setting permanent, set the matching metrics... variable and deploy again.
Run some dimensions only
Thescope input says which dimensions a run measures.
asset-hierarchy, equipment-asset, time-series, maintenance, files, model-3d, and file-annotation. The dashboard shows each dimension from the latest complete run that covered it.
Dashboard app variables
Set these in.env.local before you build the app.
Use the dashboard
Start a run from the app
By default, the dashboard never starts a run by itself. It needsVITE_CQ_WORKFLOW_ID and VITE_CQ_WORKFLOW_VERSION, and a user who can start runs.
- First run: on a project with no completed run, the Configuration page opens a first-run screen. Select Run built-in checks.
- Later runs: use Refresh to re-read the latest results, the run button on a dimension page to re-measure that dimension, or Run with this file on the Configuration page to include your own links.
- If a run fails: the run banner turns red. Open the run details from the banner, or the execution of
wf_context_quality_metricsin Data fusion > Integrate > Data workflows, to see which task failed and why.
Configure your own metrics
Upload a YAML or JSON file that lists data model links. Each entry names a model and theView.property links to count. For example:
View.property must be a direct relation, or a list of them. A text property, such as a time series “equipment” string, fails with ... is not a direct relation, so it is not a link.
Configured metrics only work for models and instance spaces that the run identity can read. For a model in another space, add that schema space to dataModelsAcl and its instance spaces to metricsSourceSpaces. Don’t change those scopes to all. Without this, the run fails with a 403 before anything is written.
Metrics reference
Each dimension has a headline metric. A score is always items that pass divided by items that apply.metricsFreshnessDays, 30 by default). For time series, freshness means the latest datapoint is within that window.
Items can be excluded before counting, for example synthetic time series or decommissioned equipment. The backend counts every exclusion in the run log, so nothing is dropped silently, but the dashboard doesn’t list them yet. Tiers are an optional importance grade from 1 to 3 for assets, based on your own mapping of types to tiers.
Access
Architecture
The backend separates computing from showing. A data workflow runs a function in Cognite Functions that computes raw counts and appends them to a Records stream as an immutable run log. The app reads the stream, groups the counts by dimension, and sums them for the space or location you select. A run writes astarted marker, then its rows of counts, and last a complete marker. For each dimension, the dashboard shows the latest run that has a complete marker and that measured that dimension. See Run some dimensions only. After the complete marker, the export task builds the Excel workbook. If it fails or is slow, the run is still shown, and Run notes reports export-failed. Overview can then show scores while the Excel download is missing or stale. The backend never updates or deletes a record, and it adds new properties only as optional ones, so an older run stays readable.