Update IRBInfoSchema to include STATUS and DETAIL

Add IRBInfoErrorSchema
This commit is contained in:
mike cullerton 2022-04-07 17:28:07 -04:00
parent 382152e48a
commit 59899cc4c2

View File

@ -147,12 +147,14 @@ class IRBInfoSchema(ma.Schema):
load_instance = True load_instance = True
fields = ("UVA_STUDY_TRACKING", "DATE_MODIFIED", "IRB_ADMINISTRATIVE_REVIEWER", fields = ("UVA_STUDY_TRACKING", "DATE_MODIFIED", "IRB_ADMINISTRATIVE_REVIEWER",
"AGENDA_DATE", "IRB_REVIEW_TYPE", "IRB_OF_RECORD", "IRBEVENT", "IRBEVENT_ID", "IRB_STATUS", "IRB_STATUS_ID", "AGENDA_DATE", "IRB_REVIEW_TYPE", "IRB_OF_RECORD", "IRBEVENT", "IRBEVENT_ID", "IRB_STATUS", "IRB_STATUS_ID",
"UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES", "STUDYIRBREVIEWERADMIN") "UVA_IRB_HSR_IS_IRB_OF_RECORD_FOR_ALL_SITES", "STUDYIRBREVIEWERADMIN", "STATUS", "DETAIL")
IRBEVENT = fields.Method("get_event") IRBEVENT = fields.Method("get_event")
IRBEVENT_ID = fields.Method("get_event_id") IRBEVENT_ID = fields.Method("get_event_id")
IRB_STATUS = fields.Method("get_status") IRB_STATUS = fields.Method("get_status")
IRB_STATUS_ID = fields.Method("get_status_id") IRB_STATUS_ID = fields.Method("get_status_id")
STATUS = fields.Method("get_online_status")
DETAIL = fields.Method("get_online_detail")
@staticmethod @staticmethod
def get_event(obj): def get_event(obj):
@ -174,6 +176,34 @@ class IRBInfoSchema(ma.Schema):
if obj is not None and hasattr(obj, 'IRB_STATUS'): if obj is not None and hasattr(obj, 'IRB_STATUS'):
return obj.IRB_STATUS[0].STATUS_ID return obj.IRB_STATUS[0].STATUS_ID
@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.'
class Investigator(db.Model): class Investigator(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)