Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6b9dff2
adding table models for new cbs fields
tkalir Feb 2, 2026
2d25d22
adding alembic migration for new dictionary tables
tkalir Feb 2, 2026
05a55ca
adding intersection columns
tkalir Feb 10, 2026
f511ead
adding junction and junction_arm tables
tkalir Feb 10, 2026
35ad180
adding alembic migration for junction and junction_arm
tkalir Feb 10, 2026
feafff1
adding new cbs static junction files
tkalir Feb 10, 2026
83210b1
adding junction parser
tkalir Feb 11, 2026
cce3cce
Merge pull request #2904 from tkalir/new-cbs-format-reading-junction-…
tkalir Feb 11, 2026
4df1280
removing old junction columns
tkalir Feb 11, 2026
437336f
Merge branch 'new-cbs-format' of https://github.com/data-for-change/a…
tkalir Feb 12, 2026
3c723b8
Merge pull request #2905 from tkalir/new-cbs-format-removing-old-junc…
tkalir Feb 12, 2026
fc03964
removing usage of unit field
tkalir Feb 12, 2026
d802726
removing police unit columns
tkalir Feb 12, 2026
5022ea9
Merge pull request #2906 from tkalir/new-cbs-format-remove-unit-field
tkalir Feb 12, 2026
b5007ce
removing road shape usage and columns
tkalir Feb 12, 2026
a3d8d25
adding migration to remove road_shape
tkalir Feb 12, 2026
c7d227f
Merge pull request #2907 from tkalir/new-cbs-format-removing-road-shape
tkalir Feb 12, 2026
2c3bd84
removing road shape usage and columns
tkalir Feb 12, 2026
c44aa7c
adding migration to remove road sign columns
tkalir Feb 12, 2026
dbf696d
Merge pull request #2908 from tkalir/new-cbs-format-removing-road-sign
tkalir Feb 12, 2026
030086c
removing vehicle status column usage
tkalir Feb 12, 2026
1ac46ba
adding migration file for removing vehicle status columns
tkalir Feb 12, 2026
b15643e
adding cross columns to involved
tkalir Feb 12, 2026
3b9a635
moving cross columns from markers to involved
tkalir Feb 12, 2026
d238293
adding migration for removing cross columns
tkalir Feb 12, 2026
21cf76a
Merge pull request #2909 from tkalir/new-cbs-column-moving-cross-colu…
tkalir Feb 12, 2026
5577a5b
adding new columns to markers tables
tkalir Feb 13, 2026
049847e
Merge pull request #2911 from tkalir/new-cbs-format-adding-accident-c…
tkalir Feb 13, 2026
d74687a
adding new vehicle types
tkalir Feb 17, 2026
41f27c5
Merge pull request #2912 from tkalir/new-cbs-format-add-new-vehicel-t…
tkalir Feb 17, 2026
006000d
adjust parser for new format
tkalir Feb 18, 2026
b9318ea
extracting cbs dictionary handling
tkalir Feb 19, 2026
0f3928e
Merge pull request #2913 from tkalir/new-cbs-format-adjust-parser
tkalir Feb 19, 2026
9e86940
Merge pull request #2914 from data-for-change/dev
tkalir Feb 19, 2026
5a1b205
Update deploy conditions for new-cbs-format branch
tkalir Feb 19, 2026
b2c0897
trigger ci
tkalir Feb 19, 2026
2d37fd9
trigger deploy via push to new-cbs-format
tkalir Feb 19, 2026
b5c8576
trigger ci
tkalir Feb 21, 2026
85153be
Merge branch 'new-cbs-format' of https://github.com/data-for-change/a…
tkalir Feb 21, 2026
dc7b226
trigger deployment
tkalir Feb 22, 2026
c3b816c
fix deployment workflow for new-cbs-format
tkalir Feb 22, 2026
3193e8a
trigger deployment
tkalir Feb 22, 2026
67ca13b
fix streets dict read
tkalir Feb 22, 2026
1d8ee20
fix streets dict read
tkalir Feb 22, 2026
bbd0d2d
fix streets dict read
tkalir Feb 22, 2026
3a9189e
changing safety_data_accident vehicles to bigint
tkalir Feb 24, 2026
8e64163
fixing support for new vehicle values
tkalir Feb 24, 2026
bba9e6b
updated injured_type list in involved_query
tkalir Feb 25, 2026
084fe19
Merge pull request #2915 from tkalir/new-cbs-format-fix-involved-quer…
tkalir Feb 25, 2026
ee2ac8a
Fix bitwise shift operation for vehicle type
tkalir Mar 4, 2026
eae61e2
Add street1 and street2 to involved query result.
ziv17 Apr 10, 2026
7d34970
Merge pull request #2916 from ziv17/new-cbs-format
ziv17 Apr 10, 2026
e9f669a
adding electric motorcycle to vehicle types
tkalir Apr 14, 2026
b72b699
allowing missing year\provider code on cbs data update
tkalir Apr 14, 2026
bced9f7
Merge pull request #2918 from tkalir/new-cbs-format-allow-missing-files
tkalir Apr 14, 2026
a431c0e
Add support for safety-data.dfc2.anyway.co.il
ziv17 May 11, 2026
289efcd
Handle error in getting osm data while loading CBS cities data
ziv17 May 12, 2026
5282ca1
Upgrade Python to 3.10
ziv17 May 27, 2026
ef2c36f
check without change in executor.py
ziv17 Jun 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.10'
- name: Install Dependencies
run: |
pip install -r test_requirements.txt
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches:
- master
- dev
- new-cbs-format
env:
DOCKER_REPOSITORY_ANYWAY: "${{ github.repository }}/anyway"
DOCKER_REPOSITORY_DB: "${{ github.repository }}/db"
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
DFC_IAC_DEPLOY_KEY: ${{ secrets.DFC_IAC_DEPLOY_KEY }}
ANYWAY_ETL_DEPLOY_KEY: ${{ secrets.ANYWAY_ETL_DEPLOY_KEY }}
run: |
if [ "${GITHUB_REF}" == "refs/heads/master" ] || [ "${GITHUB_REF}" == "refs/heads/dev" ]; then
if [ "${GITHUB_REF}" == "refs/heads/master" ] || [ "${GITHUB_REF}" == "refs/heads/new-cbs-format" ]; then
SHA_TAG=sha-`git rev-parse --short $GITHUB_SHA` &&\
echo SHA_TAG=$SHA_TAG &&\
ANYWAY_IMAGE="${DOCKER_REPOSITORY_ANYWAY}:${SHA_TAG}" &&\
Expand All @@ -102,7 +102,7 @@ jobs:
if ! git log -1 --pretty=format:"%s" | grep -- --no-deploy; then
git config --global user.name "Anyway CI" &&\
git config --global user.email "anyway-ci@localhost" &&\
if [ "${GITHUB_REF}" == "refs/heads/master" ] || [ "${GITHUB_REF}" == "refs/heads/dev" ]; then
if [ "${GITHUB_REF}" == "refs/heads/master" ] || [ "${GITHUB_REF}" == "refs/heads/new-cbs-format" ]; then
cd `mktemp -d` &&\
echo "${DFC_IAC_DEPLOY_KEY}" > dfc_iac_deploy_key &&\
chmod 400 dfc_iac_deploy_key &&\
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ venv

/.vscode
/.env*
/.devcontainer


GOOGLE_APPLICATION_CREDENTIALS_KEY.json
15 changes: 6 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
FROM ubuntu:20.04 AS builder
FROM python:3.10-slim-bookworm AS builder

# Install system tools
RUN apt-get clean && \
apt-get -y update && \
apt-get install -y \
python3-dev \
build-essential \
libpq-dev \
virtualenv && \
binutils \
postgresql-client && \
apt-get clean

WORKDIR /anyway

COPY requirements.txt /anyway

# We create the venv inside a builder container to avoid pulling in build deps into final image
RUN virtualenv /venv3 -p python3
RUN python -m venv /venv3
RUN . /venv3/bin/activate && \
pip install -U setuptools wheel && \
pip install --upgrade pip && \
Expand All @@ -24,13 +24,12 @@ RUN . /venv3/bin/activate && \
RUN find /venv3 -name '*.so' | xargs strip


FROM ubuntu:20.04 AS runtime
FROM python:3.10-slim-bookworm AS runtime

RUN apt-get clean && \
apt-get -y update && \
apt-get install -y \
postgresql-client \
virtualenv && \
postgresql-client && \
apt-get clean

WORKDIR /anyway
Expand All @@ -47,7 +46,5 @@ COPY . /anyway

EXPOSE 5000

RUN flask assets clean

ENTRYPOINT ["/anyway/docker-entrypoint.sh"]
CMD FLASK_APP=anyway flask run --host 0.0.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""removing cross columns from markers

Revision ID: 205025444ebe
Revises: 237ab8f171d0
Create Date: 2026-02-12 21:29:57.945021
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "205025444ebe"
down_revision = "237ab8f171d0"
branch_labels = None
depends_on = None


def upgrade():
# markers
op.drop_column("markers", "cross_location")
op.drop_column("markers", "cross_direction")
op.drop_column("markers", "didnt_cross")
op.drop_column("markers", "cross_mode")

# markers_hebrew
op.drop_column("markers_hebrew", "cross_location")
op.drop_column("markers_hebrew", "cross_direction")
op.drop_column("markers_hebrew", "didnt_cross")
op.drop_column("markers_hebrew", "cross_mode")

op.drop_column("markers_hebrew", "cross_location_hebrew")
op.drop_column("markers_hebrew", "cross_direction_hebrew")
op.drop_column("markers_hebrew", "didnt_cross_hebrew")
op.drop_column("markers_hebrew", "cross_mode_hebrew")

# vehicles_markers_hebrew
op.drop_column("vehicles_markers_hebrew", "cross_location")
op.drop_column("vehicles_markers_hebrew", "cross_direction")
op.drop_column("vehicles_markers_hebrew", "didnt_cross")
op.drop_column("vehicles_markers_hebrew", "cross_mode")

op.drop_column("vehicles_markers_hebrew", "cross_location_hebrew")
op.drop_column("vehicles_markers_hebrew", "cross_direction_hebrew")
op.drop_column("vehicles_markers_hebrew", "didnt_cross_hebrew")
op.drop_column("vehicles_markers_hebrew", "cross_mode_hebrew")


def downgrade():
# markers
op.add_column("markers", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("markers", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("markers", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("markers", sa.Column("cross_mode", sa.Integer(), nullable=True))

# markers_hebrew
op.add_column("markers_hebrew", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("markers_hebrew", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_mode", sa.Integer(), nullable=True))

op.add_column("markers_hebrew", sa.Column("cross_location_hebrew", sa.Text(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_direction_hebrew", sa.Text(), nullable=True))
op.add_column("markers_hebrew", sa.Column("didnt_cross_hebrew", sa.Text(), nullable=True))
op.add_column("markers_hebrew", sa.Column("cross_mode_hebrew", sa.Text(), nullable=True))

# vehicles_markers_hebrew
op.add_column("vehicles_markers_hebrew", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_mode", sa.Integer(), nullable=True))

op.add_column("vehicles_markers_hebrew", sa.Column("cross_location_hebrew", sa.Text(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_direction_hebrew", sa.Text(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("didnt_cross_hebrew", sa.Text(), nullable=True))
op.add_column("vehicles_markers_hebrew", sa.Column("cross_mode_hebrew", sa.Text(), nullable=True))
54 changes: 54 additions & 0 deletions alembic/versions/237ab8f171d0_adding_cross_columns_to_involved.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""adding cross columns to involved

Revision ID: 237ab8f171d0
Revises: ef951922e4ef
Create Date: 2026-02-12 20:56:58.410115
"""

from alembic import op
import sqlalchemy as sa

# revision identifiers, used by Alembic.
revision = "237ab8f171d0"
down_revision = "ef951922e4ef"
branch_labels = None
depends_on = None


def upgrade():
# involved (raw)
op.add_column("involved", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("involved", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("involved", sa.Column("cross_mode", sa.Integer(), nullable=True))
op.add_column("involved", sa.Column("didnt_cross", sa.Integer(), nullable=True))

# involved_hebrew (decorated)
op.add_column("involved_hebrew", sa.Column("cross_direction", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("cross_direction_hebrew", sa.Text(), nullable=True))

op.add_column("involved_hebrew", sa.Column("cross_location", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("cross_location_hebrew", sa.Text(), nullable=True))

op.add_column("involved_hebrew", sa.Column("cross_mode", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("cross_mode_hebrew", sa.Text(), nullable=True))

op.add_column("involved_hebrew", sa.Column("didnt_cross", sa.Integer(), nullable=True))
op.add_column("involved_hebrew", sa.Column("didnt_cross_hebrew", sa.Text(), nullable=True))


def downgrade():
# involved_hebrew
op.drop_column("involved_hebrew", "didnt_cross_hebrew")
op.drop_column("involved_hebrew", "didnt_cross")
op.drop_column("involved_hebrew", "cross_mode_hebrew")
op.drop_column("involved_hebrew", "cross_mode")
op.drop_column("involved_hebrew", "cross_location_hebrew")
op.drop_column("involved_hebrew", "cross_location")
op.drop_column("involved_hebrew", "cross_direction_hebrew")
op.drop_column("involved_hebrew", "cross_direction")

# involved
op.drop_column("involved", "didnt_cross")
op.drop_column("involved", "cross_mode")
op.drop_column("involved", "cross_location")
op.drop_column("involved", "cross_direction")
96 changes: 96 additions & 0 deletions alembic/versions/333a785776cd_add_new_dictionary_tables.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
"""Add new dictionary tables

Revision ID: 333a785776cd
Revises: b7c8d9e0f1a2
Create Date: 2026-02-02 17:47:20.438985

"""

# revision identifiers, used by Alembic.
revision = '333a785776cd'
down_revision = 'b7c8d9e0f1a2'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('entrance_exit',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('entrance_exit_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_entrance_exit_id'), 'entrance_exit', ['id'], unique=False)
op.create_index(op.f('ix_entrance_exit_provider_code'), 'entrance_exit', ['provider_code'], unique=False)
op.create_index(op.f('ix_entrance_exit_year'), 'entrance_exit', ['year'], unique=False)
op.create_table('infrastructure_type',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('infrastructure_type_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_infrastructure_type_id'), 'infrastructure_type', ['id'], unique=False)
op.create_index(op.f('ix_infrastructure_type_provider_code'), 'infrastructure_type', ['provider_code'], unique=False)
op.create_index(op.f('ix_infrastructure_type_year'), 'infrastructure_type', ['year'], unique=False)
op.create_table('road_alignment',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('road_alignment_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_road_alignment_id'), 'road_alignment', ['id'], unique=False)
op.create_index(op.f('ix_road_alignment_provider_code'), 'road_alignment', ['provider_code'], unique=False)
op.create_index(op.f('ix_road_alignment_year'), 'road_alignment', ['year'], unique=False)
op.create_table('road_geometry',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('road_geometry_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_road_geometry_id'), 'road_geometry', ['id'], unique=False)
op.create_index(op.f('ix_road_geometry_provider_code'), 'road_geometry', ['provider_code'], unique=False)
op.create_index(op.f('ix_road_geometry_year'), 'road_geometry', ['year'], unique=False)
op.create_table('vehicle_purpose',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('year', sa.Integer(), nullable=False),
sa.Column('provider_code', sa.Integer(), nullable=False),
sa.Column('vehicle_purpose_hebrew', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id', 'year', 'provider_code')
)
op.create_index(op.f('ix_vehicle_purpose_id'), 'vehicle_purpose', ['id'], unique=False)
op.create_index(op.f('ix_vehicle_purpose_provider_code'), 'vehicle_purpose', ['provider_code'], unique=False)
op.create_index(op.f('ix_vehicle_purpose_year'), 'vehicle_purpose', ['year'], unique=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_vehicle_purpose_year'), table_name='vehicle_purpose')
op.drop_index(op.f('ix_vehicle_purpose_provider_code'), table_name='vehicle_purpose')
op.drop_index(op.f('ix_vehicle_purpose_id'), table_name='vehicle_purpose')
op.drop_table('vehicle_purpose')
op.drop_index(op.f('ix_road_geometry_year'), table_name='road_geometry')
op.drop_index(op.f('ix_road_geometry_provider_code'), table_name='road_geometry')
op.drop_index(op.f('ix_road_geometry_id'), table_name='road_geometry')
op.drop_table('road_geometry')
op.drop_index(op.f('ix_road_alignment_year'), table_name='road_alignment')
op.drop_index(op.f('ix_road_alignment_provider_code'), table_name='road_alignment')
op.drop_index(op.f('ix_road_alignment_id'), table_name='road_alignment')
op.drop_table('road_alignment')
op.drop_index(op.f('ix_infrastructure_type_year'), table_name='infrastructure_type')
op.drop_index(op.f('ix_infrastructure_type_provider_code'), table_name='infrastructure_type')
op.drop_index(op.f('ix_infrastructure_type_id'), table_name='infrastructure_type')
op.drop_table('infrastructure_type')
op.drop_index(op.f('ix_entrance_exit_year'), table_name='entrance_exit')
op.drop_index(op.f('ix_entrance_exit_provider_code'), table_name='entrance_exit')
op.drop_index(op.f('ix_entrance_exit_id'), table_name='entrance_exit')
op.drop_table('entrance_exit')
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""adding junction and junction_arm tables

Revision ID: 39966aa5db4d
Revises: c5d5e94fb059
Create Date: 2026-02-10 16:45:35.963690

"""

# revision identifiers, used by Alembic.
revision = '39966aa5db4d'
down_revision = 'c5d5e94fb059'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
op.create_table(
'junction',
sa.Column('junction', sa.Integer(), nullable=False),
sa.Column('junction_hebrew', sa.String(length=100), nullable=True),
sa.Column('x', sa.Float(), nullable=True),
sa.Column('y', sa.Float(), nullable=True),
sa.PrimaryKeyConstraint('junction'),
)
op.create_table(
'junction_arm',
sa.Column('arm_symbol', sa.Integer(), nullable=False),
sa.Column('junction_symbol', sa.Integer(), nullable=True),
sa.Column('is_suburban', sa.Boolean(), nullable=True),
sa.Column('road_symbol', sa.Integer(), nullable=True),
sa.Column('km', sa.Float(), nullable=True),
sa.Column('yishuv_symbol', sa.Integer(), nullable=True),
sa.Column('street_symbol', sa.Integer(), nullable=True),
sa.Column('arm_name', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('arm_symbol'),
)
op.create_index(op.f('ix_junction_arm_arm_symbol'), 'junction_arm', ['arm_symbol'], unique=False)


def downgrade():
op.drop_index(op.f('ix_junction_arm_arm_symbol'), table_name='junction_arm')
op.drop_table('junction_arm')
op.drop_table('junction')
# ### end Alembic commands ###
Loading
Loading