diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/json_data.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/json_data.py index 103bdc57..0723a50a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/json_data.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/json_data.py @@ -4,6 +4,22 @@ from spiffworkflow_backend.models.db import db from spiffworkflow_backend.models.db import SpiffworkflowBaseDBModel +# delta algorithm <- just to save it for when we want to try to implement it: +# a = {"hey": { "hey2": 2, "hey3": 3, "hey6": 7 }, "hey30": 3, "hey40": 4} +# b = {"hey": { "hey2": 4, "hey5": 3 }, "hey20": 2, "hey30": 3} +# a_keys = set(a.keys()) +# b_keys = set(b.keys()) +# removed = a_keys - b_keys +# added_keys = b_keys - a_keys +# keys_present_in_both = a_keys & b_keys +# changed = {} +# for key_in_both in keys_present_in_both: +# if a[key_in_both] != b[key_in_both]: +# changed[key_in_both] = b[key_in_both] +# added = {} +# for added_key in added_keys: +# added[added_key] = b[added_key] +# final_tuple = [added, removed, changed] class JsonDataModel(SpiffworkflowBaseDBModel): __tablename__ = "json_data" id: int = db.Column(db.Integer, primary_key=True) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py index 6b91bafa..713bd3cd 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/spiff_step_details.py @@ -10,145 +10,6 @@ from spiffworkflow_backend.models.db import db from spiffworkflow_backend.models.db import SpiffworkflowBaseDBModel from spiffworkflow_backend.models.process_instance import ProcessInstanceModel -# process_instance: -# process_model_definition_id -# process_id - - -# "bpmn_messages", -# "correlations", -# "subprocesses", <-- omit from json -# -# also in subprocesses -# "data", -# "tasks" <-- omit from json -# "last_task", # guid generated by spiff -# "root", # guid generated by spiff -# "success", # boolean -# -# runtime_json: -# "last_task", # guid generated by spiff -# "root", # guid generated by spiff -# "success", # boolean -# "bpmn_messages", # if top-level process -# "correlations", # if top-level process -# process: -# id -# parent_process_id -# runtime_json <-- minus tasks and subproceses -# type <-- subprocess, top_level_process -# data - -# runtime_json: -# "id": "a56e1403-2838-4f03-a31f-f99afe16f38d", -# "parent": null, -# "children": [ -# "af6ba340-71e7-46d7-b2d4-e3db1751785d" -# ], -# "last_state_change": 1677775475.18116, -# "state": 32, -# "task_spec": "Root", -# "triggered": false, -# "workflow_name": "Process_category_number_one_call_activity_call_activity_test_bd2e724", -# "internal_data": {}, -# "data": {} -# task: -# id -# guid -# process_id -# task_definition_id -# state <-- store string value -# runtime_json -# data - -# ### workflow -# "io_specification": null, -# "data_objects": {}, -# "correlation_keys": {}, -# "typename": "BpmnProcessSpec" -# "name": "Process_category_number_one_call_activity_call_activity_test_bd2e724", -# "description": "Process_category_number_one_call_activity_call_activity_test_bd2e724", -# "file": "call_activity_test.bpmn", -# "task_specs": {} - -# ### definition -# "Root": { -# "id": "Process_category_number_one_call_activity_call_activity_test_bd2e724_8", -# "name": "Root", -# "description": "", -# "manual": false, -# "internal": false, -# "lookahead": 2, -# "inputs": [], -# "outputs": [], -# "typename": "Simple" -# } -# ## runtime -# "a56e1403-2838-4f03-a31f-f99afe16f38d": { -# "id": "a56e1403-2838-4f03-a31f-f99afe16f38d", -# "parent": null, -# "children": [ -# "af6ba340-71e7-46d7-b2d4-e3db1751785d" -# ], -# "last_state_change": 1677775475.18116, -# "state": 32, -# "task_spec": "Root", -# "triggered": false, -# "workflow_name": "Process_category_number_one_call_activity_call_activity_test_bd2e724", -# "internal_data": {}, -# "data": {} -# }, - - -# ### definition -# "StartEvent_1": { -# "id": "Process_category_number_one_call_activity_call_activity_test_bd2e724_4", -# "name": "StartEvent_1", -# "description": null, -# "manual": false, -# "internal": false, -# "lookahead": 2, -# "inputs": [ -# "Start" -# ], -# "outputs": [ -# "same_process_model" -# ], -# "lane": null, -# "documentation": null, -# "position": { -# "x": 179, -# "y": 159 -# }, -# "data_input_associations": [], -# "data_output_associations": [], -# "io_specification": null, -# "event_definition": { -# "internal": false, -# "external": false, -# "typename": "NoneEventDefinition" -# }, -# "typename": "StartEvent", -# "extensions": {} -# }, -# ## runtime -# "b86b5552-c541-4afe-b200-db0190439f38": { -# "id": "b86b5552-c541-4afe-b200-db0190439f38", -# "parent": "af6ba340-71e7-46d7-b2d4-e3db1751785d", -# "children": [ -# "e9525f55-794f-450d-b5da-bee1951f99fc" -# ], -# "last_state_change": 1677775475.1963174, -# "state": 32, -# "task_spec": "StartEvent_1", -# "triggered": false, -# "workflow_name": "Process_category_number_one_call_activity_call_activity_test_bd2e724", -# "internal_data": { -# "event_fired": true -# }, -# "data": {} -# }, - @dataclass class SpiffStepDetailsModel(SpiffworkflowBaseDBModel):