From 9a63ab9c4fe182aab6c72902acb9a98b2face2c5 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 3 Jun 2021 14:28:24 -0400 Subject: [PATCH] Change `do_task_validate_only` in study_info script to call the real do_task. We do this so we can seed settings into the workflow for testing different scenarios using the study from validate_study_id --- crc/scripts/study_info.py | 198 ++------------------------------------ 1 file changed, 6 insertions(+), 192 deletions(-) diff --git a/crc/scripts/study_info.py b/crc/scripts/study_info.py index b5e49e84..e5df40f8 100644 --- a/crc/scripts/study_info.py +++ b/crc/scripts/study_info.py @@ -4,9 +4,10 @@ from SpiffWorkflow.bpmn.PythonScriptEngine import Box from crc import session from crc.api.common import ApiError +from crc.api.workflow import get_workflow from crc.models.protocol_builder import ProtocolBuilderInvestigatorType from crc.models.study import StudyModel, StudySchema -from crc.models.workflow import WorkflowStatus +from crc.api import workflow as workflow_api from crc.scripts.script import Script from crc.services.cache_service import timeit from crc.services.file_service import FileService @@ -172,197 +173,10 @@ Returns information specific to the protocol. # Assure the reference file exists (a bit hacky, but we want to raise this error early, and cleanly.) FileService.get_reference_file_data(FileService.DOCUMENT_LIST) FileService.get_reference_file_data(FileService.INVESTIGATOR_LIST) - data = { - "study": { - "info": { - "id": 12, - "title": "test", - "short_title": "tst", - "primary_investigator_id": 21, - "user_uid": "dif84", - "sponsor": "sponsor", - "ind_number": "1234", - "inactive": False - }, - "sponsors": [ - { - "COMMONRULEAGENCY": None, - "SPONSOR_ID": 2453, - "SP_NAME": "Abbott Ltd", - "SP_TYPE": "Private", - "SP_TYPE_GROUP_NAME": None, - "SS_STUDY": 2 - }, - { - "COMMONRULEAGENCY": None, - "SPONSOR_ID": 2387, - "SP_NAME": "Abbott-Price", - "SP_TYPE": "Incoming Sub Award", - "SP_TYPE_GROUP_NAME": "Government", - "SS_STUDY": 2 - }, - { - "COMMONRULEAGENCY": None, - "SPONSOR_ID": 1996, - "SP_NAME": "Abernathy-Heidenreich", - "SP_TYPE": "Foundation/Not for Profit", - "SP_TYPE_GROUP_NAME": "Other External Funding", - "SS_STUDY": 2 - } - ], - - "investigators": { - "PI": { - "label": ProtocolBuilderInvestigatorType.PI.value, - "display": "Always", - "unique": "Yes", - "user_id": "dhf8r", - "title": "", - "display_name": "Daniel Harold Funk", - "sponsor_type": "Contractor", - "telephone_number": "0000000000", - "department": "", - "email_address": "dhf8r@virginia.edu", - "given_name": "Daniel", - "uid": "dhf8r", - "affiliation": "", - "date_cached": "2020-08-04T19:32:08.006128+00:00" - }, - "SC_I": { - "label": ProtocolBuilderInvestigatorType.SC_I.value, - "display": "Always", - "unique": "Yes", - "user_id": "ajl2j", - "title": "", - "display_name": "Aaron Louie", - "sponsor_type": "Contractor", - "telephone_number": "0000000000", - "department": "", - "email_address": "ajl2j@virginia.edu", - "given_name": "Aaron", - "uid": "ajl2j", - "affiliation": "sponsored", - "date_cached": "2020-08-04T19:32:10.699666+00:00" - }, - "SC_II": { - "label": ProtocolBuilderInvestigatorType.SC_II.value, - "display": "Optional", - "unique": "Yes", - "user_id": "cah3us", - "title": "", - "display_name": "Alex Herron", - "sponsor_type": "Contractor", - "telephone_number": "0000000000", - "department": "", - "email_address": "cah3us@virginia.edu", - "given_name": "Alex", - "uid": "cah3us", - "affiliation": "sponsored", - "date_cached": "2020-08-04T19:32:10.075852+00:00" - }, - }, - "pi": { - "PI": { - "label": ProtocolBuilderInvestigatorType.PI.value, - "display": "Always", - "unique": "Yes", - "user_id": "dhf8r", - "title": "", - "display_name": "Daniel Harold Funk", - "sponsor_type": "Contractor", - "telephone_number": "0000000000", - "department": "", - "email_address": "dhf8r@virginia.edu", - "given_name": "Daniel", - "uid": "dhf8r", - "affiliation": "", - "date_cached": "2020-08-04T19:32:08.006128+00:00" - } - }, - "roles": - { - "INVESTIGATORTYPE": "PI", - "INVESTIGATORTYPEFULL": ProtocolBuilderInvestigatorType.PI.value, - "NETBADGEID": "dhf8r" - }, - "details": - { - "DSMB": None, - "DSMB_FREQUENCY": None, - "GCRC_NUMBER": None, - "IBC_NUMBER": None, - "IDE": None, - "IND_1": 1234, - "IND_2": None, - "IND_3": None, - "IRBREVIEWERADMIN": None, - "IS_ADULT_PARTICIPANT": None, - "IS_APPROVED_DEVICE": None, - "IS_AUX": None, - "IS_BIOMEDICAL": None, - "IS_CANCER_PATIENT": None, - "IS_CENTRAL_REG_DB": None, - "IS_CHART_REVIEW": None, - "IS_COMMITTEE_CONFLICT": None, - "IS_CONSENT_WAIVER": None, - "IS_DB": None, - "IS_ELDERLY_POP": None, - "IS_ENGAGED_RESEARCH": None, - "IS_FETUS_POP": None, - "IS_FINANCIAL_CONFLICT": None, - "IS_FOR_CANCER_CENTER": None, - "IS_FUNDING_SOURCE": None, - "IS_GCRC": None, - "IS_GENE_TRANSFER": None, - "IS_GRANT": None, - "IS_HGT": None, - "IS_IBC": None, - "IS_IDE": None, - "IS_IND": 1, - "IS_MENTAL_IMPAIRMENT_POP": None, - "IS_MINOR": None, - "IS_MINOR_PARTICIPANT": None, - "IS_MULTI_SITE": None, - "IS_NOT_CONSENT_WAIVER": None, - "IS_NOT_PRC_WAIVER": None, - "IS_OTHER_VULNERABLE_POP": None, - "IS_OUTSIDE_CONTRACT": None, - "IS_PI_INITIATED": None, - "IS_PI_SCHOOL": None, - "IS_PRC": None, - "IS_PRC_DSMP": None, - "IS_PREGNANT_POP": None, - "IS_PRISONERS_POP": None, - "IS_QUALITATIVE": None, - "IS_RADIATION": None, - "IS_REVIEW_BY_CENTRAL_IRB": None, - "IS_SPONSOR": None, - "IS_SPONSOR_MONITORING": None, - "IS_SURROGATE_CONSENT": None, - "IS_TISSUE_BANKING": None, - "IS_UVA_DB": None, - "IS_UVA_IDE": None, - "IS_UVA_IND": None, - "IS_UVA_LOCATION": None, - "IS_UVA_PI_MULTI": None, - "MULTI_SITE_LOCATIONS": None, - "NON_UVA_LOCATION": None, - "OTHER_VULNERABLE_DESC": None, - "PRC_NUMBER": None, - "SPONSORS_PROTOCOL_REVISION_DATE": None, - "UPLOAD_COMPLETE": None - }, - 'protocol': { - 'id': 0, - } - } - } - if args[0] == 'documents': - return self.box_it(StudyService().get_documents_status(study_id)) - return self.box_it(data['study'][args[0]]) - - # self.add_data_to_task(task=task, data=data["study"]) - # self.add_data_to_task(task, {"documents": StudyService().get_documents_status(study_id)}) + # we call the real do_task so we can + # seed workflow validations with settings from studies in PB Mock + # in order to test multiple paths thru the workflow + return self.do_task(task, study_id, workflow_id, args[0]) @timeit def do_task(self, task, study_id, workflow_id, *args, **kwargs):