# Path: utils.py
# def convert_to_int(possible_number, use_if_not_int):
#     """
#     Save conversion of string to int with ability to specify default if string is not a number
#     """
#     try:
#         result = int(possible_number)
#     except ValueError:
#         result = use_if_not_int
#     return result
# 
# def join_with_space_and_convert_spaces(segments, replace_with='-'):
#     """
#     Helper function joins array pieces together and then replaces any spaces
#     with specified value.
#     """
#     return " ".join(segments).replace(" ", replace_with)
# 
# def yesterday():
#     return date.today() - ONE_DAY


from django.db.utils import DatabaseError
from utils import convert_to_int, join_with_space_and_convert_spaces, yesterday
from models import HousingLocation
        if len(self._location_segments) == 2:
            self._set_sub_division(self._location_segments[1], [])
        else:
            self._set_sub_division(self._location_segments[2] + self._location_segments[1], self._location_segments[3:])

    def _set_location_15_values(self):
        if self._location_segments[1] == "EM":
            self._housing_location.in_program = "Electronic Monitoring"
            self._housing_location.in_jail = False
        elif self._location_segments[1] == "EMAW":
            self._housing_location.in_program = "Electronic Monitoring, AWOL"
            self._housing_location.in_jail = False
        elif self._location_segments[1] in ["KK", "LV", "US"]:
            self._housing_location.in_program = "Other County"
            self._housing_location.in_jail = False
        else:
            self._housing_location.sub_division = self._location_segments[1]

    def _set_location_17_values(self):
        if self._location_segments[1] == "MOMS":
            self._housing_location.in_program = "MOMS Program"
        elif self._location_segments[1] == "SFFP":
            self._housing_location.in_program = "Sherrif Female Furlough Program"
            self._housing_location.in_jail = False
        elif self._location_segments[1] == "SFFPAW":
            self._housing_location.in_program = "Sherrif Female Furlough Program, AWOL"
            self._housing_location.in_jail = False

    def _set_sub_division(self, sub_division, sub_division_location):
        self._housing_location.sub_division = sub_division

# Path: utils.py
# def convert_to_int(possible_number, use_if_not_int):
#     """
#     Save conversion of string to int with ability to specify default if string is not a number
#     """
#     try:
#         result = int(possible_number)
#     except ValueError:
#         result = use_if_not_int
#     return result
# 
# def join_with_space_and_convert_spaces(segments, replace_with='-'):
#     """
#     Helper function joins array pieces together and then replaces any spaces
#     with specified value.
#     """
#     return " ".join(segments).replace(" ", replace_with)
# 
# def yesterday():
#     return date.today() - ONE_DAY


# Path: countyapi/housing_location_info.py
from django.db.utils import DatabaseError
from utils import convert_to_int, join_with_space_and_convert_spaces, yesterday
from models import HousingLocation

        if len(self._location_segments) == 2:
            self._set_sub_division(self._location_segments[1], [])
        else:
            self._set_sub_division(self._location_segments[2] + self._location_segments[1], self._location_segments[3:])

    def _set_location_15_values(self):
        if self._location_segments[1] == "EM":
            self._housing_location.in_program = "Electronic Monitoring"
            self._housing_location.in_jail = False
        elif self._location_segments[1] == "EMAW":
            self._housing_location.in_program = "Electronic Monitoring, AWOL"
            self._housing_location.in_jail = False
        elif self._location_segments[1] in ["KK", "LV", "US"]:
            self._housing_location.in_program = "Other County"
            self._housing_location.in_jail = False
        else:
            self._housing_location.sub_division = self._location_segments[1]

    def _set_location_17_values(self):
        if self._location_segments[1] == "MOMS":
            self._housing_location.in_program = "MOMS Program"
        elif self._location_segments[1] == "SFFP":
            self._housing_location.in_program = "Sherrif Female Furlough Program"
            self._housing_location.in_jail = False
        elif self._location_segments[1] == "SFFPAW":
            self._housing_location.in_program = "Sherrif Female Furlough Program, AWOL"
            self._housing_location.in_jail = False

    def _set_sub_division(self, sub_division, sub_division_location):
        self._housing_location.sub_division = sub_division

        self._housing_location.sub_division_location = join_with_space_and_convert_spaces(sub_division_location)