Merge pull request #33 from sartography/feature/limit_investigator_options

Sponsor List Endpoint
This commit is contained in:
Aaron Louie 2020-08-25 11:00:33 -04:00 committed by GitHub
commit e6c2f5a628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 2 deletions

View File

@ -36,6 +36,11 @@ def get_study_details(studyid):
return StudyDetailsSchema().dump(details)
def sponsors(studyid):
sponsors = db.session.query(StudySponsor).filter(StudySponsor.SS_STUDY == studyid).all()
return StudySponsorSchema(many=True).dump(sponsors)
def get_form(id, requirement_code):
return
@ -152,7 +157,7 @@ def site_map():
# **************************
from pb.forms import StudyForm, StudyTable, InvestigatorForm, StudyDetailsForm, ConfirmDeleteForm, StudySponsorForm
from pb.models import Study, RequiredDocument, Investigator, StudySchema, RequiredDocumentSchema, InvestigatorSchema, \
StudyDetails, StudyDetailsSchema, StudySponsor, Sponsor
StudyDetails, StudyDetailsSchema, StudySponsor, Sponsor, SponsorSchema, StudySponsorSchema
@app.route('/', methods=['GET', 'POST'])
@ -219,7 +224,7 @@ def new_investigator(study_id):
form = InvestigatorForm(request.form)
# Remove options from form if unique investigator already exist, but AS_C and SI can happen many times.
investigators = db.session.query(Investigator).filter(Study.STUDYID == study_id).all()
investigators = db.session.query(Investigator).filter(Investigator.STUDYID == study_id).all()
choices = form.INVESTIGATORTYPE.choices
existing_types = [i.INVESTIGATORTYPE for i in investigators]
existing_types = list(filter(lambda a: a != "AS_C", existing_types))

View File

@ -90,6 +90,29 @@ paths:
type: array
items:
$ref: "#/components/schemas/Investigator"
/sponsors:
get:
tags:
- CR-Connect
summary: Sponsors associated with a study.
operationId: pb.sponsors
description: A list of all the sponsors related to a study
parameters:
- in: query
name: studyid
description: A valid studyid, as provided in the call to list all studies.
required: true
schema:
type: string
responses:
'200':
description: A list of sponsors
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Sponsor"
/study:
parameters:
- in: query
@ -155,6 +178,32 @@ components:
format: string
example: IDS - Investigational Drug Service Approval
description: A descriptive name of the required dcoument.
Sponsor:
properties:
SP_NAME:
type: string
example: "AstraZeneca Pharmaceuticals LP (Wilmington, DE)"
description: A descriptive name
SP_TYPE:
type: string
example: "Industry"
description: the type of sponsor
SP_TYPE_GROUP_NAME:
type: string
example: "Industry"
description: The category of the type of sponsor
SS_STUDY:
type: number
example: 15333
description: The unqiue id of the associated study
COMMONRULEAGENCY:
type: boolean
example: true
description: Is this a common rule agency
SPONSOR_ID:
type: number
example: 1022
description: The unique id of the sponsor
Investigator:
properties:
STUDYID:

View File

@ -52,6 +52,7 @@ class StudySponsor(db.Model):
class StudySponsorSchema(ma.Schema):
class Meta:
fields = ("SS_STUDY", "SPONSOR_ID", "SP_NAME", "SP_TYPE", "SP_TYPE_GROUP_NAME", "COMMONRULEAGENCY")