Add new API endpoint for pre_review info

This commit is contained in:
mike cullerton 2022-06-17 13:12:24 -04:00
parent 0fbbfcf898
commit 1df280c753
2 changed files with 94 additions and 1 deletions

View File

@ -2,7 +2,8 @@ from pb import session
from pb.models import Investigator, InvestigatorSchema, IRBInfo, IRBInfoSchema, IRBInfoErrorSchema,\ from pb.models import Investigator, InvestigatorSchema, IRBInfo, IRBInfoSchema, IRBInfoErrorSchema,\
IRBStatus, IRBStatusSchema, RequiredDocument, RequiredDocumentSchema, \ IRBStatus, IRBStatusSchema, RequiredDocument, RequiredDocumentSchema, \
Study, StudySchema, StudyDetails, StudyDetailsSchema, \ Study, StudySchema, StudyDetails, StudyDetailsSchema, \
StudySponsor, StudySponsorSchema, CreatorStudySchema StudySponsor, StudySponsorSchema, CreatorStudySchema, \
PreReview, PreReviewSchema, PreReviewErrorSchema
def get_user_studies(uva_id): def get_user_studies(uva_id):
@ -46,3 +47,11 @@ def current_irb_info(studyid):
else: else:
# IRB Online returns a list with 1 dictionary in this case # IRB Online returns a list with 1 dictionary in this case
return IRBInfoSchema(many=True).dump([irb_info]) 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)

View File

@ -175,6 +175,27 @@ paths:
application/json: application/json:
schema: schema:
$ref: "#/components/schemas/IRBInfo" $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: components:
schemas: schemas:
Study: Study:
@ -642,3 +663,66 @@ components:
type: string type: string
example: Non-UVA IRB Full Board example: Non-UVA IRB Full Board
description: Human readable version of Review Type 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