def main(api_endpoint): email = input('Enter email: ') password = getpass.getpass() source_project_id = input( 'Enter project IDs (separate them by "," if you want to provide several): ' ) kauth = KiliAuth(email=email, password=password, api_endpoint=api_endpoint) playground = Playground(kauth) df = pd.DataFrame(columns=['Project', 'Date', 'Email']) for project_id in source_project_id.split(','): project = playground.projects(project_id=project_id)[0] assets = playground.assets(project_id=project_id) title = project['title'] for asset in assets: for label in asset['labels']: created_at = label['createdAt'][:10] author_email = label['author']['email'] df = df.append( { 'Project': title, 'Date': created_at, 'Email': author_email }, ignore_index=True) df_grouped = df.groupby(['Project', 'Date', 'Email']).size() time = datetime.now().strftime('%Y%m%d%H%M') df_grouped.to_excel(f'labeler-stats-{time}.xlsx')
def main(api_endpoint): email = input('Enter email: ') password = getpass.getpass() project_id = input('Enter project id: ') with open('./conf/new_assets.yml', 'r') as f: configuration = yaml.safe_load(f) assets = configuration['assets'] kauth = KiliAuth(email, password, api_endpoint) playground = Playground(kauth) project = playground.projects(project_id=project_id)[0] roles = get(project, 'roles') for asset in tqdm(assets): external_id = get(asset, 'externalId') to_be_labeled_by = [ get(user, 'email') for user in get(asset, 'toBeLabeledBy') ] asset = get_asset_by_external_id(playground, project_id, external_id) asset_id = get(asset, 'id') playground.update_properties_in_asset( asset_id=asset_id, to_be_labeled_by=to_be_labeled_by)