hydamo-validation 1.3.0b3__tar.gz → 1.3.0b5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hydamo-validation might be problematic. Click here for more details.
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/PKG-INFO +1 -1
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/__init__.py +4 -2
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/logical_validation.py +11 -7
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/summaries.py +4 -3
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/validator.py +42 -27
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/PKG-INFO +1 -1
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/pyproject.toml +46 -46
- hydamo_validation-1.3.0b5/tests/test_dommelerwaard.py +87 -0
- hydamo_validation-1.3.0b3/tests/test_dommelerwaard.py +0 -31
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/LICENSE +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/README.md +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/datamodel.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/datasets.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/__init__.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/general.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/logic.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/topologic.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/geometry.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/schemas/hydamo/HyDAMO_2.2.json +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/schemas/hydamo/HyDAMO_2.3.json +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/schemas/rules/rules_1.0.json +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/schemas/rules/rules_1.1.json +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/schemas/rules/rules_1.2.json +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/schemas/rules/rules_1.3.json +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/styles/hydroobject.qml +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/styles/hydroobject.sld +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/styles.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/syntax_validation.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/utils.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/SOURCES.txt +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/dependency_links.txt +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/requires.txt +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/top_level.txt +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/zip-safe +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/setup.cfg +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/setup.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_datasets.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_general_functions.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_hydamo_2_2.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_init.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_logic_functions.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_not_overlapping.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_productie.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_structures_at_interersections.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_summaries.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_topologic_functions.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_validationrules.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_wrij.py +0 -0
- {hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_wrij_profielen.py +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
__author__ = ["Het Waterschapshuis", "D2HYDRO", "HKV", "HydroConsult"]
|
|
2
2
|
__copyright__ = "Copyright 2021, HyDAMO ValidatieTool"
|
|
3
3
|
__credits__ = ["D2HYDRO", "HKV", "HydroConsult"]
|
|
4
|
-
__version__ = "1.3.
|
|
4
|
+
__version__ = "1.3.0b5"
|
|
5
5
|
|
|
6
6
|
__license__ = "MIT"
|
|
7
7
|
__maintainer__ = "Daniel Tollenaar"
|
|
8
8
|
__email__ = "daniel@d2hydro.nl"
|
|
9
9
|
|
|
10
|
-
import fiona
|
|
10
|
+
import fiona # top-level import to avoid fiona import issue: https://github.com/conda-forge/fiona-feedstock/issues/213
|
|
11
|
+
from pathlib import Path
|
|
11
12
|
from hydamo_validation.functions import topologic as topologic_functions
|
|
12
13
|
from hydamo_validation.functions import logic as logic_functions
|
|
13
14
|
from hydamo_validation.functions import general as general_functions
|
|
@@ -19,4 +20,5 @@ __all__ = [
|
|
|
19
20
|
"logic_functions",
|
|
20
21
|
"general_functions",
|
|
21
22
|
"validator",
|
|
23
|
+
"SCHEMAS_PATH",
|
|
22
24
|
]
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/logical_validation.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"""Logical validation."""
|
|
2
2
|
|
|
3
|
+
# %%
|
|
3
4
|
from hydamo_validation import general_functions, logic_functions, topologic_functions
|
|
4
5
|
from shapely.geometry import LineString, Point, Polygon
|
|
5
6
|
import numpy as np
|
|
@@ -102,9 +103,9 @@ def gdf_add_summary(
|
|
|
102
103
|
if critical:
|
|
103
104
|
gdf.loc[gdf[variable] == False, "invalid_critical"] += f"{rule_id}{separator}"
|
|
104
105
|
else:
|
|
105
|
-
gdf.loc[
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
gdf.loc[gdf[variable] == False, "invalid_non_critical"] += (
|
|
107
|
+
f"{rule_id}{separator}"
|
|
108
|
+
)
|
|
108
109
|
if tags is not None:
|
|
109
110
|
gdf.loc[tags_indices, ("tags_assigned")] += f"{tags}{separator}"
|
|
110
111
|
gdf.loc[gdf[variable] == False, "tags_invalid"] += f"{tags}{separator}"
|
|
@@ -122,16 +123,19 @@ def execute(
|
|
|
122
123
|
):
|
|
123
124
|
"""Execute the logical validation."""
|
|
124
125
|
|
|
125
|
-
object_rules_sets =
|
|
126
|
+
object_rules_sets = [
|
|
126
127
|
i
|
|
127
128
|
for i in validation_rules_sets["objects"]
|
|
128
129
|
if i["object"] in datamodel.data_layers
|
|
130
|
+
]
|
|
131
|
+
logger.info(
|
|
132
|
+
rf"lagen met valide objecten en regels: {[i["object"] for i in object_rules_sets]}"
|
|
129
133
|
)
|
|
130
134
|
for object_rules in object_rules_sets:
|
|
131
135
|
col_translation: dict = {}
|
|
132
136
|
|
|
133
137
|
object_layer = object_rules["object"]
|
|
134
|
-
logger.info(f"
|
|
138
|
+
logger.info(f"{object_layer}: start")
|
|
135
139
|
object_gdf = getattr(datamodel, object_layer).copy()
|
|
136
140
|
|
|
137
141
|
# add summary columns
|
|
@@ -145,7 +149,7 @@ def execute(
|
|
|
145
149
|
general_rules_sorted = sorted(general_rules, key=lambda k: k["id"])
|
|
146
150
|
for rule in general_rules_sorted:
|
|
147
151
|
logger.info(
|
|
148
|
-
f"{object_layer}:
|
|
152
|
+
f"{object_layer}: uitvoeren general-rule met id {rule['id']}"
|
|
149
153
|
)
|
|
150
154
|
try:
|
|
151
155
|
result_variable = rule["result_variable"]
|
|
@@ -224,7 +228,7 @@ def execute(
|
|
|
224
228
|
try:
|
|
225
229
|
rule_id = rule["id"]
|
|
226
230
|
logger.info(
|
|
227
|
-
f"{object_layer}:
|
|
231
|
+
f"{object_layer}: uitvoeren validatieregel met id {rule_id} ({rule['name']})"
|
|
228
232
|
)
|
|
229
233
|
result_variable = rule["result_variable"]
|
|
230
234
|
if "exceptions" in rule.keys():
|
|
@@ -142,7 +142,7 @@ class LayersSummary:
|
|
|
142
142
|
gdf_out = gdf.copy()
|
|
143
143
|
if gdf_out.crs:
|
|
144
144
|
gdf_out.to_crs("epsg:4326", inplace=True)
|
|
145
|
-
gdf_out.to_file(file_path, driver="GeoJSON")
|
|
145
|
+
gdf_out.to_file(file_path, driver="GeoJSON", engine="pyogrio")
|
|
146
146
|
|
|
147
147
|
# drop geometry for writing to csv
|
|
148
148
|
elif output_type == "csv":
|
|
@@ -150,7 +150,7 @@ class LayersSummary:
|
|
|
150
150
|
output_type, f"{object_layer}.csv"
|
|
151
151
|
)
|
|
152
152
|
df = gdf.drop("geometry", axis=1)
|
|
153
|
-
df.to_csv(file_path)
|
|
153
|
+
df.to_csv(file_path, index=False)
|
|
154
154
|
|
|
155
155
|
# write to geopackage as is
|
|
156
156
|
elif output_type == "geopackage":
|
|
@@ -161,6 +161,7 @@ class LayersSummary:
|
|
|
161
161
|
layer=object_layer,
|
|
162
162
|
driver="GPKG",
|
|
163
163
|
engine="pyogrio",
|
|
164
|
+
layer_options={"OVERWRITE": "YES"},
|
|
164
165
|
)
|
|
165
166
|
layers += [object_layer]
|
|
166
167
|
else:
|
|
@@ -182,7 +183,7 @@ class ResultSummary:
|
|
|
182
183
|
self.error_layers = []
|
|
183
184
|
self.syntax_result = []
|
|
184
185
|
self.validation_result = []
|
|
185
|
-
self.error =
|
|
186
|
+
self.error = []
|
|
186
187
|
self.errors = None
|
|
187
188
|
self.warnings = None
|
|
188
189
|
|
|
@@ -23,7 +23,7 @@ import traceback
|
|
|
23
23
|
|
|
24
24
|
OUTPUT_TYPES = ["geopackage", "geojson", "csv"]
|
|
25
25
|
LOG_LEVELS = Literal["INFO", "DEBUG"]
|
|
26
|
-
INCLUDE_COLUMNS = ["code"]
|
|
26
|
+
INCLUDE_COLUMNS = ["nen3610id", "code"]
|
|
27
27
|
SCHEMAS_PATH = Path(__file__).parent.joinpath(r"./schemas")
|
|
28
28
|
HYDAMO_SCHEMAS_PATH = SCHEMAS_PATH.joinpath("hydamo")
|
|
29
29
|
RULES_SCHEMAS_PATH = SCHEMAS_PATH.joinpath("rules")
|
|
@@ -54,6 +54,13 @@ def _add_log_file(logger, log_file):
|
|
|
54
54
|
return logger
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
def _close_log_file(logger):
|
|
58
|
+
"""Remove log-file from existing logger"""
|
|
59
|
+
for h in logger.handlers:
|
|
60
|
+
h.close()
|
|
61
|
+
logger.removeHandler(h)
|
|
62
|
+
|
|
63
|
+
|
|
57
64
|
def _log_to_results(log_file, result_summary):
|
|
58
65
|
result_summary.log = log_file.read_text().split("\n")
|
|
59
66
|
|
|
@@ -180,28 +187,31 @@ def _validator(
|
|
|
180
187
|
log_level=log_level,
|
|
181
188
|
)
|
|
182
189
|
|
|
183
|
-
logger.info("
|
|
190
|
+
logger.info("init validatie")
|
|
184
191
|
date_check = pd.Timestamp.now().isoformat()
|
|
185
192
|
result_summary = ResultSummary(date_check=date_check)
|
|
186
193
|
layers_summary = LayersSummary(date_check=date_check)
|
|
187
194
|
# check if all files are present
|
|
188
195
|
# create a results_path
|
|
196
|
+
permission_error = False
|
|
189
197
|
if dir_path.exists():
|
|
190
198
|
results_path = dir_path.joinpath("results")
|
|
191
199
|
if results_path.exists():
|
|
192
200
|
try:
|
|
193
201
|
shutil.rmtree(results_path)
|
|
194
202
|
except PermissionError:
|
|
195
|
-
|
|
196
|
-
f"Cannot remove {results_path}. This may lead to write-issues later!"
|
|
197
|
-
)
|
|
198
|
-
pass
|
|
203
|
+
permission_error = True
|
|
199
204
|
results_path.mkdir(parents=True, exist_ok=True)
|
|
200
205
|
else:
|
|
201
206
|
raise FileNotFoundError(f"{dir_path.absolute().resolve()} does not exist")
|
|
202
207
|
|
|
203
208
|
log_file = results_path.joinpath("validator.log")
|
|
204
209
|
logger = _add_log_file(logger, log_file=log_file)
|
|
210
|
+
logger.info("start validatie")
|
|
211
|
+
if permission_error:
|
|
212
|
+
logger.warning(
|
|
213
|
+
f"Kan pad {results_path} niet verwijderen. Dit kan later tot problemen leiden!"
|
|
214
|
+
)
|
|
205
215
|
dataset_path = dir_path.joinpath("datasets")
|
|
206
216
|
validation_rules_json = dir_path.joinpath("validationrules.json")
|
|
207
217
|
missing_paths = []
|
|
@@ -209,11 +219,11 @@ def _validator(
|
|
|
209
219
|
if not path.exists():
|
|
210
220
|
missing_paths += [str(path)]
|
|
211
221
|
if missing_paths:
|
|
212
|
-
result_summary.error
|
|
222
|
+
result_summary.error += [f'missing_paths: {",".join(missing_paths)}']
|
|
213
223
|
raise FileNotFoundError(f'missing_paths: {",".join(missing_paths)}')
|
|
214
224
|
else:
|
|
215
225
|
validation_rules_sets = read_validation_rules(
|
|
216
|
-
validation_rules_json,
|
|
226
|
+
validation_rules_json, result_summary
|
|
217
227
|
)
|
|
218
228
|
|
|
219
229
|
# check if output-files are supported
|
|
@@ -224,7 +234,7 @@ def _validator(
|
|
|
224
234
|
error_message = (
|
|
225
235
|
r"unsupported output types: " f'{",".join(unsupported_output_types)}'
|
|
226
236
|
)
|
|
227
|
-
result_summary.error
|
|
237
|
+
result_summary.error += [error_message]
|
|
228
238
|
raise TypeError(error_message)
|
|
229
239
|
|
|
230
240
|
# set coverages
|
|
@@ -249,7 +259,7 @@ def _validator(
|
|
|
249
259
|
result_summary.dataset_layers = datasets.layers
|
|
250
260
|
|
|
251
261
|
## validate syntax of datasets on layers-level and append to result
|
|
252
|
-
logger.info("start syntax-
|
|
262
|
+
logger.info("start syntax-validatie van object-lagen")
|
|
253
263
|
valid_layers = datamodel_layers(datamodel.layers, datasets.layers)
|
|
254
264
|
result_summary.missing_layers = missing_layers(
|
|
255
265
|
datamodel.layers, datasets.layers
|
|
@@ -265,17 +275,15 @@ def _validator(
|
|
|
265
275
|
status_object = validation_rules_sets["status_object"]
|
|
266
276
|
|
|
267
277
|
for layer in valid_layers:
|
|
268
|
-
logger.info(f"
|
|
278
|
+
logger.info(f"{layer}: inlezen")
|
|
269
279
|
|
|
270
280
|
# read layer
|
|
271
281
|
gdf, schema = datasets.read_layer(
|
|
272
282
|
layer, result_summary=result_summary, status_object=status_object
|
|
273
283
|
)
|
|
274
|
-
if
|
|
275
|
-
gdf.empty
|
|
276
|
-
): # pass if gdf is empty. Most likely due to mall-formed or ill-specifiec status_object
|
|
284
|
+
if gdf.empty: # pass if gdf is empty. Most likely due to mall-formed or ill-specifiec status_object
|
|
277
285
|
logger.warning(
|
|
278
|
-
f"
|
|
286
|
+
f"{layer}: geen objecten ingelezen. Zorg dat alle waarden in de kolom 'status_object' voorkomen in {status_object}"
|
|
279
287
|
)
|
|
280
288
|
continue
|
|
281
289
|
|
|
@@ -285,23 +293,28 @@ def _validator(
|
|
|
285
293
|
gdf[col] = None
|
|
286
294
|
schema["properties"][col] = "str"
|
|
287
295
|
|
|
288
|
-
logger.info(f"
|
|
296
|
+
logger.info(f"{layer}: syntax-validatie")
|
|
289
297
|
gdf, result_gdf = fields_syntax(
|
|
290
298
|
gdf,
|
|
291
|
-
schema,
|
|
292
|
-
datamodel.validation_schemas[layer],
|
|
299
|
+
schema=schema,
|
|
300
|
+
validation_schema=datamodel.validation_schemas[layer],
|
|
293
301
|
keep_columns=INCLUDE_COLUMNS,
|
|
294
302
|
)
|
|
295
303
|
|
|
296
304
|
# Add the syntax-validation result to the results_summary
|
|
297
305
|
layers_summary.set_data(result_gdf, layer, schema["geometry"])
|
|
298
306
|
# Add the corrected datasets_layer data to the datamodel.
|
|
299
|
-
|
|
307
|
+
if gdf.empty:
|
|
308
|
+
logger.warning(
|
|
309
|
+
f"{layer}: geen valide objecten na syntax-validatie. Inspecteer 'syntax_oordeel' in de resultaten; deze is false voor alle objecten. De laag zal genegeerd worden in de (topo)logische validatie."
|
|
310
|
+
)
|
|
311
|
+
else:
|
|
312
|
+
datamodel.set_data(gdf, layer, index_col=None)
|
|
300
313
|
syntax_result += [layer]
|
|
301
314
|
|
|
302
315
|
# do logical validation: append result to layers_summary
|
|
303
316
|
result_summary.status = "logical validation"
|
|
304
|
-
logger.info("start (topo)
|
|
317
|
+
logger.info("start (topo)logische validatie van object-lagen")
|
|
305
318
|
layers_summary, result_summary = logical_validation.execute(
|
|
306
319
|
datamodel,
|
|
307
320
|
validation_rules_sets,
|
|
@@ -312,7 +325,7 @@ def _validator(
|
|
|
312
325
|
)
|
|
313
326
|
|
|
314
327
|
# finish validation and export results
|
|
315
|
-
logger.info("
|
|
328
|
+
logger.info("exporteren resultaten")
|
|
316
329
|
result_summary.status = "export results"
|
|
317
330
|
result_layers = layers_summary.export(results_path, output_types)
|
|
318
331
|
result_summary.result_layers = result_layers
|
|
@@ -328,21 +341,21 @@ def _validator(
|
|
|
328
341
|
result_summary.success = True
|
|
329
342
|
result_summary.status = "finished"
|
|
330
343
|
result_summary.duration = timer.report()
|
|
331
|
-
logger.info(f"
|
|
344
|
+
logger.info(f"klaar in {result_summary.duration:.2f} seconden")
|
|
332
345
|
|
|
333
346
|
_log_to_results(log_file, result_summary)
|
|
334
347
|
result_summary.to_json(results_path)
|
|
335
348
|
|
|
349
|
+
_close_log_file(logger)
|
|
350
|
+
|
|
336
351
|
return datamodel, layers_summary, result_summary
|
|
337
352
|
|
|
338
353
|
except Exception as e:
|
|
339
|
-
|
|
340
|
-
e_str = " ".join(e_str.split())
|
|
341
|
-
stacktrace = rf"{traceback.format_exc(limit=2)}".split("\n")
|
|
354
|
+
stacktrace = rf"\n{traceback.format_exc(limit=0, chain=False)}".split("\n")
|
|
342
355
|
if result_summary.error is not None:
|
|
343
|
-
result_summary.error +=
|
|
356
|
+
result_summary.error += stacktrace
|
|
344
357
|
else:
|
|
345
|
-
result_summary.error =
|
|
358
|
+
result_summary.error = stacktrace
|
|
346
359
|
if results_path is not None:
|
|
347
360
|
result_layers = layers_summary.export(results_path, output_types)
|
|
348
361
|
_log_to_results(log_file, result_summary)
|
|
@@ -352,4 +365,6 @@ def _validator(
|
|
|
352
365
|
else:
|
|
353
366
|
result_summary.to_dict()
|
|
354
367
|
|
|
368
|
+
_close_log_file(logger)
|
|
369
|
+
|
|
355
370
|
return None
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "hydamo_validation"
|
|
7
|
-
description = "Validation module for HyDAMO data"
|
|
8
|
-
readme = "README.md"
|
|
9
|
-
authors = [
|
|
10
|
-
{ name = "Daniel Tollenaar", email = "daniel@d2hydro.nl" },
|
|
11
|
-
]
|
|
12
|
-
license = { text = "MIT" }
|
|
13
|
-
|
|
14
|
-
requires-python = ">=3.12"
|
|
15
|
-
dependencies = [
|
|
16
|
-
"geopandas",
|
|
17
|
-
"pandas>=2",
|
|
18
|
-
"pyogrio",
|
|
19
|
-
"rasterio",
|
|
20
|
-
"shapely>=2",
|
|
21
|
-
"rasterstats",
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
dynamic = ["version"]
|
|
25
|
-
|
|
26
|
-
[project.optional-dependencies]
|
|
27
|
-
tests = ["pytest"]
|
|
28
|
-
|
|
29
|
-
[tool.flake8]
|
|
30
|
-
max-line-length = 120
|
|
31
|
-
max-complexity = 10
|
|
32
|
-
|
|
33
|
-
[tool.setuptools]
|
|
34
|
-
zip-safe = true
|
|
35
|
-
|
|
36
|
-
[tool.setuptools.dynamic]
|
|
37
|
-
version = { attr = "hydamo_validation.__version__" }
|
|
38
|
-
|
|
39
|
-
[tool.setuptools.packages.find]
|
|
40
|
-
include = ["hydamo_validation", "hydamo_validation.*"]
|
|
41
|
-
|
|
42
|
-
[tool.setuptools.package-data]
|
|
43
|
-
hydamo_validation = ["schemas/hydamo/*.json","schemas/rules/*.json", "styles/*.*"]
|
|
44
|
-
|
|
45
|
-
[project.urls]
|
|
46
|
-
Source = "https://github.com/HetWaterschapshuis/HyDAMOValidatieModule"
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hydamo_validation"
|
|
7
|
+
description = "Validation module for HyDAMO data"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Daniel Tollenaar", email = "daniel@d2hydro.nl" },
|
|
11
|
+
]
|
|
12
|
+
license = { text = "MIT" }
|
|
13
|
+
|
|
14
|
+
requires-python = ">=3.12"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"geopandas",
|
|
17
|
+
"pandas>=2",
|
|
18
|
+
"pyogrio",
|
|
19
|
+
"rasterio",
|
|
20
|
+
"shapely>=2",
|
|
21
|
+
"rasterstats",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
dynamic = ["version"]
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
tests = ["pytest"]
|
|
28
|
+
|
|
29
|
+
[tool.flake8]
|
|
30
|
+
max-line-length = 120
|
|
31
|
+
max-complexity = 10
|
|
32
|
+
|
|
33
|
+
[tool.setuptools]
|
|
34
|
+
zip-safe = true
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.dynamic]
|
|
37
|
+
version = { attr = "hydamo_validation.__version__" }
|
|
38
|
+
|
|
39
|
+
[tool.setuptools.packages.find]
|
|
40
|
+
include = ["hydamo_validation", "hydamo_validation.*"]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.package-data]
|
|
43
|
+
hydamo_validation = ["schemas/hydamo/*.json","schemas/rules/*.json", "styles/*.*"]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Source = "https://github.com/HetWaterschapshuis/HyDAMOValidatieModule"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# %%
|
|
2
|
+
from hydamo_validation import validator
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
DATA_DIR = Path(r"d:\repositories\HyDAMOValidatieModule\tests\data")
|
|
7
|
+
coverage = {"AHN": DATA_DIR.joinpath(r"dtm")}
|
|
8
|
+
directory = DATA_DIR.joinpath(r"tasks/test_dommelerwaard")
|
|
9
|
+
exports_dir = Path(__file__).parent / "exports"
|
|
10
|
+
exports_dir.mkdir(exist_ok=True)
|
|
11
|
+
|
|
12
|
+
hydamo_validator = validator(
|
|
13
|
+
output_types=["geopackage", "csv", "geojson"], coverages=coverage, log_level="INFO"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
datamodel, layer_summary, result_summary = hydamo_validator(
|
|
18
|
+
directory=directory, raise_error=False
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_hydroobjects():
|
|
23
|
+
EXPECTED_INDEX = pd.Index(
|
|
24
|
+
[
|
|
25
|
+
"nen3610id",
|
|
26
|
+
"code",
|
|
27
|
+
"geometry",
|
|
28
|
+
"syntax_breedte",
|
|
29
|
+
"syntax_categorieoppwaterlichaam",
|
|
30
|
+
"syntax_code",
|
|
31
|
+
"syntax_created_date",
|
|
32
|
+
"syntax_detailniveaugeometrie",
|
|
33
|
+
"syntax_draineert",
|
|
34
|
+
"syntax_featuretype",
|
|
35
|
+
"syntax_getijdebeinvloed",
|
|
36
|
+
"syntax_globalid",
|
|
37
|
+
"syntax_hydroobjectgroeperingid",
|
|
38
|
+
"syntax_hyperlink",
|
|
39
|
+
"syntax_krwstromendid",
|
|
40
|
+
"syntax_last_edited_date",
|
|
41
|
+
"syntax_lengte",
|
|
42
|
+
"syntax_lvpublicatiedatum",
|
|
43
|
+
"syntax_metadataid",
|
|
44
|
+
"syntax_naam",
|
|
45
|
+
"syntax_namespace",
|
|
46
|
+
"syntax_nen3610id",
|
|
47
|
+
"syntax_niveau",
|
|
48
|
+
"syntax_objectid",
|
|
49
|
+
"syntax_ontstaanswijze",
|
|
50
|
+
"syntax_opmerking",
|
|
51
|
+
"syntax_oppervlaktewaterlichaamid",
|
|
52
|
+
"syntax_oppwatervolgnummer",
|
|
53
|
+
"syntax_persistentie",
|
|
54
|
+
"syntax_ruimtelijkeafbakeningbekend",
|
|
55
|
+
"syntax_ruwheidhoog",
|
|
56
|
+
"syntax_ruwheidlaag",
|
|
57
|
+
"syntax_soortoppwaterkwaliteit",
|
|
58
|
+
"syntax_soortoppwaterkwantiteit",
|
|
59
|
+
"syntax_statusleggerwatersysteem",
|
|
60
|
+
"syntax_statusobject",
|
|
61
|
+
"syntax_typeruwheid",
|
|
62
|
+
"syntax_vaarwegid",
|
|
63
|
+
"syntax_geometry",
|
|
64
|
+
"syntax_oordeel",
|
|
65
|
+
"validate_000_lengte_gt_1m",
|
|
66
|
+
"validate_001_goed_gesplitst",
|
|
67
|
+
"validate_002_goede_kruising",
|
|
68
|
+
"validate_003_geen_eindpunt",
|
|
69
|
+
"validate_006_kunstwerk_op_peilscheiding",
|
|
70
|
+
"validate_005_kunstwerk_tussen_hobject",
|
|
71
|
+
"rating",
|
|
72
|
+
"valid",
|
|
73
|
+
"invalid",
|
|
74
|
+
"invalid_critical",
|
|
75
|
+
"invalid_non_critical",
|
|
76
|
+
"ignored",
|
|
77
|
+
"summary",
|
|
78
|
+
"tags_assigned",
|
|
79
|
+
"tags_invalid",
|
|
80
|
+
"date_check",
|
|
81
|
+
]
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
assert layer_summary.hydroobject.columns.equals(EXPECTED_INDEX)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# %%
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# %%
|
|
2
|
-
from hydamo_validation import validator
|
|
3
|
-
from hydamo_validation import __version__
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from datetime import datetime
|
|
6
|
-
|
|
7
|
-
# try:
|
|
8
|
-
# from .config import DATA_DIR
|
|
9
|
-
# except ImportError:
|
|
10
|
-
# from config import DATA_DIR
|
|
11
|
-
|
|
12
|
-
DATA_DIR = Path(r"d:\repositories\HyDAMOValidatieModule\tests\data")
|
|
13
|
-
coverage = {"AHN": DATA_DIR.joinpath(r"dtm")}
|
|
14
|
-
directory = DATA_DIR.joinpath(r"tasks/test_dommelerwaard")
|
|
15
|
-
exports_dir = Path(__file__).parent / "exports"
|
|
16
|
-
exports_dir.mkdir(exist_ok=True)
|
|
17
|
-
|
|
18
|
-
# hydamo_validator = validator(output_types=["geopackage", "csv", "geojson"],
|
|
19
|
-
# coverages=coverage,
|
|
20
|
-
# log_level="INFO"
|
|
21
|
-
# )
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# datamodel, layer_summary, result_summary = hydamo_validator(
|
|
25
|
-
# directory=directory,
|
|
26
|
-
# raise_error=True
|
|
27
|
-
# )
|
|
28
|
-
|
|
29
|
-
# datamodel.to_geopackage(exports_dir / "datamodel.gpkg",
|
|
30
|
-
# use_schema=False)
|
|
31
|
-
# %%
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/__init__.py
RENAMED
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/general.py
RENAMED
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/logic.py
RENAMED
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/functions/topologic.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/styles/hydroobject.qml
RENAMED
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/styles/hydroobject.sld
RENAMED
|
File without changes
|
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation/syntax_validation.py
RENAMED
|
File without changes
|
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/requires.txt
RENAMED
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/hydamo_validation.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hydamo_validation-1.3.0b3 → hydamo_validation-1.3.0b5}/tests/test_structures_at_interersections.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|