uk_bin_collection 0.146.1__py3-none-any.whl → 0.146.2__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.
- uk_bin_collection/compare_lad_codes.py +58 -0
- uk_bin_collection/tests/input.json +2 -1
- {uk_bin_collection-0.146.1.dist-info → uk_bin_collection-0.146.2.dist-info}/METADATA +2 -1
- {uk_bin_collection-0.146.1.dist-info → uk_bin_collection-0.146.2.dist-info}/RECORD +7 -6
- {uk_bin_collection-0.146.1.dist-info → uk_bin_collection-0.146.2.dist-info}/LICENSE +0 -0
- {uk_bin_collection-0.146.1.dist-info → uk_bin_collection-0.146.2.dist-info}/WHEEL +0 -0
- {uk_bin_collection-0.146.1.dist-info → uk_bin_collection-0.146.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
import json
|
2
|
+
import geopandas as gpd
|
3
|
+
|
4
|
+
def extract_lad_codes(input_json_path):
|
5
|
+
with open(input_json_path, "r") as f:
|
6
|
+
data = json.load(f)
|
7
|
+
|
8
|
+
lad_codes = set()
|
9
|
+
lad_code_to_council_input = {}
|
10
|
+
|
11
|
+
for council_key, council_info in data.items():
|
12
|
+
if isinstance(council_info, dict):
|
13
|
+
if "LAD24CD" in council_info:
|
14
|
+
code = council_info["LAD24CD"]
|
15
|
+
lad_codes.add(code)
|
16
|
+
lad_code_to_council_input[code] = council_key
|
17
|
+
if "supported_councils_LAD24CD" in council_info:
|
18
|
+
for code in council_info["supported_councils_LAD24CD"]:
|
19
|
+
lad_codes.add(code)
|
20
|
+
lad_code_to_council_input[code] = f"{council_key} (shared)"
|
21
|
+
|
22
|
+
return lad_codes, lad_code_to_council_input
|
23
|
+
|
24
|
+
def compare_with_geojson(input_lad_codes, geojson_path):
|
25
|
+
gdf = gpd.read_file(geojson_path)
|
26
|
+
geojson_lad_codes = set(gdf["LAD24CD"].dropna().unique())
|
27
|
+
|
28
|
+
geojson_lad_map = {
|
29
|
+
row["LAD24CD"]: row["LAD24NM"]
|
30
|
+
for _, row in gdf.iterrows()
|
31
|
+
if "LAD24CD" in row and "LAD24NM" in row
|
32
|
+
}
|
33
|
+
|
34
|
+
missing_in_input = geojson_lad_codes - input_lad_codes
|
35
|
+
extra_in_input = input_lad_codes - geojson_lad_codes
|
36
|
+
matching = input_lad_codes & geojson_lad_codes
|
37
|
+
|
38
|
+
return matching, missing_in_input, extra_in_input, geojson_lad_map
|
39
|
+
|
40
|
+
# --- Run the comparison ---
|
41
|
+
input_json_path = "uk_bin_collection/tests/input.json"
|
42
|
+
geojson_path = "uk_bin_collection/Local_Authority_Boundaries.geojson"
|
43
|
+
|
44
|
+
input_lad_codes, input_name_map = extract_lad_codes(input_json_path)
|
45
|
+
matching, missing, extra, geojson_name_map = compare_with_geojson(input_lad_codes, geojson_path)
|
46
|
+
|
47
|
+
# --- Print results ---
|
48
|
+
print(f"✅ Matching LAD24CDs ({len(matching)}):")
|
49
|
+
for code in sorted(matching):
|
50
|
+
print(f" {code} → input.json: {input_name_map.get(code)} | geojson: {geojson_name_map.get(code)}")
|
51
|
+
|
52
|
+
print(f"\n🟡 LADs in GeoJSON but missing in input.json ({len(missing)}):")
|
53
|
+
for code in sorted(missing):
|
54
|
+
print(f" {code} → geojson: {geojson_name_map.get(code)}")
|
55
|
+
|
56
|
+
print(f"\n🔴 LADs in input.json but not in GeoJSON ({len(extra)}):")
|
57
|
+
for code in sorted(extra):
|
58
|
+
print(f" {code} → input.json: {input_name_map.get(code)}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: uk_bin_collection
|
3
|
-
Version: 0.146.
|
3
|
+
Version: 0.146.2
|
4
4
|
Summary: Python Lib to collect UK Bin Data
|
5
5
|
Author: Robert Bradley
|
6
6
|
Author-email: robbrad182@gmail.com
|
@@ -9,6 +9,7 @@ Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
10
10
|
Classifier: Programming Language :: Python :: 3.13
|
11
11
|
Requires-Dist: bs4
|
12
|
+
Requires-Dist: geopandas (>=1.0.1,<2.0.0)
|
12
13
|
Requires-Dist: holidays
|
13
14
|
Requires-Dist: icalevents (>=0.2.1,<0.3.0)
|
14
15
|
Requires-Dist: lxml
|
@@ -1,11 +1,12 @@
|
|
1
1
|
uk_bin_collection/Local_Authority_Boundaries.geojson,sha256=_j-hUiL0--t2ewd_s29-j7_AKRlhagRMmOhXyco-B6I,1175922
|
2
2
|
uk_bin_collection/README.rst,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
uk_bin_collection/compare_lad_codes.py,sha256=BjXPzxYbbqyl2Pv9yPip0BVpyD3GOofwgWa-BQUecqM,2214
|
3
4
|
uk_bin_collection/map.html,sha256=qKc4Lscv1eSIc0M3vDofzZf5w9_eslEYpz1-kK4tup0,4346
|
4
5
|
uk_bin_collection/tests/check_selenium_url_in_input.json.py,sha256=lf-JT7vvaSfvgbrfOhzrhfSzJqL82WajlRqo1GqfcMM,7875
|
5
6
|
uk_bin_collection/tests/council_feature_input_parity.py,sha256=DO6Mk4ImYgM5ZCZ-cutwz5RoYYWZRLYx2tr6zIs_9Rc,3843
|
6
7
|
uk_bin_collection/tests/features/environment.py,sha256=VQZjJdJI_kZn08M0j5cUgvKT4k3iTw8icJge1DGOkoA,127
|
7
8
|
uk_bin_collection/tests/features/validate_council_outputs.feature,sha256=SJK-Vc737hrf03tssxxbeg_JIvAH-ddB8f6gU1LTbuQ,251
|
8
|
-
uk_bin_collection/tests/input.json,sha256
|
9
|
+
uk_bin_collection/tests/input.json,sha256=-EVTLbgBwk879YMbAHkIYC7svXffzlL8xOa8Tab8M7g,133327
|
9
10
|
uk_bin_collection/tests/output.schema,sha256=ZwKQBwYyTDEM4G2hJwfLUVM-5v1vKRvRK9W9SS1sd18,1086
|
10
11
|
uk_bin_collection/tests/step_defs/step_helpers/file_handler.py,sha256=Ygzi4V0S1MIHqbdstUlIqtRIwnynvhu4UtpweJ6-5N8,1474
|
11
12
|
uk_bin_collection/tests/step_defs/test_validate_council.py,sha256=VZ0a81sioJULD7syAYHjvK_-nT_Rd36tUyzPetSA0gk,3475
|
@@ -332,8 +333,8 @@ uk_bin_collection/uk_bin_collection/councils/YorkCouncil.py,sha256=I2kBYMlsD4bId
|
|
332
333
|
uk_bin_collection/uk_bin_collection/councils/council_class_template/councilclasstemplate.py,sha256=QD4v4xpsEE0QheR_fGaNOIRMc2FatcUfKkkhAhseyVU,1159
|
333
334
|
uk_bin_collection/uk_bin_collection/create_new_council.py,sha256=m-IhmWmeWQlFsTZC4OxuFvtw5ZtB8EAJHxJTH4O59lQ,1536
|
334
335
|
uk_bin_collection/uk_bin_collection/get_bin_data.py,sha256=YvmHfZqanwrJ8ToGch34x-L-7yPe31nB_x77_Mgl_vo,4545
|
335
|
-
uk_bin_collection-0.146.
|
336
|
-
uk_bin_collection-0.146.
|
337
|
-
uk_bin_collection-0.146.
|
338
|
-
uk_bin_collection-0.146.
|
339
|
-
uk_bin_collection-0.146.
|
336
|
+
uk_bin_collection-0.146.2.dist-info/LICENSE,sha256=vABBUOzcrgfaTKpzeo-si9YVEun6juDkndqA8RKdKGs,1071
|
337
|
+
uk_bin_collection-0.146.2.dist-info/METADATA,sha256=1F2N9JtI_FSX2IALiojB8bO-kjCn1N2tNyAAnKGuv6s,19900
|
338
|
+
uk_bin_collection-0.146.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
339
|
+
uk_bin_collection-0.146.2.dist-info/entry_points.txt,sha256=36WCSGMWSc916S3Hi1ZkazzDKHaJ6CD-4fCEFm5MIao,90
|
340
|
+
uk_bin_collection-0.146.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{uk_bin_collection-0.146.1.dist-info → uk_bin_collection-0.146.2.dist-info}/entry_points.txt
RENAMED
File without changes
|