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
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,
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.