Ejemplo n.º 1
0
    def test_sections(self):

        doc = MetatabDoc()

        s = doc.new_section("SectionOne", "A B C".split())

        print(doc.sections)

        print(doc.as_dict())
Ejemplo n.º 2
0
l = get_library()
table_meta_p = l.partition(
    'census.gov-acs_geofile-schemas-2009e-table_meta-2014-5')
column_meta_p = l.partition(
    'census.gov-acs_geofile-schemas-2009e-column_meta-2014-5')

sequence_p = l.partition(
    'census.gov-acs_geofile-schemas-2009e-table_sequence-2014-5')
sequences = {
    row.table_id: (row.sequence_number, row.start, row.table_cells)
    for row in sequence_p if row.start
}

root_doc = MetatabDoc()
root = root_doc.new_section('Root')

root.new_term('Declare', 'http://assets.metatab.org/census.csv')
root.new_term('Title', 'American Community Survey, 5 Year, 2009-2014')
root.new_term('Release', 5)
root.new_term('Year', 2014)
root.new_term('Include', 'acs20145-sources.csv')
root.new_term('Include', 'acs20145-schema.csv')

root_doc.write_csv('acs20145-metadata.csv')

src_doc = MetatabDoc()
source_sec = src_doc.new_section('Sources', ['geography', 'state'])

from censuslib import ACS09TableRowGenerator as TableRowGenerator