Skip to content

Instantly share code, notes, and snippets.

@larssono
Created November 9, 2017 22:09
Show Gist options
  • Save larssono/47e70be6f5a0e075797bd273576fb4cc to your computer and use it in GitHub Desktop.
Save larssono/47e70be6f5a0e075797bd273576fb4cc to your computer and use it in GitHub Desktop.
import pandas as pd
import bridgeclient
import synapseclient
from multiprocessing.dummy import Pool
from synapseutils.monitor import with_progress_bar
mp = Pool(4)
bridge = bridgeclient.bridgeConnector(<email>, <password>, study='journey-pro')
syn = synapseclient.login()
startdate = '2017-08-15T00:00:00.000Z'
#Get list of participants
df = bridge.getParticipants(startdate).drop(['studyIdentifier'], axis=1)
getParticipantMeta = with_progress_bar(lambda id: bridge.getParticipantMetaData(id), totalCalls=len(df))
participants = pd.DataFrame(mp.map(getParticipantMeta, df.id))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment