Jump to content

Building a new asset tree starting from a pandas df


Go to solution Solved by Mark Derbecker,

Recommended Posts

Hi,

We are working on a variety of use cases where each time we need a purpose built asset tree.

What we want to do is to search all signals and conditions from an existing simple asset tree, containing only the machine serial number as a parent. Next load our machine database containing all the useful metadata (like model type, width, power source, firmware version, etc) to allow us to build a new structure based on on the metadata that we want.

For example in this case i want to build a new tree using driver, Model Type & width. (level 1, 2, 3, 4)

I can easily merge the 2 dataframes (searched signals & machine metadata per serial number) together and choose the necessary levels of my tree like this:

image.png.286379821220e0f4d6904debd7c90782.png

but what is still needed to convert this into a Seeq asset tree and push this to a local workbook?

when I push this df I only get empty assets and no signals.

 

Thanks,

Jan

Link to comment
Share on other sites

  • Seeq Team
  • Solution

It's gonna be easy!

Let's assume the DataFrame you show above is called "metadata_df". Do the following:

# Reduce the columns to only those that matter for metadata push
metadata_df = metadata_df[['ID', 'Type_x', 'Name', 'Description', 'Build Path']]

# Rename the columns to the correct names for pushing
metadata_df = metadata_df.rename(columns={'Type_x': 'Type', 'Build Path': 'Path'})

# Filter out the asset rows, we don't need them
metadata_df = metadata_df[metadata_df['Type'] != 'Asset']

# Mark everything as a "Reference" so that SPy builds "jump tags" for them
metadata_df['Reference'] = True

# https://www.youtube.com/watch?v=dPfTiX2i4Vk
spy.push(metadata=metadata_df)

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...