Esempio n. 1
0
def populate_thesaurus():
    nodes = load_csv_treemap(TREEMAP_FILE)
    rows = []
    for node in nodes:
        label = node.breadcrumb.split('\u00BB')[-1].strip()
        row = ThesaurusClass(id=node.id,
                             root=node.root,
                             label=label[:100],
                             level=node.level,
                             size=node.size,
                             ratio=node.ratio,
                             x=node.x,
                             y=node.y,
                             width=node.w,
                             height=node.h,
                             sort=node.sort,
                             breadcrumb=node.breadcrumb[:300])
        rows.append(row)
    ThesaurusClass.objects.bulk_create(rows)
Esempio n. 2
0
def load_level4_nodes():
    nodes = load_csv_treemap(TREEMAP_FILE)
    return set([n.id for n in nodes if n.level == 4])