Exemplo n.º 1
0
def twice_test(dash_app):
    import datetime
    dash_app.layout = html.Div([
        dcc.Upload(
            id='upload-image',
            children=html.Div([
                'Drag and Drop or ',
                html.A('Select Files')
            ]),
            style={
                'width': '100%',
                'height': '60px',
                'lineHeight': '60px',
                'borderWidth': '1px',
                'borderStyle': 'dashed',
                'borderRadius': '5px',
                'textAlign': 'center',
                'margin': '10px'
            },
            # Allow multiple files to be uploaded
            multiple=True
        ),
        html.Textarea(id='output-image-upload'),
    ])

    def parse_contents(contents, filename, date):
        return html.Div([
            html.H5(filename),
            html.H6(datetime.datetime.fromtimestamp(date)),

            # HTML images accept base64 encoded strings in the same format
            # that is supplied by the upload
            html.Img(src=contents),
            html.Hr(),
            html.Div('Raw Content'),
            html.Pre(contents[0:200] + '...', style={
                'whiteSpace': 'pre-wrap',
                'wordBreak': 'break-all'
            })
        ])

    @dash_app.callback(Output('output-image-upload', 'value'),
                       Input('upload-image', 'contents'),
                       State('upload-image', 'filename'),
                       State('upload-image', 'last_modified'))
    def update_output(list_of_contents, list_of_names, list_of_dates):
        # print(list_of_contents)
        # print(list_of_names)
        # print(list_of_dates)
        # if list_of_contents is not None:
        #     children = [
        #         parse_contents(c, n, d) for c, n, d in zip(list_of_contents, list_of_names, list_of_dates)]
        import base64
        # print(base64.b64decode(list_of_dates[0]))
        return list_of_contents[0]
Exemplo n.º 2
0
def tab1_mejerne_komponente():
    return [
        html.Div(children=[
            html.H6("Demonstraing remote control"),
            dbc.Row(children=[
                dbc.Col(html.H4("Working configuration")),
                dbc.Col(html.Button("Change working configuration")),
            ]),
            html.Table(
                id="default_values_resistance",
                children=[
                    html.Thead(
                        html.Tr([
                            html.Td(" "),
                            html.Td(u"Otpror [\u03A9]"),
                            html.Td("tolerancija [%]"),
                            html.Td("Betta faktor [K]"),
                            html.Td("Betta Tolerancija [%]"),
                        ])),
                    html.Tr([
                        html.Td("Ntc"),
                        html.Td(
                            config.get("database").get("ntcresistor").get(
                                "resistance")),
                        html.Td(
                            config.get("database").get("ntcresistor").get(
                                "tolerance")),
                        html.Td(
                            config.get("database").get("ntcresistor").get(
                                "betta")),
                        html.Td(
                            config.get("database").get("ntcresistor").get(
                                "bettaTolerance")),
                    ]),
                    html.Tr([
                        html.Td("Shunt"),
                        html.Td(
                            config.get("database").get("shunt").get(
                                "resistance")),
                        html.Td(
                            config.get("database").get("shunt").get(
                                "tolerance")),
                    ]),
                ],
            ),
            html.Table(
                id="napajanje",
                children=[
                    html.Tr([html.Td("Napajanje kruga"),
                             html.Td("3.3 V")])
                ],
            ),
        ]),  # end div with tables
        html.Label([
            "Sampling speed of adc",
            dcc.Dropdown(
                id="sps",
                options=[{
                    "label": i,
                    "value": i
                } for i in config.get("database").get("adc").get(
                    "samplingSpeed")],
                value=config.get("database").get("adc").get("samplingSpeed")
                [0],
                clearable=False,
                searchable=False,
            ),
        ]),
        html.Label([
            "numbers of samples to take",
            dcc.Input(
                id="number_of_samples",
                value=100,
                type="number",
                step=1,
                min=1,
                max=50000,
                debounce=True,
                inputMode="numeric",
                required=True,
            ),
        ]),
        html.Label(
            [
                "Koliko mjerenja(1. kucica) prema intervalu (2 kucica, sekundi) ",
                dcc.Input(
                    id="input_interval_number",
                    value=0,
                    type="number",
                    step=1,
                    min=0,
                    max=500,
                    inputMode="numeric",
                    required=True,
                    disabled=False,
                ),
                dcc.Input(
                    id="input_interval_time",
                    value=0,
                    type="number",
                    step=1,
                    min=0,
                    max=500,
                    inputMode="numeric",
                    required=True,
                    disabled=False,
                ),
                html.Button(
                    id="interval-button", n_clicks=0, children="set interval"),
                html.Textarea(
                    "prva kucica oznacava broj mjerenja koja ce se napraviti \na druga kucica koliki je interval izmedju 2 uzastopna mjerenja \nkada zavrse sva mjerenja pritisni STOP gumb, (fix this later)"
                ),
            ],
            style={"display": "grid"},
        ),
        html.Button(
            id="start-button",
            disabled=False,
            n_clicks=0,
            children="START jedno mjerenje",
        ),
        dcc.Graph(id="output-state"),
    ]
Exemplo n.º 3
0
    dbc.Badge(children="OFF",
              color="secondary",
              className="mr-1",
              id='error_correction_status'), 'error correction'
],
                                   style=proc_style)

transferd_log = html.Div([
    dbc.Button(
        "Transferd log",
        id="transferd-collapse-button",
        className="mb-3",
        color="primary",
    ),
    dbc.Collapse(
        dbc.Card(html.Textarea('test')),
        id="transferd-collapse",
    ),
])

chopper_log = html.Div([
    dbc.Button(
        "chopper log",
        id="chopper-collapse-button",
        className="mb-3",
        color="primary",
    ),
    dbc.Collapse(
        dbc.Card(html.Textarea('chopper output')),
        id="chopper-collapse",
    ),
Exemplo n.º 4
0
             style={
                 'fontFamily': 'Titillium Web',
                 'text-align': 'center'
             }),
    html.Br(),

    #explanation paragraph
    html.Textarea(id='introduction',
                  children="\tWith the aim to observe \
changes in SERPs and understand SEO-based manipulation techniques, Wellesley\
 CRED lab implement the SERP observatory by collecting the SERPs for a \
series of queries of different kinds on a daily basis.",
                  style={
                      'width': '800px',
                      'height': '90px',
                      'backgroundColor': 'FloralWhite',
                      'color': 'black',
                      'border': 'none',
                      'padding': '2%',
                      'margin': 'auto',
                      'display': 'block',
                      'fontFamily': 'Dosis',
                      'fontSize': '17'
                  }),
    html.Br(),
    #generate_table(df),
    html.Div(
        [
            html.Div([
                html.H6("2020 Election Candidates"),
            ] + [
            value="大阪",
        ),
        html.H3("スライダー"),
        dcc.Slider(
            min=-10, max=10, marks={i: f"label{i}"
                                    for i in range(-10, 11, 5)}),
    ],
    style=div_style2,
)

# ➌ Divのchildren属性に渡すレイアウト(中央下)
bottom_mid = html.Div(
    [
        html.H3("テキストエリア入力"),
        html.Textarea(style={
            "height": 200,
            "width": "60%"
        }),
        html.Button("ボタン"),
    ],
    style=div_style2,
)

# ➌ Divのchildren属性に渡すレイアウト(右下)
bottom_right = html.Div(
    [
        html.H3("選択肢", style={"textAlign": "center"}),
        # 2つのコンポーネントはスタイルシートを活用して横並びに
        dcc.Checklist(
            options=[
                {
                    "label": "北海道",
Exemplo n.º 6
0
def getResults(app):
    return [html.Textarea(str(r[0]) + '\n' + str(r[1]), style={'width': '525', 'height': '550'}) for r in app.resultParameters]
Exemplo n.º 7
0
def parser():
    return html.Div(
        [
            # Select Division Dropdown
            html.Div(
                [
                    # Select Division Dropdown
                    html.Div(children="",
                             className='glyphicon glyphicon-user',
                             id="user"),
                    #html.Button(id="addConn",className="glyphicon glyphicon-plus-sign"),
                    html.Button(id='logout',
                                n_clicks=0,
                                className="glyphicon glyphicon-off"),
                ],
                className='fixed_header'),
            html.Div([
                html.H3(children="", className="h3"),
                html.Button(id="closeMsg",
                            className="glyphicon glyphicon-close")
            ],
                     className="userAlert",
                     id="userAlert"),
            html.Div([
                html.H3(children="Connect With DAVID"),
                html.Div([
                    html.Div([
                        html.Label(" Select Category : ",
                                   style={"width": "40%"}),
                        dcc.Dropdown(id='category',
                                     options=[{
                                         'label': 'Report an Issue',
                                         'value': 'Issue'
                                     }, {
                                         'label': 'Ask a Query',
                                         'value': 'Query'
                                     }, {
                                         'label': 'Share a Suggestion',
                                         'value': 'Sugestion'
                                     }],
                                     value='Suggestion')
                    ],
                             style={
                                 "display": "inline-flex",
                                 "width": "100%"
                             }),
                    html.Div(
                        [
                            html.Label(" Subject : ", style={"width": "40%"}),
                            dcc.Input(id='msg_sub',
                                      placeholder='Enter Subject...')
                        ],
                        style={
                            "width": "100%",
                            "display": "inline-flex",
                            "padding": "10px 0px"
                        })
                ],
                         className="subArea"),
                html.Div([
                    html.Label(" Message : ", style={"width": "40%"}),
                    dcc.Textarea(id='msg_txt', placeholder='Enter Message...')
                ],
                         className="msgArea"),
                html.Div(
                    [
                        html.Label(" Email : ", style={"width": "40%"}),
                        dcc.Input(id='msg_mail', placeholder='Enter Email...'),
                    ],
                    style={
                        "width": "100%",
                        "padding": "10px 0px",
                        "display": "inline-flex"
                    }),
                html.Div(
                    [
                        html.Label(" Send Copy : ", style={"width": "40%"}),
                        dcc.Input(id='msg_cc', placeholder='Enter Email...'),
                    ],
                    style={
                        "width": "100%",
                        "padding": "10px 0px",
                        "display": "inline-flex"
                    }),
                html.
                P("* You'll receive a confirmation mail on this email . We promise not to spam you , !",
                  style={
                      "color": "#fff",
                      "font-size": "12px",
                      "margin-left": "105px"
                  }),
                html.Button(children="SEND", className="btn send "),
                html.Button(children="CLOSE", className="btn closeModal ")
            ],
                     className="contactModal hidden"),
            html.Div([
                html.Div(children="DAVID", className="logoContainer"),
                html.Div([
                    html.Span([html.A("ABOUT", href='/about')],
                              className="invisble-btn about"),
                    html.Span([html.A("HOME", href='/login')],
                              className="invisble-btn about"),
                    html.Span([
                        html.Button(children="Knowledge Base",
                                    className="invisble-btn parser")
                    ]),
                    html.Span([
                        html.Button(children="DASHBOARD",
                                    className="invisble-btn dash")
                    ]),
                    html.Span([
                        html.Button(children="CONTACT",
                                    className="invisble-btn",
                                    id="contactDavid")
                    ]),
                ],
                         className="linksContainer")
            ],
                     className="horizontal_header"),
            html.Div([
                html.Span(className="glyphicon glyphicon-upload upload"),
                dcc.Upload(
                    id="upload-data",
                    children=html.Div([
                        "Drag and drop or click to select a file to upload."
                    ]),
                    style={
                        "width": "100%",
                        "height": "60px",
                        "lineHeight": "60px",
                        "borderWidth": "1px",
                        "borderStyle": "dashed",
                        "borderRadius": "5px",
                        "textAlign": "center",
                        "margin": "10px",
                    },
                    multiple=True,
                ),
                html.Div([html.Ul(id="copied-file-list")],
                         id="copied-file-list-container"),
                html.Span(
                    className="glyphicon glyphicon-circle-arrow-right icons")
            ],
                     className="uploadSection"),
            html.Div([
                html.Span(className="glyphicon glyphicon-search ",
                          style={
                              "font-size": "50px",
                              "padding": "10px"
                          }),
                dcc.Input(placeholder="Search for corpus here..."),
                html.Span(
                    className="glyphicon glyphicon-circle-arrow-left icons")
            ],
                     className="searchBox hidden"),
            #html.H2("File List"),
            #html.Div([html.Ul(id="file-list")],id="file-list-container"),
            html.Hr(),
            html.Div(
                [
                    #todolist : check for knwoledge article and auto-fill if check return true
                    html.Div(
                        [html.Label(children="Title"),
                         dcc.Input(type="text")],
                        className="title sec"),
                    html.Div(
                        [html.Label(children="Description"),
                         html.Textarea()],
                        className="issue_description sec"),
                    html.Div([
                        html.Label(children="Domain"),
                        dcc.Input(type="text")
                    ],
                             className="issue_domain sec left-half"),
                    html.Div([
                        html.Label(children="Module"),
                        dcc.Input(type="text")
                    ],
                             className="issue_module sec right-half"),
                    html.Div([
                        html.Label(children="Customer"),
                        dcc.Input(type="text")
                    ],
                             className="customer sec left-half"),
                    html.Div([
                        html.Label(children="Log Date"),
                        dcc.Input(type="date")
                    ],
                             className="log_date sec right-half"),
                    html.Div([
                        html.Label(children="Steps to Reproduce"),
                        html.Textarea()
                    ],
                             className="reproduce sec"),
                    html.Div([
                        html.Label(children="Steps to Resolve"),
                        html.Textarea()
                    ],
                             className="resolve sec"),
                    html.Div([
                        html.Label(children="Filed By"),
                        dcc.Input(type="text")
                    ],
                             className="author sec"),
                    dcc.Input(id="fileConnectorId", className="hidden"),
                    html.Div(
                        [
                            #html.Button(children="SAVE"),
                            html.Span([
                                html.Button(children="SUBMIT",
                                            className="submit sec last")
                            ]),
                            html.Span([
                                html.Button(children="SAVE AS DRAFT",
                                            className="draft sec last")
                            ]),

                            #],className="submit sec last"),
                        ],
                        className="submit sec last"),
                ],
                className="form-container",
                id="formContainer"),
        ],
        style={"max-width": "100%"},
    )
Exemplo n.º 8
0
    dhc.Div([
        dhc.Div('Strategy:', className='four columns'),
        dcc.Dropdown(id='strategy', options=[], className='eight columns u-pull-right')
    ], className='row mb-10'),
    dhc.Div(
        dtb.DataTable(  # https://github.com/plotly/dash-table-experiments/blob/master/usage-editable.py
            rows=ob.cash_param(),
            # optional - sets the order of columns
            columns=['Parameter', 'Value'],
            editable=True,
            id='params-table'
        ), className='row mb-10'),

    dhc.Div([
        dhc.Div('Notes:'),
        dhc.Textarea(id='notes-area', style={'width': '100%'})
    ], className='row', style={'vertical-align': 'bottom'}),
], className="three columns gray-block", style={'position': 'absolute', 'top': 0, 'bottom': '123px'})

center = dhc.Div([
    dhc.Div([
        dhc.Div([dcc.Graph(id='charts')]),
    ], id='graph-container', className='row',
        style={'position': 'absolute', 'top': '0px', 'bottom': '0px', 'left': '0px', 'right': '0px'})
], className='offset-by-three six columns gray-block', style={'position': 'absolute', 'top': 0,  'bottom': '9.2em'})

right_column = dhc.Div([
    dhc.Div(
        dhc.Div([
            dhc.Div([
                dhc.Div([
Exemplo n.º 9
0
def create_tabs_layout(simu_desc_file):
    # return dbc.Container(id='app-control-tabs', className='control-tabs', children=[
    return dbc.Tabs(id='app-tabs', children=[
        dbc.Tab(
            label=_('About'),
            tab_id='what-is',
            children=dbc.Col(className='control-tab', children=[
                html.H4(className='what-is', children=_('App presentation')),
                html.P(
                    _('This website simulates drones sent with Automatic External '
                      'Defibrillators '
                      'to Out-of-Hospital Cardiac Arrest incidents. '
                      "Simulation is based on real life data, gathered in 2017 by Paris' "
                      'Firefighters, who intervened on more than 3000 OHCA in Paris and '
                      'Paris suburbs.')
                ),
                html.P(
                    _('The aim is to compare the hypothetical time to arrival of drones to'
                      ' the actual time to arrival of BLS teams, and to estimate to what '
                      'extent drones could improve the chain of survival.')
                ),
                html.P([
                    _('This app allows the user to compute their own simulation, '
                      'by changing '
                      'both dispatch center and drone flight parameters. '
                      'The source code is '
                      'available on '),
                    dbc.CardLink('Github',
                                 href='https://github.com/AlbaneMiron/drone-simulation'),
                    _(' to allow for expertise and replication.'),
                ]),
                html.P(
                    _('Default parameters correspond to what is assumed to be the '
                      'most likely set of drone characteristics and to the actual '
                      'operational'
                      "performance of Paris'firefighters medical dispatch center.")
                ),
                html.Div([
                    html.Img(
                        src='https://maps.googleapis.com/maps/api/staticmap?center=Paris,+France&zoom=11&scale=false&size=600x300&maptype=roadmap&key=AIzaSyAMs0JsrC88jq_yxCxfFqZ8dIBt0wEl3CY&format=png&visual_refresh=true',
                    ),
                ], style={'textAlign': 'center'}),
                # dbc.Card(
                #     dbc.Button(" GitHub",
                #                id='submit-button', className='fa fa-github',
                #                size='lg',
                #                href="https://github.com/AlbaneMiron/drone-simulation"),
                #     style={"width": "12rem",
                #            "marginLeft": "auto",
                #            "marginRight": "auto"
                #            }),

            ], style={'marginTop': '10px',
                      'paddingRight': '0', 'paddingLeft': '0'})

        ),

        dbc.Tab(
            label=_('Simulation description'),
            tab_id='datasets',
            children=dbc.Col(className='control-tab', children=[
                html.H4(className='datasets',
                        children=_('Rescue chain: BLS teams vs drones')),
                html.Img(src=simu_desc_file,
                         style={'maxWidth': '100%', 'maxHeight': '100%'}),
            ], style={'marginTop': '10px',
                      'paddingRight': '0', 'paddingLeft': '0'}),
        ),

        dbc.Tab(
            label=_('Parameters simulation A'),
            tab_id='simA',
            children=dbc.Col(
                create_parameters_layout('A')),
        ),
        dbc.Tab(
            label=_('Parameters simulation B'),
            tab_id='simB',
            children=dbc.Col(
                create_parameters_layout(
                    'B', suffix='_b',
                    input_drone='Centres de secours',
                )),
        ),

        dbc.Tab(
            label=_('Comparison of both simulations'),
            tab_id='sims',
            children=dbc.Col(
                [
                    create_both_graphs('A', style={
                        'borderRight': 'solid 1px #ddd',
                        'marginRight': '15px',
                        'paddingRight': '15px',
                    }),
                    create_both_graphs('B', suffix='_b'),
                ],
                style={'display': 'flex', 'marginTop': '10px',
                       'paddingRight': '0', 'paddingLeft': '0'}),
        ),

        dbc.Tab(
            label=_('Custom Datasets'),
            tab_id='data',
            children=dbc.Col([
                html.H3(children=_('Custom Datasets')),

                html.Div(_('Launch a simulation on your own data:')),
                html.H4(children=_('Starting Points'), style={'marginTop': 30}),
                html.Div([_(
                    'Upload a CSV file containing a list of starting points for drones. '
                    'Each row represents one starting point and should contain an index '
                    'followed by the latitude and longitude of the point. Example:'
                )]),
                html.Textarea(
                    children=textwrap.dedent('''\
                                COBI,48.8511191742212,2.33150232324835
                                MALA,48.8615396838525,2.3057037964225398
                                CHPY,48.8079548017692,2.53121646098508'''),
                    disabled=True, style={'height': 80, 'width': 400}),
                dcc.Upload(
                    id='upload-starting-points',
                    children=html.Div([
                        _('Drag and Drop or '),
                        html.A(html.Button(_('Select a File'))),
                    ]),
                ),
                html.Div(id='output-starting-points-upload'),

                html.H4(children=_('Incidents'), style={'marginTop': 30}),
                html.Div([_(
                    'Upload a CSV file containing a list of incidents. Each row (except the first '
                    'one used for fields headers) represents one incident and should contain the '
                    'following fields:'
                )]),
                html.Ul([
                    html.Li(_('time_call: the date and time of the emergency call')),
                    html.Li(_('latitude: the latitude of the incident, as a float')),
                    html.Li(_('longitude: the longitude of the incident as a float')),
                    html.Li(_(
                        'BLS_time: the time taken by the BLS team to reach the incident, '
                        'in seconds',
                    )),
                    html.Li(_(
                        'home: a flag indicating whether the incident happened at home (1) '
                        'or in a street or public place (0)',
                    )),
                    html.Li(_(
                        'day: a flag indicating whether the incident happened during the '
                        'aeronautical day (1) or night (0)',
                    )),
                    html.Li(_(
                        'low_wind: a flag indicating whether the wind during incident was low '
                        'enough to fly (1) or faster than 50 km/h (0)',
                    )),
                    html.Li(_(
                        'clear_sight: a flag indicating whether the sight during incident was '
                        'clear enough to fly (1) or below 200m (0)',
                    )),
                ]),
                html.Textarea(
                    children=textwrap.dedent('''\
                        ,time_call,BLS_time,day,low_wind,clear_sight,home,latitude,longitude
                        0,01/01/17 00:13,214.0,0,1,1,1,48.8240664,2.3680644
                        1,01/01/17 03:49,1062.0,0,1,1,1,48.785867700000004,2.4296106
                        2,01/01/17 06:03,442.0,0,1,1,1,48.8405163,2.2878906000000003
                        3,01/01/17 06:15,486.0,0,1,1,1,48.8759425,2.1920694
                        4,01/01/17 08:56,366.0,1,1,1,1,48.7890453,2.4475238999999998
                        5,01/01/17 12:14,630.0,1,1,1,1,48.873926899999994,2.1894501'''),
                    disabled=True, style={'height': 150, 'width': '100%'}),
                dcc.Upload(
                    id='upload-incidents',
                    children=html.Div([
                        _('Drag and Drop or '),
                        html.A(html.Button(_('Select a File'))),
                    ]),
                ),
                html.Div(id='output-incidents-upload'),
            ], style={'marginTop': '10px',
                      'paddingRight': '0', 'paddingLeft': '0'}),
        ),
    ], style={'marginTop': '10px',
              'paddingRight': '0', 'paddingLeft': '0'})
Exemplo n.º 10
0
                                            placeholder="Digite o seu sobrenome"
                                        )
                                    ]),
                                ]),
                                Row([
                                    RowElement([], 9),
                                    RowElement([
                                        html.Button("Enviar", id="send-button")
                                    ], 0, {'marginTop': '10px'})
                                ])
                            ])
                    ])
            ]),
    ],
             style={'padding': '0 8px'}),
    html.Textarea(id="output-data")
],
                      id="main-container")


@app.callback(Output("student-list", "options"),
              [Input("program-list", "value")])
def program_selected(program_id):
    students = pd.read_sql_query(
        '''
        select * from students_program
        where program_id={}
    '''.format(program_id), engine)

    students = students.drop(columns=["subject", "program_id"])