Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions scripts_Utility/edit_subject_priority.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python

###################################
# Script: Edit Metadata
#
# To Use:
# 1) Edit input parameters below.
# 2) Run from command line: `python edit_metadata_indiv.py`

from panoptes_client import Panoptes, Subject
import pandas as pd

###################################
# Input Parameters

puser = 'USERNAME'
ppswd = 'PASSWORD'

# Subject Input File
# - includes a `subject_id` column
# - includes priority column

file_subjects = 'example-subjects.csv'

###################################

# Read subjects from CSV
d = pd.read_csv(file_subjects)

Panoptes.connect(username=puser, password=ppswd)

# Iterate through subjects
for ind,row in d.iterrows():
s = Subject.find(row.subject_id)
# Note that without a second argument of subject_set_id, this will update the priority for all subject sets that the subject is in.
s.update_priority(row['priority'])