diff --git a/CHANGELOG.md b/CHANGELOG.md index 56972a8..777992f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - JSONSchema validate: - Add format checkers - Add more fields to output object +- GeoJSON to JSON: + - meta information includes inconsistent ids on organisations and phases ## [0.3.0] - 2022-11-08 diff --git a/libcoveofds/geojson.py b/libcoveofds/geojson.py index 96d812d..f29a200 100644 --- a/libcoveofds/geojson.py +++ b/libcoveofds/geojson.py @@ -1,4 +1,7 @@ import copy +from collections import defaultdict + +from json_merge_patch import create_patch as json_diff_function from libcove2.common import fields_present_generator @@ -169,6 +172,10 @@ def _convert_span_to_feature( class GeoJSONToJSONConverter: def __init__(self): self._networks: dict = {} + self._inconsistent_phase_ids_by_network_id: defaultdict = defaultdict(set) + self._inconsistent_organisation_ids_by_network_id: defaultdict = defaultdict( + set + ) def process_data(self, nodes_data: dict, spans_data: dict) -> None: # Network @@ -285,8 +292,11 @@ def _process_phase(self, network_id: str, phase: dict) -> str: phase_id = phase.get("id") if phase_id: if phase_id in self._networks[network_id]["phases"]: - # TODO check value is same, add error if not - pass + # Is it inconsistent with what we have seen before? + if json_diff_function( + self._networks[network_id]["phases"][phase_id], phase + ): + self._inconsistent_phase_ids_by_network_id[network_id].add(phase_id) else: self._networks[network_id]["phases"][phase_id] = phase return phase_id @@ -296,8 +306,14 @@ def _process_organisation(self, network_id: str, organisation: dict) -> str: organisation_id = organisation.get("id") if organisation_id: if organisation_id in self._networks[network_id]["organisations"]: - # TODO check value is same, add error if not - pass + # Is it inconsistent with what we have seen before? + if json_diff_function( + self._networks[network_id]["organisations"][organisation_id], + organisation, + ): + self._inconsistent_organisation_ids_by_network_id[network_id].add( + organisation_id + ) else: self._networks[network_id]["organisations"][ organisation_id @@ -329,5 +345,14 @@ def get_meta_json(self) -> dict: out["output_field_coverage"][key] = {"count": 1} else: out["output_field_coverage"][key]["count"] += 1 + # inconsistent + out["inconsistent_phases_by_network_id"] = { + k: {"phase_ids": sorted(list(v))} + for k, v in self._inconsistent_phase_ids_by_network_id.items() + } + out["inconsistent_organisations_by_network_id"] = { + k: {"organisation_ids": sorted(list(v))} + for k, v in self._inconsistent_organisation_ids_by_network_id.items() + } # return return out diff --git a/make_expected_test_data.sh b/make_expected_test_data.sh index 8544aa1..0a0dee8 100755 --- a/make_expected_test_data.sh +++ b/make_expected_test_data.sh @@ -16,6 +16,8 @@ libcoveofds gjtoj --outputmetafilename tests/fixtures/geojson_to_json/basic_1.me libcoveofds gjtoj --outputmetafilename tests/fixtures/geojson_to_json/no_geometry_1.meta.expected.json tests/fixtures/geojson_to_json/no_geometry_1.nodes.geo.json tests/fixtures/geojson_to_json/no_geometry_1.spans.geo.json tests/fixtures/geojson_to_json/no_geometry_1.expected.json libcoveofds gjtoj --outputmetafilename tests/fixtures/geojson_to_json/phases_1.meta.expected.json tests/fixtures/geojson_to_json/phases_1.nodes.geo.json tests/fixtures/geojson_to_json/phases_1.spans.geo.json tests/fixtures/geojson_to_json/phases_1.expected.json libcoveofds gjtoj --outputmetafilename tests/fixtures/geojson_to_json/organisations_1.meta.expected.json tests/fixtures/geojson_to_json/organisations_1.nodes.geo.json tests/fixtures/geojson_to_json/organisations_1.spans.geo.json tests/fixtures/geojson_to_json/organisations_1.expected.json +libcoveofds gjtoj --outputmetafilename tests/fixtures/geojson_to_json/phases_inconsistent_1.meta.expected.json tests/fixtures/geojson_to_json/phases_inconsistent_1.nodes.geo.json tests/fixtures/geojson_to_json/phases_inconsistent_1.spans.geo.json tests/fixtures/geojson_to_json/phases_inconsistent_1.expected.json +libcoveofds gjtoj --outputmetafilename tests/fixtures/geojson_to_json/organisations_inconsistent_1.meta.expected.json tests/fixtures/geojson_to_json/organisations_inconsistent_1.nodes.geo.json tests/fixtures/geojson_to_json/organisations_inconsistent_1.spans.geo.json tests/fixtures/geojson_to_json/organisations_inconsistent_1.expected.json # JSON to GeoJSON libcoveofds jtogj --outputmetafilename tests/fixtures/json_to_geojson/basic_1.expected.meta.json tests/fixtures/json_to_geojson/basic_1.json tests/fixtures/json_to_geojson/basic_1.expected.nodes.geo.json tests/fixtures/json_to_geojson/basic_1.expected.spans.geo.json diff --git a/mypy.ini b/mypy.ini index 043aa57..6f45e81 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,3 +5,6 @@ ignore_missing_imports = True [mypy-jsonschema.*] ignore_missing_imports = True + +[mypy-json_merge_patch.*] +ignore_missing_imports = True diff --git a/setup.py b/setup.py index c392c79..f03e5cd 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ packages=find_packages(), long_description="A data review library", python_requires=">=3.8", - install_requires=["jsonschema", "requests", "jsonref"], + install_requires=["jsonschema", "requests", "jsonref", "json-merge-patch"], extras_require={ "dev": ["pytest", "flake8", "black==22.3.0", "isort", "mypy", "Sphinx"] }, diff --git a/tests/fixtures/geojson_to_json/basic_1.meta.expected.json b/tests/fixtures/geojson_to_json/basic_1.meta.expected.json index c39a592..0357490 100644 --- a/tests/fixtures/geojson_to_json/basic_1.meta.expected.json +++ b/tests/fixtures/geojson_to_json/basic_1.meta.expected.json @@ -54,5 +54,7 @@ "/networks/spans/route/coordinates": { "count": 1 } - } + }, + "inconsistent_phases_by_network_id": {}, + "inconsistent_organisations_by_network_id": {} } \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/no_geometry_1.meta.expected.json b/tests/fixtures/geojson_to_json/no_geometry_1.meta.expected.json index d45c664..a035f61 100644 --- a/tests/fixtures/geojson_to_json/no_geometry_1.meta.expected.json +++ b/tests/fixtures/geojson_to_json/no_geometry_1.meta.expected.json @@ -36,5 +36,7 @@ "/networks/spans/end": { "count": 1 } - } + }, + "inconsistent_phases_by_network_id": {}, + "inconsistent_organisations_by_network_id": {} } \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/organisations_1.meta.expected.json b/tests/fixtures/geojson_to_json/organisations_1.meta.expected.json index 2b060f3..bcfe7c0 100644 --- a/tests/fixtures/geojson_to_json/organisations_1.meta.expected.json +++ b/tests/fixtures/geojson_to_json/organisations_1.meta.expected.json @@ -87,5 +87,7 @@ "/networks/organisations/name": { "count": 2 } - } + }, + "inconsistent_phases_by_network_id": {}, + "inconsistent_organisations_by_network_id": {} } \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/organisations_inconsistent_1.expected.json b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.expected.json new file mode 100644 index 0000000..51d04c2 --- /dev/null +++ b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.expected.json @@ -0,0 +1,126 @@ +{ + "networks": [ + { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network", + "nodes": [ + { + "id": "1", + "name": "Accra", + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222" + }, + "location": { + "type": "Point", + "coordinates": [ + -0.174, + 5.625 + ] + } + }, + { + "id": "2", + "name": "Kumasi", + "status": "operational", + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222" + }, + "location": { + "type": "Point", + "coordinates": [ + -1.628, + 6.711 + ] + } + } + ], + "spans": [ + { + "id": "1", + "name": "Accra to Kumasi", + "start": "1", + "end": "2", + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222" + }, + "route": { + "type": "LineString", + "coordinates": [ + [ + -0.173, + 5.626 + ], + [ + -0.178, + 5.807 + ], + [ + -0.112, + 5.971 + ], + [ + -0.211, + 5.963 + ], + [ + -0.321, + 6.17 + ], + [ + -0.488, + 6.29 + ], + [ + -0.56, + 6.421 + ], + [ + -0.752, + 6.533 + ], + [ + -0.867, + 6.607 + ], + [ + -1.101, + 6.585 + ], + [ + -1.304, + 6.623 + ], + [ + -1.461, + 6.727 + ], + [ + -1.628, + 6.713 + ] + ] + } + } + ], + "organisations": [ + { + "id": "GH-RGD-CS111111111", + "name": "FibreCo" + }, + { + "id": "GH-RGD-CS222222222", + "name": "FastWeb" + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/organisations_inconsistent_1.meta.expected.json b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.meta.expected.json new file mode 100644 index 0000000..7079725 --- /dev/null +++ b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.meta.expected.json @@ -0,0 +1,100 @@ +{ + "output_field_coverage": { + "/networks": { + "count": 1 + }, + "/networks/id": { + "count": 1 + }, + "/networks/name": { + "count": 1 + }, + "/networks/nodes": { + "count": 1 + }, + "/networks/nodes/id": { + "count": 2 + }, + "/networks/nodes/name": { + "count": 2 + }, + "/networks/nodes/physicalInfrastructureProvider": { + "count": 2 + }, + "/networks/nodes/physicalInfrastructureProvider/id": { + "count": 2 + }, + "/networks/nodes/networkProvider": { + "count": 2 + }, + "/networks/nodes/networkProvider/id": { + "count": 2 + }, + "/networks/nodes/location": { + "count": 2 + }, + "/networks/nodes/location/type": { + "count": 2 + }, + "/networks/nodes/location/coordinates": { + "count": 2 + }, + "/networks/nodes/status": { + "count": 1 + }, + "/networks/spans": { + "count": 1 + }, + "/networks/spans/id": { + "count": 1 + }, + "/networks/spans/name": { + "count": 1 + }, + "/networks/spans/start": { + "count": 1 + }, + "/networks/spans/end": { + "count": 1 + }, + "/networks/spans/physicalInfrastructureProvider": { + "count": 1 + }, + "/networks/spans/physicalInfrastructureProvider/id": { + "count": 1 + }, + "/networks/spans/networkProvider": { + "count": 1 + }, + "/networks/spans/networkProvider/id": { + "count": 1 + }, + "/networks/spans/route": { + "count": 1 + }, + "/networks/spans/route/type": { + "count": 1 + }, + "/networks/spans/route/coordinates": { + "count": 1 + }, + "/networks/organisations": { + "count": 1 + }, + "/networks/organisations/id": { + "count": 2 + }, + "/networks/organisations/name": { + "count": 2 + } + }, + "inconsistent_phases_by_network_id": {}, + "inconsistent_organisations_by_network_id": { + "a096d627-72e1-4f9b-b129-951b1737bff4": { + "organisation_ids": [ + "GH-RGD-CS111111111", + "GH-RGD-CS222222222" + ] + } + } +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/organisations_inconsistent_1.nodes.geo.json b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.nodes.geo.json new file mode 100644 index 0000000..badd376 --- /dev/null +++ b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.nodes.geo.json @@ -0,0 +1,58 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -0.174, + 5.625 + ] + }, + "properties": { + "id": "1", + "name": "Accra", + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111", + "name": "FibreCo" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222", + "name": "FastWeb" + }, + "network": { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network" + } + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -1.628, + 6.711 + ] + }, + "properties": { + "id": "2", + "name": "Kumasi", + "status": "operational", + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111", + "name": "Fibre Company" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222", + "name": "Fast Web" + }, + "network": { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network" + } + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/organisations_inconsistent_1.spans.geo.json b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.spans.geo.json new file mode 100644 index 0000000..d0ef682 --- /dev/null +++ b/tests/fixtures/geojson_to_json/organisations_inconsistent_1.spans.geo.json @@ -0,0 +1,116 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -0.173, + 5.626 + ], + [ + -0.178, + 5.807 + ], + [ + -0.112, + 5.971 + ], + [ + -0.211, + 5.963 + ], + [ + -0.321, + 6.17 + ], + [ + -0.488, + 6.29 + ], + [ + -0.56, + 6.421 + ], + [ + -0.752, + 6.533 + ], + [ + -0.867, + 6.607 + ], + [ + -1.101, + 6.585 + ], + [ + -1.304, + 6.623 + ], + [ + -1.461, + 6.727 + ], + [ + -1.628, + 6.713 + ] + ] + }, + "properties": { + "id": "1", + "name": "Accra to Kumasi", + "start": { + "id": "1", + "name": "Accra", + "location": { + "type": "Point", + "coordinates": [ + -0.174, + 5.625 + ] + }, + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222" + } + }, + "end": { + "id": "2", + "name": "Kumasi", + "status": "operational", + "location": { + "type": "Point", + "coordinates": [ + -1.628, + 6.711 + ] + }, + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222" + } + }, + "physicalInfrastructureProvider": { + "id": "GH-RGD-CS111111111", + "name": "FibreCo" + }, + "networkProvider": { + "id": "GH-RGD-CS222222222", + "name": "FastWeb" + }, + "network": { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network" + } + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/phases_1.meta.expected.json b/tests/fixtures/geojson_to_json/phases_1.meta.expected.json index 2f20880..0a2b59b 100644 --- a/tests/fixtures/geojson_to_json/phases_1.meta.expected.json +++ b/tests/fixtures/geojson_to_json/phases_1.meta.expected.json @@ -96,5 +96,7 @@ "/networks/phases/description": { "count": 1 } - } + }, + "inconsistent_phases_by_network_id": {}, + "inconsistent_organisations_by_network_id": {} } \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/phases_inconsistent_1.expected.json b/tests/fixtures/geojson_to_json/phases_inconsistent_1.expected.json new file mode 100644 index 0000000..08ac39a --- /dev/null +++ b/tests/fixtures/geojson_to_json/phases_inconsistent_1.expected.json @@ -0,0 +1,126 @@ +{ + "networks": [ + { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network", + "contracts": [ + { + "id": "1", + "title": "NextGen Phase 1 Construction Contract", + "description": "Contract for the construction of phase 1 of the NextGen network.", + "relatedPhases": [ + { + "id": "1" + } + ] + } + ], + "nodes": [ + { + "id": "1", + "name": "Accra", + "phase": { + "id": "1" + }, + "location": { + "type": "Point", + "coordinates": [ + -0.174, + 5.625 + ] + } + }, + { + "id": "2", + "name": "Kumasi", + "status": "operational", + "phase": { + "id": "1" + }, + "location": { + "type": "Point", + "coordinates": [ + -1.628, + 6.711 + ] + } + } + ], + "spans": [ + { + "id": "1", + "name": "Accra to Kumasi", + "start": "1", + "end": "2", + "phase": { + "id": "1" + }, + "route": { + "type": "LineString", + "coordinates": [ + [ + -0.173, + 5.626 + ], + [ + -0.178, + 5.807 + ], + [ + -0.112, + 5.971 + ], + [ + -0.211, + 5.963 + ], + [ + -0.321, + 6.17 + ], + [ + -0.488, + 6.29 + ], + [ + -0.56, + 6.421 + ], + [ + -0.752, + 6.533 + ], + [ + -0.867, + 6.607 + ], + [ + -1.101, + 6.585 + ], + [ + -1.304, + 6.623 + ], + [ + -1.461, + 6.727 + ], + [ + -1.628, + 6.713 + ] + ] + } + } + ], + "phases": [ + { + "id": "1", + "name": "NextGen Phase 1", + "description": "The first phase of the Ghana Fibre Network NextGen roll-out." + } + ] + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/phases_inconsistent_1.meta.expected.json b/tests/fixtures/geojson_to_json/phases_inconsistent_1.meta.expected.json new file mode 100644 index 0000000..7a9a9f5 --- /dev/null +++ b/tests/fixtures/geojson_to_json/phases_inconsistent_1.meta.expected.json @@ -0,0 +1,108 @@ +{ + "output_field_coverage": { + "/networks": { + "count": 1 + }, + "/networks/id": { + "count": 1 + }, + "/networks/name": { + "count": 1 + }, + "/networks/contracts": { + "count": 1 + }, + "/networks/contracts/id": { + "count": 1 + }, + "/networks/contracts/title": { + "count": 1 + }, + "/networks/contracts/description": { + "count": 1 + }, + "/networks/contracts/relatedPhases": { + "count": 1 + }, + "/networks/contracts/relatedPhases/id": { + "count": 1 + }, + "/networks/nodes": { + "count": 1 + }, + "/networks/nodes/id": { + "count": 2 + }, + "/networks/nodes/name": { + "count": 2 + }, + "/networks/nodes/phase": { + "count": 2 + }, + "/networks/nodes/phase/id": { + "count": 2 + }, + "/networks/nodes/location": { + "count": 2 + }, + "/networks/nodes/location/type": { + "count": 2 + }, + "/networks/nodes/location/coordinates": { + "count": 2 + }, + "/networks/nodes/status": { + "count": 1 + }, + "/networks/spans": { + "count": 1 + }, + "/networks/spans/id": { + "count": 1 + }, + "/networks/spans/name": { + "count": 1 + }, + "/networks/spans/start": { + "count": 1 + }, + "/networks/spans/end": { + "count": 1 + }, + "/networks/spans/phase": { + "count": 1 + }, + "/networks/spans/phase/id": { + "count": 1 + }, + "/networks/spans/route": { + "count": 1 + }, + "/networks/spans/route/type": { + "count": 1 + }, + "/networks/spans/route/coordinates": { + "count": 1 + }, + "/networks/phases": { + "count": 1 + }, + "/networks/phases/id": { + "count": 1 + }, + "/networks/phases/name": { + "count": 1 + }, + "/networks/phases/description": { + "count": 1 + } + }, + "inconsistent_phases_by_network_id": { + "a096d627-72e1-4f9b-b129-951b1737bff4": { + "phase_ids": [ + "1" + ] + } + }, + "inconsistent_organisations_by_network_id": {} +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/phases_inconsistent_1.nodes.geo.json b/tests/fixtures/geojson_to_json/phases_inconsistent_1.nodes.geo.json new file mode 100644 index 0000000..b25df74 --- /dev/null +++ b/tests/fixtures/geojson_to_json/phases_inconsistent_1.nodes.geo.json @@ -0,0 +1,80 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -0.174, + 5.625 + ] + }, + "properties": { + "id": "1", + "name": "Accra", + "phase": { + "id": "1", + "name": "NextGen Phase 1", + "description": "The first phase of the Ghana Fibre Network NextGen roll-out." + }, + "network": { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network", + "contracts": [ + { + "id": "1", + "title": "NextGen Phase 1 Construction Contract", + "description": "Contract for the construction of phase 1 of the NextGen network.", + "relatedPhases": [ + { + "id": "1", + "name": "NextGen Phase 1", + "description": "The first phase of the Ghana Fibre Network NextGen roll-out." + } + ] + } + ] + } + } + }, + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -1.628, + 6.711 + ] + }, + "properties": { + "id": "2", + "name": "Kumasi", + "status": "operational", + "phase": { + "id": "1", + "name": "NextGen Phase the first", + "description": "The starting phase of the Ghana Fibre Network NextGen roll-out." + }, + "network": { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network", + "contracts": [ + { + "id": "1", + "title": "NextGen Phase 1 Construction Contract", + "description": "Contract for the construction of phase 1 of the NextGen network.", + "relatedPhases": [ + { + "id": "1", + "name": "NextGen Phase 1", + "description": "The first phase of the Ghana Fibre Network NextGen roll-out." + } + ] + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/geojson_to_json/phases_inconsistent_1.spans.geo.json b/tests/fixtures/geojson_to_json/phases_inconsistent_1.spans.geo.json new file mode 100644 index 0000000..1b21102 --- /dev/null +++ b/tests/fixtures/geojson_to_json/phases_inconsistent_1.spans.geo.json @@ -0,0 +1,121 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -0.173, + 5.626 + ], + [ + -0.178, + 5.807 + ], + [ + -0.112, + 5.971 + ], + [ + -0.211, + 5.963 + ], + [ + -0.321, + 6.17 + ], + [ + -0.488, + 6.29 + ], + [ + -0.56, + 6.421 + ], + [ + -0.752, + 6.533 + ], + [ + -0.867, + 6.607 + ], + [ + -1.101, + 6.585 + ], + [ + -1.304, + 6.623 + ], + [ + -1.461, + 6.727 + ], + [ + -1.628, + 6.713 + ] + ] + }, + "properties": { + "id": "1", + "name": "Accra to Kumasi", + "start": { + "id": "1", + "name": "Accra", + "location": { + "type": "Point", + "coordinates": [ + -0.174, + 5.625 + ] + }, + "phase": { + "id": "1" + } + }, + "end": { + "id": "2", + "name": "Kumasi", + "status": "operational", + "location": { + "type": "Point", + "coordinates": [ + -1.628, + 6.711 + ] + }, + "phase": { + "id": "1" + } + }, + "phase": { + "id": "1", + "name": "NextGen Phase 1", + "description": "The first phase of the Ghana Fibre Network NextGen roll-out." + }, + "network": { + "id": "a096d627-72e1-4f9b-b129-951b1737bff4", + "name": "Ghana Fibre Network", + "contracts": [ + { + "id": "1", + "title": "NextGen Phase 1 Construction Contract", + "description": "Contract for the construction of phase 1 of the NextGen network.", + "relatedPhases": [ + { + "id": "1", + "name": "NextGen Phase 1", + "description": "The first phase of the Ghana Fibre Network NextGen roll-out." + } + ] + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/tests/test_geojson_to_json.py b/tests/test_geojson_to_json.py index 8e89650..c7bae86 100644 --- a/tests/test_geojson_to_json.py +++ b/tests/test_geojson_to_json.py @@ -13,6 +13,9 @@ # sort references to things correctly ("phases_1"), ("organisations_1"), + # Check for errors in meta + ("phases_inconsistent_1"), + ("organisations_inconsistent_1"), ]