Utils

Challenge utility functions

challengeutils.utils.change_all_submission_status(syn, evaluationid, submission_status='SCORED', change_to_status='VALIDATED')[source]

Function to change submission status of all submissions in a queue The defaults is to change submissions from SCORED -> VALIDATED This function can be useful for ‘rescoring’ submissions

Parameters
  • syn – Synapse object

  • evaluationid – Id of an Evaluation queue

  • submission_status – Submissions with this status that you want to change. Default is SCORED.

  • change_to_status – Submission status to change a submission to. Default is VALIDATED.

challengeutils.utils.change_submission_annotation_acl(status, annotations, is_private=False)[source]

Function to change the acl of a list of known annotation keys on one submission

Parameters
  • status – syn.getSubmissionStatus()

  • annotations – list of annotation keys to make public

  • is_private – whether the annotation is private or not, default to True

Returns

Submission status with new submission annotation ACLs

challengeutils.utils.change_submission_status(syn, submissionid, status='RECEIVED')[source]

Function to change a submission status

Parameters
  • syn – Synapse object

  • submissionid – Id of a submission

  • status – Submission status to change a submission to

Returns

Updated submission status

challengeutils.utils.delete_submission(syn, submissionid)[source]

Deletes a submission

Parameters
  • syn – Synapse object

  • submissionid – Id of a submission

challengeutils.utils.download_submission(syn, submissionid, download_location=None)[source]

Download submission and return json

Parameters
  • syn – Synapse object

  • submissionid – Submission id

  • download_location – Location to download submission

Returns

submission json results

Return type

dict

challengeutils.utils.evaluation_queue_query(syn, uri, limit=20, offset=0)[source]

This is to query the evaluation queue service. The limit parameter is set at 20 by default. Using a larger limit results in fewer calls to the service, but if responses are large enough to be a burden on the service they may be truncated.

Parameters
  • syn – A Synapse object

  • uri – A URI for evaluation queues (select * from evaluation_12345)

  • limit – How many records should be returned per request

  • offset – At what record offset from the first should iteration start

Yields

dict – A generator over some paginated results

challengeutils.utils.get_contributors(syn, evaluationids, status='SCORED', start_datetime=None, end_datetime=None)[source]

Function to get contributors from a list of evaluation ids Note: the date and time is in UTC

Parameters
  • syn – Synapse object

  • evaluationids – a list of evaluation ids

  • status – Submission status. Default = SCORED

  • start_datetime – start date time in YYYY-MM-DD H:M format, example: 2019-01-01 1:00

  • end_datetime – end date time in YYYY-MM-DD H:M format, example: 2019-01-01 23:59

Returns

Set of contributors’ user ids

challengeutils.utils.list_evaluations(syn, project)[source]

List evaluation queues of a Synapse project

Parameters
  • syn – Synapse object

  • project – Synapse id/entity of project

challengeutils.utils.update_all_submissions_annotation_acl(syn, evaluationid, annotations, status='SCORED', is_private=False)[source]

Function to change the acl of a list of known annotation keys on all submissions of a evaluation

Parameters
  • syn – synapse object

  • evaluationid – evaluation id

  • annotations – list of annotation keys to make public

  • status – ALL, VALIDATED, INVALID

  • is_private – whether the annotation is private or not, default to True

challengeutils.utils.update_single_submission_status(status, add_annotations, is_private=True, force=False)[source]

This will update a single submission’s status

Parameters
  • status – syn.getSubmissionStatus()

  • add_annotations – Annotations that you want to add in dict or submission status annotations format. If dict, all submissions will be added as private submissions

  • is_private – Annotations are set to private (default is True)

  • force – Force update the annotation from private to public and vice versa.

Returns

Updated submission status