New script to get IRB Info for a study

This commit is contained in:
mike cullerton 2021-05-01 15:52:41 -04:00
parent 1bcf4ea02e
commit 060ee5076d
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
from crc.scripts.script import Script
from crc.api.common import ApiError
from crc.services.protocol_builder import ProtocolBuilderService
class IRBInfo(Script):
pb = ProtocolBuilderService()
def get_description(self):
return """Returns the IRB Info data for a Study"""
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
return isinstance(study_id, int)
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
irb_info = self.pb.get_irb_info(study_id)
if isinstance(irb_info, dict):
return irb_info
else:
raise ApiError.from_task(code='missing_irb_info',
message=f'There was a problem retrieving IRB Info for study {study_id}.',
task=task)