Esempio n. 1
0
def template_clean_data(p, clean_data, features, items, cleaners_names, filter_names):
    p(html.h2(u'Clean data:'))
    with p(html.div({u'id':u'clean_data', 
                      u'style':u'height:20em;overflow:scroll;'})):
        with p(html.table()):
            with p(html.tr()):
                p(html.td(' '))
                for i,f in enumerate(features):
                    with p(html.td_block()):
                        p(html.b(u'Missing:'))
                        p(html.br())
                        p(u'<select class="cleaners">')
                        for name in cleaner_funcs:
                            p(u'<option')
                            if name == cleaners_names[i]:
                                p(u' SELECTED="SELECTED"')
                            p(u' value="%s"' % name)
                            p(u'>')
                            p(name)
                            p(u'</option>')
                        p(u'</select>')

                        p(html.br())
                        p(html.br())
                        p(html.b(u'Filters:'))
                        p(html.br())
                        with p(html.div({u'class':u'filters'})):
                            for f in filter_funcs:
                                p(u'<input type="checkbox"')
                                if f in filter_names[i]:
                                    p(u' checked="checked"')
                                p(u' name="%s"' % f)
                                p(u'>')
                                p(f)
                                p(u'</input>')
                                p(html.br())
            with p(html.tr()):
                p(html.td(u'&nbsp;'))
                for f in features:
                    with p(html.td_block({u'valign':u'top'})):
                        p(html.b(f))
            for item,row in zip(items, clean_data):
                with p(html.tr()):
                    p(html.td(html.b(item)))
                    for cell in row:
                        if isinstance(cell, ChangedFloat):
                            p(html.td(html.b(u'%.6s ' % cell) + html.span(cell.original, {u'style':u'"font-size:smaller;color:gray;"'})))
                        else:
                            p(html.td('%.6s' % cell))
Esempio n. 2
0
def template_rankings(p, items, rankings):
    with p(html.table()):
        with p(html.tr()):
            with p(html.td_block({u'valign':u'top'})):
                p(html.h2('Rankings:'))
            with p(html.td_block({u'valign':u'top'})):
                p(u'&nbsp;')
                p(u'<button id="rerank">Re-rank</button>')
            with p(html.td_block({u'valign':u'top'})):
                p(u'<img src="http://www.labmeeting.com/images/upload/spinner.gif" style="display:none;" id="loading" />')
    r = [u'%s (%s)' % (html.b(items[i]), html.span_smaller(u'%s' % score))
                                                    for score,i in rankings]
    p.sub(partial_list(r))