Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable basket export for kek #183

Merged
merged 36 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
bc7c06b
Enable basket export for KEK
domi4484 Nov 20, 2024
53b36e5
Fix metaattribute
domi4484 Nov 20, 2024
ea1a26f
Org with or whitout basket
domi4484 Nov 20, 2024
c459616
Fix topic name
domi4484 Nov 21, 2024
ab7af95
Print current basket id
domi4484 Dec 9, 2024
7a2be0b
Enable basket for kek import
domi4484 Dec 10, 2024
0fccdd9
more debug info
domi4484 Dec 10, 2024
1813350
Try disable selection test
domi4484 Dec 10, 2024
0144e74
debug
domi4484 Dec 10, 2024
d6df629
debug
domi4484 Dec 10, 2024
4326a98
reset handling of org basket in base_common
domi4484 Dec 10, 2024
1048e96
Skip another selection test for now
domi4484 Dec 10, 2024
5e326a1
Apply suggestions from code review
domi4484 Dec 10, 2024
0bebb06
fix skip syntax
domi4484 Dec 10, 2024
a2307ce
sia405 selection export should wirk because baskets are not used
domi4484 Dec 10, 2024
1e4d34e
Rename export xtf according to exported model
domi4484 Dec 10, 2024
900333f
raise exception for debug
domi4484 Dec 10, 2024
6277fde
here its still a dict
domi4484 Dec 10, 2024
5561f96
Change back
domi4484 Dec 10, 2024
3fe7d37
Basket should not be enabled for dss import
domi4484 Dec 13, 2024
9fa9ca5
comment debug exception
domi4484 Dec 13, 2024
fb92bf2
More debug infos
domi4484 Dec 13, 2024
cfef36e
warning
domi4484 Dec 13, 2024
dfa2f30
debug
domi4484 Dec 13, 2024
4e0d3f9
Explicitly setup DB for test case f
domi4484 Dec 13, 2024
ce5a116
Re-enable case-e
domi4484 Dec 13, 2024
68924da
tmate
domi4484 Dec 13, 2024
4bbb46b
on failure
domi4484 Dec 13, 2024
a160f19
set --exportModels for KEK
domi4484 Dec 15, 2024
b6d2a5f
Cleanup
domi4484 Dec 15, 2024
b9e6f39
Missing NAME
domi4484 Dec 15, 2024
84a3fc0
Output exported file content
domi4484 Dec 15, 2024
867e566
Change current basket
domi4484 Dec 16, 2024
f633bd0
Change basket back for labels
domi4484 Dec 16, 2024
190496f
Merge branch 'master' into enableBasktetExportForKEK
ponceta Dec 17, 2024
535e2ec
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions qgepqwat2ili/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,34 +201,41 @@ 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
qgep_export_dss(
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
qgep_export_kek(
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(
Expand Down
2 changes: 1 addition & 1 deletion qgepqwat2ili/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 4 additions & 1 deletion qgepqwat2ili/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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":
Expand All @@ -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")
Expand All @@ -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()
Expand Down
9 changes: 7 additions & 2 deletions qgepqwat2ili/utils/qgep_export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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":
Copy link
Contributor

@sjib sjib Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domi4484 Here you are not writing the current_basket if you have class organisation - is this the problem? The tests fail on organisation data.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base["t_basket"] = self.current_basket.t_id

return base
Expand Down Expand Up @@ -281,6 +281,11 @@ def export_organisation(self):
bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80),
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

self.abwasser_session.add(organisation)
self.create_metaattributes(row)
print(".", end="")
Expand Down
Loading