diff --git a/crc/scripts/documents.py b/crc/scripts/documents.py index 5f198ebf..b7adb366 100644 --- a/crc/scripts/documents.py +++ b/crc/scripts/documents.py @@ -19,7 +19,7 @@ is also provided. This place a dictionary of values in the current task, where the key is the code in the lookup table. For example: -``` "documents" : +``` "Documents" : { "UVACompliance_PRCApproval": { "name": "Cancer Center's PRC Approval Form", @@ -28,8 +28,8 @@ For example: "category3": "", "Who Uploads?": "CRC", "required": True, - "requirement_id": 6 - "upload_count": 0 + "Id": 6 + "count": 0 }, 24: { ... } @@ -38,13 +38,13 @@ For example: def do_task_validate_only(self, task, study_id, *args, **kwargs): """For validation only, pretend no results come back from pb""" pb_docs = [] - task.data["required_docs"] = self.get_documents(study_id, pb_docs) + self.add_data_to_task(task, self.get_documents(study_id, pb_docs)) def do_task(self, task, study_id, *args, **kwargs): """Takes data from the protocol builder, and merges it with data from the IRB Pro Categories spreadsheet to return pertinent details about the required documents.""" pb_docs = self.pb.get_required_docs(study_id, as_objects=True) - task.data["documents"] = self.get_documents(study_id, pb_docs) + self.add_data_to_task(task, self.get_documents(study_id, pb_docs)) def get_documents(self, study_id, pb_docs): """Takes data from the protocol builder, and merges it with data from the IRB Pro Categories spreadsheet to return diff --git a/crc/scripts/fact_service.py b/crc/scripts/fact_service.py index 025e4b89..93d97aa3 100644 --- a/crc/scripts/fact_service.py +++ b/crc/scripts/fact_service.py @@ -40,6 +40,7 @@ class FactService(Script): else: details = "unknown fact type." - task.data['details'] = details + self.add_data_to_task(task, details) + print(details) return details diff --git a/crc/scripts/script.py b/crc/scripts/script.py index d7276be5..3240573a 100644 --- a/crc/scripts/script.py +++ b/crc/scripts/script.py @@ -53,6 +53,8 @@ class Script: return all_subclasses + def add_data_to_task(self, task, data): + task.data[self.__class__.__name__] = data class ScriptValidationError: diff --git a/crc/scripts/study_info.py b/crc/scripts/study_info.py index d272ba14..89642a46 100644 --- a/crc/scripts/study_info.py +++ b/crc/scripts/study_info.py @@ -45,15 +45,15 @@ class StudyInfo(Script): {} } } - task.data["study"] = data["study"] + self.add_data_to_task(task=task, data=data["study"]) def do_task(self, task, study_id, *args, **kwargs): self.check_args(args) cmd = args[0] study_info = {} - if "study" in task.data: - study_info = task.data["study"] + 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() diff --git a/crc/static/bpmn/top_level_workflow/data_security_plan.dmn b/crc/static/bpmn/top_level_workflow/data_security_plan.dmn index bdb508ec..d67da3b2 100644 --- a/crc/static/bpmn/top_level_workflow/data_security_plan.dmn +++ b/crc/static/bpmn/top_level_workflow/data_security_plan.dmn @@ -5,9 +5,9 @@ - + - documents['UVACompl_PRCAppr']['required'] + Documents['Study_DataSecurityPlan']['required'] diff --git a/crc/static/bpmn/top_level_workflow/enter_core_info.dmn b/crc/static/bpmn/top_level_workflow/enter_core_info.dmn index 6f129294..d4345af3 100644 --- a/crc/static/bpmn/top_level_workflow/enter_core_info.dmn +++ b/crc/static/bpmn/top_level_workflow/enter_core_info.dmn @@ -7,7 +7,7 @@ - documents['UVACompl_PRCAppr']['required'] + Documents['UVACompl_PRCAppr']['required'] diff --git a/crc/static/bpmn/top_level_workflow/sponsor_funding_source.dmn b/crc/static/bpmn/top_level_workflow/sponsor_funding_source.dmn index 5d204a42..e66274d3 100644 --- a/crc/static/bpmn/top_level_workflow/sponsor_funding_source.dmn +++ b/crc/static/bpmn/top_level_workflow/sponsor_funding_source.dmn @@ -5,9 +5,9 @@ - + - documents['AD_LabManual']['required'] + Documents['AD_LabManual']['required'] diff --git a/tests/data/top_level_workflow/data_security_plan.dmn b/tests/data/top_level_workflow/data_security_plan.dmn index 582f1067..d67da3b2 100644 --- a/tests/data/top_level_workflow/data_security_plan.dmn +++ b/tests/data/top_level_workflow/data_security_plan.dmn @@ -7,7 +7,7 @@ - documents['Study_DataSecurityPlan']['required'] + Documents['Study_DataSecurityPlan']['required'] diff --git a/tests/data/top_level_workflow/enter_core_info.dmn b/tests/data/top_level_workflow/enter_core_info.dmn index 6f129294..d4345af3 100644 --- a/tests/data/top_level_workflow/enter_core_info.dmn +++ b/tests/data/top_level_workflow/enter_core_info.dmn @@ -7,7 +7,7 @@ - documents['UVACompl_PRCAppr']['required'] + Documents['UVACompl_PRCAppr']['required'] diff --git a/tests/data/top_level_workflow/sponsor_funding_source.dmn b/tests/data/top_level_workflow/sponsor_funding_source.dmn index 2c644ef3..e66274d3 100644 --- a/tests/data/top_level_workflow/sponsor_funding_source.dmn +++ b/tests/data/top_level_workflow/sponsor_funding_source.dmn @@ -7,7 +7,7 @@ - documents['AD_LabManual']['required'] + Documents['AD_LabManual']['required'] diff --git a/tests/test_workflow_processor.py b/tests/test_workflow_processor.py index 18d51650..9fb241a8 100644 --- a/tests/test_workflow_processor.py +++ b/tests/test_workflow_processor.py @@ -48,7 +48,7 @@ class TestWorkflowProcessor(BaseTest): self.assertEqual(WorkflowStatus.complete, processor.get_status()) data = processor.get_data() self.assertIsNotNone(data) - self.assertIn("details", data) + self.assertIn("FactService", data) def test_workflow_with_dmn(self): self.load_example_data() @@ -152,7 +152,7 @@ class TestWorkflowProcessor(BaseTest): self.assertEqual(WorkflowStatus.complete, processor.get_status()) task = processor.next_task() self.assertIsNotNone(task) - self.assertIn("details", task.data) + self.assertIn("FactService", task.data) self.assertIsInstance(task.task_spec, EndEvent) def test_workflow_validation_error_is_properly_raised(self):