Skip to content

Commit

Permalink
Merge pull request #215 from alexjball/load-coords
Browse files Browse the repository at this point in the history
  • Loading branch information
JMStudiosJoe committed Nov 29, 2021
2 parents a1a0d88 + 5596b7d commit 6e67ac3
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 211 deletions.
24 changes: 13 additions & 11 deletions alembic/dev_seeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create_user(user):
role=UserRole.PUBLIC,
first_name="Test",
last_name="Example",
phone_number="(123) 456-7890"
phone_number="(123) 456-7890",
)
)

Expand All @@ -33,7 +33,7 @@ def create_user(user):
role=UserRole.CONTRIBUTOR,
first_name="Contributor",
last_name="Example",
phone_number="(123) 456-7890"
phone_number="(123) 456-7890",
)
)

Expand All @@ -60,12 +60,14 @@ def create_user(user):
)


def create_incident(key=1, date="10-01-2019"):
def create_incident(key=1, date="10-01-2019", lon=84, lat=34):
base_id = 10000000
id = base_id + key
incident = Incident(
id=id,
location=f"Test location {key}",
longitude=lon,
latitude=lat,
description=f"Test description {key}",
department=f"Small Police Department {key}",
time_of_incident=f"{date} 00:00:00",
Expand All @@ -84,11 +86,11 @@ def create_incident(key=1, date="10-01-2019"):
incident.create()


create_incident(key=1, date="10-01-2019")
create_incident(key=2, date="11-01-2019")
create_incident(key=3, date="12-01-2019")
create_incident(key=4, date="03-15-2020")
create_incident(key=5, date="04-15-2020")
create_incident(key=6, date="08-10-2020")
create_incident(key=7, date="10-01-2020")
create_incident(key=8, date="10-15-2020")
create_incident(key=1, date="10-01-2019", lon=-84.362576, lat=33.7589748)
create_incident(key=2, date="11-01-2019", lon=-118.1861128, lat=33.76702)
create_incident(key=3, date="12-01-2019", lon=-117.8827321, lat=33.800308)
create_incident(key=4, date="03-15-2020", lon=-118.1690197, lat=33.8338271)
create_incident(key=5, date="04-15-2020", lon=-83.9007382, lat=33.8389977)
create_incident(key=6, date="08-10-2020", lon=-84.2687574, lat=33.9009798)
create_incident(key=7, date="10-01-2020", lon=-118.40853, lat=33.9415889)
create_incident(key=8, date="10-15-2020", lon=-84.032149, lat=33.967774)
3 changes: 3 additions & 0 deletions backend/database/models/incident.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Incident(db.Model, CrudMixin, SourceMixin):
complaint_date = db.Column(db.Date)
closed_date = db.Column(db.Date)
location = db.Column(db.Text) # TODO: location object
# Float is double precision (8 bytes) by default in Postgres
longitude = db.Column(db.Float)
latitude = db.Column(db.Float)
# TODO: neighborhood seems like a weird identifier that may not always
# apply in consistent ways across municipalities.
neighborhood = db.Column(db.Text)
Expand Down
Loading

0 comments on commit 6e67ac3

Please sign in to comment.