mirror of
https://github.com/sartography/protocol-builder-mock.git
synced 2025-02-21 20:08:18 +00:00
Add form and method to gather pre_review information
Add route to form method
This commit is contained in:
parent
29b8eb89ff
commit
adcc41de7e
21
pb/forms.py
21
pb/forms.py
@ -1,11 +1,10 @@
|
||||
from flask_table import Table, Col, LinkCol, BoolCol, DatetimeCol, NestedTableCol
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import SelectMultipleField, StringField, BooleanField, SelectField, validators, HiddenField, DateField, IntegerField
|
||||
from wtforms_alchemy import ModelForm
|
||||
from wtforms.widgets.html5 import DateInput
|
||||
from wtforms.validators import Optional
|
||||
|
||||
from pb.models import RequiredDocument, Investigator, StudyDetails, IRBStatus, IRBInfo, IRBInfoEvent, IRBInfoStatus
|
||||
from pb.models import RequiredDocument, Investigator, IRBStatus, IRBInfoEvent, IRBInfoStatus
|
||||
|
||||
|
||||
class StudyForm(FlaskForm):
|
||||
@ -209,6 +208,11 @@ class StudyTable(Table):
|
||||
anchor_attrs={'class': 'btn btn-icon btn-accent', 'title': 'Edit Info'},
|
||||
th_html_attrs={'class': 'mat-icon text-center', 'title': 'Edit Info'}
|
||||
)
|
||||
pre_review = LinkCol(
|
||||
'check', 'edit_pre_review', url_kwargs=dict(study_id='STUDYID'),
|
||||
anchor_attrs={'class': 'btn btn-icon btn-accent', 'title': 'Pre Review'},
|
||||
th_html_attrs={'class': 'mat-icon text-center', 'title': 'Pre Review'}
|
||||
)
|
||||
STUDYID = Col('Study Id')
|
||||
TITLE = Col('Title')
|
||||
NETBADGEID = Col('User')
|
||||
@ -223,3 +227,16 @@ class StudyTable(Table):
|
||||
th_html_attrs={'class': 'mat-icon text-center', 'title': 'Delete Study'}
|
||||
)
|
||||
|
||||
|
||||
class PreReviewForm(FlaskForm):
|
||||
SS_STUDY_ID = HiddenField()
|
||||
UVA_STUDY_TRACKING = StringField('UVA_STUDY_TRACKING', render_kw={'readonly': True})
|
||||
DATEENTERED = DateField('DATEENTERED', widget=DateInput())
|
||||
REVIEW_TYPE = IntegerField('REVIEW_TYPE')
|
||||
COMMENTS = StringField('COMMENTS')
|
||||
IRBREVIEWERADMIN = StringField('IRBREVIEWERADMIN')
|
||||
FNAME = StringField('FNAME')
|
||||
LNAME = StringField('LNAME')
|
||||
LOGIN = StringField('LOGIN')
|
||||
EVENT_TYPE = IntegerField('EVENT_TYPE', render_kw={'readonly': True})
|
||||
STATUS_DETAIL = SelectField("STATUS/DETAIL", choices=['', 'Error: No Records Found', 'Record: Study returned to PI.'])
|
||||
|
54
pb/routes.py
54
pb/routes.py
@ -4,8 +4,8 @@ from pb.ldap.ldap_service import LdapService
|
||||
from pb.pb_mock import get_current_user, get_selected_user, update_selected_user, \
|
||||
render_study_template, _update_study, redirect_home, _update_irb_info, _allowed_file, \
|
||||
process_csv_study_details, has_no_empty_params, verify_required_document_list, verify_study_details_list
|
||||
from pb.forms import StudyForm, IRBInfoForm, InvestigatorForm, ConfirmDeleteForm, StudySponsorForm, StudyDetailsForm
|
||||
from pb.models import Study, StudyDetails, IRBInfo, IRBInfoEvent, IRBInfoStatus, IRBStatus, Investigator, Sponsor, StudySponsor, RequiredDocument
|
||||
from pb.forms import StudyForm, IRBInfoForm, InvestigatorForm, ConfirmDeleteForm, StudySponsorForm, StudyDetailsForm, PreReviewForm
|
||||
from pb.models import Study, StudyDetails, IRBInfo, IRBInfoEvent, IRBInfoStatus, IRBStatus, Investigator, Sponsor, StudySponsor, RequiredDocument, PreReview
|
||||
|
||||
import json
|
||||
|
||||
@ -441,3 +441,53 @@ def verify_study_details():
|
||||
else:
|
||||
flash('Study details are not up to date.', 'failure')
|
||||
return redirect_home()
|
||||
|
||||
|
||||
@app.route('/edit_pre_review/<study_id>', methods=['GET', 'POST'])
|
||||
def edit_pre_review(study_id):
|
||||
study = db.session.query(Study).filter(Study.STUDYID == study_id).first()
|
||||
pre_review_models = db.session.query(PreReview).filter(PreReview.SS_STUDY_ID == study_id).all()
|
||||
pre_reviews = []
|
||||
for model in pre_review_models:
|
||||
pre_reviews.append({
|
||||
'DATEENTERED': model.DATEENTERED,
|
||||
'COMMENTS': model.COMMENTS,
|
||||
'PROT_EVENT_ID': model.PROT_EVENT_ID,
|
||||
'form_action': BASE_HREF + "/delete_pre_review/" + str(model.PROT_EVENT_ID)
|
||||
})
|
||||
form = PreReviewForm(request.form, obj=study)
|
||||
if request.method == 'GET':
|
||||
form.UVA_STUDY_TRACKING.data = study_id
|
||||
form.EVENT_TYPE.data = 299
|
||||
if request.method == 'POST':
|
||||
if form.validate():
|
||||
pre_review = PreReview(
|
||||
PROT_EVENT_ID=None,
|
||||
SS_STUDY_ID=study_id,
|
||||
DATEENTERED=form.DATEENTERED.data,
|
||||
REVIEW_TYPE=form.REVIEW_TYPE.data,
|
||||
COMMENTS=form.COMMENTS.data,
|
||||
IRBREVIEWERADMIN=form.IRBREVIEWERADMIN.data,
|
||||
FNAME=form.FNAME.data,
|
||||
LNAME=form.LNAME.data,
|
||||
LOGIN=form.LOGIN.data,
|
||||
EVENT_TYPE=299,
|
||||
STATUS='Record',
|
||||
DETAIL='Study returned to PI.'
|
||||
)
|
||||
session.add(pre_review)
|
||||
session.commit()
|
||||
flash('Pre-Review updated successfully!', 'success')
|
||||
return redirect_home()
|
||||
action = BASE_HREF + "/edit_pre_review/" + study_id
|
||||
title = "Edit Pre Review"
|
||||
return render_template(
|
||||
'form.html',
|
||||
form=form,
|
||||
action=action,
|
||||
title=title,
|
||||
description_map={'PROT_EVENT_ID': 'Assigned by DB'},
|
||||
base_href=BASE_HREF,
|
||||
pre_reviews=pre_reviews
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user