Skip to content

Commit

Permalink
cbs - modify tables and add dictionary tables
Browse files Browse the repository at this point in the history
  • Loading branch information
atalyaalon committed Sep 29, 2018
1 parent fb9ae40 commit 7a9fed7
Show file tree
Hide file tree
Showing 18 changed files with 1,551 additions and 418 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion anyway/accidents_around_schools.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def acc_inv_query(longitude, latitude, distance, start_date, end_date, school):
.filter(or_((AccidentMarker.provider_code == CONST.CBS_ACCIDENT_TYPE_1_CODE), (AccidentMarker.provider_code == CONST.CBS_ACCIDENT_TYPE_3_CODE))) \
.filter(AccidentMarker.created >= start_date) \
.filter(AccidentMarker.created < end_date) \
.filter(AccidentMarker.locationAccuracy == LOCATION_ACCURACY_PRECISE_INT) \
.filter(AccidentMarker.location_accuracy == LOCATION_ACCURACY_PRECISE_INT) \
.filter(AccidentMarker.yishuv_symbol != YISHUV_SYMBOL_NOT_EXIST) \
.filter(Involved.age_group.in_([1,2,3,4])) #ages 0-19

Expand Down
4 changes: 2 additions & 2 deletions anyway/field_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
road_type="SUG_DEREH" # part of the desciption
day_type="SUG_YOM" # part of the desciption
road_shape="ZURAT_DEREH" # part of the desciption
unit="YEHIDA" # part of the desciption
police_unit="YEHIDA" # part of the desciption
one_lane = "HAD_MASLUL"
multi_lane = "RAV_MASLUL"
speed_limit = "MEHIRUT_MUTERET"
intactness = "TKINUT"
road_intactness = "TKINUT"
road_width = "ROHAV"
road_sign = "SIMUN_TIMRUR"
road_light = "TEURA"
Expand Down
11 changes: 7 additions & 4 deletions anyway/localization.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import pandas as pd
import os
from . import field_names
from .utilities import decode_hebrew
Expand Down Expand Up @@ -248,9 +249,7 @@


with _open_hebrew_textfile(os.path.join("static/data/cities.csv"), "r") as f:
_cities = list(csv.DictReader(f))

_cities_names = {int(x[field_names.sign]): decode_hebrew(x[field_names.name]) for x in _cities}
_cities = pd.read_csv(f, index_col=field_names.sign)


def get_field(field, value=None):
Expand All @@ -266,4 +265,8 @@ def get_supported_tables():


def get_city_name(symbol_id):
return _cities_names.get(symbol_id, None)
try:
city = _cities_names.loc[symbol_id,field_names.name]
return city
except:
return None
Loading

0 comments on commit 7a9fed7

Please sign in to comment.