Skip to content

Commit

Permalink
[NEAT-809] 🤨Source system prefix (#1018)
Browse files Browse the repository at this point in the history
## Description
Bug found in large scale testing.

## Bump

- [x] Patch
- [ ] Minor
- [ ] Skip

## Changelog
### Fixed
- The `neat.to.cdf.instances()` now removes the `CogniteSourceSystem_`
prefix if it can if the data was read using the
  `neat.read.cdf.classic.graph(...)` method.
  • Loading branch information
doctrino authored Mar 3, 2025
1 parent 0a214eb commit 225a0b2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 34 deletions.
2 changes: 2 additions & 0 deletions cognite/neat/_session/_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ def _graph(
self._state.instances.store.transform(
LiteralToEntity(None, namespace["source"], "ClassicSourceSystem", "name"),
)
# The above transformations creates a new type, so we need to update
self._state.instances.neat_prefix_by_type_uri.update({namespace["ClassicSourceSystem"]: "ClassicSourceSystem_"})
# Updating the information model.
prepare_issues = self._state.rule_store.transform(
ClassicPrepareCore(namespace, reference_timeseries, reference_files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1505,34 +1505,6 @@ instances:
type:
externalId: ClassicAsset
space: sp_windfarm
- externalId: ClassicSourceSystem_manufacturer1
instanceType: node
sources:
- properties:
name: manufacturer1
source:
externalId: ClassicSourceSystem
space: sp_windfarm
type: view
version: v1
space: sp_windfarm_dataset
type:
externalId: ClassicSourceSystem
space: sp_windfarm
- externalId: ClassicSourceSystem_manufacturer2
instanceType: node
sources:
- properties:
name: manufacturer2
source:
externalId: ClassicSourceSystem
space: sp_windfarm
type: view
version: v1
space: sp_windfarm_dataset
type:
externalId: ClassicSourceSystem
space: sp_windfarm
- externalId: Label_Measurement
instanceType: node
sources:
Expand Down Expand Up @@ -1569,7 +1541,7 @@ instances:
externalId: Asset_Measurement
space: sp_windfarm_dataset
source:
externalId: ClassicSourceSystem_manufacturer2
externalId: manufacturer2
space: sp_windfarm_dataset
tags:
- Label_Measurement
Expand Down Expand Up @@ -1615,7 +1587,7 @@ instances:
assetCategory: WindFarm
name: Utsira
source:
externalId: ClassicSourceSystem_manufacturer1
externalId: manufacturer1
space: sp_windfarm_dataset
tags:
- Label_PowerGeneratingUnit
Expand Down Expand Up @@ -1646,7 +1618,7 @@ instances:
externalId: Utsira
space: source_ds
source:
externalId: ClassicSourceSystem_manufacturer1
externalId: manufacturer1
space: sp_windfarm_dataset
tags:
- Label_PowerGeneratingUnit
Expand Down Expand Up @@ -1675,7 +1647,7 @@ instances:
fileCategory: DataSheet
name: WT-01_datasheet.txt
source:
externalId: ClassicSourceSystem_manufacturer1
externalId: manufacturer1
space: sp_windfarm_dataset
source:
externalId: ClassicFile
Expand Down Expand Up @@ -1799,7 +1771,7 @@ instances:
externalId: Utsira
space: source_ds
source:
externalId: ClassicSourceSystem_manufacturer1
externalId: manufacturer1
space: sp_windfarm_dataset
tags:
- Label_PowerGeneratingUnit
Expand Down Expand Up @@ -1947,6 +1919,34 @@ instances:
type:
externalId: ClassicDataSet
space: sp_windfarm
- externalId: manufacturer1
instanceType: node
sources:
- properties:
name: manufacturer1
source:
externalId: ClassicSourceSystem
space: sp_windfarm
type: view
version: v1
space: sp_windfarm_dataset
type:
externalId: ClassicSourceSystem
space: sp_windfarm
- externalId: manufacturer2
instanceType: node
sources:
- properties:
name: manufacturer2
source:
externalId: ClassicSourceSystem
space: sp_windfarm
type: view
version: v1
space: sp_windfarm_dataset
type:
externalId: ClassicSourceSystem
space: sp_windfarm
- externalId: metMast
instanceType: node
sources:
Expand Down Expand Up @@ -1982,7 +1982,7 @@ instances:
metadata:
blob: data
source:
externalId: ClassicSourceSystem_manufacturer1
externalId: manufacturer1
space: sp_windfarm_dataset
startTime: '1970-01-01T00:00:00.400+00:00'
subtype: Planned
Expand Down

0 comments on commit 225a0b2

Please sign in to comment.