Skip to main content
Answer

NEAT with Cognite Toolkit

  • August 13, 2025
  • 1 reply
  • 53 views

Forum|alt.badge.img+1

Hi All…

 

Curious if anyone has any experience creating a custom data model using NEAT and then loading that data model using the Cognite Toolkit?  What would the flow look like to make this happen?

 

Thanks!

Wayne

Best answer by Jason Dressel

Wayne,
Have a look at the following:
It follows https://cognite-neat.readthedocs-hosted.com/en/latest/tutorials/data-modeling/from-conceptual-to-physical-via-CDM.html,

In short,

  • Create a concept.xlsx
  • Modify that with your custom DM concepts
  • Expand to CDM (optional only if your concepts extend CDM concepts)
  • Convert to a physical model (gory details) - may need to iterate on the xlsx (Indexes, Constraints, etc)
  • Read into NEAT session and push to CDF and/or publish to a toolkit compatible zip file.

hth,

Jason
PS: If you have a DM in CDF already, and want to make a Toolkit compatible zip from that, NEAT can read your DM (neat.read.cdf.data_model((<space>, <datamodel>, <version>))

# %%
from cognite.neat import NeatSession
from cognite.client import CogniteClient

# %%
client: CogniteClient = ... # A CogniteClient is required in some of the cells

# %%
# Write out your very first NEAT conceptual model template
neat = NeatSession(verbose=True)
neat.template.conceptual_model("./neat_101_conceptual_model.xlsx")

# %% [markdown]
# ## TODO: Edit the conceptual model in Excel

# %%
neat = NeatSession(verbose=True)
neat.read.excel("./neat_101_conceptual_model_pump.xlsx") # NOTE: YES, it'll complain about missing CDF CDM concepts if you're model extends CDM concepts


# %%
neat.inspect.issues() # Check for issues in your conceptual model, iterate by fixing them in the xlsx file. Ignore the CDM related errors

# %% [markdown]
# ## Expand your conceptual model (incorporate CDM concepts)

# %%
neat = NeatSession(client, verbose=True)
neat.template.expand("./neat_101_conceptual_model_pump_expanded.xlsx") # This expands the conceptual model to include CDF CDM concepts and writes to a new XLSX file

# %%
neat.inspect.issues()

# %% [markdown]
# ## Read the expanded file and convert it to a physical file we can export to CDF directly and or a Toolkit friendly format

# %%
# Read the expanded conceptual model into a new NEAT session
neat = NeatSession(client, verbose=True)
neat.read.excel("./neat_101_conceptual_model_pump_expand.xlsx") # Need to read the expanded conceptual model

# %%
neat.convert() # Convert the conceptual model to a physical model
neat.to.excel("./neat_101_physical_model_pump_expanded.xlsx") # Write out the physical model to Excel

# %% [markdown]
# ## OUTPUT to CDF

# %%
neat.to.cdf.data_model(dry_run=True)

# %%
neat.to.cdf.data_model(dry_run=False)

# %% [markdown]
# ## OUTPUT TO CDF TOOLKIT

# %%
neat.to.yaml("./pump_model.zip", format="toolkit") # Write to CDF Toolkit YAML format

 

1 reply

Forum|alt.badge.img
  • Seasoned Practitioner
  • Answer
  • August 13, 2025

Wayne,
Have a look at the following:
It follows https://cognite-neat.readthedocs-hosted.com/en/latest/tutorials/data-modeling/from-conceptual-to-physical-via-CDM.html,

In short,

  • Create a concept.xlsx
  • Modify that with your custom DM concepts
  • Expand to CDM (optional only if your concepts extend CDM concepts)
  • Convert to a physical model (gory details) - may need to iterate on the xlsx (Indexes, Constraints, etc)
  • Read into NEAT session and push to CDF and/or publish to a toolkit compatible zip file.

hth,

Jason
PS: If you have a DM in CDF already, and want to make a Toolkit compatible zip from that, NEAT can read your DM (neat.read.cdf.data_model((<space>, <datamodel>, <version>))

# %%
from cognite.neat import NeatSession
from cognite.client import CogniteClient

# %%
client: CogniteClient = ... # A CogniteClient is required in some of the cells

# %%
# Write out your very first NEAT conceptual model template
neat = NeatSession(verbose=True)
neat.template.conceptual_model("./neat_101_conceptual_model.xlsx")

# %% [markdown]
# ## TODO: Edit the conceptual model in Excel

# %%
neat = NeatSession(verbose=True)
neat.read.excel("./neat_101_conceptual_model_pump.xlsx") # NOTE: YES, it'll complain about missing CDF CDM concepts if you're model extends CDM concepts


# %%
neat.inspect.issues() # Check for issues in your conceptual model, iterate by fixing them in the xlsx file. Ignore the CDM related errors

# %% [markdown]
# ## Expand your conceptual model (incorporate CDM concepts)

# %%
neat = NeatSession(client, verbose=True)
neat.template.expand("./neat_101_conceptual_model_pump_expanded.xlsx") # This expands the conceptual model to include CDF CDM concepts and writes to a new XLSX file

# %%
neat.inspect.issues()

# %% [markdown]
# ## Read the expanded file and convert it to a physical file we can export to CDF directly and or a Toolkit friendly format

# %%
# Read the expanded conceptual model into a new NEAT session
neat = NeatSession(client, verbose=True)
neat.read.excel("./neat_101_conceptual_model_pump_expand.xlsx") # Need to read the expanded conceptual model

# %%
neat.convert() # Convert the conceptual model to a physical model
neat.to.excel("./neat_101_physical_model_pump_expanded.xlsx") # Write out the physical model to Excel

# %% [markdown]
# ## OUTPUT to CDF

# %%
neat.to.cdf.data_model(dry_run=True)

# %%
neat.to.cdf.data_model(dry_run=False)

# %% [markdown]
# ## OUTPUT TO CDF TOOLKIT

# %%
neat.to.yaml("./pump_model.zip", format="toolkit") # Write to CDF Toolkit YAML format