2020-02-27 14:54:46 +00:00
|
|
|
import enum
|
|
|
|
|
2020-03-26 16:51:53 +00:00
|
|
|
from marshmallow import INCLUDE, post_load
|
2020-02-27 14:54:46 +00:00
|
|
|
|
|
|
|
from crc import ma
|
|
|
|
|
|
|
|
|
|
|
|
class ProtocolBuilderInvestigatorType(enum.Enum):
|
|
|
|
PI = "Primary Investigator"
|
|
|
|
SI = "Sub Investigator"
|
|
|
|
DC = "Department Contact"
|
|
|
|
SC_I = "Study Coordinator 1"
|
|
|
|
SC_II = "Study Coordinator 2"
|
|
|
|
AS_C = "Additional Study Coordinators"
|
|
|
|
DEPT_CH = "Department Chair"
|
|
|
|
IRBC = "IRB Coordinator"
|
|
|
|
SCI = "Scientific Contact"
|
|
|
|
|
|
|
|
|
2020-07-31 03:03:11 +00:00
|
|
|
# Deprecated: Marked for removal
|
2020-02-27 14:54:46 +00:00
|
|
|
class ProtocolBuilderStatus(enum.Enum):
|
2021-08-16 16:09:02 +00:00
|
|
|
# • Active: found in PB and not hold
|
2020-04-21 21:13:30 +00:00
|
|
|
# • Hold: store boolean value in CR Connect (add to Study Model)
|
2021-08-16 16:09:02 +00:00
|
|
|
# • Open To Enrollment: has start date?
|
2020-04-21 21:13:30 +00:00
|
|
|
# • Abandoned: deleted in PB
|
2021-12-06 19:36:34 +00:00
|
|
|
incomplete = 'incomplete' # Found in PB but not ready to start (not q_complete)
|
2021-08-16 16:09:02 +00:00
|
|
|
active = 'active' # found in PB, marked as "q_complete" and not hold
|
2020-07-28 21:16:48 +00:00
|
|
|
hold = 'hold' # CR Connect side, if the Study ias marked as "hold".
|
2021-08-16 16:09:02 +00:00
|
|
|
open = 'open' # Open To Enrollment: has start date?
|
2020-07-28 21:16:48 +00:00
|
|
|
abandoned = 'abandoned' # Not found in PB
|
2020-04-21 21:13:30 +00:00
|
|
|
|
2021-12-06 19:36:34 +00:00
|
|
|
# DRAFT = 'draft', # !Q_COMPLETE
|
|
|
|
# IN_PROCESS = 'in_process', # Q_COMPLETE && !UPLOAD_COMPLETE
|
|
|
|
# IN_REVIEW = 'in_review', # Q_COMPLETE && (!UPLOAD_COMPLETE)
|
|
|
|
# REVIEW_COMPLETE = 'review_complete', # Q_COMPLETE && UPLOAD_COMPLETE
|
|
|
|
# INACTIVE = 'inactive', # Not found in PB
|
2020-04-21 21:13:30 +00:00
|
|
|
|
|
|
|
|
2021-12-06 19:36:34 +00:00
|
|
|
class ProtocolBuilderCreatorStudy(object):
|
2020-02-27 14:54:46 +00:00
|
|
|
|
2021-12-06 19:36:34 +00:00
|
|
|
def __init__(self, STUDYID, DATELASTMODIFIED, DATECREATED, TITLE):
|
2020-02-27 14:54:46 +00:00
|
|
|
self.STUDYID = STUDYID
|
2021-12-06 19:36:34 +00:00
|
|
|
self.DATELASTMODIFIED = DATELASTMODIFIED
|
|
|
|
self.DATECREATED = DATECREATED
|
2020-02-27 14:54:46 +00:00
|
|
|
self.TITLE = TITLE
|
|
|
|
|
2021-12-06 19:36:34 +00:00
|
|
|
|
|
|
|
class ProtocolBuilderCreatorStudySchema(ma.Schema):
|
2020-02-27 14:54:46 +00:00
|
|
|
class Meta:
|
|
|
|
unknown = INCLUDE
|
2021-12-06 19:36:34 +00:00
|
|
|
fields = ["STUDYID", "DATELASTMODIFIED", "DATECREATED", "TITLE"]
|
2020-02-27 14:54:46 +00:00
|
|
|
|
2020-03-26 16:51:53 +00:00
|
|
|
@post_load
|
2021-12-06 19:36:34 +00:00
|
|
|
def make_study(self, data, **kwargs):
|
|
|
|
return ProtocolBuilderCreatorStudy(**data)
|
2020-03-26 16:51:53 +00:00
|
|
|
|
2020-02-27 14:54:46 +00:00
|
|
|
|
|
|
|
class ProtocolBuilderInvestigator(object):
|
2020-03-26 16:51:53 +00:00
|
|
|
def __init__(self, NETBADGEID: str, INVESTIGATORTYPE: str, INVESTIGATORTYPEFULL: str):
|
2020-02-27 14:54:46 +00:00
|
|
|
self.NETBADGEID = NETBADGEID
|
|
|
|
self.INVESTIGATORTYPE = INVESTIGATORTYPE
|
|
|
|
self.INVESTIGATORTYPEFULL = INVESTIGATORTYPEFULL
|
|
|
|
|
|
|
|
|
|
|
|
class ProtocolBuilderInvestigatorSchema(ma.Schema):
|
|
|
|
class Meta:
|
|
|
|
model = ProtocolBuilderInvestigator
|
|
|
|
unknown = INCLUDE
|
2020-04-03 17:52:12 +00:00
|
|
|
fields = ["NETBADGEID", "INVESTIGATORTYPE", "INVESTIGATORTYPEFULL"]
|
2020-02-27 14:54:46 +00:00
|
|
|
|
2020-03-26 16:51:53 +00:00
|
|
|
@post_load
|
|
|
|
def make_inv(self, data, **kwargs):
|
|
|
|
return ProtocolBuilderInvestigator(**data)
|
2020-02-27 14:54:46 +00:00
|
|
|
|
2020-04-03 20:24:38 +00:00
|
|
|
|
2020-02-27 14:54:46 +00:00
|
|
|
class ProtocolBuilderRequiredDocument(object):
|
|
|
|
def __init__(self, AUXDOCID: str, AUXDOC: str):
|
|
|
|
self.AUXDOCID = AUXDOCID
|
|
|
|
self.AUXDOC = AUXDOC
|
|
|
|
|
|
|
|
|
|
|
|
class ProtocolBuilderRequiredDocumentSchema(ma.Schema):
|
|
|
|
class Meta:
|
2021-12-06 19:36:34 +00:00
|
|
|
fields = ["AUXDOCID", "AUXDOC"]
|
2020-02-27 14:54:46 +00:00
|
|
|
unknown = INCLUDE
|
|
|
|
|
2020-03-26 16:51:53 +00:00
|
|
|
@post_load
|
|
|
|
def make_req(self, data, **kwargs):
|
|
|
|
return ProtocolBuilderRequiredDocument(**data)
|