Skip to content

Commit

Permalink
Slimming down data files (#361)
Browse files Browse the repository at this point in the history
* Change 632 "Leuchturm":		 Location from: 54.1798, 12.0796 to: 54.1814, 12.0855

* Refactor: remove longitude and latitude fields

* Fix: undo wrong formatting

* Fix app.py

* rm lon and lat fields from hook

* Change 712 "Wasserkirche Zurich":		Title from: Wasserkirche (Zürich) to: Wasserkirche Zurich

* Change 711 "Ütliberg Kulm":		Title from: Ã�tliberg Kulm to: Ütliberg Kulm		Address from: 8143 Zurich/Zürich, Switzerland to: 8143 Zurich/Zürich, Switzerland		 Location from: 47.3497, 8.4915 to: 47.3497, 8.4915

* Change 725 "Alpamare Pfäffikon":		 Location from: 47.1992, 8.7912 to: 47.1955, 8.7916

* Change 712 "Wasserkirche (Zürich)":	Machine with pending changes is getting changed *AGAIN* @jannisborn @NinaWie:		Title from: Wasserkirche Zurich to: Wasserkirche (Zürich)		 Location from: 47.3703, 8.5433 to: 47.3706, 8.5431

* revert changes from tests
  • Loading branch information
NinaWie authored Oct 26, 2024
1 parent 34ee916 commit 787fa3f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 19,999 deletions.
6 changes: 0 additions & 6 deletions .hooks/check_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

def check_data(data: List[Dict[str, Any]], name: str):
for x in data["features"]:
assert isinstance(
x["properties"]["latitude"], str
), f"In {name} file did not find str for coordinates for ID = {x['properties']['id']}"
assert isinstance(
x["properties"]["longitude"], str
), f"In {name} file did not find str for coordinates for ID = {x['properties']['id']}"
assert isinstance(
x["geometry"]["coordinates"][0], float
), f"In {name} file did not find float for coordinates for ID = {x['properties']['id']}"
Expand Down
4 changes: 0 additions & 4 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,6 @@ def create_machine():
"status": "unvisited",
"external_url": "null",
"internal_url": "null",
"latitude": location[1],
"longitude": location[0],
"machine_status": "available",
"id": tmp_id, # to be updated later
"last_updated": str(datetime.today()).split(" ")[0],
Expand Down Expand Up @@ -415,8 +413,6 @@ def change_machine():

# adapt dictionary entries
updated_machine_entry["properties"]["address"] = address
updated_machine_entry["properties"]["latitude"] = str(latitude)
updated_machine_entry["properties"]["longitude"] = str(longitude)
updated_machine_entry["geometry"]["coordinates"] = [longitude, latitude]
if address != old_address:
msg += f"\tAddress from: {old_address} to: {address}\n"
Expand Down
48 changes: 0 additions & 48 deletions backend/pennyme/geojson.py

This file was deleted.

2 changes: 0 additions & 2 deletions backend/pennyme/osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ def osm_to_geojson(result: overpy.Result) -> Dict[str, Any]:
"status": "unvisited",
"external_url": url,
"internal_url": "null",
"latitude": str(machine.lat),
"longitude": str(machine.lon),
"machine_status": "available",
"id": -1,
"last_updated": -1,
Expand Down
2 changes: 0 additions & 2 deletions backend/pennyme/pennycollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ def get_prelim_geojson(
"status": "unvisited",
"external_url": link,
"internal_url": "null",
"latitude": "N.A.",
"longitude": "N.A.",
"machine_status": state,
"id": -1,
},
Expand Down
6 changes: 3 additions & 3 deletions backend/scripts/location_differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ def location_differ(
geojson["properties"]["name"]
)
url = geojson["properties"]["external_url"]
if url == "null" or "209.221.138.252" not in url:
if "209.221.138.252" not in url:
entry = geojson["properties"].copy()
entry["source"] = "Server"
entry["data_idx"] = i
entry["longitude"] = geojson["geometry"]["coordinates"][0]
entry["latitude"] = geojson["geometry"]["coordinates"][1]
external_list.append(entry)
elif url not in server_dict.keys():
server_dict[url] = [geojson]
Expand Down Expand Up @@ -649,8 +651,6 @@ def location_differ(
api=gmaps,
)

geojson["properties"]["latitude"] = str(lat)
geojson["properties"]["longitude"] = str(lng)
geojson["geometry"]["coordinates"] = [lng, lat]
geojson["properties"]["last_updated"] = today
geojson["properties"]["id"] = machine_idx
Expand Down
Loading

0 comments on commit 787fa3f

Please sign in to comment.