Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
Main Cherrypick (#159)
Browse files Browse the repository at this point in the history
* backend: add route description field

* backend: add description to routes response

* backend: parse description from route kml

New location tracker (#146)

* backend: add location tracker db models

* backend: use db w/location posting

* backend: reimplement location subscription

* backend: remove vantracker

* backend: refactor

* backend: more refactoring

* backend: more cleanup

* backend: fix tracker issues

* backend: more fixes

* backend: even more tracker fixes

* backend: remove vans and update analytics

* backend: fix analytics

* backend: kill sessions on kml upload

They are no longer accurate.

* backend: avoid crash w/invalid body

* backend: fix broken van filter

* backend: fix arrival backtracking

* backend: reject invalid route id body

* backend: misc cleanup

* backend: add error cases to van websockets

* backend: handle wraparound in candle

* backend: dont expose unknown errors in websocket

Not the best idea security-wise

* backend: reformat

* all: reformat

* backend: reformat

* backend: ill test things later

* backend: sa.func exists

* backend: pylint doesnt know how sqlalchemy works

* backend: fix black

* backend: pylint

* backend: black

* backend: reduce threshold time to 10s

Should help with "passby" stops where the van barely stops by something.

Need organic location data to confirm this.

* frontend: remove console.log

* backend: rebase fixes

backend: add stop/route include params (#153)

New frontend (#148)

* frontend: huge rework commit

This is not a good idea.

* frontend/backend: a whole day of random fixing

* frontend: show locations of living vans

* frontend: focus map on routes/stops

* frontend: add stop navigation from map

* frontend: reformat

* frontend: list padding & refresh

* frontend: more tweaks

* frontend: handle websocket errors

* frontend: fix van location query

* frontend: reduce type weirdness with errors

* frontend: document

* frontend: re-add bolded text

* all: have defined orders for child routes/stops

And add a closest stop header

* frontend: fix query text style application

* frontend: fix stop item order

* frontend: reformat

* frontend: reformat

* all: rebase fixes

* backend: remove stop/route include params

They were split into another PR.

add ios build num for 1.0.4

build: update deps & version code

backend: merge conflict

backend: format

Revert "backend: format"

This reverts commit 7fd3d70.

backend: reformat
  • Loading branch information
OxygenCobalt authored Apr 18, 2024
1 parent f748aae commit ae926f8
Show file tree
Hide file tree
Showing 77 changed files with 4,211 additions and 2,692 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"inlineChat.mode": "preview"
}
3 changes: 3 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"expo": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""create ridership analytics table
Revision ID: 3095ad90c23e
Revises: 3282eafd6bb4
Create Date: 2024-03-21 17:37:54.313073
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "3095ad90c23e"
down_revision: Union[str, None] = "3282eafd6bb4"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.execute(
"""
DROP TABLE IF EXISTS public.ridership;
"""
)
op.create_table(
"ridership_analytics",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column(
"session_id",
sa.Integer,
sa.ForeignKey("van_tracker_session.id", ondelete="CASCADE"),
nullable=False,
),
sa.Column(
"route_id",
sa.Integer,
sa.ForeignKey("routes.id", ondelete="CASCADE"),
nullable=False,
),
sa.Column("entered", sa.Integer, nullable=False),
sa.Column("exited", sa.Integer, nullable=False),
sa.Column("lat", sa.Float, nullable=False),
sa.Column("lon", sa.Float, nullable=False),
sa.Column("datetime", sa.DateTime(timezone=True), nullable=False),
sa.UniqueConstraint("session_id", "datetime"),
)


def downgrade() -> None:
op.create_table(
"ridership",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column(
"van_id",
sa.Integer,
sa.ForeignKey("vans.id", ondelete="CASCADE"),
nullable=False,
),
sa.Column(
"route_id",
sa.Integer,
sa.ForeignKey("routes.id", ondelete="CASCADE"),
nullable=False,
),
sa.Column("entered", sa.Integer, nullable=False),
sa.Column("exited", sa.Integer, nullable=False),
sa.Column("lat", sa.Float, nullable=False),
sa.Column("lon", sa.Float, nullable=False),
sa.Column("datetime", sa.DateTime(timezone=True), nullable=False),
sa.UniqueConstraint("van_id", "datetime"),
)
op.execute(
"""
DROP TABLE IF EXISTS public.ridership_analytics;
"""
)
43 changes: 43 additions & 0 deletions backend/alembic/versions/3282eafd6bb4_create_van_location_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""create van location table
Revision ID: 3282eafd6bb4
Revises: 43451376c0bf
Create Date: 2024-03-11 14:23:32.098485
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "3282eafd6bb4"
down_revision: Union[str, None] = "43451376c0bf"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.create_table(
"van_location",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column(
"created_at",
sa.DateTime,
nullable=False,
server_default=sa.func.now(), # pylint: disable=all
),
sa.Column("session_id", sa.Integer, nullable=False),
sa.Column("lat", sa.Float, nullable=False),
sa.Column("lon", sa.Float, nullable=False),
sa.ForeignKeyConstraint(["session_id"], ["van_tracker_session.id"]),
)


def downgrade() -> None:
op.execute(
"""
DROP TABLE van_location CASCADE;
"""
)
29 changes: 29 additions & 0 deletions backend/alembic/versions/4183de971218_add_route_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""add route description
Revision ID: 4183de971218
Revises: 8166e12f260c
Create Date: 2024-03-24 12:31:02.141874
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "4183de971218"
down_revision: Union[str, None] = "8b773adbb487"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.add_column(
"routes",
sa.Column("description", sa.String(255), nullable=False, server_default=""),
)


def downgrade() -> None:
op.drop_column("routes", "description")
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""create van tracker session table
Revision ID: 43451376c0bf
Revises: 8166e12f260c
Create Date: 2024-03-11 14:07:02.375363
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "43451376c0bf"
down_revision: Union[str, None] = "8166e12f260c"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.create_table(
"van_tracker_session",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column(
"created_at",
sa.DateTime,
nullable=False,
server_default=sa.func.now(), # pylint: disable=all
),
sa.Column(
"updated_at",
sa.DateTime,
nullable=False,
server_default=sa.func.now(),
onupdate=sa.func.now(),
),
sa.Column("van_guid", sa.String, nullable=False),
sa.Column("route_id", sa.Integer, nullable=False),
sa.Column("stop_index", sa.Integer, nullable=False, server_default="-1"),
sa.Column("dead", sa.Boolean, nullable=False, default=False),
)


def downgrade() -> None:
op.execute(
"""
DROP TABLE van_tracker_session CASCADE;
"""
)
35 changes: 35 additions & 0 deletions backend/alembic/versions/8b773adbb487_drop_van_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""drop van table
Revision ID: 8b773adbb487
Revises: 3095ad90c23e
Create Date: 2024-03-21 17:52:31.297787
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "8b773adbb487"
down_revision: Union[str, None] = "3095ad90c23e"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.execute(
"""
DROP TABLE IF EXISTS public.vans CASCADE;
"""
)


def downgrade() -> None:
op.create_table(
"vans",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column("route_id", sa.Integer, sa.ForeignKey("routes.id"), nullable=True),
sa.Column("guid", sa.String(15), nullable=False),
)
Loading

0 comments on commit ae926f8

Please sign in to comment.