2020-08-12 23:15:16 +00:00
from marshmallow import fields
2020-02-17 16:43:26 +00:00
from sqlalchemy import func
2020-05-24 22:30:57 +00:00
from pb import db , ma
2021-06-22 19:29:16 +00:00
from marshmallow_sqlalchemy import SQLAlchemySchema
2021-11-09 14:42:18 +00:00
from sqlalchemy . orm import backref , dynamic
2020-02-17 16:43:26 +00:00
2020-08-13 19:19:55 +00:00
class Sponsor ( db . Model ) :
SPONSOR_ID = db . Column ( db . Integer , primary_key = True )
SP_NAME = db . Column ( db . String , nullable = True )
SP_MAILING_ADDRESS = db . Column ( db . String , nullable = True )
SP_PHONE = db . Column ( db . String , nullable = True )
SP_FAX = db . Column ( db . String , nullable = True )
SP_EMAIL = db . Column ( db . String , nullable = True )
SP_HOMEPAGE = db . Column ( db . String , nullable = True )
COMMONRULEAGENCY = db . Column ( db . Boolean , nullable = True )
SP_TYPE = db . Column ( db . String , nullable = True )
SP_TYPE_GROUP_NAME = db . Column ( db . String , nullable = True )
@staticmethod
def all_types ( ) :
types = [
Sponsor ( SP_TYPE = " Federal " , SP_TYPE_GROUP_NAME = " Government " ) ,
Sponsor ( SP_TYPE = " Foundation/Not for Profit " , SP_TYPE_GROUP_NAME = " Other External Funding " ) ,
Sponsor ( SP_TYPE = " Incoming Sub Award " , SP_TYPE_GROUP_NAME = " Government " ) ,
Sponsor ( SP_TYPE = " Industry " , SP_TYPE_GROUP_NAME = " Industry " ) ,
Sponsor ( SP_TYPE = " Internal/Departmental/Gift " , SP_TYPE_GROUP_NAME = " Internal Funding " ) ,
Sponsor ( SP_TYPE = " No Funding " , SP_TYPE_GROUP_NAME = " Internal Funding " ) ,
Sponsor ( SP_TYPE = " Other Colleges and Universities " , SP_TYPE_GROUP_NAME = " Other External Funding " ) ,
Sponsor ( SP_TYPE = " State " , SP_TYPE_GROUP_NAME = " Government " ) ,
]
return types
@staticmethod
def get_type_group_name ( type_code ) :
for t in Sponsor . all_types ( ) :
if t . SP_TYPE == type_code :
return t . SP_TYPE_GROUP_NAME
class SponsorSchema ( ma . Schema ) :
class Meta :
fields = ( " SPONSOR_ID " , " SP_NAME " , " SP_MAILING_ADDRESS " ,
" SP_PHONE " , " SP_FAX " , " SP_EMAIL " , " SP_HOMEPAGE " ,
" COMMONRULEAGENCY " , " SP_TYPE " )
class StudySponsor ( db . Model ) :
id = db . Column ( db . Integer , primary_key = True )
SS_STUDY = db . Column ( db . Integer , db . ForeignKey ( ' study.STUDYID ' ) )
SPONSOR_ID = db . Column ( db . Integer , db . ForeignKey ( ' sponsor.SPONSOR_ID ' ) )
study = db . relationship ( " Study " , back_populates = " sponsors " )
sponsor = db . relationship ( " Sponsor " )
class StudySponsorSchema ( ma . Schema ) :
2020-08-25 14:26:29 +00:00
2020-08-13 19:19:55 +00:00
class Meta :
fields = ( " SS_STUDY " , " SPONSOR_ID " , " SP_NAME " , " SP_TYPE " , " SP_TYPE_GROUP_NAME " , " COMMONRULEAGENCY " )
SP_TYPE = fields . Function ( lambda obj : obj . sponsor . SP_TYPE )
SP_NAME = fields . Function ( lambda obj : obj . sponsor . SP_NAME )
SP_TYPE_GROUP_NAME = fields . Function ( lambda obj : obj . sponsor . SP_TYPE_GROUP_NAME )
COMMONRULEAGENCY = fields . Function ( lambda obj : obj . sponsor . COMMONRULEAGENCY )
2020-02-17 16:43:26 +00:00
class Study ( db . Model ) :
2020-02-17 21:21:18 +00:00
STUDYID = db . Column ( db . Integer , primary_key = True )
2021-02-22 17:36:10 +00:00
TITLE = db . Column ( db . Text ( ) , nullable = False )
2020-02-17 21:21:18 +00:00
NETBADGEID = db . Column ( db . String ( ) , nullable = False )
DATE_MODIFIED = db . Column ( db . DateTime ( timezone = True ) , default = func . now ( ) )
2021-04-01 16:39:09 +00:00
Q_COMPLETE = db . relationship ( " IRBStatus " , backref = " study " , lazy = ' dynamic ' )
2021-04-08 21:35:24 +00:00
irb_info = db . relationship ( " IRBInfo " , backref = " study " , lazy = ' dynamic ' )
2020-02-17 16:43:26 +00:00
requirements = db . relationship ( " RequiredDocument " , backref = " study " , lazy = ' dynamic ' )
investigators = db . relationship ( " Investigator " , backref = " study " , lazy = ' dynamic ' )
2020-02-17 22:30:55 +00:00
study_details = db . relationship ( " StudyDetails " , uselist = False , backref = " study " )
2020-08-13 19:19:55 +00:00
sponsors = db . relationship ( " StudySponsor " , back_populates = " study " , cascade = " all, delete, delete-orphan " )
2021-11-09 14:42:18 +00:00
# This is a hack to get PB Mock up and running
# We need to decide what to do about HSRNUMBER
# TODO: Resolve HSRNUMBER issue
HSRNUMBER = " 0 "
2020-02-17 16:43:26 +00:00
2021-06-18 18:40:11 +00:00
class IRBInfoEvent ( db . Model ) :
STUDY_ID = db . Column ( db . Integer , db . ForeignKey ( ' irb_info.SS_STUDY_ID ' ) , primary_key = True )
EVENT_ID = db . Column ( db . String ( ) , nullable = False , default = ' ' )
EVENT = db . Column ( db . String ( ) , nullable = False , default = ' ' )
@staticmethod
def all ( ) :
event = [ IRBInfoEvent ( EVENT_ID = ' ' , EVENT = ' ' ) ,
IRBInfoEvent ( EVENT_ID = ' 299 ' , EVENT = ' PreReview Returned to PI New Protocol ' ) ,
2021-08-16 20:36:22 +00:00
IRBInfoEvent ( EVENT_ID = ' 2 ' , EVENT = ' Pending Full Committee Review ' ) ,
2021-06-18 18:40:11 +00:00
IRBInfoEvent ( EVENT_ID = ' 57 ' , EVENT = ' Approval New Protocol ' ) ,
2021-08-16 20:36:22 +00:00
IRBInfoEvent ( EVENT_ID = ' 300 ' , EVENT = ' Approvable with Conditions-New Protocol ' ) ,
2021-06-18 18:40:11 +00:00
IRBInfoEvent ( EVENT_ID = ' 312 ' , EVENT = ' Condition Response Accepted-New Protocol ' ) ,
IRBInfoEvent ( EVENT_ID = ' 316 ' , EVENT = ' Deferred New Protocol ' ) ,
2022-04-20 16:41:30 +00:00
IRBInfoEvent ( EVENT_ID = ' 346 ' , EVENT = ' Receipt of Non-UVA Study ' ) ,
2022-04-21 15:13:00 +00:00
IRBInfoEvent ( EVENT_ID = ' 317 ' , EVENT = ' Disapproved New Protocol ' ) ,
2022-04-25 20:18:09 +00:00
IRBInfoEvent ( EVENT_ID = ' 62 ' , EVENT = ' Closed by PI ' ) ,
IRBInfoEvent ( EVENT_ID = ' 63 ' , EVENT = ' Receipt of New Protocol ' ) ]
2021-06-18 18:40:11 +00:00
return event
2021-06-21 16:59:31 +00:00
class IRBInfoEventSchema ( SQLAlchemySchema ) :
2021-06-18 18:40:11 +00:00
class Meta :
2021-06-22 19:29:16 +00:00
model = IRBInfoEvent
2021-06-18 18:40:11 +00:00
class IRBInfoStatus ( db . Model ) :
STUDY_ID = db . Column ( db . Integer , db . ForeignKey ( ' irb_info.SS_STUDY_ID ' ) , primary_key = True )
STATUS_ID = db . Column ( db . String ( ) , nullable = False , default = ' ' )
STATUS = db . Column ( db . String ( ) , nullable = False , default = ' ' )
@staticmethod
def all ( ) :
status = [ IRBInfoStatus ( STATUS_ID = ' ' , STATUS = ' ' ) ,
2021-08-16 20:36:22 +00:00
IRBInfoStatus ( STATUS_ID = ' 30 ' , STATUS = ' In PreReview New Protocol ' ) ,
2021-06-18 18:40:11 +00:00
IRBInfoStatus ( STATUS_ID = ' 31 ' , STATUS = ' PreReview Complete New Protocol ' ) ,
IRBInfoStatus ( STATUS_ID = ' 2 ' , STATUS = ' Open to enrollment ' ) ,
IRBInfoStatus ( STATUS_ID = ' 39 ' , STATUS = ' Withdrawn ' ) ,
2022-04-21 15:13:00 +00:00
IRBInfoStatus ( STATUS_ID = ' 37 ' , STATUS = ' Disapproved ' ) ,
IRBInfoStatus ( STATUS_ID = ' 35 ' , STATUS = ' Approvable with Conditions ' ) ]
2021-06-18 18:40:11 +00:00
return status
2021-06-21 16:59:31 +00:00
class IRBInfoStatusSchema ( SQLAlchemySchema ) :
2021-06-18 18:40:11 +00:00
class Meta :
2021-06-22 19:29:16 +00:00
model = IRBInfoStatus
2021-06-18 18:40:11 +00:00
2021-04-08 21:35:24 +00:00
class IRBInfo ( db . Model ) :
SS_STUDY_ID = db . Column ( db . Integer , db . ForeignKey ( ' study.STUDYID ' ) , primary_key = True )
UVA_STUDY_TRACKING = db . Column ( db . String ( ) , nullable = False , default = ' ' )
DATE_MODIFIED = db . Column ( db . Date , nullable = True )
IRB_ADMINISTRATIVE_REVIEWER = db . Column ( db . String ( ) , nullable = False , default = ' ' )
AGENDA_DATE = db . Column ( db . Date , nullable = True )
IRB_REVIEW_TYPE = db . Column ( db . String ( ) , nullable = False , default = ' ' )
2021-06-22 19:28:57 +00:00
IRBEVENT = db . relationship ( " IRBInfoEvent " , backref = backref ( " irb_info_event " ) , lazy = ' dynamic ' )
IRB_STATUS = db . relationship ( " IRBInfoStatus " , backref = backref ( " irb_info_status " ) , lazy = ' dynamic ' )
2021-04-16 20:39:36 +00:00
IRB_OF_RECORD = db . Column ( db . String ( ) , nullable = False , default = ' ' )
2021-04-08 21:35:24 +00:00
UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES = db . Column ( db . Integer ( ) , nullable = True )
STUDYIRBREVIEWERADMIN = db . Column ( db . String ( ) , nullable = False , default = ' ' )
2022-04-07 21:26:39 +00:00
IRB_ONLINE_STATUS = db . Column ( db . String ( ) , nullable = True )
2021-04-08 21:35:24 +00:00
2021-06-22 19:28:57 +00:00
class IRBInfoSchema ( ma . Schema ) :
2021-04-08 21:35:24 +00:00
class Meta :
2021-06-22 19:28:57 +00:00
model = IRBInfo
2021-06-18 18:42:09 +00:00
include_relationships = True
2021-06-21 16:59:31 +00:00
load_instance = True
2021-04-08 21:35:24 +00:00
fields = ( " UVA_STUDY_TRACKING " , " DATE_MODIFIED " , " IRB_ADMINISTRATIVE_REVIEWER " ,
2021-08-16 20:36:22 +00:00
" AGENDA_DATE " , " IRB_REVIEW_TYPE " , " IRB_OF_RECORD " , " IRBEVENT " , " IRBEVENT_ID " , " IRB_STATUS " , " IRB_STATUS_ID " ,
2022-04-07 21:28:07 +00:00
" UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES " , " STUDYIRBREVIEWERADMIN " , " STATUS " , " DETAIL " )
2021-04-08 21:35:24 +00:00
2021-06-22 19:28:57 +00:00
IRBEVENT = fields . Method ( " get_event " )
2021-08-16 20:36:22 +00:00
IRBEVENT_ID = fields . Method ( " get_event_id " )
2021-06-22 19:28:57 +00:00
IRB_STATUS = fields . Method ( " get_status " )
2021-08-16 20:36:22 +00:00
IRB_STATUS_ID = fields . Method ( " get_status_id " )
2022-04-07 21:28:07 +00:00
STATUS = fields . Method ( " get_online_status " )
DETAIL = fields . Method ( " get_online_detail " )
2021-06-22 19:28:57 +00:00
@staticmethod
def get_event ( obj ) :
2021-08-17 16:28:46 +00:00
if obj is not None and hasattr ( obj , ' IRBEVENT ' ) :
return obj . IRBEVENT [ 0 ] . EVENT
2021-06-22 19:28:57 +00:00
2021-08-16 20:36:22 +00:00
@staticmethod
def get_event_id ( obj ) :
2021-08-17 16:28:46 +00:00
if obj is not None and hasattr ( obj , ' IRBEVENT ' ) :
return obj . IRBEVENT [ 0 ] . EVENT_ID
2021-08-16 20:36:22 +00:00
2021-06-22 19:28:57 +00:00
@staticmethod
def get_status ( obj ) :
2021-08-17 16:28:46 +00:00
if obj is not None and hasattr ( obj , ' IRB_STATUS ' ) :
return obj . IRB_STATUS [ 0 ] . STATUS
2021-06-22 19:28:57 +00:00
2021-08-16 20:36:22 +00:00
@staticmethod
def get_status_id ( obj ) :
2021-08-17 16:28:46 +00:00
if obj is not None and hasattr ( obj , ' IRB_STATUS ' ) :
return obj . IRB_STATUS [ 0 ] . STATUS_ID
2021-08-16 20:36:22 +00:00
2022-04-07 21:28:07 +00:00
@staticmethod
def get_online_status ( obj ) :
if obj is not None and hasattr ( obj , ' IRB_ONLINE_STATUS ' ) and obj . IRB_ONLINE_STATUS is not None :
return obj . IRB_ONLINE_STATUS
@staticmethod
def get_online_detail ( obj ) :
if obj is not None and hasattr ( obj , ' IRB_ONLINE_STATUS ' ) and obj . IRB_ONLINE_STATUS is not None :
return ' Study downloaded to IRB Online. '
class IRBInfoErrorSchema ( ma . Schema ) :
class Meta :
model = IRBInfo
load_instance = True
fields = ( ' STATUS ' , ' DETAIL ' )
STATUS = fields . Method ( " get_online_status " )
DETAIL = fields . Method ( " get_online_detail " )
@staticmethod
def get_online_status ( obj ) :
return ' Error '
@staticmethod
def get_online_detail ( obj ) :
return ' Study not downloaded to IRB Online. '
2021-06-22 19:28:57 +00:00
2020-02-17 16:43:26 +00:00
class Investigator ( db . Model ) :
id = db . Column ( db . Integer , primary_key = True )
2020-02-17 21:21:18 +00:00
STUDYID = db . Column ( db . Integer , db . ForeignKey ( ' study.STUDYID ' ) )
NETBADGEID = db . Column ( db . String ( ) , nullable = False )
INVESTIGATORTYPE = db . Column ( db . String ( ) , nullable = False )
INVESTIGATORTYPEFULL = db . Column ( db . String ( ) , nullable = False )
2020-02-17 16:43:26 +00:00
@staticmethod
2020-02-17 18:25:14 +00:00
def all_types ( ) :
2020-02-17 16:43:26 +00:00
types = [
2020-02-17 21:21:18 +00:00
Investigator ( INVESTIGATORTYPE = " PI " , INVESTIGATORTYPEFULL = " Primary Investigator " ) ,
Investigator ( INVESTIGATORTYPE = " SI " , INVESTIGATORTYPEFULL = " Sub Investigator " ) ,
Investigator ( INVESTIGATORTYPE = " DC " , INVESTIGATORTYPEFULL = " Department Contact " ) ,
Investigator ( INVESTIGATORTYPE = " SC_I " , INVESTIGATORTYPEFULL = " Study Coordinator 1 " ) ,
Investigator ( INVESTIGATORTYPE = " SC_II " , INVESTIGATORTYPEFULL = " Study Coordinator 2 " ) ,
Investigator ( INVESTIGATORTYPE = " AS_C " , INVESTIGATORTYPEFULL = " Additional Study Coordinators " ) ,
Investigator ( INVESTIGATORTYPE = " DEPT_CH " , INVESTIGATORTYPEFULL = " Department Chair " ) ,
Investigator ( INVESTIGATORTYPE = " IRBC " , INVESTIGATORTYPEFULL = " IRB Coordinator " ) ,
2020-02-17 16:43:26 +00:00
]
return types
2020-02-17 21:21:18 +00:00
def set_type ( self , type_code ) :
self . INVESTIGATORTYPE = type_code
for t in self . all_types ( ) :
if t . INVESTIGATORTYPE == type_code :
self . INVESTIGATORTYPEFULL = t . INVESTIGATORTYPEFULL
2020-06-16 19:50:46 +00:00
2020-02-17 21:21:18 +00:00
class InvestigatorSchema ( ma . Schema ) :
class Meta :
2021-11-09 14:42:18 +00:00
fields = ( " STUDYID " , " NETBADGEID " , " INVESTIGATORTYPE " , " INVESTIGATORTYPEFULL " )
2020-02-17 21:21:18 +00:00
2020-02-17 16:43:26 +00:00
class RequiredDocument ( db . Model ) :
id = db . Column ( db . Integer , primary_key = True )
2021-11-09 14:42:18 +00:00
SS_AUXILIARY_DOC_TYPE_ID = db . Column ( db . String ( ) , nullable = False , default = " " )
AUXILIARY_DOC = db . Column ( db . String ( ) , nullable = False , default = " " )
2020-02-17 21:21:18 +00:00
STUDYID = db . Column ( db . Integer , db . ForeignKey ( ' study.STUDYID ' ) )
2020-02-17 16:43:26 +00:00
@staticmethod
def all ( ) :
2021-11-09 14:42:18 +00:00
docs = [ RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 1 , AUXILIARY_DOC = " Investigators Brochure " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 2 , AUXILIARY_DOC = " Screening Log " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 3 , AUXILIARY_DOC = " Protocol " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 6 , AUXILIARY_DOC = " Cancer Center ' s PRC Approval Form " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 7 , AUXILIARY_DOC = " GCRC Approval Form " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 8 , AUXILIARY_DOC = " SOM CTO IND/IDE Review Letter " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 9 , AUXILIARY_DOC = " HIRE Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 10 , AUXILIARY_DOC = " Cancer Center ' s PRC Approval Waiver " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 11 , AUXILIARY_DOC = " HSR Grant " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 12 , AUXILIARY_DOC = " Certificate of Confidentiality Application " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 14 , AUXILIARY_DOC = " Institutional Biosafety Committee Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 18 , AUXILIARY_DOC = " SOM CTO Approval Letter - UVA PI Multisite Trial " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 19 , AUXILIARY_DOC = " IRB Approval or Letter of Approval from Administration: Send Data or Specimens to UVA " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 20 , AUXILIARY_DOC = " IRB Approval or Letter of Approval from Administration: Study Conducted at non- UVA Facilities " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 21 , AUXILIARY_DOC = " New Medical Device Form " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 22 , AUXILIARY_DOC = " SOM CTO Review regarding need for IDE " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 23 , AUXILIARY_DOC = " SOM CTO Review regarding need for IND " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 24 , AUXILIARY_DOC = " InfoSec Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 25 , AUXILIARY_DOC = " Scientific Pre-review Documentation " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 26 , AUXILIARY_DOC = " IBC Number " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 32 , AUXILIARY_DOC = " IDS - Investigational Drug Service Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 33 , AUXILIARY_DOC = " Data Security Plan " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 35 , AUXILIARY_DOC = " Model Consent " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 36 , AUXILIARY_DOC = " RDRC Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 39 , AUXILIARY_DOC = " Age of Majority Cover Letter and Consent " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 40 , AUXILIARY_DOC = " SBS/IRB Approval-FERPA " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 41 , AUXILIARY_DOC = " HIRE Standard Radiation Language " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 42 , AUXILIARY_DOC = " COI Management Plan " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 43 , AUXILIARY_DOC = " SOM CTO Approval Letter-Non UVA, Non Industry PI MultiSite Study " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 44 , AUXILIARY_DOC = " GRIME Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 45 , AUXILIARY_DOC = " GMEC Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 46 , AUXILIARY_DOC = " IRB Reliance Agreement Request Form- IRB-HSR is IRB of Record " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 47 , AUXILIARY_DOC = " Non UVA IRB Approval - Initial and Last Continuation " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 48 , AUXILIARY_DOC = " MR Physicist Approval- Use of Gadolinium " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 49 , AUXILIARY_DOC = " SOM CTO Approval- Non- UVA Academia PI of IDE " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 51 , AUXILIARY_DOC = " IDS Waiver " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 52 , AUXILIARY_DOC = " Package Inserts " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 53 , AUXILIARY_DOC = " IRB Reliance Agreement Request Form- IRB-HSR Not IRB of Record " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 54 , AUXILIARY_DOC = " ESCRO Approval " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 56 , AUXILIARY_DOC = " Unaffiliated Investigator Agreement " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 57 , AUXILIARY_DOC = " Laser Safety Officer Approval " ) ,
2022-03-28 18:20:53 +00:00
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 58 , AUXILIARY_DOC = " FDA Letter granting IND/IDE# or exemption " ) ,
RequiredDocument ( SS_AUXILIARY_DOC_TYPE_ID = 59 , AUXILIARY_DOC = " SOM CTO Review for Gene Therapy/Transfer Study " ) ]
2020-02-17 16:43:26 +00:00
return docs
2020-02-17 21:21:18 +00:00
2021-11-09 14:42:18 +00:00
2020-02-17 21:21:18 +00:00
class RequiredDocumentSchema ( ma . Schema ) :
class Meta :
2021-11-11 20:32:02 +00:00
fields = ( " SS_AUXILIARY_DOC_TYPE_ID " , " AUXILIARY_DOC " )
2020-02-17 21:21:18 +00:00
2021-04-01 16:39:09 +00:00
class IRBStatus ( db . Model ) :
STUDYID = db . Column ( db . Integer , db . ForeignKey ( ' study.STUDYID ' ) , primary_key = True )
STATUS = db . Column ( db . String ( ) , nullable = False , default = " " )
DETAIL = db . Column ( db . String ( ) , nullable = False , default = " " )
@staticmethod
def all ( ) :
status = [ IRBStatus ( STATUS = " Error " , DETAIL = " Study ID does not exist. " ) ,
IRBStatus ( STATUS = " Error " , DETAIL = " General study errors. UVA Study Tracking Number is missing or not formatted correctly. " ) ,
IRBStatus ( STATUS = " No Error " , DETAIL = " Passed validation. " ) ]
return status
class IRBStatusSchema ( ma . Schema ) :
class Meta :
fields = ( " STATUS " , " DETAIL " )
2021-12-06 20:49:39 +00:00
class CreatorStudySchema ( ma . Schema ) :
class Meta :
model = Study
include_relationships = True
load_instance = True
2022-03-17 23:54:49 +00:00
fields = [ " STUDYID " , " TITLE " , " DATECREATED " , " DATELASTMODIFIED " , " REVIEW_TYPE " ]
2021-12-06 20:49:39 +00:00
DATECREATED = DATELASTMODIFIED = fields . Method ( " get_dates " )
2022-03-17 23:54:49 +00:00
REVIEW_TYPE = fields . Method ( " get_review_type " )
2021-12-06 20:49:39 +00:00
@staticmethod
def get_dates ( obj ) :
if obj is not None and hasattr ( obj , " DATE_MODIFIED " ) :
return obj . DATE_MODIFIED
2022-03-17 23:54:49 +00:00
@staticmethod
def get_review_type ( obj ) :
if obj is not None and hasattr ( obj , " study_details " ) :
return obj . study_details . REVIEW_TYPE
2021-12-06 20:49:39 +00:00
2021-11-09 14:42:18 +00:00
class StudySchema ( ma . Schema ) :
class Meta :
include_relationships = True
load_instance = True
# Fields to expose
fields = ( " STUDYID " , " TITLE " , " NETBADGEID " ,
" DATE_MODIFIED " , " Q_COMPLETE " , " HSRNUMBER " )
Q_COMPLETE = fields . Method ( " get_q_complete " )
# TODO: Resolve HSRNUMBER issue
# Currently, we set HSRNUMBER to 0 in the model
@staticmethod
def get_q_complete ( obj ) :
""" Ultimately, this will be calculated based on the contents of Q_COMPLETE.
For now , we return the contents of Q_COMPLETE """
# TODO: Calculate whatever we need to calculate.
# TODO: Currently, we don't return HSRNUMBER,
# but we don't currently use it in CR Connect either
if obj is not None and hasattr ( obj , ' Q_COMPLETE ' ) :
if len ( obj . Q_COMPLETE . all ( ) ) > 0 :
return { ' STATUS ' : obj . Q_COMPLETE [ 0 ] . STATUS , ' DETAIL ' : obj . Q_COMPLETE [ 0 ] . DETAIL }
return { }
2020-02-17 21:21:18 +00:00
class StudyDetails ( db . Model ) :
STUDYID = db . Column ( db . Integer , db . ForeignKey ( ' study.STUDYID ' ) , primary_key = True )
2021-05-26 20:51:41 +00:00
UVA_STUDY_TRACKING = db . Column ( db . String , nullable = True )
2020-02-17 21:21:18 +00:00
IS_IND = db . Column ( db . Integer , nullable = True )
IND_1 = db . Column ( db . String , nullable = True )
IND_2 = db . Column ( db . String , nullable = True )
IND_3 = db . Column ( db . String , nullable = True )
IS_UVA_IND = db . Column ( db . Integer , nullable = True )
IS_IDE = db . Column ( db . Integer , nullable = True )
IS_UVA_IDE = db . Column ( db . Integer , nullable = True )
IDE = db . Column ( db . String , nullable = True )
IS_CHART_REVIEW = db . Column ( db . Integer , nullable = True )
IS_RADIATION = db . Column ( db . Integer , nullable = True )
GCRC_NUMBER = db . Column ( db . String , nullable = True )
IS_GCRC = db . Column ( db . Integer , nullable = True )
IS_PRC_DSMP = db . Column ( db . Integer , nullable = True )
IS_PRC = db . Column ( db . Integer , nullable = True )
PRC_NUMBER = db . Column ( db . String , nullable = True )
IS_IBC = db . Column ( db . Integer , nullable = True )
IBC_NUMBER = db . Column ( db . String , nullable = True )
2021-03-25 17:11:27 +00:00
SPONSORS_PROTOCOL_REVISION_DATE = db . Column ( db . Date , nullable = True )
2020-02-17 21:21:18 +00:00
IS_SPONSOR_MONITORING = db . Column ( db . Integer , nullable = True )
IS_AUX = db . Column ( db . Integer , nullable = True )
IS_SPONSOR = db . Column ( db . Integer , nullable = True )
IS_GRANT = db . Column ( db . Integer , nullable = True )
IS_COMMITTEE_CONFLICT = db . Column ( db . Integer , nullable = True )
2021-03-30 14:56:23 +00:00
DSMB = db . Column ( db . String , nullable = True )
2020-02-17 21:21:18 +00:00
DSMB_FREQUENCY = db . Column ( db . Integer , nullable = True )
IS_DB = db . Column ( db . Integer , nullable = True )
IS_UVA_DB = db . Column ( db . Integer , nullable = True )
IS_CENTRAL_REG_DB = db . Column ( db . Integer , nullable = True )
IS_CONSENT_WAIVER = db . Column ( db . Integer , nullable = True )
IS_HGT = db . Column ( db . Integer , nullable = True )
IS_GENE_TRANSFER = db . Column ( db . Integer , nullable = True )
IS_TISSUE_BANKING = db . Column ( db . Integer , nullable = True )
IS_SURROGATE_CONSENT = db . Column ( db . Integer , nullable = True )
IS_ADULT_PARTICIPANT = db . Column ( db . Integer , nullable = True )
IS_MINOR_PARTICIPANT = db . Column ( db . Integer , nullable = True )
IS_MINOR = db . Column ( db . Integer , nullable = True )
IS_BIOMEDICAL = db . Column ( db . Integer , nullable = True )
IS_QUALITATIVE = db . Column ( db . Integer , nullable = True )
IS_PI_SCHOOL = db . Column ( db . Integer , nullable = True )
IS_PRISONERS_POP = db . Column ( db . Integer , nullable = True )
IS_PREGNANT_POP = db . Column ( db . Integer , nullable = True )
IS_FETUS_POP = db . Column ( db . Integer , nullable = True )
IS_MENTAL_IMPAIRMENT_POP = db . Column ( db . Integer , nullable = True )
IS_ELDERLY_POP = db . Column ( db . Integer , nullable = True )
IS_OTHER_VULNERABLE_POP = db . Column ( db . Integer , nullable = True )
OTHER_VULNERABLE_DESC = db . Column ( db . String , nullable = True )
IS_MULTI_SITE = db . Column ( db . Integer , nullable = True )
IS_UVA_LOCATION = db . Column ( db . Integer , nullable = True )
NON_UVA_LOCATION = db . Column ( db . String , nullable = True )
MULTI_SITE_LOCATIONS = db . Column ( db . String , nullable = True )
IS_OUTSIDE_CONTRACT = db . Column ( db . Integer , nullable = True )
IS_UVA_PI_MULTI = db . Column ( db . Integer , nullable = True )
IS_NOT_PRC_WAIVER = db . Column ( db . Integer , nullable = True )
IS_CANCER_PATIENT = db . Column ( db . Integer , nullable = True )
UPLOAD_COMPLETE = db . Column ( db . Integer , nullable = True )
IS_FUNDING_SOURCE = db . Column ( db . Integer , nullable = True )
IS_PI_INITIATED = db . Column ( db . Integer , nullable = True )
IS_ENGAGED_RESEARCH = db . Column ( db . Integer , nullable = True )
IS_APPROVED_DEVICE = db . Column ( db . Integer , nullable = True )
IS_FINANCIAL_CONFLICT = db . Column ( db . Integer , nullable = True )
IS_NOT_CONSENT_WAIVER = db . Column ( db . Integer , nullable = True )
IS_FOR_CANCER_CENTER = db . Column ( db . Integer , nullable = True )
IS_REVIEW_BY_CENTRAL_IRB = db . Column ( db . Integer , nullable = True )
IRBREVIEWERADMIN = db . Column ( db . String , nullable = True )
2021-03-25 17:11:27 +00:00
IS_SPONSOR_TRACKING = db . Column ( db . Integer , nullable = True )
SPONSOR_TRACKING = db . Column ( db . Integer , nullable = True )
IS_DSMB = db . Column ( db . Integer , nullable = True )
IS_COMPLETE_NON_IRB_REGULATORY = db . Column ( db . Integer , nullable = True )
IS_INSIDE_CONTRACT = db . Column ( db . Integer , nullable = True )
IS_CODED_RESEARCH = db . Column ( db . Integer , nullable = True )
IS_OUTSIDE_SPONSOR = db . Column ( db . Integer , nullable = True )
IS_UVA_COLLABANALYSIS = db . Column ( db . Integer , nullable = True )
2021-03-30 14:56:23 +00:00
REVIEW_TYPE = db . Column ( db . Integer , nullable = True )
REVIEWTYPENAME = db . Column ( db . String , nullable = True )
2021-03-25 17:11:27 +00:00
2020-02-17 21:21:18 +00:00
class StudyDetailsSchema ( ma . SQLAlchemyAutoSchema ) :
class Meta :
model = StudyDetails
2020-02-17 22:30:55 +00:00
load_instance = True
include_relationships = False
2021-05-11 20:33:44 +00:00
class SelectedUser ( db . Model ) :
user_id = db . Column ( db . String ( ) , primary_key = True )
selected_user = db . Column ( db . String ( ) , nullable = True )
class SelectedUserSchema ( ma . Schema ) :
class Meta :
fields = ( " user_id " , " selected_user " )