CogniteMigration data model.
Prerequisites
Before migrating events, complete the following:- Creating a data model and mappings
- Deploying the CogniteMigration data model
- Migrating data sets
- Migrating source systems
- Migrating assets
Required capabilities
The following capabilities are required to runcdf migrate events:
Migrating events
Migrate human-created events (work orders, inspections, maintenance records) to data modeling nodes with this procedure. System-generated events (alarms, sensor events, logs) should be migrated to records instead. See Migrating events to records.
cdf migrate events.
1
Choose how to select events
Use data set selection if all events go to the same view, mapping, and instance space. Use CSV file selection to map events to different views, such as status events in the Kelmarsh example.
2
Run `cdf migrate events`
Run the command in interactive mode, or pass the options as arguments. See
cdf migrate events --help.3
Verify the migration
Confirm that lineage nodes exist in the
InstanceSource view. See Verify the migration.Data set selection
To migrate all events in a data set, run the command in interactive mode:cdf migrate events --help for details.
The disadvantage of data set selection is that all events must use the same resource view mapping, target view, and instance space. Use CSV file selection when events need different mappings or consumer views.
CSV file selection
To migrate events using a CSV file, run:<path to csv file> with a path relative to your Cognite Toolkit project root.
This CSV file migrates a Kelmarsh wind farm status event:
migration.events.csv
space: The target instance space where the event will be created.externalId: The external ID of the resulting event.id: The integer internal ID of the source event to migrate.
ingestionMapping: The resource view mapping to use. If omitted, the default mapping for events is used (typically the CogniteActivity view in the CogniteCore model). The Cognite Toolkit reads mappings from theResourceViewMappingview in theCogniteMigrationdata model. Deploy custom mappings withcdf buildandcdf deployusing the Resource view mapping resource type.consumerViewSpace,consumerViewExternalId,consumerViewVersion: The preferred consumer view for the event. Canvas and Charts use this setting when they display the event.
status_event_mapping mapping and StatusEvent consumer view.
Verify the migration
After a successful run, the Cognite Toolkit stores lineage for migrated events in theInstanceSource view in the CogniteMigration data model.
In the Kelmarsh example, lineage nodes for the status events look like this:

StatusEvent nodes:

What cdf migrate events does
When you run cdf migrate events, the migration plugin performs the following steps on batches of events:
1
Download events
The Cognite Toolkit reads events from the asset-centric
/events/byids or /events/list endpoints, depending on the selection method.2
Convert events to instance nodes
The Cognite Toolkit looks up the mapping and converts each event to an instance node. Mappings are defined
by
externalId in the ResourceViewMapping view in the CogniteMigration data model. The mapping for each event comes from the ingestionMapping column in the CSV file or from the --ingestion-mapping
CLI argument. If no mapping is specified, the default mapping is used.3
Write instance nodes to CDF
The Cognite Toolkit writes the created instance nodes to CDF using the
/models/instances endpoint.4
Create lineage nodes
While writing instances, the Cognite Toolkit creates lineage nodes in the
InstanceSource view in the CogniteMigration data model
to record the lineage from source events to the created instance nodes.