# Path: ngcrowd/helpers.py
# def get_utf_encoded_value(value):
#     return value.encode('utf-8').strip() if value else ''


from ngcrowd.models import *
from ngcrowd.helpers import get_utf_encoded_value
from sqlalchemy.orm import joinedload
from os import path, makedirs
from xml.etree.ElementTree import Element, SubElement, tostring
        from collections import OrderedDict
import csv
import shutil
        regions = session.query(Region)\
            .filter(Region.imported == True)\
            .all()

        for region in regions:
            self.export_region(region.id)


class GeoCsvUikExportStrategy():
    def __init__(self, dir_destination='', dir_template=''):
        self.root_dir = dir_destination
        self.templates_dir = dir_template
        self.csv_file = None
        self.writer = None
        self.scheme = OrderedDict([
            ('id', 'Integer(5)'),
            ('lat', 'Real(10.7)'),
            ('lon', 'Real(10.7)'),
            ('number_official', 'String(255)'),
            ('address_voting', 'String(255)'),
            ('place_voting', 'String(255)'),
            ('comment', 'String(255)'),
            ('is_applied', 'String(255)'),
            ('geocoding_precision', 'String(255)'),
            ('tik', 'String(255)'),
            ('tik_id', 'Integer(5)'),
            ('region', 'String(255)')
        ])
        self.__temp_uik = self.scheme.copy()


# Path: ngcrowd/helpers.py
# def get_utf_encoded_value(value):
#     return value.encode('utf-8').strip() if value else ''


# Path: ngcrowd/modules/export/export.py
from ngcrowd.models import *
from ngcrowd.helpers import get_utf_encoded_value
from sqlalchemy.orm import joinedload
from os import path, makedirs
from xml.etree.ElementTree import Element, SubElement, tostring
        from collections import OrderedDict
import csv
import shutil

        regions = session.query(Region)\
            .filter(Region.imported == True)\
            .all()

        for region in regions:
            self.export_region(region.id)


class GeoCsvUikExportStrategy():
    def __init__(self, dir_destination='', dir_template=''):
        self.root_dir = dir_destination
        self.templates_dir = dir_template
        self.csv_file = None
        self.writer = None
        self.scheme = OrderedDict([
            ('id', 'Integer(5)'),
            ('lat', 'Real(10.7)'),
            ('lon', 'Real(10.7)'),
            ('number_official', 'String(255)'),
            ('address_voting', 'String(255)'),
            ('place_voting', 'String(255)'),
            ('comment', 'String(255)'),
            ('is_applied', 'String(255)'),
            ('geocoding_precision', 'String(255)'),
            ('tik', 'String(255)'),
            ('tik_id', 'Integer(5)'),
            ('region', 'String(255)')
        ])
        self.__temp_uik = self.scheme.copy()


    def start(self, region_id):