From 80519bbb53b7791a97dab13618765c115c685b7d Mon Sep 17 00:00:00 2001 From: Natalie Schultz <90212258+nataliejschultz@users.noreply.github.com> Date: Mon, 9 Oct 2023 17:03:11 -0600 Subject: [PATCH] Cleanup After last push, now that I know it works, removing some unnecessary things and reinstating the testing schedule. --- .github/workflows/nominatim-docker-test.yml | 18 +++++++----------- emission/individual_tests/TestNominatim.py | 14 -------------- emission/net/ext_service/geocoder/nominatim.py | 3 +-- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/.github/workflows/nominatim-docker-test.yml b/.github/workflows/nominatim-docker-test.yml index 7c15657c7..6b3a168db 100644 --- a/.github/workflows/nominatim-docker-test.yml +++ b/.github/workflows/nominatim-docker-test.yml @@ -3,20 +3,16 @@ name: nominatim-docker-test # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - # pull_request: - # branches: - # - master + push: - branches: - - nominatim - # paths: - # - 'net/ext_service/geocoder' - # - 'analysis/intake/cleaning/clean_and_resample.py' + paths: + - 'net/ext_service/geocoder' + - 'analysis/intake/cleaning/clean_and_resample.py' - # schedule: + schedule: - # # Run every Sunday at 4:05 am - # - cron: '5 4 * * 0' + # Run every Sunday at 4:05 am + - cron: '5 4 * * 0' jobs: # This workflow contains a single job called "build" build: diff --git a/emission/individual_tests/TestNominatim.py b/emission/individual_tests/TestNominatim.py index b9b19c77f..22fb02fbb 100644 --- a/emission/individual_tests/TestNominatim.py +++ b/emission/individual_tests/TestNominatim.py @@ -19,12 +19,6 @@ GEOFABRIK_QUERY_URL = os.environ.get("GEOFABRIK_QUERY_URL") NOMINATIM_CONTAINER_URL = os.environ.get("NOMINATIM_CONTAINER_URL") -# GFBK = os.environ.get("GFBK_KEY") - -# GEOFABRIK_QUERY_URL = ( -# "https://geocoding.geofabrik.de/{}".format(GFBK) if GFBK is not None -# else print("No key available") -# ) class NominatimTest(unittest.TestCase): maxDiff = None @@ -56,14 +50,6 @@ def test_geofabrik_and_nominatim(self): for k in key_list: self.assertEqual(osm_result[k], geofabrik_result[k]) self.assertEqual(container_result[k], geofabrik_result[k]) - - # #Compares the result of a call to OSM with a call to the container. - # def test_nominatim_api(self): - # nominatim_url = "http://nominatim.openstreetmap.org/reverse?lat=41.832942092439694&lon=-71.41558148857203&format=json" - # nominatim_result_raw = requests.get(nominatim_url) - # nominatim_result = nominatim_result_raw.json()['display_name'][0:70] - # container_result = eco.Geocoder.reverse_geocode(41.832942092439694, -71.41558148857203)[0:70] - # self.assertEqual(nominatim_result, container_result) #Checks the display name generated by get_filtered_place in clean_and_resample.py, which creates a cleaned place from the fake place # and reverse geocodes with the coordinates. diff --git a/emission/net/ext_service/geocoder/nominatim.py b/emission/net/ext_service/geocoder/nominatim.py index e20e093a3..01299313f 100644 --- a/emission/net/ext_service/geocoder/nominatim.py +++ b/emission/net/ext_service/geocoder/nominatim.py @@ -15,7 +15,7 @@ try: NOMINATIM_QUERY_URL = os.environ.get("NOMINATIM_QUERY_URL") # logging.info(f"NOMINATIM_QUERY_URL: {NOMINATIM_QUERY_URL}") - print("URL Configured:", NOMINATIM_QUERY_URL) + print("Nominatim Query URL Configured!") if NOMINATIM_QUERY_URL is None: raise Exception("Nominatim query url not configured") @@ -61,7 +61,6 @@ def make_url_reverse(cls, lat, lon): "lon" : lon, "format" : "json" } - query_url = NOMINATIM_QUERY_URL + "/reverse?" encoded_params = urllib.parse.urlencode(params) url = query_url + encoded_params