Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "New York City" geoname entry to match our incident database entries #1797

Open
chigby opened this issue Nov 21, 2023 · 0 comments
Open

Comments

@chigby
Copy link
Contributor

chigby commented Nov 21, 2023

In our incidents database, there are a number of incidents with the city field set to New York. There is no corresponding geoname for this city. The one in the geonames.geonames table is New York City. We want to update the geoname to match our use of the city name.

In my opinion, this is best done by running this query:

UPDATE geonames_geoname SET name = 'New York' WHERE name = 'New York City';

In the Django shell, this is:

from geonames.models import GeoName
GeoName.objects.filter(name="New York City").update(name="New York")

To fix the incidents currently in production:

  1. Run the above query/shell commands.
  2. Either:
    • Run the ./manage.py populate_geodata command. This will update all incidents to have their lat/long data reflect the updated geonames DB, including the ones with the city "New York"
    • Refresh the incident lat/long data one-by-one loading the ones you want to fix in the wagtail editor and issuing a "Publish" command.

Additionally, we will want to apply this change everywhere we can, so we should update the fixtures to use the correct name.

The easiest way to do this is to:

  1. Ensure that the fixtures have been loaded in the local dev environment (docker compose exec django ./manage.py loaddata --app geonames cities500-us-only.json.xz)
  2. Update the DB using the query or shell commands from above.
  3. Regenerate the fixtures: docker compose exec django ./manage.py dumpdata geonames -o geonames/fixtures/cities500-us-only.json.xz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant