From 3c395ca3682894105e71873058ccc6e6a20eefbc Mon Sep 17 00:00:00 2001 From: burnettk Date: Fri, 30 Dec 2022 22:49:35 -0500 Subject: [PATCH] configure metadata extration paths appropriately --- .../routes/process_models_controller.py | 9 +++++++++ .../integration/test_process_api.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_models_controller.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_models_controller.py index 6276eda5d..a1c750cd9 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_models_controller.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_models_controller.py @@ -352,10 +352,15 @@ def process_model_create_with_natural_language( f"{process_group.id}/{process_model_identifier}" ) + metadata_extraction_paths = [] + for column in columns: + metadata_extraction_paths.append({"key": column, "path": column}) + process_model_attributes = { "id": qualified_process_model_identifier, "display_name": process_model_display_name, "description": None, + "metadata_extraction_paths": metadata_extraction_paths, } process_model_info = ProcessModelInfo(**process_model_attributes) # type: ignore @@ -371,6 +376,10 @@ def process_model_create_with_natural_language( f"User: {g.user.username} created process model via natural language:" f" {process_model_info.id}" ) + + # TODO: Create a form json schema and UI schema + # TODO: Add report + return Response( json.dumps(ProcessModelInfoSchema().dump(process_model_info)), status=201, diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index a7179966f..809063cbb 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -199,6 +199,11 @@ class TestProcessApi(BaseTest): assert response.json is not None assert response.json["id"] == f"{process_group_id}/bug-tracker" assert response.json["display_name"] == "Bug Tracker" + assert response.json["metadata_extraction_paths"] == [ + {"key": "summary", "path": "summary"}, + {"key": "description", "path": "description"}, + {"key": "priority", "path": "priority"}, + ] def test_primary_process_id_updates_via_xml( self,