mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
Script to get the status of the current script
This commit is contained in:
parent
5cf011f1d9
commit
8c66a3d2ef
18
crc/scripts/get_study_status.py
Normal file
18
crc/scripts/get_study_status.py
Normal file
@ -0,0 +1,18 @@
|
||||
from crc import session
|
||||
from crc.models.study import StudyModel
|
||||
from crc.scripts.script import Script
|
||||
|
||||
|
||||
class StudyStatus(Script):
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user