Assure that all script tasks place data in a dictionary that is named exactly the same as the class - which is also the same as the Script tag.
This commit is contained in:
parent
c6b6ee5d70
commit
697127660f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<biodi:bounds x="190" y="80" width="180" height="80" />
|
||||
</extensionElements>
|
||||
<decisionTable id="DecisionTable_1mjqwlv">
|
||||
<input id="InputClause_18pwfqu" label="Required Doc Keys">
|
||||
<input id="InputClause_18pwfqu" label="Data Plan Required in PB?">
|
||||
<inputExpression id="LiteralExpression_1y84stb" typeRef="boolean" expressionLanguage="feel">
|
||||
<text>documents['UVACompl_PRCAppr']['required']</text>
|
||||
<text>Documents['Study_DataSecurityPlan']['required']</text>
|
||||
</inputExpression>
|
||||
</input>
|
||||
<output id="OutputClause_05y0j7c" label="data_security_plan" name="data_security_plan" typeRef="string" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<decisionTable id="decisionTable_1">
|
||||
<input id="InputClause_1ki80j6" label="required doc ids">
|
||||
<inputExpression id="LiteralExpression_10mfcy7" typeRef="boolean" expressionLanguage="Python">
|
||||
<text>documents['UVACompl_PRCAppr']['required']</text>
|
||||
<text>Documents['UVACompl_PRCAppr']['required']</text>
|
||||
</inputExpression>
|
||||
</input>
|
||||
<output id="output_1" label="enter_core_info" name="enter_core_info" typeRef="string" />
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<biodi:bounds x="190" y="70" width="180" height="80" />
|
||||
</extensionElements>
|
||||
<decisionTable id="DecisionTable_00zdxg0">
|
||||
<input id="InputClause_02n3ccs" label="CoCApplication Required?">
|
||||
<input id="InputClause_02n3ccs" label="Sponsor Document Required in PB?">
|
||||
<inputExpression id="LiteralExpression_1ju4o1o" typeRef="boolean" expressionLanguage="feel">
|
||||
<text>documents['AD_LabManual']['required']</text>
|
||||
<text>Documents['AD_LabManual']['required']</text>
|
||||
</inputExpression>
|
||||
</input>
|
||||
<output id="OutputClause_1ybi1ud" label="sponsor_funding_source" name="eat_my_shorts" typeRef="string" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<decisionTable id="DecisionTable_1mjqwlv">
|
||||
<input id="InputClause_18pwfqu" label="Data Plan Required in PB?">
|
||||
<inputExpression id="LiteralExpression_1y84stb" typeRef="boolean" expressionLanguage="feel">
|
||||
<text>documents['Study_DataSecurityPlan']['required']</text>
|
||||
<text>Documents['Study_DataSecurityPlan']['required']</text>
|
||||
</inputExpression>
|
||||
</input>
|
||||
<output id="OutputClause_05y0j7c" label="data_security_plan" name="data_security_plan" typeRef="string" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<decisionTable id="decisionTable_1">
|
||||
<input id="InputClause_1ki80j6" label="required doc ids">
|
||||
<inputExpression id="LiteralExpression_10mfcy7" typeRef="boolean" expressionLanguage="Python">
|
||||
<text>documents['UVACompl_PRCAppr']['required']</text>
|
||||
<text>Documents['UVACompl_PRCAppr']['required']</text>
|
||||
</inputExpression>
|
||||
</input>
|
||||
<output id="output_1" label="enter_core_info" name="enter_core_info" typeRef="string" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<decisionTable id="DecisionTable_00zdxg0">
|
||||
<input id="InputClause_02n3ccs" label="Sponsor Document Required in PB?">
|
||||
<inputExpression id="LiteralExpression_1ju4o1o" typeRef="boolean" expressionLanguage="feel">
|
||||
<text>documents['AD_LabManual']['required']</text>
|
||||
<text>Documents['AD_LabManual']['required']</text>
|
||||
</inputExpression>
|
||||
</input>
|
||||
<output id="OutputClause_1ybi1ud" label="sponsor_funding_source" name="eat_my_shorts" typeRef="string" />
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue