Would you like to hear about webinars we're
doing, new features we're adding and projects we're undertaking? Sign up
here to our pleasantly infrequent newsletter!
To delete an existing subject, add the following lines of code to your processing script:
## README: this example shows how we can delete a subject from Moveshelf
# using the Moveshelf API.
# Delete a subject by ID
subject_id="<subjectId>"# subject["id"]
result=api.deleteSubject(subject_id)ifresult:print(f"Subject {subject_id} deleted successfully")else:print(f"Failed to delete subject {subject_id}")
To delete multiple subjects, add the following lines of code to your processing script:
## README: this example shows how we can delete multiple subjects from Moveshelf
# using the Moveshelf API.
# Delete multiple subjects at once
subject_ids=["<subjectId_1>","<subjectId_2>","<subjectId_3>"]results=api.deleteSubjects(subject_ids)# Check results
forsubject_id,successinresults.items():status="SUCCESS"ifsuccesselse"FAILED"print(f"Subject {subject_id}: {status}")# Count successes and failures
successful=sum(results.values())total=len(subject_ids)print(f"Deleted {successful}/{total} subjects successfully")
To delete an existing session, add the following lines of code to your processing script:
## README: this example shows how we can delete a session from Moveshelf
# using the Moveshelf API.
# Delete a session by ID
session_id="<sessionId>"# session["id"]
result=api.deleteSession(session_id)ifresult:print(f"Session {session_id} deleted successfully")else:print(f"Failed to delete session {session_id}")
To delete an existing trial, add the following lines of code to your processing script:
## README: this example shows how we can delete a trial from Moveshelf
# using the Moveshelf API.
# Delete a trial (clip) by ID
clip_id="<clipId>"# clip["id"]
result=api.deleteClip(clip_id)ifresult:print(f"Trial {clip_id} deleted successfully")else:print(f"Failed to delete trial {clip_id}")
This section explains how to delete all trials within a specified condition from Moveshelf using the Moveshelf API, based on the session's ID and the condition name.
Prerequisites
Before implementing this example, ensure that your processing script includes all necessary setup steps. In particular, you should have:
To delete all trials within an existing condition, add the following lines of code to your processing script:
## README: this example shows how we can delete all trials/clips within
# a condition from Moveshelf using the Moveshelf API.
# Delete all trials within a condition
session_id="<sessionId>"# session["id"]
condition_name="<conditionName>"# e.g., "Barefoot"
result=api.deleteClipByCondition(session_id,condition_name)print(f"Deletion Results:")print(f" Successfully deleted: {result['deleted_count']} trials")print(f" Failed to delete: {result['failed_count']} trials")# Show detailed results
fordetailinresult['details']:status="✓"ifdetail['deleted']else"✗"print(f" {status}{detail['title']} ({detail['clip_id']})")
To delete an existing data file, add the following lines of code to your processing script:
## README: this example shows how we can delete a specific data
# file from Moveshelf using the Moveshelf API.
# Delete additional data by ID
additional_data_id="<additionalDataId>"# additional_data["id"]
result=api.deleteAdditionalData(additional_data_id)ifresult:print(f"File {additional_data_id} deleted successfully")else:print(f"Failed to delete file {additional_data_id}")