datamarket 0.9.34__tar.gz → 0.9.36__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 datamarket might be problematic. Click here for more details.
- {datamarket-0.9.34 → datamarket-0.9.36}/PKG-INFO +1 -1
- {datamarket-0.9.34 → datamarket-0.9.36}/pyproject.toml +1 -1
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/nominatim.py +7 -7
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/params/nominatim.py +2 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/LICENSE +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/README.md +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/__init__.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/__init__.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/alchemy.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/aws.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/drive.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/ftp.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/peerdb.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/proxy.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/interfaces/tinybird.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/params/__init__.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/__init__.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/airflow.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/alchemy.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/main.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/selenium.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/soda.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/strings/__init__.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/strings/normalization.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/strings/obfuscation.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/typer.py +0 -0
- {datamarket-0.9.34 → datamarket-0.9.36}/src/datamarket/utils/types.py +0 -0
|
@@ -10,7 +10,7 @@ import requests
|
|
|
10
10
|
from geopy.distance import geodesic
|
|
11
11
|
from jellyfish import jaro_winkler_similarity
|
|
12
12
|
|
|
13
|
-
from ..params.nominatim import POSTCODES
|
|
13
|
+
from ..params.nominatim import CITY_TO_PROVINCE, POSTCODES
|
|
14
14
|
from ..utils.strings import normalize
|
|
15
15
|
|
|
16
16
|
########################################################################################################################
|
|
@@ -88,7 +88,7 @@ class Nominatim:
|
|
|
88
88
|
"country": raw_address.get("country"),
|
|
89
89
|
"country_code": (raw_address.get("country_code") or "").lower(),
|
|
90
90
|
"state": raw_address.get("state"),
|
|
91
|
-
"province": raw_address.get("province"),
|
|
91
|
+
"province": raw_address.get("province") or CITY_TO_PROVINCE.get(city),
|
|
92
92
|
"city": city,
|
|
93
93
|
"postcode": postcode,
|
|
94
94
|
"district": district,
|
|
@@ -203,7 +203,7 @@ class Nominatim:
|
|
|
203
203
|
dist_geonames: float,
|
|
204
204
|
authoritative_postcode: Optional[str],
|
|
205
205
|
authoritative_province_from_postcode: Optional[str],
|
|
206
|
-
|
|
206
|
+
nominatim_province: Optional[str],
|
|
207
207
|
) -> Dict[str, Optional[str]]:
|
|
208
208
|
"""
|
|
209
209
|
Selects the final address result based on distances and applies the authoritative postcode/province.
|
|
@@ -211,7 +211,7 @@ class Nominatim:
|
|
|
211
211
|
if dist_nominatim <= dist_geonames and dist_nominatim != float("inf"):
|
|
212
212
|
final_result = parsed_nominatim_result
|
|
213
213
|
final_result["postcode"] = authoritative_postcode
|
|
214
|
-
final_result["province"] =
|
|
214
|
+
final_result["province"] = nominatim_province
|
|
215
215
|
elif dist_geonames < dist_nominatim and dist_geonames != float("inf"):
|
|
216
216
|
final_result = parsed_geonames_result
|
|
217
217
|
final_result["postcode"] = authoritative_postcode
|
|
@@ -251,9 +251,9 @@ class Nominatim:
|
|
|
251
251
|
parsed_geonames_result = self._parse_geonames_result(geonames_response)
|
|
252
252
|
|
|
253
253
|
# Determine authoritative postcode
|
|
254
|
-
|
|
254
|
+
nominatim_province = parsed_nominatim_result.get("province")
|
|
255
255
|
selected_postcode, selected_province_from_postcode = self._select_postcode_and_derived_province(
|
|
256
|
-
parsed_nominatim_result, parsed_geonames_result,
|
|
256
|
+
parsed_nominatim_result, parsed_geonames_result, nominatim_province
|
|
257
257
|
)
|
|
258
258
|
|
|
259
259
|
# Calculate distances
|
|
@@ -280,7 +280,7 @@ class Nominatim:
|
|
|
280
280
|
dist_geonames,
|
|
281
281
|
selected_postcode,
|
|
282
282
|
selected_province_from_postcode,
|
|
283
|
-
|
|
283
|
+
nominatim_province,
|
|
284
284
|
)
|
|
285
285
|
|
|
286
286
|
return final_result
|
|
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
|
|
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
|
|
File without changes
|