python-osw-validation 0.2.10__py3-none-any.whl → 0.2.11__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.
@@ -161,12 +161,30 @@ class OSWValidation:
161
161
  # Validate OSW external extensions
162
162
  for file in validator.externalExtensions:
163
163
  file_path = os.path.join(file)
164
+ file_name = os.path.basename(file)
164
165
  extensionFile = gpd.read_file(file_path)
165
166
  invalid_geojson = extensionFile[extensionFile.is_valid == False]
166
167
  is_valid = len(invalid_geojson) == 0
167
168
  if not is_valid:
168
- self.errors.append(
169
- f"Invalid geometries found in extension file {file}, list of invalid geometries: {invalid_geojson.to_json()}")
169
+ try:
170
+ # Safely extract invalid _id or fallback to index if _id is missing
171
+ invalid_ids = list(set(invalid_geojson.get('_id', invalid_geojson.index)))
172
+ num_invalid = len(invalid_ids)
173
+ limit = min(num_invalid, 20)
174
+ displayed_invalid = ', '.join(map(str, invalid_ids[:limit]))
175
+ self.errors.append(
176
+ f"Invalid geometries found in extension file `{file_name}`. Showing {limit if num_invalid > 20 else 'all'} of {num_invalid} invalid geometry IDs: {displayed_invalid}"
177
+ )
178
+ except Exception as e:
179
+ self.errors.append(f"Invalid features found in `{file_name}`, but failed to extract IDs: {e}")
180
+
181
+ # Optional: Test serializability of extension file
182
+ try:
183
+ for idx, row in extensionFile.drop(columns='geometry').iterrows():
184
+ json.dumps(row.to_dict())
185
+ except Exception as e:
186
+ self.errors.append(f"Extension file `{file_name}` has non-serializable properties: {e}")
187
+ break
170
188
 
171
189
  if self.errors:
172
190
  return ValidationResult(False, self.errors)
@@ -1 +1 @@
1
- __version__ = '0.2.10'
1
+ __version__ = '0.2.11'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-osw-validation
3
- Version: 0.2.10
3
+ Version: 0.2.11
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
@@ -127,3 +127,24 @@ Ran 37 tests in 1284.068s
127
127
 
128
128
  OK
129
129
  ```
130
+
131
+ ## Use locally:
132
+ To use the library locally, use the [example.py](./src/example.py) code
133
+
134
+ ## Deployment:
135
+
136
+ - The library can be pushed to [TestPy](https://test.pypi.org/project/python-osw-validation/) or [PYPI](https://pypi.org/project/python-osw-validation/)
137
+ ### Deploy to TestPy
138
+ - On every push to `dev` branch, a workflow is triggered which publishes the updated version to TestPy
139
+
140
+ ### Deploy to PyPI
141
+ - This happens whenever a tag/release is created with `*.*.*` notation (eg. 0.0.8)
142
+ - To change the version, change the version at [version.py](./src/python_osw_validation/version.py)
143
+ - To release a new version:
144
+ - Go to Github link of this repository
145
+ - Under [releases](https://github.com/TaskarCenterAtUW/TDEI-python-lib-osw-validation/releases), click on `Draft a new release`
146
+ - Under `choose a new tag`, add a new tag `v*.*.*` , Generate Release notes
147
+ - Choose `main` branch for release
148
+ - Publish the release.
149
+ - This release triggers a workflow to generate the new version of the Package.
150
+ - The new package will be available at https://pypi.org/project/python-osw-validation/
@@ -0,0 +1,10 @@
1
+ python_osw_validation/__init__.py,sha256=eMf_TBIaQWFmQelG1lZkvDpwaW0JjIJNiDEFKx4bHe8,10467
2
+ python_osw_validation/extracted_data_validator.py,sha256=wZyCk8NlJv10cj_GrRTAiwm4cBhTAeDethjzJU-amoI,3877
3
+ python_osw_validation/version.py,sha256=MDWVRBs0IWHig-yP3jl_AM0VvBpaMmDN0nBK4Hl8Idk,22
4
+ python_osw_validation/zipfile_handler.py,sha256=jXnP-8O5AAOBapuNF3-XdFVM1MHiPaWpl_wlbX-aqhY,2631
5
+ python_osw_validation/schema/opensidewalks.schema.json,sha256=i0iJwb_4Tq20BVUpkpgyM_7fm4SW_d_HNXKw0xul7OA,240987
6
+ python_osw_validation-0.2.11.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
7
+ python_osw_validation-0.2.11.dist-info/METADATA,sha256=pmboxEjaNs3SxMNlnh-L-zsnPFbSjvJF6Vezkuz25fc,7232
8
+ python_osw_validation-0.2.11.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
+ python_osw_validation-0.2.11.dist-info/top_level.txt,sha256=GE81UPcDHEffJCxYu3M_iPz3Dt-O3axB73R5SLm_Veo,22
10
+ python_osw_validation-0.2.11.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- python_osw_validation/__init__.py,sha256=c8d2PUgU89lNR5Zh4zetbKYRijcl3-SM5Aux8ycfkl0,9355
2
- python_osw_validation/extracted_data_validator.py,sha256=wZyCk8NlJv10cj_GrRTAiwm4cBhTAeDethjzJU-amoI,3877
3
- python_osw_validation/version.py,sha256=Sg_6D3b_dkjLywxS_G9vAU50xLvx_3hgYewd0IeIFAQ,22
4
- python_osw_validation/zipfile_handler.py,sha256=jXnP-8O5AAOBapuNF3-XdFVM1MHiPaWpl_wlbX-aqhY,2631
5
- python_osw_validation/schema/opensidewalks.schema.json,sha256=i0iJwb_4Tq20BVUpkpgyM_7fm4SW_d_HNXKw0xul7OA,240987
6
- python_osw_validation-0.2.10.dist-info/LICENSE,sha256=2bm9uFabQZ3Ykb_SaSU_uUbAj2-htc6WJQmS_65qD00,1073
7
- python_osw_validation-0.2.10.dist-info/METADATA,sha256=ogdQ8kOflxrhmhxTbhSNqvMDIZdP4CZ1IRb9o6gipog,6141
8
- python_osw_validation-0.2.10.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
9
- python_osw_validation-0.2.10.dist-info/top_level.txt,sha256=GE81UPcDHEffJCxYu3M_iPz3Dt-O3axB73R5SLm_Veo,22
10
- python_osw_validation-0.2.10.dist-info/RECORD,,