Merge branch 'feature/enum_lookup_data' into feature/dynamic_enum_list

This commit is contained in:
Aaron Louie 2020-07-13 11:53:29 -04:00
commit 32343c04d6
5 changed files with 82 additions and 152 deletions

View File

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0xebv4o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="Process_1e61sci" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1gnws9u</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1gnws9u" sourceRef="StartEvent_1" targetRef="Activity_13fk8t8" />
<bpmn:endEvent id="Event_13knd01">
<bpmn:incoming>Flow_1xria19</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1xria19" sourceRef="Activity_0vmt66y" targetRef="Event_13knd01" />
<bpmn:userTask id="Activity_13fk8t8" name="Display Some Lookup Fields" camunda:formKey="lookup_form">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="lookup_dropdown" label="This is a dropdown" type="enum">
<camunda:properties>
<camunda:property id="spreadsheet.name" value="lookup.xlsx" />
<camunda:property id="spreadsheet.value.column" value="UID" />
<camunda:property id="spreadsheet.label.column" value="FULL_NAME" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="lookup_checkbox" label="These are checkboxes" type="enum">
<camunda:properties>
<camunda:property id="spreadsheet.name" value="lookup.xlsx" />
<camunda:property id="spreadsheet.value.column" value="UID" />
<camunda:property id="spreadsheet.label.column" value="FULL_NAME" />
<camunda:property id="enum_type" value="checkbox" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="lookup_radio" label="Here are some radio buttons" type="enum">
<camunda:properties>
<camunda:property id="spreadsheet.name" value="lookup.xlsx" />
<camunda:property id="spreadsheet.value.column" value="UID" />
<camunda:property id="spreadsheet.label.column" value="FULL_NAME" />
<camunda:property id="enum_type" value="radio" />
</camunda:properties>
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1gnws9u</bpmn:incoming>
<bpmn:outgoing>Flow_0zud2rb</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_0zud2rb" sourceRef="Activity_13fk8t8" targetRef="Activity_0vmt66y" />
<bpmn:manualTask id="Activity_0vmt66y" name="Display Stuff">
<bpmn:documentation>lookup_dropdown: {{ lookup_dropdown }}
lookup_checkbox: {{ lookup_checkbox }}
lookup_radio: {{ lookup_radio }}
</bpmn:documentation>
<bpmn:incoming>Flow_0zud2rb</bpmn:incoming>
<bpmn:outgoing>Flow_1xria19</bpmn:outgoing>
</bpmn:manualTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1e61sci">
<bpmndi:BPMNEdge id="Flow_1gnws9u_di" bpmnElement="Flow_1gnws9u">
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1xria19_di" bpmnElement="Flow_1xria19">
<di:waypoint x="510" y="117" />
<di:waypoint x="552" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0zud2rb_di" bpmnElement="Flow_0zud2rb">
<di:waypoint x="370" y="117" />
<di:waypoint x="410" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_142ek9m_di" bpmnElement="Activity_13fk8t8">
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_13knd01_di" bpmnElement="Event_13knd01">
<dc:Bounds x="552" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_17ng7d7_di" bpmnElement="Activity_0vmt66y">
<dc:Bounds x="410" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_07f7kut" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_07f7kut" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="Process_IDS" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>SequenceFlow_1dexemq</bpmn:outgoing>
@ -100,7 +100,7 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<camunda:constraint name="required" config="true" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="FormField_Explain" label="Please explain" type="text_area">
<camunda:formField id="FormField_Explain" label="Please explain" type="textarea">
<camunda:properties>
<camunda:property id="rows" value="5" />
</camunda:properties>
@ -123,7 +123,7 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<camunda:constraint name="required" config="true" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="FormField_Explain" label="Please explain" type="text_area">
<camunda:formField id="FormField_Explain" label="Please explain" type="textarea">
<camunda:properties>
<camunda:property id="rows" value="5" />
</camunda:properties>
@ -159,13 +159,13 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<camunda:constraint name="required" config="true" />
</camunda:validation>
</camunda:formField>
<camunda:formField id="FormField_Explain" label="Please explain" type="text_area">
<camunda:formField id="FormField_Explain" label="Please explain" type="textarea">
<camunda:properties>
<camunda:property id="rows" value="5" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="FormField_Training" label="Is any training required prior to obtaining system access?" type="boolean" />
<camunda:formField id="FormField_Details" label="If yes, provide details:" type="text_area">
<camunda:formField id="FormField_Details" label="If yes, provide details:" type="textarea">
<camunda:properties>
<camunda:property id="rows" value="5" />
<camunda:property id="hide_expression" value="!model.FormField_Training | model.FormField_Training == null" />
@ -206,7 +206,7 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<camunda:value id="no" name="No" />
<camunda:value id="unknown" name="Unknown" />
</camunda:formField>
<camunda:formField id="FormField_Details" label="If yes or unknown, provide details:" type="text_area" />
<camunda:formField id="FormField_Details" label="If yes or unknown, provide details:" type="textarea" />
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0lixqzs</bpmn:incoming>
@ -223,122 +223,122 @@ Protocol Owner: **(need to insert value here)**</bpmn:documentation>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_IDS">
<bpmndi:BPMNEdge id="Flow_1x9d2mo_di" bpmnElement="Flow_1x9d2mo">
<di:waypoint x="200" y="340" />
<di:waypoint x="270" y="340" />
<di:waypoint x="340" y="340" />
<di:waypoint x="410" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r7kcks_di" bpmnElement="SequenceFlow_1r7kcks">
<di:waypoint x="1180" y="340" />
<di:waypoint x="1272" y="340" />
<di:waypoint x="1320" y="340" />
<di:waypoint x="1412" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0lixqzs_di" bpmnElement="SequenceFlow_0lixqzs">
<di:waypoint x="985" y="340" />
<di:waypoint x="1080" y="340" />
<di:waypoint x="1125" y="340" />
<di:waypoint x="1220" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1dexemq_di" bpmnElement="SequenceFlow_1dexemq">
<di:waypoint x="48" y="340" />
<di:waypoint x="100" y="340" />
<di:waypoint x="188" y="340" />
<di:waypoint x="240" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1bkjyhx_di" bpmnElement="SequenceFlow_1bkjyhx">
<di:waypoint x="645" y="340" />
<di:waypoint x="695" y="340" />
<di:waypoint x="785" y="340" />
<di:waypoint x="835" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1kam5in_di" bpmnElement="SequenceFlow_1kam5in">
<di:waypoint x="506" y="340" />
<di:waypoint x="545" y="340" />
<di:waypoint x="646" y="340" />
<di:waypoint x="685" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1dcu8zu_di" bpmnElement="SequenceFlow_1dcu8zu">
<di:waypoint x="370" y="340" />
<di:waypoint x="406" y="340" />
<di:waypoint x="510" y="340" />
<di:waypoint x="546" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0m01j99_di" bpmnElement="SequenceFlow_0m01j99">
<di:waypoint x="890" y="560" />
<di:waypoint x="960" y="560" />
<di:waypoint x="960" y="365" />
<di:waypoint x="1030" y="560" />
<di:waypoint x="1100" y="560" />
<di:waypoint x="1100" y="365" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1lys0jq_di" bpmnElement="SequenceFlow_1lys0jq">
<di:waypoint x="720" y="365" />
<di:waypoint x="720" y="560" />
<di:waypoint x="790" y="560" />
<di:waypoint x="860" y="365" />
<di:waypoint x="860" y="560" />
<di:waypoint x="930" y="560" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_13fzv9y_di" bpmnElement="SequenceFlow_13fzv9y">
<di:waypoint x="890" y="450" />
<di:waypoint x="960" y="450" />
<di:waypoint x="960" y="365" />
<di:waypoint x="1030" y="450" />
<di:waypoint x="1100" y="450" />
<di:waypoint x="1100" y="365" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0jwnfzy_di" bpmnElement="SequenceFlow_0jwnfzy">
<di:waypoint x="720" y="365" />
<di:waypoint x="720" y="450" />
<di:waypoint x="790" y="450" />
<di:waypoint x="860" y="365" />
<di:waypoint x="860" y="450" />
<di:waypoint x="930" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pg0dkw_di" bpmnElement="SequenceFlow_1pg0dkw">
<di:waypoint x="890" y="340" />
<di:waypoint x="935" y="340" />
<di:waypoint x="1030" y="340" />
<di:waypoint x="1075" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0y21euo_di" bpmnElement="SequenceFlow_0y21euo">
<di:waypoint x="745" y="340" />
<di:waypoint x="790" y="340" />
<di:waypoint x="885" y="340" />
<di:waypoint x="930" y="340" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1iiazgn_di" bpmnElement="SequenceFlow_1iiazgn">
<di:waypoint x="890" y="120" />
<di:waypoint x="960" y="120" />
<di:waypoint x="960" y="315" />
<di:waypoint x="1030" y="120" />
<di:waypoint x="1100" y="120" />
<di:waypoint x="1100" y="315" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_100vc9e_di" bpmnElement="SequenceFlow_100vc9e">
<di:waypoint x="890" y="230" />
<di:waypoint x="960" y="230" />
<di:waypoint x="960" y="315" />
<di:waypoint x="1030" y="230" />
<di:waypoint x="1100" y="230" />
<di:waypoint x="1100" y="315" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0movigc_di" bpmnElement="SequenceFlow_0movigc">
<di:waypoint x="720" y="315" />
<di:waypoint x="720" y="230" />
<di:waypoint x="790" y="230" />
<di:waypoint x="860" y="315" />
<di:waypoint x="860" y="230" />
<di:waypoint x="930" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1guaev4_di" bpmnElement="SequenceFlow_1guaev4">
<di:waypoint x="720" y="315" />
<di:waypoint x="720" y="120" />
<di:waypoint x="790" y="120" />
<di:waypoint x="860" y="315" />
<di:waypoint x="860" y="120" />
<di:waypoint x="930" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="12" y="322" width="36" height="36" />
<dc:Bounds x="152" y="322" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_0wr3vp4_di" bpmnElement="Task_EnterIDSStudyIdentification">
<dc:Bounds x="790" y="80" width="100" height="80" />
<dc:Bounds x="930" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_0s34owg_di" bpmnElement="Task_EnterIDSFeeStructure">
<dc:Bounds x="790" y="190" width="100" height="80" />
<dc:Bounds x="930" y="190" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ParallelGateway_1c14ymx_di" bpmnElement="ExclusiveGateway_14igy57">
<dc:Bounds x="695" y="315" width="50" height="50" />
<dc:Bounds x="835" y="315" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ParallelGateway_188sr3c_di" bpmnElement="ExclusiveGateway_1b69uum">
<dc:Bounds x="935" y="315" width="50" height="50" />
<dc:Bounds x="1075" y="315" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0jypqha_di" bpmnElement="EndEvent_0jypqha">
<dc:Bounds x="1272" y="322" width="36" height="36" />
<dc:Bounds x="1412" y="322" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_0li1vo4_di" bpmnElement="Task_ReviewPharmacyManualStatus">
<dc:Bounds x="790" y="300" width="100" height="80" />
<dc:Bounds x="930" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_0uvz4r8_di" bpmnElement="UserTask_ReviewInvestigatorsBrochureStatus">
<dc:Bounds x="790" y="410" width="100" height="80" />
<dc:Bounds x="930" y="410" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_06sfx4u_di" bpmnElement="UserTask_ReviewIVRS-IWRS-IXRSManualStatus">
<dc:Bounds x="790" y="520" width="100" height="80" />
<dc:Bounds x="930" y="520" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BusinessRuleTask_1ld7tdu_di" bpmnElement="BusinessRuleTask_PharmacyManual">
<dc:Bounds x="406" y="300" width="100" height="80" />
<dc:Bounds x="546" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BusinessRuleTask_04d0y1w_di" bpmnElement="BusinessRuleTask_InvestigatorsBrochure">
<dc:Bounds x="270" y="300" width="100" height="80" />
<dc:Bounds x="410" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BusinessRuleTask_03zh0rt_di" bpmnElement="BusinessRuleTask_IVRS-IWRS-IXRSManual">
<dc:Bounds x="545" y="300" width="100" height="80" />
<dc:Bounds x="685" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="UserTask_03o04d0_di" bpmnElement="UserTask_03o04d0">
<dc:Bounds x="1080" y="300" width="100" height="80" />
<dc:Bounds x="1220" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0f5ox7w_di" bpmnElement="Activity_LoadDocuments">
<dc:Bounds x="100" y="300" width="100" height="80" />
<dc:Bounds x="240" y="300" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>

View File

@ -69,12 +69,6 @@ class ExampleDataLoader:
db.session.commit()
# Pass IRB Review
self.create_spec(id="group_test",
name="group_test",
display_name="Group Test",
description="TBD",
category_id=0,
display_order=0)
self.create_spec(id="irb_api_personnel",
name="irb_api_personnel",
display_name="Personnel",

View File

@ -83,6 +83,17 @@ class TestTasksApi(BaseTest):
workflow = WorkflowApiSchema().load(json_data)
return workflow
def assert_options_populated(self, results, lookup_data_keys):
option_keys = ['value', 'label', 'data']
self.assertIsInstance(results, list)
for result in results:
for option_key in option_keys:
self.assertTrue(option_key in result, 'should have value, label, and data properties populated')
self.assertIsNotNone(result[option_key], '%s should not be None' % option_key)
self.assertIsInstance(result['data'], dict)
for lookup_data_key in lookup_data_keys:
self.assertTrue(lookup_data_key in result['data'], 'should have all lookup data columns populated')
def test_get_current_user_tasks(self):
self.load_example_data()
@ -342,6 +353,7 @@ class TestTasksApi(BaseTest):
self.assert_success(rv)
results = json.loads(rv.get_data(as_text=True))
self.assertEqual(5, len(results))
self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING'])
def test_lookup_endpoint_for_task_field_using_lookup_entry_id(self):
self.load_example_data()
@ -357,13 +369,15 @@ class TestTasksApi(BaseTest):
self.assert_success(rv)
results = json.loads(rv.get_data(as_text=True))
self.assertEqual(5, len(results))
self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING'])
rv = self.app.get('/v1.0/workflow/%i/lookup/%s?value=%s' %
(workflow.id, field_id, results[0]['value']), # All records with a word that starts with 'c'
headers=self.logged_in_headers(),
content_type="application/json")
results = json.loads(rv.get_data(as_text=True))
self.assertEqual(1, len(results))
self.assertIsInstance(results[0]['data'], dict)
self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING'])
self.assertNotIn('id', results[0], "Don't include the internal id, that can be very confusing, and should not be used.")
def test_lookup_endpoint_also_works_for_enum(self):
@ -371,7 +385,7 @@ class TestTasksApi(BaseTest):
# In the event of an auto-complete it's a type-ahead search field, for an enum the
# the key/values from the spreadsheet are added directly to the form and it shows up as
# a dropdown. This tests the case of wanting to get additional data when a user selects
# something from a drodown.
# something from a dropdown.
self.load_example_data()
workflow = self.create_workflow('enum_options_from_file')
# get the first form in the two form workflow.
@ -386,6 +400,7 @@ class TestTasksApi(BaseTest):
self.assert_success(rv)
results = json.loads(rv.get_data(as_text=True))
self.assertEqual(1, len(results))
self.assert_options_populated(results, ['CUSTOMER_NUMBER', 'CUSTOMER_NAME', 'CUSTOMER_CLASS_MEANING'])
self.assertIsInstance(results[0]['data'], dict)
def test_lookup_endpoint_for_task_ldap_field_lookup(self):
@ -402,6 +417,9 @@ class TestTasksApi(BaseTest):
content_type="application/json")
self.assert_success(rv)
results = json.loads(rv.get_data(as_text=True))
self.assert_options_populated(results, ['telephone_number', 'affiliation', 'uid', 'title',
'given_name', 'department', 'date_cached', 'sponsor_type',
'display_name', 'email_address'])
self.assertEqual(1, len(results))
def test_sub_process(self):