Jump to content

Archiving Datalab Created Conditions


Go to solution Solved by Chiragasourabh .,

Recommended Posts

Posted

I have used DataLab to create and push Conditions in a Workbook based on signal properties. I am not pushing this in as a formula, but rather using Start and End times calculated in DataLab.

In developing my code, I've ended up with multiple Conditions with the same name. I can ultimately find the correct one which I pushed in, but would like to "Delete" or "Archive" those incorrect Conditions.

I have been able to achieve this with Signals by setting the Archived parameter to True. I would like to do the equivalent for my conditions. My attempt, which does not seem to be working, is as follows:

condition_df = spy.search('worksheet_url')
condition_df.set_index('Name', inplace=True, drop=False)
condition_df['Maximum Duration'] = '1mo'
condition_df['Archived'] = True

spy.push(metadata=condition_df,
         replace={'Start': start_time, 'End':  end_time},
         workbook=workbook_id)

This deletes all capsules in my date range, but if I search for my conditions in the Data tab, the attempt to archive these conditions does not seem to have worked.

  • Seeq Team
Posted

You can try archiving the conditions using API. The code below should archive the conditions in your worksheet. 

from seeq import sdk
import pandas as pd

# Setting up the SDK end point
items_api = sdk.ItemsApi(spy.client)

worksheet_url = 'worksheet_url'

condition_df = spy.search(worksheet_url)

for id in condition_df['ID']:
    items_api.archive_item(id=id)

 

  • Solution
Posted (edited)

As a workaround, you can use the spy.push without replace parameter to archive the conditions.
 

condition_df['Archived'] = True
spy.push(metadata=condition_df,workbook=workbook_id)

 

Edited by Chiragasourabh .
Posted

Thank you - I can confirm Chiragasourabh's solution removing the Replace statement from my push worked. I have not tried Kin How's solution, yet.

  • Like 1

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...