From bc7c06b10e26a40bd9ca79459fb216d2273df175 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Wed, 20 Nov 2024 21:25:43 +0100 Subject: [PATCH 01/35] Enable basket export for KEK --- qgepqwat2ili/__init__.py | 11 +++++++++-- qgepqwat2ili/gui/__init__.py | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index 4e533d76..93b60dd4 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -201,20 +201,25 @@ def main(args): ILI_EXPORT_MODEL_NAME = None if args.direction == "export": + basket_enabled = True + if args.export_sia405 or args.export_dss: + basket_enabled = False + utils.ili2db.create_ili_schema( SCHEMA, ILI_MODEL, make_log_path(log_path, "ilicreate"), recreate_schema=args.recreate_schema, - create_basket_col=False, + create_basket_col=basket_enabled, ) - # add model dependency + if args.export_sia405: # SIA405_ABWASSER_2015_LV95 qgep_export_sia405( selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation, + basket_enabled=basket_enabled, ) elif args.export_dss: # DSS_2015_LV95 expor5t @@ -222,6 +227,7 @@ def main(args): selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation, + basket_enabled=basket_enabled, ) else: # VSA_KEK_2019_LV95 export @@ -229,6 +235,7 @@ def main(args): selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation, + basket_enabled=basket_enabled, ) utils.ili2db.export_xtf_data( diff --git a/qgepqwat2ili/gui/__init__.py b/qgepqwat2ili/gui/__init__.py index 6cc9b206..a859ef38 100644 --- a/qgepqwat2ili/gui/__init__.py +++ b/qgepqwat2ili/gui/__init__.py @@ -549,7 +549,7 @@ def action_do_export(): config.ABWASSER_ILI_MODEL, log_path, recreate_schema=True, - create_basket_col=False, + create_basket_col=True, ) elif emodel == "SIA405_ABWASSER_2015_LV95": create_ili_schema( @@ -663,6 +663,7 @@ def action_do_export(): selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation, + basket_enabled=True, ) # 22.3.2023 / 28.3.2023 adjusted to qgepsia405_export elif emodel == "SIA405_ABWASSER_2015_LV95": @@ -673,6 +674,7 @@ def action_do_export(): selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation, + basket_enabled=False, ) elif emodel == "DSS_2015_LV95": logger.info("Start Exporting DSS_2015_LV95 - qgepdss_export") @@ -682,6 +684,7 @@ def action_do_export(): selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation, + basket_enabled=False, ) else: progress_dialog.close() From 53b36e5df30d9b700c12790dfb74e1881d136aa0 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Wed, 20 Nov 2024 21:51:52 +0100 Subject: [PATCH 02/35] Fix metaattribute --- qgepqwat2ili/utils/qgep_export_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 5c0eec9a..8b4f919e 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -149,7 +149,7 @@ def create_metaattributes(self, row): ) if self.current_basket is not None: - metaattribute["t_basket"] = self.current_basket.t_id + metaattribute.t_basket = self.current_basket.t_id self.abwasser_session.add(metaattribute) From ea1a26f96abf029d6413ac0e1e11d403597ff3ca Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Wed, 20 Nov 2024 22:20:55 +0100 Subject: [PATCH 03/35] Org with or whitout basket --- qgepqwat2ili/utils/qgep_export_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 8b4f919e..1a50ec0d 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -165,7 +165,7 @@ def base_common(self, row, type_name): "t_id": self.get_tid(row), } - if self.current_basket is not None: + if self.current_basket is not None and type_name != "organisation": base["t_basket"] = self.current_basket.t_id return base @@ -281,6 +281,10 @@ def export_organisation(self): bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80), bezeichnung=self.null_to_emptystr(row.identifier), ) + + if self.current_basket is not None: + organisation.t_basket = self.current_basket.t_id + self.abwasser_session.add(organisation) self.create_metaattributes(row) print(".", end="") From c4596163cb5492d39c86006ebba4a0291a5469bd Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Thu, 21 Nov 2024 15:47:27 +0100 Subject: [PATCH 04/35] Fix topic name --- qgepqwat2ili/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/config.py b/qgepqwat2ili/config.py index 86a3dc84..4bf58c8f 100644 --- a/qgepqwat2ili/config.py +++ b/qgepqwat2ili/config.py @@ -51,6 +51,6 @@ WASSER_ILI_MODEL_NAME = "SIA405_WASSER_2015_LV95" TOPIC_NAME_SIA405_ADMINISTRATION = "SIA405_Base_Abwasser_LV95.Administration" -TOPIC_NAME_SIA405_ABWASSER = "SIA405_ABWASSER_2015.SIA405_Abwasser" +TOPIC_NAME_SIA405_ABWASSER = "SIA405_ABWASSER_2015_LV95.SIA405_Abwasser" TOPIC_NAME_DSS = "DSS_2015.Siedlungsentwaesserung" TOPIC_NAME_KEK = "VSA_KEK_2019_LV95.KEK" From ab7af95cfc59aa1377d459fcebead0ff32a7e7f9 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Mon, 9 Dec 2024 17:16:36 +0100 Subject: [PATCH 05/35] Print current basket id --- qgepqwat2ili/utils/qgep_export_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 1a50ec0d..42428144 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -282,6 +282,7 @@ def export_organisation(self): bezeichnung=self.null_to_emptystr(row.identifier), ) + print(f"Current basket id: {self.current_basket.t_id}") if self.current_basket is not None: organisation.t_basket = self.current_basket.t_id From 7a2be0bafc406ff827979f3cd25e45d5a98d2b59 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 14:20:45 +0100 Subject: [PATCH 06/35] Enable basket for kek import --- qgepqwat2ili/__init__.py | 2 +- qgepqwat2ili/gui/__init__.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index 93b60dd4..9feb0df3 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -288,7 +288,7 @@ def main(args): ILI_MODEL, make_log_path(log_path, "ilicreate"), recreate_schema=args.recreate_schema, - create_basket_col=False, + create_basket_col=True, ) utils.ili2db.import_xtf_data( SCHEMA, args.path, make_log_path(log_path, "iliimport") diff --git a/qgepqwat2ili/gui/__init__.py b/qgepqwat2ili/gui/__init__.py index a859ef38..cf324ed4 100644 --- a/qgepqwat2ili/gui/__init__.py +++ b/qgepqwat2ili/gui/__init__.py @@ -178,6 +178,7 @@ def action_import(plugin): config.ABWASSER_ILI_MODEL, log_path, recreate_schema=True, + create_basket_col=True, ) elif imodel == "SIA405_ABWASSER_2015_LV95": create_ili_schema( @@ -185,6 +186,7 @@ def action_import(plugin): config.ABWASSER_SIA405_ILI_MODEL, log_path, recreate_schema=True, + create_basket_col=False, ) elif imodel == "DSS_2015_LV95": create_ili_schema( @@ -192,6 +194,7 @@ def action_import(plugin): config.ABWASSER_DSS_ILI_MODEL, log_path, recreate_schema=True, + create_basket_col=False, ) else: # print(imodel) From 0fccdd9216ce6fed38d9c84b71deae51fb21bdf2 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 15:01:52 +0100 Subject: [PATCH 07/35] more debug info --- qgepqwat2ili/qgep/export.py | 1 + qgepqwat2ili/qgepdss/export.py | 1 + qgepqwat2ili/qgepsia405/export.py | 1 + qgepqwat2ili/utils/ili2db.py | 8 ++++++++ qgepqwat2ili/utils/qgep_export_utils.py | 3 ++- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index 07087053..4aa602d5 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -21,6 +21,7 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ + print("qgep_export_kek") qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index 6bcfe72e..cbf8857a 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -21,6 +21,7 @@ def qgep_export_dss(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ + print("qgep_export_dss") qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index e1e93382..ebb33fb5 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -20,6 +20,7 @@ def qgep_export_sia405(selection=None, labels_file=None, orientation=None, baske Args: selection: if provided, limits the export to networkelements that are provided in the selection """ + print("qgep_export_sia405") qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/utils/ili2db.py b/qgepqwat2ili/utils/ili2db.py index b4e0f7f4..401faeb8 100644 --- a/qgepqwat2ili/utils/ili2db.py +++ b/qgepqwat2ili/utils/ili2db.py @@ -21,6 +21,8 @@ def check_organisation_subclass_data(): cursor = connection.cursor() cursor.execute("SELECT obj_id FROM qgep_od.organisation;") + + organisation_subclass_check = True if cursor.rowcount > 0: organisation_count = cursor.rowcount logger.info(f"Number of organisation datasets: {organisation_count}") @@ -62,6 +64,7 @@ def check_wastewater_structure_subclass_data(): cursor = connection.cursor() cursor.execute("SELECT obj_id FROM qgep_od.wastewater_structure;") + wastewater_structure_subclass_check = True if cursor.rowcount > 0: wastewater_structure_count = cursor.rowcount logger.info(f"Number of wastewater_structure datasets: {wastewater_structure_count}") @@ -240,6 +243,7 @@ def check_fk_operator_null(): missing_fk_operator_count = 0 # add MANDATORY classes to be checked + check_fk_operator_null = True for notsubclass in [ # SIA405 Abwasser ("wastewater_structure"), @@ -281,6 +285,8 @@ def check_fk_dataowner_null(): connection.set_session(autocommit=True) cursor = connection.cursor() + check_fk_dataowner_null = True + missing_fk_dataowner_count = 0 # add MANDATORY classes to be checked for notsubclass in [ @@ -370,6 +376,8 @@ def check_fk_provider_null(): connection.set_session(autocommit=True) cursor = connection.cursor() + check_fk_provider_null = True + missing_fk_provider_count = 0 # add MANDATORY classes to be checked for notsubclass in [ diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 42428144..83bb62ad 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -282,8 +282,9 @@ def export_organisation(self): bezeichnung=self.null_to_emptystr(row.identifier), ) - print(f"Current basket id: {self.current_basket.t_id}") + print(f"Current basket: {self.current_basket}") if self.current_basket is not None: + print(f"Current basket id: {self.current_basket.t_id}") organisation.t_basket = self.current_basket.t_id self.abwasser_session.add(organisation) From 1813350d527247799fb015a44b9883ef7ceac63b Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 19:53:34 +0100 Subject: [PATCH 08/35] Try disable selection test --- qgepqwat2ili/tests/test_qgep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 775440e1..d69c5c64 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -147,7 +147,7 @@ def test_case_d_import_complete_xtf_to_qgep(self): session.close() # test for VSA_KEK_2019_LV95 export with selection and labels - def test_case_e_export_selection(self): + def _test_case_e_export_selection(self): """ # E. export a selection """ From 0144e7486c1b48a1a6d6fb7a7a2a2716902aa092 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 20:22:41 +0100 Subject: [PATCH 09/35] debug --- qgepqwat2ili/utils/qgep_export_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 83bb62ad..60cc9fdd 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -282,6 +282,7 @@ def export_organisation(self): bezeichnung=self.null_to_emptystr(row.identifier), ) + print(f"Org id: {organisation.t_id}") print(f"Current basket: {self.current_basket}") if self.current_basket is not None: print(f"Current basket id: {self.current_basket.t_id}") From d6df629543550156b42d7203706517ca86d20892 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 20:32:05 +0100 Subject: [PATCH 10/35] debug --- qgepqwat2ili/utils/qgep_export_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 60cc9fdd..6f9855d0 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -282,7 +282,7 @@ def export_organisation(self): bezeichnung=self.null_to_emptystr(row.identifier), ) - print(f"Org id: {organisation.t_id}") + print(f"Org t_ili_tid: {organisation.t_ili_tid}") print(f"Current basket: {self.current_basket}") if self.current_basket is not None: print(f"Current basket id: {self.current_basket.t_id}") From 4326a983f5ba554ca3f5455587c8a4278d7c4d37 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 21:09:37 +0100 Subject: [PATCH 11/35] reset handling of org basket in base_common --- qgepqwat2ili/utils/qgep_export_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 6f9855d0..8e519217 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -165,7 +165,7 @@ def base_common(self, row, type_name): "t_id": self.get_tid(row), } - if self.current_basket is not None and type_name != "organisation": + if self.current_basket is not None: base["t_basket"] = self.current_basket.t_id return base @@ -284,9 +284,10 @@ def export_organisation(self): print(f"Org t_ili_tid: {organisation.t_ili_tid}") print(f"Current basket: {self.current_basket}") + if self.current_basket is not None: print(f"Current basket id: {self.current_basket.t_id}") - organisation.t_basket = self.current_basket.t_id + # organisation.t_basket = self.current_basket.t_id self.abwasser_session.add(organisation) self.create_metaattributes(row) From 1048e969676d2d4da8f0672eb50ce46ef5ed2dc3 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 21:19:27 +0100 Subject: [PATCH 12/35] Skip another selection test for now --- qgepqwat2ili/tests/test_qgep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index d69c5c64..24121dca 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -214,7 +214,7 @@ def _test_case_e_export_selection(self): ) # test for SIA405_ABWASSER_2015_LV95 export with selection and labels - def test_case_f_export_selection_sia405(self): + def _test_case_f_export_selection_sia405(self): """ # F. export a selection """ From 5e326a16eabb043d79971786a0777801ac6ebb55 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 22:02:33 +0100 Subject: [PATCH 13/35] Apply suggestions from code review --- qgepqwat2ili/qgep/export.py | 1 - qgepqwat2ili/qgepdss/export.py | 1 - qgepqwat2ili/qgepsia405/export.py | 1 - qgepqwat2ili/tests/test_qgep.py | 6 ++++-- qgepqwat2ili/utils/qgep_export_utils.py | 8 -------- 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index 4aa602d5..07087053 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -21,7 +21,6 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - print("qgep_export_kek") qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index cbf8857a..6bcfe72e 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -21,7 +21,6 @@ def qgep_export_dss(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - print("qgep_export_dss") qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index ebb33fb5..e1e93382 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -20,7 +20,6 @@ def qgep_export_sia405(selection=None, labels_file=None, orientation=None, baske Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - print("qgep_export_sia405") qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 24121dca..2b87ff20 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -147,7 +147,8 @@ def test_case_d_import_complete_xtf_to_qgep(self): session.close() # test for VSA_KEK_2019_LV95 export with selection and labels - def _test_case_e_export_selection(self): + @pytest.mark.skip(reason="Selection export broken with baskets") + def test_case_e_export_selection(self): """ # E. export a selection """ @@ -214,7 +215,8 @@ def _test_case_e_export_selection(self): ) # test for SIA405_ABWASSER_2015_LV95 export with selection and labels - def _test_case_f_export_selection_sia405(self): + @pytest.mark.skip(reason="Selection export broken with baskets") + def test_case_f_export_selection_sia405(self): """ # F. export a selection """ diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 8e519217..8b4f919e 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -281,14 +281,6 @@ def export_organisation(self): bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80), bezeichnung=self.null_to_emptystr(row.identifier), ) - - print(f"Org t_ili_tid: {organisation.t_ili_tid}") - print(f"Current basket: {self.current_basket}") - - if self.current_basket is not None: - print(f"Current basket id: {self.current_basket.t_id}") - # organisation.t_basket = self.current_basket.t_id - self.abwasser_session.add(organisation) self.create_metaattributes(row) print(".", end="") From 0bebb06581c4fea95e8f487a2faffa1265a18740 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 22:10:15 +0100 Subject: [PATCH 14/35] fix skip syntax --- qgepqwat2ili/tests/test_qgep.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 2b87ff20..252351b4 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -147,7 +147,7 @@ def test_case_d_import_complete_xtf_to_qgep(self): session.close() # test for VSA_KEK_2019_LV95 export with selection and labels - @pytest.mark.skip(reason="Selection export broken with baskets") + @unittest.skip("Selection export broken with baskets") def test_case_e_export_selection(self): """ # E. export a selection @@ -215,7 +215,7 @@ def test_case_e_export_selection(self): ) # test for SIA405_ABWASSER_2015_LV95 export with selection and labels - @pytest.mark.skip(reason="Selection export broken with baskets") + @unittest.skip("Selection export broken with baskets") def test_case_f_export_selection_sia405(self): """ # F. export a selection From a2307ceca77000c4a2c3c2b6bc7b9a44ec13033d Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 22:20:47 +0100 Subject: [PATCH 15/35] sia405 selection export should wirk because baskets are not used --- qgepqwat2ili/tests/test_qgep.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 252351b4..70285971 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -215,7 +215,6 @@ def test_case_e_export_selection(self): ) # test for SIA405_ABWASSER_2015_LV95 export with selection and labels - @unittest.skip("Selection export broken with baskets") def test_case_f_export_selection_sia405(self): """ # F. export a selection From 1e4d34ee43730c695a8f7beea211cc27bf88e420 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 22:42:09 +0100 Subject: [PATCH 16/35] Rename export xtf according to exported model --- qgepqwat2ili/tests/test_qgep.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 70285971..f4901a2c 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -220,7 +220,7 @@ def test_case_f_export_selection_sia405(self): # F. export a selection """ - path = os.path.join(tempfile.mkdtemp(), "export_VSA_KEK_2019_LV95.xtf") + path = os.path.join(tempfile.mkdtemp(), "export_selection_SIA405.xtf") selection = [ # reach_id "ch13p7mzRE001221", From 900333ff5a348554651a0058d31abb30e5235a2a Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 22:53:37 +0100 Subject: [PATCH 17/35] raise exception for debug --- qgepqwat2ili/utils/qgep_export_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 8b4f919e..445bebb6 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -168,6 +168,9 @@ def base_common(self, row, type_name): if self.current_basket is not None: base["t_basket"] = self.current_basket.t_id + if base.t_ili_tid == "00000000OG000000": + raise Exception("This should not happen") + return base def wastewater_structure_common(self, row): From 6277fdecab4e197f3b4e6be8338994f7d3b1e5f6 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 23:07:19 +0100 Subject: [PATCH 18/35] here its still a dict --- qgepqwat2ili/utils/qgep_export_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 445bebb6..f7fb3a26 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -168,7 +168,7 @@ def base_common(self, row, type_name): if self.current_basket is not None: base["t_basket"] = self.current_basket.t_id - if base.t_ili_tid == "00000000OG000000": + if base["t_ili_tid"] == "00000000OG000000": raise Exception("This should not happen") return base From 5561f96601f941fc8d045d361a3c0bc858136610 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 10 Dec 2024 23:33:13 +0100 Subject: [PATCH 19/35] Change back --- qgepqwat2ili/gui/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qgepqwat2ili/gui/__init__.py b/qgepqwat2ili/gui/__init__.py index cf324ed4..43962351 100644 --- a/qgepqwat2ili/gui/__init__.py +++ b/qgepqwat2ili/gui/__init__.py @@ -178,7 +178,7 @@ def action_import(plugin): config.ABWASSER_ILI_MODEL, log_path, recreate_schema=True, - create_basket_col=True, + create_basket_col=False, ) elif imodel == "SIA405_ABWASSER_2015_LV95": create_ili_schema( From 3fe7d37c5eec1749d6e1131011e71139fb737414 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 11:11:03 +0100 Subject: [PATCH 20/35] Basket should not be enabled for dss import --- qgepqwat2ili/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index 9feb0df3..d555ec4d 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -288,7 +288,7 @@ def main(args): ILI_MODEL, make_log_path(log_path, "ilicreate"), recreate_schema=args.recreate_schema, - create_basket_col=True, + create_basket_col=False, ) utils.ili2db.import_xtf_data( SCHEMA, args.path, make_log_path(log_path, "iliimport") @@ -324,7 +324,7 @@ def main(args): ABWASSER_DSS_ILI_MODEL, make_log_path(log_path, "ilicreate"), recreate_schema=args.recreate_schema, - create_basket_col=True, + create_basket_col=False, ) utils.ili2db.import_xtf_data( ABWASSER_DSS_SCHEMA, args.path, make_log_path(log_path, "iliimport") From 9fa9ca5c236ebaaf2292d728596feb11c3d81de6 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 11:31:15 +0100 Subject: [PATCH 21/35] comment debug exception --- qgepqwat2ili/utils/qgep_export_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index f7fb3a26..55a2ef2f 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -168,8 +168,8 @@ def base_common(self, row, type_name): if self.current_basket is not None: base["t_basket"] = self.current_basket.t_id - if base["t_ili_tid"] == "00000000OG000000": - raise Exception("This should not happen") + # if base["t_ili_tid"] == "00000000OG000000": + # raise Exception("This should not happen") return base From fb92bf21fc0de4d61edfc75ac127dbd71a0dac60 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 11:43:54 +0100 Subject: [PATCH 22/35] More debug infos --- qgepqwat2ili/qgep/export.py | 3 +++ qgepqwat2ili/qgepdss/export.py | 3 +++ qgepqwat2ili/qgepsia405/export.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index 07087053..76c5749c 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -21,6 +21,9 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ + logger.info( + f"Starting qgep_export_kek: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", + ) qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index 6bcfe72e..f3845602 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -21,6 +21,9 @@ def qgep_export_dss(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ + logger.info( + f"Starting qgep_export_dss: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", + ) qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index e1e93382..1ed025ca 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -20,6 +20,9 @@ def qgep_export_sia405(selection=None, labels_file=None, orientation=None, baske Args: selection: if provided, limits the export to networkelements that are provided in the selection """ + logger.info( + f"Starting qgep_export_sia405: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", + ) qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() From cfef36e3efd599ad94d5936e067bbdbaefe85bc8 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 11:59:32 +0100 Subject: [PATCH 23/35] warning --- qgepqwat2ili/qgep/export.py | 2 +- qgepqwat2ili/qgepdss/export.py | 2 +- qgepqwat2ili/qgepsia405/export.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index 76c5749c..64d1e455 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -21,7 +21,7 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - logger.info( + logger.warning( f"Starting qgep_export_kek: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", ) diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index f3845602..8c583dfd 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -21,7 +21,7 @@ def qgep_export_dss(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - logger.info( + logger.warning( f"Starting qgep_export_dss: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", ) diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index 1ed025ca..cdb8f479 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -20,7 +20,7 @@ def qgep_export_sia405(selection=None, labels_file=None, orientation=None, baske Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - logger.info( + logger.warning( f"Starting qgep_export_sia405: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", ) From dfa2f302527f4caafa8f13aaef6c0abbd6aa055b Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 14:08:49 +0100 Subject: [PATCH 24/35] debug --- qgepqwat2ili/__init__.py | 2 +- qgepqwat2ili/gui/__init__.py | 2 +- qgepqwat2ili/utils/qgep_export_utils.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index d555ec4d..159c2197 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -288,7 +288,7 @@ def main(args): ILI_MODEL, make_log_path(log_path, "ilicreate"), recreate_schema=args.recreate_schema, - create_basket_col=False, + create_basket_col=True, ) utils.ili2db.import_xtf_data( SCHEMA, args.path, make_log_path(log_path, "iliimport") diff --git a/qgepqwat2ili/gui/__init__.py b/qgepqwat2ili/gui/__init__.py index 43962351..cf324ed4 100644 --- a/qgepqwat2ili/gui/__init__.py +++ b/qgepqwat2ili/gui/__init__.py @@ -178,7 +178,7 @@ def action_import(plugin): config.ABWASSER_ILI_MODEL, log_path, recreate_schema=True, - create_basket_col=False, + create_basket_col=True, ) elif imodel == "SIA405_ABWASSER_2015_LV95": create_ili_schema( diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 55a2ef2f..edc941e5 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -148,6 +148,7 @@ def create_metaattributes(self, row): t_seq=0, ) + print(f"Create_metattributes, basket={self.current_basket}, row={row}") if self.current_basket is not None: metaattribute.t_basket = self.current_basket.t_id @@ -165,6 +166,7 @@ def base_common(self, row, type_name): "t_id": self.get_tid(row), } + print(f"base_common, basket={self.current_basket}, type_name={type_name} row={row}") if self.current_basket is not None: base["t_basket"] = self.current_basket.t_id From 4e0d3f94837fa70e09f3b0db97203b9e8a68c5b0 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 14:25:50 +0100 Subject: [PATCH 25/35] Explicitly setup DB for test case f --- qgepqwat2ili/tests/test_qgep.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index f4901a2c..1053db09 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -220,6 +220,9 @@ def test_case_f_export_selection_sia405(self): # F. export a selection """ + # Prepare db + main(["setupdb", "full"]) + path = os.path.join(tempfile.mkdtemp(), "export_selection_SIA405.xtf") selection = [ # reach_id From ce5a116fb7bcd64c1352b71e28da65795987c0d3 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 14:45:25 +0100 Subject: [PATCH 26/35] Re-enable case-e --- qgepqwat2ili/qgep/export.py | 3 --- qgepqwat2ili/qgepdss/export.py | 3 --- qgepqwat2ili/qgepsia405/export.py | 3 --- qgepqwat2ili/tests/test_qgep.py | 1 - 4 files changed, 10 deletions(-) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index 64d1e455..07087053 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -21,9 +21,6 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - logger.warning( - f"Starting qgep_export_kek: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", - ) qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index 8c583dfd..6bcfe72e 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -21,9 +21,6 @@ def qgep_export_dss(selection=None, labels_file=None, orientation=None, basket_e Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - logger.warning( - f"Starting qgep_export_dss: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", - ) qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index cdb8f479..e1e93382 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -20,9 +20,6 @@ def qgep_export_sia405(selection=None, labels_file=None, orientation=None, baske Args: selection: if provided, limits the export to networkelements that are provided in the selection """ - logger.warning( - f"Starting qgep_export_sia405: selection={selection}, labels_file={labels_file}, orientation={orientation}, basket_enabled={basket_enabled}", - ) qgep_model = get_qgep_model() abwasser_model = get_abwasser_model() diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 1053db09..88472a5c 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -147,7 +147,6 @@ def test_case_d_import_complete_xtf_to_qgep(self): session.close() # test for VSA_KEK_2019_LV95 export with selection and labels - @unittest.skip("Selection export broken with baskets") def test_case_e_export_selection(self): """ # E. export a selection From 68924daa0083bca560427d0ddb1f755ef7a3daa6 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 15:00:55 +0100 Subject: [PATCH 27/35] tmate --- .github/workflows/interlis-test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/interlis-test.yaml b/.github/workflows/interlis-test.yaml index 1c77f732..e6216b66 100644 --- a/.github/workflows/interlis-test.yaml +++ b/.github/workflows/interlis-test.yaml @@ -43,3 +43,5 @@ jobs: PGDATABASE: qgep_prod PGUSER: postgres PGPASS: postgres + + - uses: mxschmitt/action-tmate@v3 From 4bbb46bea0b77d24d02ed3e32f1b3455632a05dd Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Fri, 13 Dec 2024 16:35:44 +0100 Subject: [PATCH 28/35] on failure --- .github/workflows/interlis-test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/interlis-test.yaml b/.github/workflows/interlis-test.yaml index e6216b66..a80581a9 100644 --- a/.github/workflows/interlis-test.yaml +++ b/.github/workflows/interlis-test.yaml @@ -44,4 +44,5 @@ jobs: PGUSER: postgres PGPASS: postgres - - uses: mxschmitt/action-tmate@v3 + - if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 From a160f196d40932c99bcc2526b89f2c3a6017e6d4 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Sun, 15 Dec 2024 21:06:14 +0100 Subject: [PATCH 29/35] set --exportModels for KEK --- qgepqwat2ili/__init__.py | 2 +- qgepqwat2ili/gui/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index 159c2197..adfc7c01 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -198,7 +198,7 @@ def main(args): SCHEMA = config.ABWASSER_SCHEMA ILI_MODEL = config.ABWASSER_ILI_MODEL ILI_MODEL_NAME = config.ABWASSER_ILI_MODEL_NAME - ILI_EXPORT_MODEL_NAME = None + ILI_EXPORT_MODEL_NAME = config.ABWASSER_ILI_MODEL if args.direction == "export": basket_enabled = True diff --git a/qgepqwat2ili/gui/__init__.py b/qgepqwat2ili/gui/__init__.py index cf324ed4..79ba58f4 100644 --- a/qgepqwat2ili/gui/__init__.py +++ b/qgepqwat2ili/gui/__init__.py @@ -706,7 +706,7 @@ def action_do_export(): # 12.7.2022 to do dependant on Model Selection if emodel == "VSA_KEK_2019_LV95": for model_name, export_model_name, progress in [ - (config.ABWASSER_ILI_MODEL_NAME, None, 50), + (config.ABWASSER_ILI_MODEL_NAME, config.ABWASSER_ILI_MODEL_NAME, 50), (config.ABWASSER_ILI_MODEL_NAME_SIA405, config.ABWASSER_ILI_MODEL_NAME_SIA405, 70), ]: From b6d2a5f470995c6a4a92e5f036d7af1c0180e64e Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Sun, 15 Dec 2024 21:16:21 +0100 Subject: [PATCH 30/35] Cleanup --- .github/workflows/interlis-test.yaml | 3 --- qgepqwat2ili/utils/qgep_export_utils.py | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/interlis-test.yaml b/.github/workflows/interlis-test.yaml index a80581a9..1c77f732 100644 --- a/.github/workflows/interlis-test.yaml +++ b/.github/workflows/interlis-test.yaml @@ -43,6 +43,3 @@ jobs: PGDATABASE: qgep_prod PGUSER: postgres PGPASS: postgres - - - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index edc941e5..7569626e 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -148,7 +148,6 @@ def create_metaattributes(self, row): t_seq=0, ) - print(f"Create_metattributes, basket={self.current_basket}, row={row}") if self.current_basket is not None: metaattribute.t_basket = self.current_basket.t_id From b9e6f3908e212fb971c52159a8a47ec34cd11c68 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Sun, 15 Dec 2024 21:30:18 +0100 Subject: [PATCH 31/35] Missing NAME --- qgepqwat2ili/__init__.py | 2 +- qgepqwat2ili/utils/qgep_export_utils.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index adfc7c01..7c953257 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -198,7 +198,7 @@ def main(args): SCHEMA = config.ABWASSER_SCHEMA ILI_MODEL = config.ABWASSER_ILI_MODEL ILI_MODEL_NAME = config.ABWASSER_ILI_MODEL_NAME - ILI_EXPORT_MODEL_NAME = config.ABWASSER_ILI_MODEL + ILI_EXPORT_MODEL_NAME = config.ABWASSER_ILI_MODEL_NAME if args.direction == "export": basket_enabled = True diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 7569626e..8b4f919e 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -165,13 +165,9 @@ def base_common(self, row, type_name): "t_id": self.get_tid(row), } - print(f"base_common, basket={self.current_basket}, type_name={type_name} row={row}") if self.current_basket is not None: base["t_basket"] = self.current_basket.t_id - # if base["t_ili_tid"] == "00000000OG000000": - # raise Exception("This should not happen") - return base def wastewater_structure_common(self, row): From 84a3fc0bb96ad848445c9d1a6fbdb4a4fb8cee1e Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Sun, 15 Dec 2024 21:42:13 +0100 Subject: [PATCH 32/35] Output exported file content --- qgepqwat2ili/tests/test_qgep.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qgepqwat2ili/tests/test_qgep.py b/qgepqwat2ili/tests/test_qgep.py index 88472a5c..c7d3f8ab 100644 --- a/qgepqwat2ili/tests/test_qgep.py +++ b/qgepqwat2ili/tests/test_qgep.py @@ -182,6 +182,11 @@ def test_case_e_export_selection(self): # Perform various checks logger.warning("Perform various checks VSA_KEK_2019_LV95 ...") + logger.warning("Exported file content:") + with open(path) as exported_file: + for line in exported_file: + logger.warning(line) + root = ET.parse(path) self.assertEqual( From 867e5666d5b072086d712f9f7537fa5090a9994c Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Mon, 16 Dec 2024 23:55:11 +0100 Subject: [PATCH 33/35] Change current basket --- qgepqwat2ili/qgep/export.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index 07087053..c544157a 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -255,6 +255,10 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e logger.info("Exporting QGEP.benching -> ABWASSER.bankett, ABWASSER.metaattribute") qgep_export_utils.export_benching() + # From here on its about KEK -> change current basket + current_basket = basket_utils.basket_topic_kek + qgep_export_utils.current_basket = current_basket + logger.info("Exporting QGEP.examination -> ABWASSER.untersuchung, ABWASSER.metaattribute") query = qgep_session.query(qgep_model.examination) if filtered: From f633bd0dadbf5b3141c6313b1b37c65037334117 Mon Sep 17 00:00:00 2001 From: Damiano Lombardi Date: Tue, 17 Dec 2024 00:11:11 +0100 Subject: [PATCH 34/35] Change basket back for labels --- qgepqwat2ili/qgep/export.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index c544157a..70e775e5 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -429,6 +429,9 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e schadenlageanfang=row.damage_begin, schadenlageende=row.damage_end, ) + + print(f"Kanalschaden: {kanalschaden.t_basket}") + abwasser_session.add(kanalschaden) qgep_export_utils.create_metaattributes(row) print(".", end="") @@ -518,6 +521,9 @@ def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_e logger.info("done") abwasser_session.flush() + current_basket = basket_utils.basket_topic_sia405_abwasser + qgep_export_utils.current_basket = current_basket + # Labels # Note: these are extracted from the optional labels file (not exported from the QGEP database) if labels_file: From 535e2ecdabbcfb1441a162326ea2fec147f6077f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 13:56:37 +0000 Subject: [PATCH 35/35] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- qgepqwat2ili/utils/ili2db.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/qgepqwat2ili/utils/ili2db.py b/qgepqwat2ili/utils/ili2db.py index 3c704b3d..1be7ba68 100644 --- a/qgepqwat2ili/utils/ili2db.py +++ b/qgepqwat2ili/utils/ili2db.py @@ -22,7 +22,6 @@ def check_organisation_subclass_data(): cursor.execute("SELECT obj_id FROM qgep_od.organisation;") - organisation_subclass_check = True if cursor.rowcount > 0: organisation_count = cursor.rowcount logger.info(f"Number of organisation datasets: {organisation_count}") @@ -64,7 +63,6 @@ def check_wastewater_structure_subclass_data(): cursor = connection.cursor() cursor.execute("SELECT obj_id FROM qgep_od.wastewater_structure;") - wastewater_structure_subclass_check = True if cursor.rowcount > 0: wastewater_structure_count = cursor.rowcount logger.info(f"Number of wastewater_structure datasets: {wastewater_structure_count}") @@ -243,7 +241,6 @@ def check_fk_operator_null(): missing_fk_operator_count = 0 # add MANDATORY classes to be checked - check_fk_operator_null = True for notsubclass in [ # SIA405 Abwasser ("wastewater_structure"), @@ -283,8 +280,6 @@ def check_fk_dataowner_null(): connection.set_session(autocommit=True) cursor = connection.cursor() - check_fk_dataowner_null = True - missing_fk_dataowner_count = 0 # add MANDATORY classes to be checked for notsubclass in [ @@ -372,8 +367,6 @@ def check_fk_provider_null(): connection.set_session(autocommit=True) cursor = connection.cursor() - check_fk_provider_null = True - missing_fk_provider_count = 0 # add MANDATORY classes to be checked for notsubclass in [