2021-12-02 15:30:47 -05:00
|
|
|
from crc import session
|
|
|
|
from crc.models.study import StudyModel
|
|
|
|
from crc.scripts.script import Script
|
|
|
|
|
|
|
|
|
2021-12-03 11:53:21 -05:00
|
|
|
class GetStudyStatus(Script):
|
2021-12-02 15:30:47 -05:00
|
|
|
|
|
|
|
def get_description(self):
|
|
|
|
return """Get the status of the current study.
|
|
|
|
Status can be one of `in_progress`, `hold`, `open_for_enrollment`, or `abandoned`."""
|
|
|
|
|
|
|
|
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
|
|
|
|
return self.do_task(task, study_id, workflow_id, *args, **kwargs)
|
|
|
|
|
|
|
|
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
|
|
|
|
study_status = session.query(StudyModel.status).filter(StudyModel.id == study_id).scalar()
|
|
|
|
if study_status:
|
|
|
|
return study_status.value
|