From 58af05fca8e34278cf19e9e43ccb3a33fcaa88e7 Mon Sep 17 00:00:00 2001 From: Mike Cullerton Date: Fri, 13 Jan 2023 12:59:54 -0500 Subject: [PATCH] Updated Script Tasks (markdown) --- Script-Tasks.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Script-Tasks.md b/Script-Tasks.md index 79e7ac6..c09a746 100644 --- a/Script-Tasks.md +++ b/Script-Tasks.md @@ -573,4 +573,43 @@ Retrieve information about submissions returned to the PI during Pre Review. Example: -```pre_reviews = get_pre_reviews()``` \ No newline at end of file +```pre_reviews = get_pre_reviews()``` + +## Get User Studies + +Returns the list of studies for a user in Protocol Builder + +Example: + +```user_studies = get_user_studies(user_id)``` + +The script returns a data object like this: + +``` +[ + { + "DATECREATED": "2002-02-19T14:26:49.127756", + "DATELASTMODIFIED": "2012-02-19T14:26:49.127756", + "STUDYID": 11111, + "TITLE": "An old study from the good old days that should not show up.", + "REVIEW_TYPE": 2 + }, + { + "DATECREATED": "2020-02-19T14:26:49.127756", + "DATELASTMODIFIED": "2020-02-19T14:26:49.127756", + "STUDYID": 54321, + "TITLE": "Another study about the effect of a naked mannequin on software productivity", + "REVIEW_TYPE": 2 + } +] +``` + +### Get the Study IDs + +You can easily pull all the Study IDs--or any other attribute, with a list comprehension + +Example: + +```user_studies = get_user_studies(user_id)``` + +```user_study_ids = [x.STUDYID for x in user_studies]```