# Path: tasks/meta.py
# class OBSTag(Base):
#     '''
#     Tags permit arbitrary groupings of columns.
# 
#     They should only be created as part of a :meth:`~.tasks.TagsTask.tags`
#     implementation.
# 
#     .. py:attribute:: id
# 
#        The unique identifier for this table.  Is always qualified by
#        the module name of the :class:`~.tasks.TagsTask` that created it, and
#        should never be specified manually.
# 
#     .. py:attribute:: name
# 
#        The name of this tag.  This is exposed in the API and user interfaces.
# 
#     .. py:attribute:: type
# 
#        The type of this tag.  This is used to provide more information about
#        what the tag means.  Examples are ``section``, ``subsection``,
#        ``license``, ``unit``, although any arbitrary type can be defined.
# 
#     .. py:attribute:: description
# 
#        Description of this tag.  This may be exposed in the API and catalog.
# 
#     .. py:attribute:: columns
# 
#        An iterable of all the :class:`~.meta.OBSColumn`s tagged with this tag.
# 
#     .. py:attribute:: version
# 
#        A version control number, used to determine whether the tag and its
#        metadata should be updated.
# 
#     '''
#     __tablename__ = 'obs_tag'
# 
#     id = Column(Text, primary_key=True)
# 
#     name = Column(Text, nullable=False)
#     type = Column(Text, nullable=False)
#     description = Column(Text)
# 
#     columns = association_proxy('tag_column_tags', 'column')
# 
#     version = Column(Numeric, default=0, nullable=False)
# 
# Path: tasks/base_tasks.py
# class TagsTask(Task):
#     '''
#     This will update-or-create :class:`OBSTag <tasks.meta.OBSTag>` objects
#     int the database when run.
# 
#     The :meth:`~.TagsTask.tags` method must be overwritten.
# 
#     :meth:`~TagsTask.version` is used to control updates to the database.
#     '''
# 
#     def tags(self):
#         '''
#         This method must be overwritten in subclasses.
# 
#         The return value must be an iterable of instances of
#         :class:`OBSTag <tasks.meta.OBSTag>`.
#         '''
#         raise NotImplementedError('Must return iterable of OBSTags')
# 
#     def on_failure(self, ex):
#         session_rollback(self, ex)
#         super(TagsTask, self).on_failure(ex)
# 
#     def on_success(self):
#         session_commit(self)
# 
#     def run(self):
#         for _, tagtarget in self.output().items():
#             tagtarget.update_or_create()
# 
#     def version(self):
#         return 0
# 
#     def output(self):
#         # if self.deps() and not all([d.complete() for d in self.deps()]):
#         #    raise Exception('Must run prerequisites first')
#         output = {}
#         for tag in self.tags():
#             orig_id = tag.id
#             tag.id = '.'.join([classpath(self), orig_id])
#             if not tag.version:
#                 tag.version = self.version()
#             output[orig_id] = TagTarget(tag, self)
#         return output


from tasks.meta import OBSTag
from tasks.base_tasks import TagsTask
            OBSTag(id='segments',
                   name='Population segments',
                   type='subsection',
                   description='Segmentations of the population.'),
            OBSTag(id='society',
                   name='Society',
                   type='subsection',
                   description='Measures of society quality of life'),
            OBSTag(id='energy',
                   name='Energy',
                   type='subsection',
                   description='Measures related to energy production and consumption.'),
            OBSTag(id='environmental',
                   name='Environmental',
                   type='subsection',
                   description='Attributes of the natural environment'),
            OBSTag(id='roads',
                   name='Roads',
                   type='subsection',
                   description=''),
            OBSTag(id='names',
                   name='Proper names',
                   type='subsection',
                   description='Proper names for boundaries and other features'),
            OBSTag(id='poi',
                   name='Points of Interest',
                   type='subsection',
                   description=''),
        ]


# Path: tasks/meta.py
# class OBSTag(Base):
#     '''
#     Tags permit arbitrary groupings of columns.
# 
#     They should only be created as part of a :meth:`~.tasks.TagsTask.tags`
#     implementation.
# 
#     .. py:attribute:: id
# 
#        The unique identifier for this table.  Is always qualified by
#        the module name of the :class:`~.tasks.TagsTask` that created it, and
#        should never be specified manually.
# 
#     .. py:attribute:: name
# 
#        The name of this tag.  This is exposed in the API and user interfaces.
# 
#     .. py:attribute:: type
# 
#        The type of this tag.  This is used to provide more information about
#        what the tag means.  Examples are ``section``, ``subsection``,
#        ``license``, ``unit``, although any arbitrary type can be defined.
# 
#     .. py:attribute:: description
# 
#        Description of this tag.  This may be exposed in the API and catalog.
# 
#     .. py:attribute:: columns
# 
#        An iterable of all the :class:`~.meta.OBSColumn`s tagged with this tag.
# 
#     .. py:attribute:: version
# 
#        A version control number, used to determine whether the tag and its
#        metadata should be updated.
# 
#     '''
#     __tablename__ = 'obs_tag'
# 
#     id = Column(Text, primary_key=True)
# 
#     name = Column(Text, nullable=False)
#     type = Column(Text, nullable=False)
#     description = Column(Text)
# 
#     columns = association_proxy('tag_column_tags', 'column')
# 
#     version = Column(Numeric, default=0, nullable=False)
# 
# Path: tasks/base_tasks.py
# class TagsTask(Task):
#     '''
#     This will update-or-create :class:`OBSTag <tasks.meta.OBSTag>` objects
#     int the database when run.
# 
#     The :meth:`~.TagsTask.tags` method must be overwritten.
# 
#     :meth:`~TagsTask.version` is used to control updates to the database.
#     '''
# 
#     def tags(self):
#         '''
#         This method must be overwritten in subclasses.
# 
#         The return value must be an iterable of instances of
#         :class:`OBSTag <tasks.meta.OBSTag>`.
#         '''
#         raise NotImplementedError('Must return iterable of OBSTags')
# 
#     def on_failure(self, ex):
#         session_rollback(self, ex)
#         super(TagsTask, self).on_failure(ex)
# 
#     def on_success(self):
#         session_commit(self)
# 
#     def run(self):
#         for _, tagtarget in self.output().items():
#             tagtarget.update_or_create()
# 
#     def version(self):
#         return 0
# 
#     def output(self):
#         # if self.deps() and not all([d.complete() for d in self.deps()]):
#         #    raise Exception('Must run prerequisites first')
#         output = {}
#         for tag in self.tags():
#             orig_id = tag.id
#             tag.id = '.'.join([classpath(self), orig_id])
#             if not tag.version:
#                 tag.version = self.version()
#             output[orig_id] = TagTarget(tag, self)
#         return output


# Path: tasks/tags.py
from tasks.meta import OBSTag
from tasks.base_tasks import TagsTask

            OBSTag(id='segments',
                   name='Population segments',
                   type='subsection',
                   description='Segmentations of the population.'),
            OBSTag(id='society',
                   name='Society',
                   type='subsection',
                   description='Measures of society quality of life'),
            OBSTag(id='energy',
                   name='Energy',
                   type='subsection',
                   description='Measures related to energy production and consumption.'),
            OBSTag(id='environmental',
                   name='Environmental',
                   type='subsection',
                   description='Attributes of the natural environment'),
            OBSTag(id='roads',
                   name='Roads',
                   type='subsection',
                   description=''),
            OBSTag(id='names',
                   name='Proper names',
                   type='subsection',
                   description='Proper names for boundaries and other features'),
            OBSTag(id='poi',
                   name='Points of Interest',
                   type='subsection',
                   description=''),
        ]


class BoundaryTags(TagsTask):