Repository: data-for-change/anyway
Issue: [Bug] Infographics API not working for a specific newsflash

**Describe the bug**
Infographics API not working

https://anyway-infographics-staging.web.app/newsflash/108913 

Please check why - and let's discuss how to avoid this

Changed files:
anyway/request_params.py, anyway/models.py, anyway/flask_app.py

diff --git a/anyway/flask_app.py b/anyway/flask_app.py
index 15dbe88f..2f5efb65 100755
--- a/anyway/flask_app.py
+++ b/anyway/flask_app.py
@@ -51,7 +51,7 @@ from anyway.models import (
     AgeGroup,
     AccidentMarkerView,
     EmbeddedReports,
-    DeprecatedCity,
+    City,
     Streets,
 )
 from anyway.request_params import get_request_params_from_request_values
@@ -1467,4 +1467,4 @@ class UpdateUserOrg(Resource):
 class Cities(Resource):
     @api.doc("get get all cities")
     def get(self):
-        return DeprecatedCity.get_all_cities()
+        return City.get_all_cities()
diff --git a/anyway/models.py b/anyway/models.py
index 1abdf40e..bf2530db 100755
--- a/anyway/models.py
+++ b/anyway/models.py
@@ -963,6 +963,30 @@ class CityFields(object):
 class City(CityFields, Base):
     __tablename__ = "cbs_cities"
 
+    @staticmethod
+    def get_name_from_symbol(symbol: int) -> str:
+        res = db.session.query(City.heb_name).filter(City.yishuv_symbol == symbol).first()
+        if res is None:
+            raise ValueError(f"{symbol}: could not find city with that symbol")
+        return res.heb_name
+
+    @staticmethod
+    def get_symbol_from_name(name: str) -> int:
+        res: City = db.session.query(City.yishuv_symbol).filter(City.heb_name == name).first()
+        if res is None:
+            logging.error(f"City: no city with name:{name}.")
+            raise ValueError(f"City: no city with name:{name}.")
+        return res.yishuv_symbol
+
+    @staticmethod
+    def get_all_cities() -> List[dict]:
+        res: City = db.session.query(City.yishuv_symbol, City.heb_name).all()
+        if res is None:
+            logging.error(f"Failed to get cities.")
+            raise RuntimeError(f"When retrieving all cities")
+        res1 = [{"yishuv_symbol": c.yishuv_symbol, "yishuv_name": c.heb_name} for c in res]
+        return res1
+
 
 class CityTemp(CityFields, Base):
     __tablename__ = "cbs_cities_temp"
diff --git a/anyway/request_params.py b/anyway/request_params.py
index e6ff5e6b..7adc4fd0 100644
--- a/anyway/request_params.py
+++ b/anyway/request_params.py
@@ -6,7 +6,7 @@ import copy
 from sqlalchemy import func
 import pandas as pd
 
-from anyway.models import NewsFlash, AccidentMarkerView, DeprecatedCity, Streets
+from anyway.models import NewsFlash, AccidentMarkerView, City, Streets
 from anyway.parsers.location_extraction import (
     get_road_segment_name_and_number,
     get_road_segment_by_name_and_road,
@@ -121,7 +121,7 @@ def get_location_from_news_flash(news_flash_id: str) -> Optional[dict]:
 def add_numeric_field_values(loc: dict, news_flash: NewsFlash) -> None:
     if loc["data"]["resolution"] == BE_CONST.ResolutionCategories.STREET:
         if "yishuv_symbol" not in loc["data"]:
-            loc["data"]["yishuv_symbol"] = DeprecatedCity.get_symbol_from_name(
+            loc["data"]["yishuv_symbol"] = City.get_symbol_from_name(
                 loc["data"]["yishuv_name"]
             )
         if "street1" not in loc["data"]:
@@ -207,9 +207,9 @@ def extract_street_location(input_vals: dict):
 def fill_missing_street_values(vals: dict) -> dict:
     res = copy.copy(vals)
     if "yishuv_symbol" in res and "yishuv_name" not in res:
-        res["yishuv_name"] = DeprecatedCity.get_name_from_symbol(res["yishuv_symbol"])
+        res["yishuv_name"] = City.get_name_from_symbol(res["yishuv_symbol"])
     else:
-        res["yishuv_symbol"] = DeprecatedCity.get_symbol_from_name(res["yishuv_name"])
+        res["yishuv_symbol"] = City.get_symbol_from_name(res["yishuv_name"])
     if "street1" in res and "street1_hebrew" not in res:
         res["street1_hebrew"] = Streets.get_street_name_by_street(
             res["yishuv_symbol"], res["street1"]