Sage-Bionetworks/Genie

Add test for find_caselistid

karawoo opened this issue · 1 comments

def find_caselistid(syn, parentid):
'''
Search for case_lists folder based on parentId given
Args:
syn: Synapse object
parentid: Synapse Id of Folder or Project
Returns:
string: Synapse id of case list
'''
release_ents = synapseutils.walk(syn, parentid)
release_folders = next(release_ents)
# if list is empty
if not release_folders[1]:
caselist_folder = synapseclient.Folder(name="case_lists",
parent=parentid)
caselistid = syn.store(caselist_folder).id
else:
caselistid = release_folders[1][0][1]
return caselistid

Closing as won't do. Any new GENIE development isn't to improve code, but strictly for Consortium requested improvements or features.