class QuestionTable(flask_table.Table):
    quiz_name = Col('QUIZ', show=False)
    section_nr = Col('SECTION', show=False)
    question_nr = flask_table.Col('')
    question_text = flask_table.Col('Q', show=False)
    question = LinkCol('Question', 'question_page.show', url_kwargs=dict(quiz_name='quiz_name', section_nr='section_nr', question_nr='question_nr'), attr='question_text')
    correct_pct = flask_table.Col('% correct')
Exemple #2
0
class StackCorrectionTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal Id')
    session = flask_table.Col('Session')
    stack_idx = flask_table.Col('Stack Idx')

    channel = SelectCol('Channel')
Exemple #3
0
class SummaryTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal Id')
    session = flask_table.Col('Session')
    scan_idx = flask_table.Col('Scan Idx')
    field = flask_table.Col('Field')
    pipe_version = flask_table.Col('Pipe Version')

    kwargs = {
        'animal_id': 'animal_id',
        'session': 'session',
        'scan_idx': 'scan_idx',
        'field': 'field',
        'pipe_version': 'pipe_version'
    }
    correlation = flask_table.LinkCol(
        'Correlation Image',
        'main.figure',
        url_kwargs=kwargs,
        url_kwargs_extra={'which': 'correlation'})
    average = flask_table.LinkCol('Average Image',
                                  'main.figure',
                                  url_kwargs=kwargs,
                                  url_kwargs_extra={'which': 'average'})
    traces = flask_table.LinkCol('Spike Traces',
                                 'main.traces',
                                 url_kwargs=kwargs,
                                 url_kwargs_extra={
                                     'channel': 1,
                                     'segmentation_method': 6,
                                     'spike_method': 5
                                 })
Exemple #4
0
class HistoryTable(flask_table.Table):
    id = flask_table.LinkCol("Round ID",
                             "lupi_ui.round_details",
                             attr_list=['id'],
                             url_kwargs=dict(round_id='id'))
    start_date = flask_table.Col("Start date")
    end_date = flask_table.Col("End date")
    players = flask_table.Col("# players")
Exemple #5
0
class CorrectionTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal Id')
    session = flask_table.Col('Session')
    scan_idx = flask_table.Col('Scan Idx')
    pipe_version = flask_table.Col('Pipe Version')
    field = flask_table.Col('Field')

    channel = SelectCol('Channel')
class AnswerTable(flask_table.Table):
    correct = flask_table.BoolCol('IS_CORRECT', show=False)
    answer = flask_table.Col('Answer')
    count = flask_table.Col('Count')
    correct_checkbox = CheckboxCol('Correct')

    def get_tr_attrs(self, item):
        if item['correct']:
            return {'class': 'correct'}
        else:
            return {'class': 'incorrect'}
Exemple #7
0
class JobTable(flask_table.Table):
    classes = ['Relation']
    table_name = flask_table.Col('Table Name')
    status = flask_table.Col('Status')
    key = KeyColumn('Key')
    user = flask_table.Col('User')
    key_hash = flask_table.Col('Key Hash')
    error_message = flask_table.Col('Error Message')
    timestamp = flask_table.DatetimeCol('Timestamp')

    delete = CheckBoxCol('Delete')
Exemple #8
0
class SurgeryStatusTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal ID')
    username = flask_table.Col('Username')
    date = flask_table.DateCol('Surgery Date')
    mouse_room = flask_table.Col('Room')
    timestamp = flask_table.DatetimeCol('Timestamp')
    day_one = flask_table.BoolCol('Day 1 Check')
    day_two = flask_table.BoolCol('Day 2 Check')
    day_three = flask_table.BoolCol('Day 3 Check')
    euthanized = flask_table.BoolCol('Euthanized')
    checkup_notes = flask_table.Col('Notes')

    kwargs = {'animal_id': 'animal_id', 'surgery_id': 'surgery_id'}
    link = flask_table.LinkCol('Edit',
                               'main.surgery_update',
                               url_kwargs=kwargs)
Exemple #9
0
class SeriesTable(flask_table.Table):
    classes = ["table table-striped"]
    test_name = flask_table.LinkCol("Test Name",
                                    "route_view_results_series_test",
                                    url_kwargs=dict(test_name="test_name",
                                                    series_name="series_name"),
                                    attr_list="test_name")

    is_stable = flask_table.Col("Considered Stable")
Exemple #10
0
def get_ftable(keys, rows):
    DynamicTable = ft.create_table(
        'dynamic',
        options={'classes': ('table', 'table-striped', 'table-bordered')})
    for col_name in keys:
        DynamicTable.add_column(col_name, ft.Col(col_name))

    dynamic_table = DynamicTable(rows)

    return dynamic_table
Exemple #11
0
    def make_columns(self, columns):
        """
        Adds the columns to the table.

        Parameters
        ----------
        columns : list
            The columns in the table.
        """

        for col in columns:
            self.table_template.add_column(col, ft.Col(col))
Exemple #12
0
 class ItemTable(FormattedTable):
     test_result = flask_table.Col("Result")
     batch_timestamp = flask_table.Col("Batch Timestamp")
     vcs_system = flask_table.Col("VCS")
     vcs_revision = flask_table.Col("VCS Revision")
     test_timestamp = flask_table.Col("Test Timestamp")
     metadata = flask_table.Col("Metadata")
Exemple #13
0
def ensure_task_table():
    if not hasattr(app, 'DBTaskTable'):

        class DBTaskTable(flask_table.Table):
            allow_sort = True

            def sort_url(self, col_key, reverse=False):
                if reverse:
                    direction = 'desc'
                else:
                    direction = 'asc'
                return flask.url_for(ut.get_funcname(index),
                                     sort=col_key,
                                     direction=direction)

        col_nice_lookup = {}
        columns = [
            'index',
            'dbname',
            ('task', task_link),
            # ('link', task_link)
        ]
        for tup in columns:
            if isinstance(tup, tuple):
                colname, link = tup
                colnice = col_nice_lookup.get(colname, colname)
                url_kwargs = {a: a for a in ut.get_func_argspec(link).args}
                endpoint = ut.get_funcname(link)
                link_kw = dict(
                    name=colnice,
                    attr=colname,
                    endpoint=endpoint,
                    url_kwargs=url_kwargs,
                    allow_sort=True,
                    show=True,
                )
                new_col = flask_table.LinkCol(**link_kw)
            elif isinstance(tup, six.string_types):
                colname = tup
                colnice = col_nice_lookup.get(colname, colname)
                new_col = flask_table.Col(name=colnice,
                                          attr=colname,
                                          allow_sort=True,
                                          show=True)
            else:
                assert False, 'unkonown tup'
            DBTaskTable.add_column(colname, new_col)
        app.DBTaskTable = DBTaskTable
    return app.DBTaskTable
Exemple #14
0
def create_datajoint_table(rels,
                           name='DataJoint Table',
                           selection=None,
                           check_funcs=None,
                           **fetch_kwargs):

    if not isinstance(rels, list):
        rels = [rels]

    table_class = flask_table.create_table(name)
    if selection is None:
        selection = set(rels[0].heading.attributes)
        for rel in rels[1:]:
            selection &= set(rel.heading.attributes)
    for col in rels[0].heading.attributes:
        if col in selection:
            table_class.add_column(col, flask_table.Col(col))

    if check_funcs is not None:
        for col in check_funcs:
            table_class.add_column(col, SimpleCheckMarkCol(col))

    items = []
    for rel in rels:
        new_items = rel.proj(*rel.heading.non_blobs).fetch(as_dict=True,
                                                           **fetch_kwargs)

        for item in new_items:
            for blob_col in rel.heading.blobs:
                item[blob_col] = '<BLOB>'
        if selection is not None:
            for i in range(len(new_items)):
                entry = {
                    k: v
                    for k, v in new_items[i].items() if k in selection
                }
                if check_funcs is not None:
                    add = {}
                    for col, f in check_funcs.items():
                        add[col] = f(entry)
                    entry.update(add)
                new_items[i] = entry

        items.extend(new_items)

    table_class.classes = ['Relation']
    table = table_class(items)

    return table
Exemple #15
0
class SegmentationTable(flask_table.Table):
    classes = ['Relation']
    animal_id = flask_table.Col('Animal Id')
    session = flask_table.Col('Session')
    scan_idx = flask_table.Col('Scan')
    pipe_version = flask_table.Col('Pipe Version')
    field = flask_table.Col('Field')
    channel = flask_table.Col('Channel')

    compartment = SelectCol('Compartment')
    ignore = CheckBoxCol('Ignore')
Exemple #16
0
def create_pandas_table(rels,
                        name='Pandas Table',
                        selection=None,
                        check_funcs=None,
                        **fetch_kwargs):

    if not isinstance(rels, list):
        rels = [rels]
    table_class = flask_table.create_table(name)
    if selection is None:
        selection = set(rels[0].columns)
        for rel in rels[1:]:
            selection &= set(rel.columns)
    for col in rels[0].columns:
        if col in selection:
            table_class.add_column(col, flask_table.Col(col))

    if check_funcs is not None:
        for col in check_funcs:
            table_class.add_column(col, SimpleCheckMarkCol(col))

    items = []
    for new_items in rels:

        for d in map(lambda x: x[1].to_dict(), new_items.iterrows()):
            if selection is not None:
                entry = {k: v for k, v in d.items() if k in selection}
            else:
                entry = d

            if check_funcs is not None:
                add = {}
                for col, f in check_funcs.items():
                    add[col] = f(entry)
                entry.update(add)
            items.append(entry)

    table_class.classes = ['Relation']
    table = table_class(items)

    return table
Exemple #17
0
class ItemTable(ft.Table):
    name = ft.Col('Name')
    description = ft.Col('Description')
Exemple #18
0
class InfoTable(flask_table.Table):
    classes = ['table']
    attribute = flask_table.Col('Attribute')
    value = flask_table.Col('Value')
Exemple #19
0
class ProgressTable(flask_table.Table):
    classes = ['Relation']
    table = flask_table.Col('Table')
    processed = flask_table.Col('Processed')
    percentage = flask_table.Col('Percentage')
Exemple #20
0
 class ItemTable(FormattedTable):
     test_name = flask_table.Col("Test Name")
     series_name = flask_table.Col("Series Name")
     batch_timestamp = flask_table.Col("timestamp")
Exemple #21
0
class CheckmarkTable(flask_table.Table):
    classes = ['table']
    relation = flask_table.Col('Relation')
    populated = CheckMarkCol('Populated')
Exemple #22
0
class CellTable(flask_table.Table):
    classes = ['Relation']

    session = flask_table.Col('Session')
    scan_idx = flask_table.Col('Scan')
    somas = flask_table.Col('Detected Somas')
Exemple #23
0
class StatsTable(flask_table.Table):
    classes = ['Relation']
    field = flask_table.Col('Field')
    somas = flask_table.Col('Number of cells')
    depth = flask_table.Col('Depth from surface [um]')