python-osw-validation 0.4.1__py3-none-any.whl → 0.4.3__py3-none-any.whl
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.
- python_osw_validation/__init__.py +12 -6
- python_osw_validation/schema/opensidewalks.edges.schema-0.3.json +0 -18
- python_osw_validation/schema/opensidewalks.lines.schema-0.3.json +0 -4
- python_osw_validation/version.py +1 -1
- {python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/METADATA +7 -7
- {python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/RECORD +9 -9
- {python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/WHEEL +0 -0
- {python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/licenses/LICENSE +0 -0
- {python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/top_level.txt +0 -0
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
import gc
|
|
3
3
|
import json
|
|
4
4
|
import math
|
|
5
|
+
import numbers
|
|
5
6
|
from typing import Dict, Any, Optional, List, Tuple
|
|
6
7
|
import geopandas as gpd
|
|
7
8
|
import jsonschema_rs
|
|
@@ -283,9 +284,7 @@ class OSWValidation:
|
|
|
283
284
|
def _is_nullish_value(self, value: Any) -> bool:
|
|
284
285
|
if value is None:
|
|
285
286
|
return True
|
|
286
|
-
|
|
287
|
-
return True
|
|
288
|
-
return isinstance(value, float) and math.isnan(value)
|
|
287
|
+
return isinstance(value, numbers.Real) and math.isnan(value)
|
|
289
288
|
|
|
290
289
|
def _collect_nullish_property_paths(self, obj: Any, prefix: str = "") -> List[Tuple[str, Any]]:
|
|
291
290
|
paths: List[Tuple[str, Any]] = []
|
|
@@ -303,6 +302,13 @@ class OSWValidation:
|
|
|
303
302
|
paths.append((prefix or "value", obj))
|
|
304
303
|
return paths
|
|
305
304
|
|
|
305
|
+
def _collect_nullish_extension_property_paths(self, props: Dict[str, Any]) -> List[Tuple[str, Any]]:
|
|
306
|
+
paths: List[Tuple[str, Any]] = []
|
|
307
|
+
for key, value in props.items():
|
|
308
|
+
if isinstance(key, str) and key.startswith("ext:"):
|
|
309
|
+
paths.extend(self._collect_nullish_property_paths(value, key))
|
|
310
|
+
return paths
|
|
311
|
+
|
|
306
312
|
def _contains_disallowed_features_for_02(self, geojson_data: Dict[str, Any]) -> set:
|
|
307
313
|
"""Detect Tree coverage or Custom content in legacy 0.2 datasets.
|
|
308
314
|
|
|
@@ -676,8 +682,8 @@ class OSWValidation:
|
|
|
676
682
|
|
|
677
683
|
filename = os.path.basename(file_path)
|
|
678
684
|
|
|
679
|
-
# Upfront guard: reject null/NaN values in
|
|
680
|
-
#
|
|
685
|
+
# Upfront guard: reject null/NaN values in free-form extension properties.
|
|
686
|
+
# Schema-owned properties are left to schema validation.
|
|
681
687
|
features = geojson_data.get("features", []) if isinstance(geojson_data, dict) else []
|
|
682
688
|
found_nullish = False
|
|
683
689
|
for idx, feature in enumerate(features):
|
|
@@ -686,7 +692,7 @@ class OSWValidation:
|
|
|
686
692
|
props = feature.get("properties")
|
|
687
693
|
if not isinstance(props, dict):
|
|
688
694
|
continue
|
|
689
|
-
bad_paths = self.
|
|
695
|
+
bad_paths = self._collect_nullish_extension_property_paths(props)
|
|
690
696
|
for path, bad_value in bad_paths:
|
|
691
697
|
if len(self.errors) >= max_errors:
|
|
692
698
|
return False
|
|
@@ -217,7 +217,6 @@
|
|
|
217
217
|
},
|
|
218
218
|
"length": {
|
|
219
219
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
220
|
-
"maximum": 5000,
|
|
221
220
|
"minimum": 0,
|
|
222
221
|
"type": "number"
|
|
223
222
|
},
|
|
@@ -399,7 +398,6 @@
|
|
|
399
398
|
},
|
|
400
399
|
"length": {
|
|
401
400
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
402
|
-
"maximum": 5000,
|
|
403
401
|
"minimum": 0,
|
|
404
402
|
"type": "number"
|
|
405
403
|
},
|
|
@@ -525,7 +523,6 @@
|
|
|
525
523
|
},
|
|
526
524
|
"length": {
|
|
527
525
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
528
|
-
"maximum": 5000,
|
|
529
526
|
"minimum": 0,
|
|
530
527
|
"type": "number"
|
|
531
528
|
},
|
|
@@ -614,7 +611,6 @@
|
|
|
614
611
|
},
|
|
615
612
|
"length": {
|
|
616
613
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
617
|
-
"maximum": 5000,
|
|
618
614
|
"minimum": 0,
|
|
619
615
|
"type": "number"
|
|
620
616
|
},
|
|
@@ -709,7 +705,6 @@
|
|
|
709
705
|
},
|
|
710
706
|
"length": {
|
|
711
707
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
712
|
-
"maximum": 5000,
|
|
713
708
|
"minimum": 0,
|
|
714
709
|
"type": "number"
|
|
715
710
|
},
|
|
@@ -797,7 +792,6 @@
|
|
|
797
792
|
},
|
|
798
793
|
"length": {
|
|
799
794
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
800
|
-
"maximum": 5000,
|
|
801
795
|
"minimum": 0,
|
|
802
796
|
"type": "number"
|
|
803
797
|
},
|
|
@@ -885,7 +879,6 @@
|
|
|
885
879
|
},
|
|
886
880
|
"length": {
|
|
887
881
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
888
|
-
"maximum": 5000,
|
|
889
882
|
"minimum": 0,
|
|
890
883
|
"type": "number"
|
|
891
884
|
},
|
|
@@ -980,7 +973,6 @@
|
|
|
980
973
|
},
|
|
981
974
|
"length": {
|
|
982
975
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
983
|
-
"maximum": 5000,
|
|
984
976
|
"minimum": 0,
|
|
985
977
|
"type": "number"
|
|
986
978
|
},
|
|
@@ -1068,7 +1060,6 @@
|
|
|
1068
1060
|
},
|
|
1069
1061
|
"length": {
|
|
1070
1062
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1071
|
-
"maximum": 5000,
|
|
1072
1063
|
"minimum": 0,
|
|
1073
1064
|
"type": "number"
|
|
1074
1065
|
},
|
|
@@ -1156,7 +1147,6 @@
|
|
|
1156
1147
|
},
|
|
1157
1148
|
"length": {
|
|
1158
1149
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1159
|
-
"maximum": 5000,
|
|
1160
1150
|
"minimum": 0,
|
|
1161
1151
|
"type": "number"
|
|
1162
1152
|
},
|
|
@@ -1244,7 +1234,6 @@
|
|
|
1244
1234
|
},
|
|
1245
1235
|
"length": {
|
|
1246
1236
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1247
|
-
"maximum": 5000,
|
|
1248
1237
|
"minimum": 0,
|
|
1249
1238
|
"type": "number"
|
|
1250
1239
|
},
|
|
@@ -1332,7 +1321,6 @@
|
|
|
1332
1321
|
},
|
|
1333
1322
|
"length": {
|
|
1334
1323
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1335
|
-
"maximum": 5000,
|
|
1336
1324
|
"minimum": 0,
|
|
1337
1325
|
"type": "number"
|
|
1338
1326
|
},
|
|
@@ -1426,7 +1414,6 @@
|
|
|
1426
1414
|
},
|
|
1427
1415
|
"length": {
|
|
1428
1416
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1429
|
-
"maximum": 5000,
|
|
1430
1417
|
"minimum": 0,
|
|
1431
1418
|
"type": "number"
|
|
1432
1419
|
},
|
|
@@ -1523,7 +1510,6 @@
|
|
|
1523
1510
|
},
|
|
1524
1511
|
"length": {
|
|
1525
1512
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1526
|
-
"maximum": 5000,
|
|
1527
1513
|
"minimum": 0,
|
|
1528
1514
|
"type": "number"
|
|
1529
1515
|
},
|
|
@@ -1617,7 +1603,6 @@
|
|
|
1617
1603
|
},
|
|
1618
1604
|
"length": {
|
|
1619
1605
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1620
|
-
"maximum": 5000,
|
|
1621
1606
|
"minimum": 0,
|
|
1622
1607
|
"type": "number"
|
|
1623
1608
|
},
|
|
@@ -1711,7 +1696,6 @@
|
|
|
1711
1696
|
},
|
|
1712
1697
|
"length": {
|
|
1713
1698
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1714
|
-
"maximum": 5000,
|
|
1715
1699
|
"minimum": 0,
|
|
1716
1700
|
"type": "number"
|
|
1717
1701
|
},
|
|
@@ -1800,7 +1784,6 @@
|
|
|
1800
1784
|
},
|
|
1801
1785
|
"length": {
|
|
1802
1786
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1803
|
-
"maximum": 5000,
|
|
1804
1787
|
"minimum": 0,
|
|
1805
1788
|
"type": "number"
|
|
1806
1789
|
},
|
|
@@ -1888,7 +1871,6 @@
|
|
|
1888
1871
|
},
|
|
1889
1872
|
"length": {
|
|
1890
1873
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
1891
|
-
"maximum": 5000,
|
|
1892
1874
|
"minimum": 0,
|
|
1893
1875
|
"type": "number"
|
|
1894
1876
|
},
|
|
@@ -170,7 +170,6 @@
|
|
|
170
170
|
},
|
|
171
171
|
"length": {
|
|
172
172
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
173
|
-
"maximum": 5000,
|
|
174
173
|
"minimum": 0,
|
|
175
174
|
"type": "number"
|
|
176
175
|
},
|
|
@@ -224,7 +223,6 @@
|
|
|
224
223
|
},
|
|
225
224
|
"length": {
|
|
226
225
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
227
|
-
"maximum": 5000,
|
|
228
226
|
"minimum": 0,
|
|
229
227
|
"type": "number"
|
|
230
228
|
}
|
|
@@ -253,7 +251,6 @@
|
|
|
253
251
|
},
|
|
254
252
|
"length": {
|
|
255
253
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
256
|
-
"maximum": 5000,
|
|
257
254
|
"minimum": 0,
|
|
258
255
|
"type": "number"
|
|
259
256
|
}
|
|
@@ -296,7 +293,6 @@
|
|
|
296
293
|
},
|
|
297
294
|
"length": {
|
|
298
295
|
"description": "A field for the length of an entity in meters. This field is always inferred from the geometry.",
|
|
299
|
-
"maximum": 5000,
|
|
300
296
|
"minimum": 0,
|
|
301
297
|
"type": "number"
|
|
302
298
|
},
|
python_osw_validation/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.4.
|
|
1
|
+
__version__ = '0.4.3'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python_osw_validation
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Python library for OSW validation
|
|
5
5
|
Home-page: https://github.com/TaskarCenterAtUW/TDEI-python-lib-osw-validation
|
|
6
6
|
Author: Sujata Misra
|
|
@@ -31,9 +31,9 @@ Dynamic: summary
|
|
|
31
31
|
|
|
32
32
|
# TDEI python lib OSW validation package
|
|
33
33
|
|
|
34
|
-
[](https://github.com/TaskarCenterAtUW/TDEI-python-lib-osw-validation/actions/workflows/unit_tests.yml)
|
|
36
|
-
|
|
34
|
+
[](https://pypi.org/project/python-osw-validation/)
|
|
35
|
+
[](https://github.com/TaskarCenterAtUW/TDEI-python-lib-osw-validation/actions/workflows/unit_tests.yml)
|
|
36
|
+

|
|
37
37
|
|
|
38
38
|
This package validates OSW GeoJSON datasets packaged as a ZIP file.
|
|
39
39
|
|
|
@@ -48,7 +48,7 @@ This package validates OSW GeoJSON datasets packaged as a ZIP file.
|
|
|
48
48
|
- Extracts the provided ZIP file
|
|
49
49
|
- Finds supported OSW dataset files inside the extracted directory
|
|
50
50
|
- Validates each file (`edges`, `lines`, `nodes`, `points`, `polygons`, and `zones`) against the matching schema
|
|
51
|
-
- Performs an upfront data-quality check for null
|
|
51
|
+
- Performs an upfront data-quality check for actual null and numeric NaN values in `ext:*` extension properties (for example JSON `null` or numeric `NaN`; string values like `"null"` and `"nan"` are not rejected by this precheck)
|
|
52
52
|
- Runs cross-file integrity checks such as duplicate `_id` detection and edge or zone references back to nodes
|
|
53
53
|
- Returns a `ValidationResult` object with `is_valid`, `errors`, and `issues`
|
|
54
54
|
|
|
@@ -81,8 +81,8 @@ print(result.issues) # capped by the same max_errors limit
|
|
|
81
81
|
|
|
82
82
|
- `errors`: high-level validation messages, capped by `max_errors` (default `20`).
|
|
83
83
|
- `issues`: detailed per-feature validation issues, also capped by `max_errors`.
|
|
84
|
-
- If null
|
|
85
|
-
- `Invalid value at '
|
|
84
|
+
- If actual null or numeric NaN values are found in `ext:*` extension properties, validation fails early before schema checks with actionable messages such as:
|
|
85
|
+
- `Invalid value at 'ext:metadata.score': nan. Null/NaN placeholders are not allowed; provide a valid value or remove this property.`
|
|
86
86
|
- For enum validation, long allowed-value lists are summarized as:
|
|
87
87
|
- first 5 values joined by `|`
|
|
88
88
|
- followed by `| and N more` when applicable.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
python_osw_validation/__init__.py,sha256=
|
|
1
|
+
python_osw_validation/__init__.py,sha256=cK7jzSRUpYZ-QvWUVC3C3dCu7ce-HtKNSTzA1IArpzg,33576
|
|
2
2
|
python_osw_validation/extracted_data_validator.py,sha256=gEGYLaM_QkK6NrrhVYmNx-jMaNHXC4PbDGf1zKwJre4,6605
|
|
3
3
|
python_osw_validation/geometry_mapping_validator.py,sha256=KscmfgSwTiXbf8IPx-RXuTIXPYY4PHDwvBeb2WmhpVA,14137
|
|
4
4
|
python_osw_validation/helpers.py,sha256=iLVJZS1-AaLsbP0ngHZLW208dKSnM2k52JFal4Nuxcg,9203
|
|
5
|
-
python_osw_validation/version.py,sha256=
|
|
5
|
+
python_osw_validation/version.py,sha256=GI8jYEksCyU_GLvu0eW6pPFjDcmTuWNQVavfvCX2KuQ,22
|
|
6
6
|
python_osw_validation/zipfile_handler.py,sha256=jXnP-8O5AAOBapuNF3-XdFVM1MHiPaWpl_wlbX-aqhY,2631
|
|
7
|
-
python_osw_validation/schema/opensidewalks.edges.schema-0.3.json,sha256=
|
|
8
|
-
python_osw_validation/schema/opensidewalks.lines.schema-0.3.json,sha256=
|
|
7
|
+
python_osw_validation/schema/opensidewalks.edges.schema-0.3.json,sha256=yE4K97WEdQBMHlVo5k9uheJ8TzHE6Tfupekxq_uv5Bk,78976
|
|
8
|
+
python_osw_validation/schema/opensidewalks.lines.schema-0.3.json,sha256=AlZuNu4dxEvnnqamHoogg9Y0yZMEyUtB0r854SF0xYo,9326
|
|
9
9
|
python_osw_validation/schema/opensidewalks.nodes.schema-0.3.json,sha256=yEv4pIY69YvPHhSiQmvU21HeI426V-Z4j2K7ONQAwLM,14445
|
|
10
10
|
python_osw_validation/schema/opensidewalks.points.schema-0.3.json,sha256=WYmlC4QFD-JUCnM0w3GBVI1E-LmCTRmTrGla1Z7o9Kw,13035
|
|
11
11
|
python_osw_validation/schema/opensidewalks.polygons.schema-0.3.json,sha256=VzDpHv1ZVT42cAk9n3gsFZjS7WcflQzSbjN-aNIVTYM,16286
|
|
12
12
|
python_osw_validation/schema/opensidewalks.schema-0.3.json,sha256=vyyGzPpqLxr1e5wFfNKzlA1sr6tmhHKM7ntaTk8z5k8,278489
|
|
13
13
|
python_osw_validation/schema/opensidewalks.zones.schema-0.3.json,sha256=JCqoCJj-dCuPVPHWSUQhRJMebaJ9IrzHWwTVAC6j7dY,11281
|
|
14
|
-
python_osw_validation-0.4.
|
|
15
|
-
python_osw_validation-0.4.
|
|
16
|
-
python_osw_validation-0.4.
|
|
17
|
-
python_osw_validation-0.4.
|
|
18
|
-
python_osw_validation-0.4.
|
|
14
|
+
python_osw_validation-0.4.3.dist-info/licenses/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
|
|
15
|
+
python_osw_validation-0.4.3.dist-info/METADATA,sha256=lwCgcN7h8dHWBpt5iR0_HB-vTXtNCvPugxwmOyVQGUE,6723
|
|
16
|
+
python_osw_validation-0.4.3.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
17
|
+
python_osw_validation-0.4.3.dist-info/top_level.txt,sha256=GE81UPcDHEffJCxYu3M_iPz3Dt-O3axB73R5SLm_Veo,22
|
|
18
|
+
python_osw_validation-0.4.3.dist-info/RECORD,,
|
|
File without changes
|
{python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{python_osw_validation-0.4.1.dist-info → python_osw_validation-0.4.3.dist-info}/top_level.txt
RENAMED
|
File without changes
|