Beispiel #1
0
def makeDbSummary(neo):
    title = html.P("Database Stats", className="dbtitle")
    hr = html.Hr(style={'width': "100%"})

    body = []
    body.append(
        html.Tr([
            html.Td("Database", className="rowname"),
            html.Td(neo.server, className="rowvalue")
        ]))
    body.append(
        html.Tr([
            html.Td("User", className="rowname"),
            html.Td(neo.user, className="rowvalue")
        ]))

    counts = neo.dbSummary().data()
    for res in counts:
        if len(res['labels']) > 1:
            res['labels'].remove('AADObject') if 'AADObject' in res[
                'labels'] else res['labels'].remove('AzureResource')
        res["labels"] = "".join(res["labels"])
    sortedCounts = sorted(counts, key=lambda r: r["labels"])

    stats = []
    for a, b in zip(*[iter(sortedCounts)] * 2):
        stats.append(
            html.Tr([
                html.Td(a.get("labels"), className="rowname"),
                html.Td(a.get("count"), className="rowvalue"),
                html.Td(b.get("labels"), className="rowname"),
                html.Td(b.get("count"), className="rowvalue")
            ]))
    return [title, dbc.Table(body), hr, dbc.Table(stats)]
Beispiel #2
0
def ver_estadisticas_gsom(n_clicks, data_portion_option):

    zero_unit = session_data.get_modelo()
    gsom = zero_unit.child_map
    data = session_data.get_data(data_portion_option)
    gsom.replace_parent_dataset(data)

    qe, mqe = gsom.get_map_qe_and_mqe()
    qe = round(qe, 4)
    mqe = round(mqe, 4)

    #Table
    table_header = [
        html.Thead(html.Tr([html.Th("Magnitude"),
                            html.Th("Value")]))
    ]

    row0 = html.Tr([html.Td("Quantization Error (Total)"), html.Td(qe)])
    row1 = html.Tr([html.Td("Mean Quantization Error"), html.Td(mqe)])

    table_body = [html.Tbody([row0, row1])]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      dark=False,
                      hover=True,
                      responsive=True,
                      striped=True)
    children = [table]

    return children
Beispiel #3
0
 def grid_layout(self):
     return html.Div([
         dcc.Interval(
             id='interval-component',
             interval=self.updateInterval*1000, # in milliseconds
             n_intervals=0
         ),
         dbc.Row([
             # Display vertical Table
             dbc.Col([
                 html.P("""Live table displays the stage's indexed X/Y, current absolute X/Y stage position,
                     expected absolute X/Y stage position, and the difference between current and expected absolute X/Y stage position"""),
                 html.P("Newer entries appear at the top of the table."),
                 dbc.Table(id='table-points', bordered=True,
                     style={'textAlign': 'center'})
             ], xl=5, width=12, style={'maxHeight': '30rem', 'overflowY': 'scroll', 'marginBottom': '1rem'}),
             # Display scan estimation/data
             dbc.Col([
                 html.Div(self.getTitleAttributes(), id='title-attributes'),
                 dbc.Card([
                     dbc.CardHeader(html.H4("Scan Estimation")),
                     dbc.CardBody([
                         html.P('N/A', id='estimation-progress-p'),
                         dbc.Progress(value=0, id="estimation-progress-bar", striped=True, animated=True),
                     ])
                 ])
             ], xl=7, width=12)
         ], style={'margin': '1rem'})
     ])
Beispiel #4
0
def table(rows):
    #global reading
    print("table rows=", rows)
    #reading=reading+1
    table_header = [
        html.Thead(
            html.Tr([
                html.Th('id'),
                html.Th('stamp'),
                html.Th('devId'),
                html.Th('SPA'),
                html.Th('TA')  #, html.Th('motor status') ,
            ]))
    ]
    table_body = [
        html.Tbody(
            html.Tr([
                html.Td(dev[0]),
                html.Td(dev[1]),
                html.Td(dev[2]),
                html.Td(dev[3]),
                html.Td(dev[4])
            ])) for dev in rows
    ]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      striped=True,
                      hover=True,
                      style={"backgroundColor": "white"})
    return table
Beispiel #5
0
def table(devices):
    #global reading
    print("table devices=", devices)
    #reading=reading+1
    table_header = [
        html.Thead(
            html.Tr([
                html.Th('stamp'),
                html.Th('devId'),
                html.Th('sun angle'),
                html.Th('tracker angle')  #, html.Th('motor status') ,
            ]))
    ]
    table_body = [
        html.Tbody(
            html.Tr([
                html.Td(dev[1]),
                html.Td(dev[2]),
                html.Td(dev[3]),
                html.Td(dev[4])
            ])) for dev in devices
    ]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      striped=True,
                      hover=True,
                      style={"backgroundColor": "white"})
    return table
Beispiel #6
0
def tablesmb(filtered_df):
    
    table_header=[html.Thead(html.Tr([html.Th('Id'),html.Th('stamp'),html.Th('devId'),html.Th('str1') ,html.Th('str2'),html.Th('str3') ,html.Th('str4'),html.Th('str5') ,html.Th('str6'),html.Th('str7') ,html.Th('str8'),html.Th('str9') ,html.Th('str10'),html.Th('str11') ,html.Th('str12'),html.Th('str13'),html.Th('vol1'),html.Th('vol2'),html.Th('vol3'),html.Th('vol4'),html.Th('vol5'),html.Th('vol6'),html.Th('vol7'),html.Th('vol8'),html.Th('vol9'),html.Th('vol10'),html.Th('vol11'),html.Th('vol12'),html.Th('vol13'),html.Th('temp')
         ]))]
    table_body=[html.Tbody(html.Tr([html.Td(dev[0]),html.Td(dev[1]),html.A(html.Td(dev[2]),href="/page-6"),html.Td(dev[3]),html.Td(dev[4]),html.Td(dev[5]),html.Td(dev[6]),html.Td(dev[7]),html.Td(dev[8]),html.Td(dev[9]),html.Td(dev[10]),html.Td(dev[11]),html.Td(dev[12]),html.Td(dev[13]),html.Td(dev[14]),html.Td(dev[15]),html.Td(dev[16]),html.Td(dev[17]),html.Td(dev[18]),html.Td(dev[19]),html.Td(dev[20]),html.Td(dev[21]),html.Td(dev[22]),html.Td(dev[23]),html.Td(dev[24]),html.Td(dev[25]),html.Td(dev[26]),html.Td(dev[27]),html.Td(dev[28]),html.Td(dev[29])]))for dev in filtered_df]
    table=dbc.Table(table_header+table_body,bordered=True,striped=True,hover=True,style={"backgroundColor":"white"})
    return table
Beispiel #7
0
def build_list_layout():
    t_header = [
        html.Thead(
            html.Tr([
                html.Th("Device"),
                html.Th("Name"),
                html.Th("Type"),
                html.Th("Online?")
            ]))
    ]

    currentList = mongoClient.get_advertised_current_list()
    allList = mongoClient.get_advertised_all_list()

    currsensor = [_["sensor"] for _ in currentList]
    t_body = [
        html.Tr([
            html.Td("arduino"),
            html.Td(sensor['sensor']),
            html.Td(sensor['data-type']),
            html.Td("Yes" if sensor['sensor'] in currsensor else "No")
        ]) for sensor in allList
    ]

    return [html.Div(dbc.Table(t_header + t_body, dark=True, striped=True))]
Beispiel #8
0
def table(rows):
    #global reading

    #reading=reading+1
    table_header = [
        html.Thead(
            html.Tr([
                html.Th('Id'),
                html.Th('stamp'),
                html.Th('devId'),
                html.Th('sun angle'),
                html.Th('tracker angle')  #, html.Th('motor status') ,
            ]))
    ]
    table_body = [
        html.Tbody(
            html.Tr([
                html.Td(dev.id),
                html.Td(dev.stamp),
                html.Td(dev.devId),
                html.Td(dev.SPA),
                html.Td(dev.TA)
            ])) for dev in rows
    ]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      striped=True,
                      hover=True,
                      style={"backgroundColor": "white"})
    return table
Beispiel #9
0
def generate_table(dataframe, max_rows=10, size="md"):
    """
    创建表
    """
    # Header
    header = html.Thead(
        children=html.Tr([html.Th(col) for col in dataframe.columns[:10]]))

    # Row
    rows = []
    for i in range(max_rows):
        td_list = []
        for index, col in enumerate(dataframe.columns[:10]):
            if index == 1:
                td_list.append(
                    html.Td(
                        dcc.Link(dataframe.iloc[i][col],
                                 href=dataframe.iloc[i][col])))
            else:
                td_list.append(html.Td(dataframe.iloc[i][col]))
        rows.append(html.Tr(td_list))
    return dbc.Table([header, html.Tbody(rows)],
                     striped=True,
                     bordered=True,
                     hover=True,
                     size=size)
Beispiel #10
0
def params_card(params_dict):

    table_header = [
        html.Thead(html.Tr([html.Th("Parameter"),
                            html.Th("Value")]))
    ]

    rows = []
    for key, value in params_dict.items():
        if callable(value):
            value = func2str(value)
        row = html.Tr([html.Td(str(key)), html.Td(str(value))])
        rows.append(row)

    table_body = [html.Tbody(rows)]

    table = dbc.Table(
        table_header + table_body,
        bordered=True,
        hover=True,
        responsive=True,
        striped=True,
        className='small',
    )
    return table
Beispiel #11
0
def build_table(data=c_dates()):

    headers = []
    for x in data.head():
        print(data[x].name)
        headers.append(html.Th(data[x].name))

    table_header = [
        html.Thead(html.Tr(headers))
    ]

    table_values = []

    provinceState = c_dates()['provinceState'].values

    countryRegion = c_dates()['countryRegion'].values

    lastUpdate = c_dates()['lastUpdate'].values

    confirmed = c_dates()['confirmed'].values

    deaths = c_dates()['deaths'].values

    recovered = c_dates()['recovered'].values


    for p,region,l,c,d,r in zip(provinceState,countryRegion, lastUpdate, confirmed, deaths, recovered):
        table_values.append(html.Tr([html.Td(p), html.Td(region),  html.Td(l),  html.Td(c),  html.Td(d),  html.Td(r)]))
        # print(c_dates()[x].values)


    table = dbc.Row([dbc.Col(html.Div(), width=2), dbc.Col(dbc.Table(table_header + table_values, bordered=True)), dbc.Col(html.Div(), width=2)])

    return table
Beispiel #12
0
def parseNetworkInterface(node):
    fields = [
        "name", "type", "macAddress", "ipForwarding", "ipConfigurationCount"
    ]

    body = makeMainBody(node, fields)
    return dbc.Table(body)
Beispiel #13
0
def table_and_graph_card(title, table, graph):
    """Return a dbc Card object that shows a table and graph.

    Args:
        title (str): Title of card displayed as H4
        table (dash_html_components.Th): html table components
        graph (plotly.graph_objects.Figure): Plotly graph

    Returns:
        dash_bootstrap_components.Card: Bootstrap card

    """
    return dbc.Card([
        html.H4(title, style={'textAlign': 'center'}),
        dbc.Row([
            dbc.Table(table,
                      bordered=True,
                      dark=False,
                      striped=True,
                      className='table-primary',
                      size='sm',
                      style=dict(width='8.1cm')),
        ],
                justify='center'),
        dcc.Graph(figure=graph, config=config),
    ],
                    color='light',
                    body=True)
Beispiel #14
0
def generate_table(head,contents):
    table = dbc.Table([
                html.Thead(html.Tr([html.Th(h) for h in head])),
                html.Tbody([html.Tr([html.Td(cont) for cont in content]) for content in contents]),
            ],bordered=True,hover=True,responsive=True,striped=True,)

    return table
Beispiel #15
0
def generate_table(dff):
    rows = []
    for i in range(len(dff)):
        row = []
        for col in ['Title', 'Output']:
            value = dff.iloc[i][col]
            url = dff.iloc[i]['URL']
            if col == 'Title':
                cell = html.Td(html.A(href=url, children=value))
            else:
                cell = html.Td(children=value)
            row.append(cell)
        rows.append(html.Tr(row))
    return dbc.Table(
        # Header
        [
            html.Tr([
                html.Th(col, style={'text-align': 'center'})
                for col in ['Title', 'Search Output']
            ])
        ] +
        # Body
        rows,
        bordered=True,
        dark=False,
        hover=True,
        responsive=True,
        striped=True,
    )
Beispiel #16
0
def display_data(value):
    """Displaying the head for the selected file."""
    db_value = db.get("file")
    if value is None and db_value is None:
        return ""
    elif value is None and not db_value is None:
        value = db_value
    elif not value == db_value:
        db.reset()
    format = FileUtils.file_format(value)
    if format == 'csv' or format == 'txt':
        path = FileUtils.path('raw', value)
        head = DataUtils.read_text_head(path)
        table_col = [html.Col(style = {'width':"10%"}), html.Col(style = {'width':"90%"})]
        table_header = [html.Thead(html.Tr([html.Th("Row No"), html.Th("Data")]))]
        rows = []
        for i in range(len(head)):
            row = html.Tr([html.Td(i+1), html.Td(head[i])])
            rows.append(row)
        table_body = [html.Tbody(rows)]
        table = dbc.Table(table_col+ table_header + table_body, bordered=True, style = common.table_style)
        div =  [common.msg("Selected File: " + value),
                common.msg("Selected Format: " + format),
                table,
                html.Br(),
                csv_properties_div]
    elif format == 'jpeg' or format == 'jpg' or format == 'gif':
        div =  [common.msg("Selected File: " + value),
                common.msg("Selected Format: " + format)]
    else:
        div = "Format Not Supported!!"
    db.put("file", value)
    db.put("format", format)
    return div
Beispiel #17
0
def generate_table(dataframe, max_rows=10, size="md"):
    """
    创建表
    """
    # Headers
    headers = [
        html.Th(col, className="text-center") if index != 1 else html.Th(col)
        for index, col in enumerate(dataframe.columns[:10])
    ]

    # Rows
    rows = []
    for i_row in range(max_rows):
        td_list = []
        for i_col, col in enumerate(dataframe.columns[:10]):
            if i_col == 1:
                td_list.append(
                    html.Td(
                        dcc.Link(dataframe.iloc[i_row][col],
                                 href=dataframe.iloc[i_row][col])))
            else:
                td_list.append(
                    html.Td(dataframe.iloc[i_row][col],
                            className="text-center"))
        rows.append(html.Tr(td_list))
    return dbc.Table([html.Thead(html.Tr(headers)),
                      html.Tbody(rows)],
                     striped=True,
                     bordered=True,
                     hover=True,
                     size=size)
Beispiel #18
0
def df_to_table2(df):
    table_header = [
        html.Thead(
            html.Tr([
                html.Th("Sold Area(MSqFt)"),
                html.Th("Flat Count"),
                html.Th(df.columns[2] + "(Cr.)"),
                html.Th(df.columns[3] + "(Cr.)"),
                html.Th(df.columns[4] + "(Cr.)")
            ]))
    ]
    row1 = html.Tr([
        html.Td(df.iloc[0]["Sale Area"]),
        html.Td(df.iloc[0]["Apartment Count"]),
        html.Td(df.iloc[0]["Agreement Value"]),
        html.Td(df.iloc[0]["AV for Brokerage"]),
        html.Td(df.iloc[0]["Brokerage Amount"])
    ])
    table_body = [html.Tbody([row1])]
    table = dbc.Table(
        table_header + table_body,
        bordered=True,
        style={
            'backgroundColor': 'white',
            'font-size': '18px',
            'color': 'blue',
            'text-align': 'left',
            'width': '60%'
        })  #bordered=True,dark=True,hover=True,responsive=True,size='lg',
    return table
def get_tables_for_course_two(student_df: list, last_month: list, last_week: list, today:list, sub_name:list =['pa','pb','pc', 'pd','pe','pf']):
    ## table 1
    table_header = [
        html.Thead(html.Tr([html.Th("{}".format("course 2"), colSpan=2), html.Th("Score", colSpan=2)])),
        html.Thead(html.Tr(
            [html.Th("milestone"), html.Th("target"), html.Th("last month"), html.Th("last week"), html.Th("today")]))
    ]
    ### table data for 1 courses
    row1 = html.Tr([html.Td("{}".format(sub_name[0])),html.Td("{}".format(student_df[0])),html.Td("{}".format(last_month[0])), html.Td("{}".format(last_week[0])),html.Td("{}".format(today[0]))])
    row2 = html.Tr(
        [html.Td("{}".format(sub_name[1])), html.Td("{}".format(student_df[1])), html.Td("{}".format(last_month[1])),
         html.Td("{}".format(last_week[1])), html.Td("{}".format(today[1]))])
    row3 = html.Tr(
        [html.Td("{}".format(sub_name[2])), html.Td("{}".format(student_df[2])), html.Td("{}".format(last_month[2])),
         html.Td("{}".format(last_week[2])), html.Td("{}".format(today[2]))])
    row4 = html.Tr(
        [html.Td("{}".format(sub_name[3])), html.Td("{}".format(student_df[3])), html.Td("{}".format(last_month[3])),
         html.Td("{}".format(last_week[3])), html.Td("{}".format(today[3]))])
    row5 = html.Tr(
        [html.Td("{}".format(sub_name[4])), html.Td("{}".format(student_df[4])), html.Td("{}".format(last_month[4])),
         html.Td("{}".format(last_week[4])), html.Td("{}".format(today[4]))])
    row6 = html.Tr(
        [html.Td("{}".format(sub_name[5])), html.Td("{}".format(student_df[5])), html.Td("{}".format(last_month[5])),
         html.Td("{}".format(last_week[5])), html.Td("{}".format(today[5]))])


    table_body = [html.Tbody([row1, row2, row3, row4, row5, row6])]
    table_course = dbc.Table(table_header + table_body, bordered=True, id="course2", style=TEXT_STYLE)

    return table_course
Beispiel #20
0
def generate_simple_table(data, idx, max_rows=50):
    # --------------------------------------------------------------------------
    # The table object
    # --------------------------------------------------------------------------
    head = html.Thead(html.Tr([html.Th(col) for col in data.columns]))
    body = html.Tbody([
        html.Tr([html.Td(data.iloc[i][col]) for col in data.columns])
        for i in range(min(len(data), max_rows))
    ])
    table = dbc.Table([head, body],
                      id=idx,
                      bordered=True,
                      dark=True,
                      hover=True,
                      responsive=True,
                      striped=True,
                      size='sm',
                      style={'overflowY': 'scroll'})

    # --------------------------------------------------------------------------
    # Consolidate
    # --------------------------------------------------------------------------
    components = []
    components.append(get_empty_col())
    components.append(html.Div(table, className='col-10'))
    components.append(get_empty_col())

    # --------------------------------------------------------------------------
    # Finish
    # --------------------------------------------------------------------------
    return html.Div(components, className='row')
Beispiel #21
0
def showTableStat(table_title,
                  id_name,
                  collapse_info=[],
                  table_body_list=[],
                  values=[]):
    return dbc.Table(children=[
        html.Thead(
            html.Tr([
                html.Th([
                    dbc.Row([
                        dbc.Col([
                            html.H6([
                                table_title,
                                dbc.Button("?",
                                           id=f'{id_name}-button',
                                           color="light",
                                           size='sm',
                                           className='ml-2')
                            ])
                        ],
                                width=6),
                    ])
                ])
            ])),
        dbc.Collapse(
            dbc.Card(dbc.CardBody(showCollapse(collapse_info))),
            id=id_name,
        ),
        showTableBody(table_body_list, values),
    ],
                     bordered=True,
                     className='card-mid'),
Beispiel #22
0
def create_vercard(ver, comps, vername, projname):
    table_body = []
    projlink = ''
    if ver is not None and comps is not None:
        # verbutton = dbc.Button("Select Version", id="verbutton", className="mr-2", size='sm')
        table_rows = [
            html.Tr([html.Td("Component Count:"),
                     html.Td(len(comps.index))]),
            html.Tr([html.Td("Phase:"),
                     html.Td(ver['phase'])]),
            html.Tr([html.Td("Distribution:"),
                     html.Td(ver['distribution'])]),
            html.Tr(
                [html.Td("License:"),
                 html.Td(ver['license.licenseDisplay'])]),
            html.Tr([html.Td("Owner:"),
                     html.Td(ver['createdBy'])]),
            html.Tr([
                html.Td("Create Date:"),
                html.Td(
                    datetime.strptime(
                        ver['createdAt'],
                        '%Y-%m-%dT%H:%M:%S.%fZ').strftime("%Y-%m-%d %H:%M"))
            ]),
            html.Tr([
                html.Td("Last Update Date:"),
                html.Td(
                    datetime.strptime(
                        ver['settingUpdatedAt'],
                        '%Y-%m-%dT%H:%M:%S.%fZ').strftime("%Y-%m-%d %H:%M"))
            ]),
        ]
        table_body = [html.Tbody(table_rows)]
        projlink = ver['_meta.href'] + '/components'

    table_header = []

    return dbc.Card(
        [
            dbc.CardHeader("Project: " + projname,
                           style={'classname': 'card-title'}),
            dbc.CardBody([
                html.H6("Project Version: " + vername,
                        style={
                            'display': 'flex',
                            'classname': 'card-title'
                        }),
                html.Br(),
                dbc.Table(table_header + table_body, bordered=True),
            ], ),
            dbc.CardFooter(dbc.CardLink('Project Version link',
                                        href=projlink)),
            # dbc.Table(table_header + table_body, bordered=True),
            # projusedbytitle, projstable,
            # html.Div(verbutton),
        ],
        id="vercard",
        # style={"width": "28rem", "height":  "50rem"},
        # style={"width": "23rem"},
    )
Beispiel #23
0
def table(devices):

    table_header = [
        html.Thead(
            html.Tr([
                html.Th('time'),
                html.Th('devId'),
                html.Th('sun angle'),
                html.Th('tracker angle')  #, html.Th('motor status') ,
            ]))
    ]
    table_body = [
        html.Tbody(
            html.Tr([
                html.Td(dev.stamp),
                html.Td(dev.devId),
                html.Td(dev.sun),
                html.Td(dev.ta)
            ])) for dev in devices
    ]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      striped=True,
                      hover=True,
                      style={"backgroundColor": "white"})
    return table
Beispiel #24
0
def table(devices):
    table_header = [
        html.Thead(
            html.Tr([
                html.Th('Reading No.'),
                html.Th('dev name'),
                html.Th('tstamp'),
                html.Th('rphV'),
                html.Th('yphV'),
                html.Th('bphV')
            ]))
    ]
    table_body = [
        html.Tbody(
            html.Tr([
                html.Td(dev.count),
                html.Td(dev.devname),
                html.Td(dev.tStamp),
                html.Td(dev.rphvol),
                html.Td(dev.yphvol),
                html.Td(dev.bphvol)
            ])) for dev in devices
    ]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      striped=True,
                      hover=True,
                      style={"backgroundColor": "white"})
    return table
Beispiel #25
0
def table(rows):
    #unicodedata.normalize('NFKD', rows).encode('ascii','ignore')
    table_header = [
        html.Thead(
            html.Tr([
                html.Th('Id'),
                html.Th('stamp'),
                html.Th('devId'),
                html.Th('sun angle'),
                html.Th('tracker angle')  #, html.Th('motor status') ,
            ]))
    ]
    table_body = [
        #html.Tbody(html.Tr([html.Td(dev['id']),html.Td(dev['stamp']),html.Td(dev['devId']),html.Td(dev['SPA']),html.Td(dev['TA'])]))for dev in rows]
        html.Tbody(
            html.Tr([
                html.Td(dev[0]),
                html.Td(dev[1]),
                html.Td(dev[2]),
                html.Td(dev[3]),
                html.Td(dev[4])
            ])) for dev in rows
    ]
    #html.Tbody(html.Tr([html.Td(conv(dev.id)),html.Td(conv(dev.stamp)),html.Td(conv(dev.devId)),html.Td(conv(dev.SPA)),html.Td(conv(dev.TA))]))for dev in rows]
    #html.Tbody(html.Tr([html.Td(dev.id),html.Td(dev.stamp),html.Td(dev.devId),html.Td(dev.SPA),html.Td(dev.TA)]))for dev in rows]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      striped=True,
                      hover=True,
                      style={"backgroundColor": "white"})
    return table
Beispiel #26
0
def generate_table(alerts, page_size, page_num):
    table_header = [
        dhc.Thead(
            dhc.Tr([
                dhc.Th(''),
                dhc.Th('Counterpart Identifier'),
                dhc.Th('Right Ascension'),
                dhc.Th('Declination'),
                dhc.Th('LIGO Event TrigNum'),
                dhc.Th('Telescope'),
                dhc.Th('Rank'),
                dhc.Th('Comments'),
            ])
        )
    ]
    table_rows = []
    for alert in alerts:
        alert_id = alert['id']
        table_rows.append(dhc.Tr([
            dhc.Td(dhc.A(alert_id, href=f'/api/alerts/{alert_id}')),
            dhc.Td(alert['extracted_fields']['counterpart_identifier']),
            dhc.Td(alert['right_ascension_sexagesimal']),
            dhc.Td(alert['declination_sexagesimal']),
            dhc.Td(alert['message'].get('event_trig_num', '')),
            dhc.Td(alert['message'].get('telescope', '')),
            dhc.Td(alert['message'].get('rank', '')),
            dhc.Td(alert['extracted_fields']['comment_warnings']),
        ]))
    return dhc.Div([
        dcc.Store(id='session'),
        dbc.Table(table_header + table_rows, bordered=True),
        generate_pagination(page_size, page_num)
    ])
Beispiel #27
0
def display_data(value):
    """Displaying the head for the selected file."""
    db_value = db.get("file")
    if value is None and db_value is None:
        return ""
    elif value is None and not db_value is None:
        value = db_value
    format = FileUtils.file_format(value)
    if format == 'csv' or format == 'txt':
        path = FileUtils.path('raw', value)
        head = DataUtils.read_text_head(path)
        table_col = [
            html.Col(style={'width': "10%"}),
            html.Col(style={'width': "90%"})
        ]
        table_header = [
            html.Thead(html.Tr([html.Th("Row No"),
                                html.Th("Data")]))
        ]
        rows = []
        for i in range(len(head)):
            row = html.Tr([html.Td(i + 1), html.Td(head[i])])
            rows.append(row)
        table_body = [html.Tbody(rows)]
        table = dbc.Table(table_col + table_header + table_body,
                          bordered=True,
                          style=common.table_style)
        div = [
            common.msg("Selected File: " + value),
            common.msg("Selected Format: " + format), table,
            html.Br(), csv_properties_div
        ]
    elif format == 'xls' or format == 'xlsx':
        path = FileUtils.path('raw', value)
        xls = pd.ExcelFile(path)
        sheets = xls.sheet_names
        div = [
            common.msg("Selected File: " + value),
            common.msg("Selected Format: " + format),
            common.msg("Select Sheet:"),
            html.Div([
                dcc.Dropdown(id='xls-file-sheet',
                             options=[{
                                 'label': sheet,
                                 'value': sheet
                             } for sheet in sheets],
                             value=None,
                             multi=False)
            ],
                     style={
                         'margin': '10px',
                         'width': '50%'
                     }),
            html.Div([], id="display-xls-file")
        ]
    else:
        div = "Format Not Supported!!"
    db.put("file", value)
    db.put("format", format)
    return div
Beispiel #28
0
 def quad_table_header(head, id1, id2, id3, id4):
     """returns table with four graphs and with title header, two tables side by side and two tables below that. each row of two tables has a row header"""
     return dbc.Table([
         html.Tr([html.Th(head, colSpan=2, scope="col")],
                 style=web_elements.elements('css')['row_title']),
         html.Tr([
             html.Th(Youless.lang('ELE'),
                     colSpan=2,
                     scope="col",
                     style=web_elements.elements('css', 'subrow_title'))
         ]),
         html.Tr([
             html.Td(dcc.Graph(id=id1),
                     style=web_elements.elements('css', 'column_css')),
             html.Td(dcc.Graph(id=id2),
                     style=web_elements.elements('css', 'column_css'))
         ]),
         html.Tr([
             html.Th(Youless.lang('GAS'),
                     colSpan=2,
                     scope="col",
                     style=web_elements.elements('css', 'subrow_title'))
         ]),
         html.Tr([
             html.Td(dcc.Graph(id=id3),
                     style=web_elements.elements('css', 'column_css')),
             html.Td(dcc.Graph(id=id4),
                     style=web_elements.elements('css', 'column_css'))
         ])
     ],
                      style=web_elements.elements('css')['table_css'],
                      borderless=True)
Beispiel #29
0
def generate_table(dataframe, max_rows=0):
    """
    Generate a table from a DataFrame
    Parameters:
        dataframe (DataFrame): data to read
        max_rows (int): maximum number of rows to read from data. default = 0 (show all rows in dataframe)
    Return:
        table (Bootstrap table): generated table
    """

    # print('  *** generate_table()')
    table_header = [
        html.Thead(
            html.Tr([html.Th(col) for col in dataframe.columns]))
    ]

    rows = []
    if(max_rows == 0):
        max_rows = len(dataframe)
    for i in range(min(len(dataframe), max_rows)):
        rows.append(
            html.Tr([
                html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
            ])
        )
    table_body = [html.Tbody(rows)]
    table = dbc.Table(table_header + table_body, bordered=True)
    
    return table
def table():
    table_header = [
        html.Thead(
            html.Tr([
                html.Th("Giorno"),
                html.Th("Ricoveri"),
                html.Th("Terapie intensive")
            ]))
    ]

    stats = reading.read_slope()

    n = len(stats['slope_ic']) - 1

    m_ic = stats['slope_ic'][n]
    q_ic = stats['ins_ic'][n]

    m_h = stats['slope_h'][n]
    q_h = stats['ins_h'][n]

    row1 = html.Tr(
        [html.Td("Domani"),
         html.Td(m_h * 7 + q_h),
         html.Td(m_ic * 7 + q_ic)])
    row2 = html.Tr([
        html.Td("Dopo domani"),
        html.Td(m_h * 8 + q_h),
        html.Td(m_ic * 8 + q_ic)
    ])
    row3 = html.Tr([
        html.Td("3 giorni"),
        html.Td(m_h * 9 + q_h),
        html.Td(m_ic * 9 + q_ic)
    ])
    row4 = html.Tr([
        html.Td("4 giorni"),
        html.Td(m_h * 10 + q_h),
        html.Td(m_ic * 10 + q_ic)
    ])
    row5 = html.Tr([
        html.Td("5 giorni"),
        html.Td(m_h * 11 + q_h),
        html.Td(m_ic * 11 + q_ic)
    ])
    row6 = html.Tr([
        html.Td("6 giorni"),
        html.Td(m_h * 12 + q_h),
        html.Td(m_ic * 12 + q_ic)
    ])
    row7 = html.Tr([
        html.Td("7 giorni"),
        html.Td(m_h * 13 + q_h),
        html.Td(m_ic * 13 + q_ic)
    ])

    table_body = [html.Tbody([row1, row2, row3, row4, row5, row6, row7])]

    table = dbc.Table(table_header + table_body, bordered=True)
    return table