From 1df280c7539c700a4127e0bef286e246a1cf26aa Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Fri, 17 Jun 2022 13:12:24 -0400 Subject: [PATCH] Add new API endpoint for pre_review info --- pb/api.py | 11 ++++++- pb/api.yml | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/pb/api.py b/pb/api.py index 6cceb17..9ff7eb9 100644 --- a/pb/api.py +++ b/pb/api.py @@ -2,7 +2,8 @@ from pb import session from pb.models import Investigator, InvestigatorSchema, IRBInfo, IRBInfoSchema, IRBInfoErrorSchema,\ IRBStatus, IRBStatusSchema, RequiredDocument, RequiredDocumentSchema, \ Study, StudySchema, StudyDetails, StudyDetailsSchema, \ - StudySponsor, StudySponsorSchema, CreatorStudySchema + StudySponsor, StudySponsorSchema, CreatorStudySchema, \ + PreReview, PreReviewSchema, PreReviewErrorSchema def get_user_studies(uva_id): @@ -46,3 +47,11 @@ def current_irb_info(studyid): else: # IRB Online returns a list with 1 dictionary in this case return IRBInfoSchema(many=True).dump([irb_info]) + + +def returned_to_pi(study_id): + results = session.query(PreReview).filter(PreReview.SS_STUDY_ID == study_id).all() + if results: + return PreReviewSchema(many=True).dump(results) + pre_review = PreReview(STATUS='Error', DETAIL='No records found.') + return PreReviewErrorSchema().dump(pre_review) diff --git a/pb/api.yml b/pb/api.yml index 1807726..a36f19a 100644 --- a/pb/api.yml +++ b/pb/api.yml @@ -175,6 +175,27 @@ paths: application/json: schema: $ref: "#/components/schemas/IRBInfo" + /returned_to_pi/{study_id}: + parameters: + - name: study_id + in: path + required: true + description: The id of the study + schema: + type: integer + format: int32 + get: + tags: + - CR-Connect + operationId: pb.api.returned_to_pi + summary: Info when study is returned to PI + responses: + 200: + description: Pre Review info about the study + content: + application/json: + schema: + $ref: "#/components/schemas/PreReview" components: schemas: Study: @@ -642,3 +663,66 @@ components: type: string example: Non-UVA IRB Full Board description: Human readable version of Review Type + PreReview: + type: object + properties: + SS_STUDY_ID: + type: number + example: 1 + description: The unique id of the study in Protocol Builder. + PROT_EVENT_ID: + type: number + example: 2 + description: The unique id of the Pre Review event + DATEENTERED: + type: string + format: date_time + example: "2022-07-03 00:00:00+00:00" + description: The date this Pre Review event occurred + REVIEW_TYPE: + type: number + example: 3 + description: The ID of the review type + UVA_STUDY_TRACKING: + type: number + example: 4 + description: An identifier for the study. Should be the same as SS_STUDY_ID + COMMENTS: + type: string + format: string + example: Returned because reasons + description: A comment about the Pre Review + IRBREVIEWERADMIN: + type: string + format: string + example: abc13 + description: The UVA user uid of the Reviewer Admin + FNAME: + type: string + format: string + example: Joanne + description: The first name of the Reviewer + LNAME: + type: string + format: string + example: Smith + description: The last name of the Reviewer + LOGIN: + type: string + format: string + example: xyz3a + description: The UVA user uid of the Reviewer + EVENT_TYPE: + type: number + example: 299 + description: The ID for the event type (should be 299) + STATUS: + type: string + format: string + example: Error + description: Used when study has *not* been returned to the PI + DETAIL: + type: string + format: string + example: No records found. + description: Used when study has *not* been returned to the PI