def do_task(self, task, study_id, workflow_id, *args, **kwargs): self.check_args(args, 2) prefix = None if len(args) > 1: prefix = args[1] cmd = args[0] # study_info = {} # if self.__class__.__name__ in task.data: # study_info = task.data[self.__class__.__name__] retval = None if cmd == 'info': study = session.query(StudyModel).filter_by(id=study_id).first() schema = StudySchema() retval = schema.dump(study) if cmd == 'investigators': retval = StudyService().get_investigators(study_id) if cmd == 'roles': retval = StudyService().get_investigators(study_id, all=True) if cmd == 'details': details = self.pb.get_study_details(study_id) if len(details) > 0: retval = details[0] else: retval = None if cmd == 'sponsors': retval = self.pb.get_sponsors(study_id) if cmd == 'documents': retval = StudyService().get_documents_status(study_id) return self.box_it(retval, prefix)
def do_task(self, task, study_id, workflow_id, *args, **kwargs): self.check_args(args) cmd = args[0] study_info = {} if self.__class__.__name__ in task.data: study_info = task.data[self.__class__.__name__] if cmd == 'info': study = session.query(StudyModel).filter_by(id=study_id).first() schema = StudySchema() self.add_data_to_task(task, {cmd: schema.dump(study)}) if cmd == 'investigators': self.add_data_to_task(task, {cmd: StudyService().get_investigators(study_id)}) if cmd == 'roles': self.add_data_to_task(task, {cmd: StudyService().get_investigators(study_id, all=True)}) if cmd == 'details': self.add_data_to_task(task, {cmd: self.pb.get_study_details(study_id)}) if cmd == 'approvals': self.add_data_to_task(task, {cmd: StudyService().get_approvals(study_id)}) if cmd == 'documents': self.add_data_to_task(task, {cmd: StudyService().get_documents_status(study_id)}) if cmd == 'protocol': self.add_data_to_task(task, {cmd: StudyService().get_protocol(study_id)})