# Path: orm.py
# def now():
# def set_sqlite_pragma(dbapi_connection, connection_record):
#     def is_blank(self):
#     def save(self):
#     def save(self):
#     def save(self):
# def counter():
# def exithandler():
# class Value(Base):
# class DataSet(Base):
# class Indicator(Base):


import datetime
import lxml.html
import requests
import xypath
import StringIO
import messytables
import orm
from orm import session, Value, DataSet, Indicator
%%Surrogate_MaxResults:1
MaxResults:2500
%%Surrogate_SearchWv:1
SearchWv:1
%%Surrogate_SearchFuzzy:1
%%Surrogate_Sort:1
Sort:1'''

indicators = {"Date of Entry into UN": xypath.RIGHT,
              "ISO Country alpha-3-code": xypath.RIGHT,
              "ISO Country alpha-2-code": xypath.RIGHT,
              "ISO Currency Code": xypath.RIGHT,
              "Short Name": xypath.RIGHT,
              "Formal Name": xypath.RIGHT,
              "Capital City": xypath.RIGHT,
              "Languages": xypath.RIGHT,
              "Currency Abbr.": xypath.DOWN}

dataset_data = {'dsID': 'unterm',
           'last_updated': "",
           'last_scraped': orm.now(),
           'name': 'unterm'}

DataSet(**dataset_data).save()


indicator_data = [{'indID': 'unterm:' + i,
                   'name': i,
                   'units': ''} for i in indicators]
for db_row in indicator_data:

# Path: orm.py
# def now():
# def set_sqlite_pragma(dbapi_connection, connection_record):
#     def is_blank(self):
#     def save(self):
#     def save(self):
#     def save(self):
# def counter():
# def exithandler():
# class Value(Base):
# class DataSet(Base):
# class Indicator(Base):


# Path: unterm.py
import datetime
import lxml.html
import requests
import xypath
import StringIO
import messytables
import orm
from orm import session, Value, DataSet, Indicator

%%Surrogate_MaxResults:1
MaxResults:2500
%%Surrogate_SearchWv:1
SearchWv:1
%%Surrogate_SearchFuzzy:1
%%Surrogate_Sort:1
Sort:1'''

indicators = {"Date of Entry into UN": xypath.RIGHT,
              "ISO Country alpha-3-code": xypath.RIGHT,
              "ISO Country alpha-2-code": xypath.RIGHT,
              "ISO Currency Code": xypath.RIGHT,
              "Short Name": xypath.RIGHT,
              "Formal Name": xypath.RIGHT,
              "Capital City": xypath.RIGHT,
              "Languages": xypath.RIGHT,
              "Currency Abbr.": xypath.DOWN}

dataset_data = {'dsID': 'unterm',
           'last_updated': "",
           'last_scraped': orm.now(),
           'name': 'unterm'}

DataSet(**dataset_data).save()


indicator_data = [{'indID': 'unterm:' + i,
                   'name': i,
                   'units': ''} for i in indicators]
for db_row in indicator_data:

    Indicator(**db_row).save()