html.Div(className='row', children=[html.Div(dcc.Graph(id='live-graph', animate=False), className='col-12 col-md-6'), html.Div(dcc.Graph(id='long-live-graph', animate=False), className='col-12 col-md-6'), ]), html.Br(), html.Div(className='row', children=[html.Div(dcc.Graph(id='pie-live-graph', animate=False), className='col-12 col-md-6'), html.Div(id="recent-threads-table", className='col-12 col-md-6'), ]), html.H2(className="card text-white bg-dark mb-3", children=[ html.H2(className="card-header", children=["Support Us"]), html.H3(className="card-body", children=[ html.H3(className="card-title", children=["Your contribution is valuable!"]), html.H3(children=[ dcc.Link('Contribute on GitHub', href="https://github.com/ZeroPanda/Reddit-Sentiment", className="btn btn-primary btn-lg"), html.Span(" "), dcc.Link('Connect on LinkedIn', href="https://www.linkedin.com/in/shahshrey31/", className="btn btn-success btn-lg") ]) ]) ], style={'padding-left': '100px', 'padding-right': '100px', 'textAlign': 'center', 'align-content': 'center', }), html.Hr(), html.Div(id="subreddit_term"), html.Div(id="search_term"), ], style={'margin-top': '5px', 'margin-left': 10, 'margin-right': 10, 'align-content': 'center', 'padding': 10},)
html.Br(), html.Br(), html.Br(), dbc.Row([ dbc.Col(lg=1), dbc.Col([ html.B( html.A(id='missing', children='Countries missing from latest quarter: (' + str(len(missing_countries)) + ')', style={ 'color': '#A29061', 'face': 'bold' })), html.Br(), html.Span(' - '.join(sorted(missing_countries)), style={'color': '#A29061'}) ], lg=7) ]) ], style={'background-color': '#eeeeee'}, fluid=True) excluded_regions = [ 'World', 'Advanced Economies', 'Euro Area', 'Europe', 'CIS', 'Central African Economic and Monetary Community', 'Emerging and Developing Europe', 'Emerging and Developing Countries', 'Middle East, North Africa, Afghanistan, and Pakistan', 'Emerging and Developing Asia', 'Western Hemisphere' ]
style={"padding": "3px"}), dbc.Row([ dbc.Col(children=dash_table.DataTable(id='table_exp', columns=[{ "name": i, "id": i } for i in df.columns], data=df.to_dict('records')), width={ "size": 10, "offset": 1 }) ], style={"padding": "3px"}), html.H3('Линейная модель: '), html.Span(id='line', children=''), html.H3('Частично-нелинейная модель'), html.Span(id='no_line', children=''), ]) @app.callback([ Output('table_exp', 'columns'), Output('table_exp', 'data'), Output('line', 'children'), Output('no_line', 'children') ], [Input('table', 'n_clicks'), Input('add_point', 'n_clicks')], [ State('clients', 'value'), State('rel_min', 'value'), State('rel_max', 'value'),
def modal(): return html.Div( html.Div( [ html.Div( [ # modal header html.Div( [ html.Span( "Workflow", style={ "color": "#506784", "fontWeight": "bold", "fontSize": "20", }, ), html.Span( "×", id="modal_close", n_clicks=0, style={ "float": "right", "cursor": "pointer", "marginTop": "0", "marginBottom": "17", }, ), ], className="row", style={"borderBottom": "1px solid #C8D4E3"}, ), # modal form html.Div( [ # left Div html.Div( [ dcc.Upload( id="upload-data", children=[ "Drag and Drop or ", html. A(children="Select a CSV file." ), ], style={ 'width': '98%', 'height': '100px', 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', }, multiple=True), html.Div(id='output-data-upload', ), # General Text Cleaning # html.P( # "Text Cleaning", # style={ # "textAlign": "left", # "marginBottom": "2", # "marginTop": "4", # }, # ), # html.P( # "In order to ensure the accuracy of the algorithm, we remove " # "noise in the data. We remove URL links, user and hashtags. " # "We also fix punctuation errors like multiple periods. These " # "data cleaning methods can greatly improve the accuracy of the " # "sentiment analysis of the machine learning model of your choice." # ), ], className="six columns", style={"paddingRight": "15"}, ), # right Div html.Div( [ # # Vectorizer # html.P( # "Vectorizer", # style={ # "textAlign": "left", # "marginBottom": "2", # "marginTop": "4", # }, # ), # dcc.Dropdown( # id="vectorizer", # options=[ # {'label': 'Count Vectorizer', 'value': 'count'}, # {'label': 'TF-IDF Vectorizer', 'value': 'tfidf'}, # ], # value='TfidfVectorizer', # clearable=False, # ), # Twitter Bot Detection html.P( "Twitter Bot Detection", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Dropdown( id="bot_detection", options=[ { 'label': 'Enable Bot Detection', 'value': 'Bot' }, { 'label': 'Disable Bot Detection', 'value': 'No_Bot' }, ], value='Bot', clearable=False, ), html.P( "Sentiment Analysis Model", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), # Sentiment models html.Div( dcc.Dropdown( id="sentiment_model", options=[{ "label": "Logistic Regression", "value": "logistic", }, { "label": "SGD Classifier", "value": "sgd", }, { "label": "Multinomial Naive Bayes", "value": "mnb", }, { "label": "Bernoulli Naive Bayes", "value": "bnb", }], clearable=False, value="logistic", )), ], className="six columns", style={"paddingLeft": "15"}, ), ], style={ "marginTop": "10", "textAlign": "center", "marginBottom": "10" }, className="row", ), # submit button html.Span("Run!", id="run", n_clicks=0, className="button button--primary add"), ], className="modal-content", style={ "textAlign": "center", "border": "1px solid #C8D4E3" }, ) ], className="modal", ), id="modal", style={"display": "none"}, )
import dash_core_components as dcc import dash_html_components as html import pandas as pd import flask import plotly.plotly as py from plotly import graph_objs as go import math from app import app, server, sf_manager # from apps import opportunities, cases, leads from apps import opportunities, cases, leads app.layout = html.Div( [ # header html.Div([ html.Span("FI Hackathon App using Redshift API", className='app-title'), html.Div(html.Img( src= 'https://www.ficonsulting.com/wp-content/uploads/2018/10/home-logo.png', height="100%"), style={ "float": "right", "height": "100%" }) ], className="row header"), # tabs html.Div([ dcc.Tabs( id="tabs",
dbc.ListGroupItem( [ dbc.ListGroupItemHeading("Item 4 heading"), dbc.ListGroupItemText("Item 4 text"), ] ), ] ), ] ) popover = html.Div( [ html.H2("Popover"), html.P( ["Click on the word ", html.Span("popover", id="popover-target")] ), dbc.Popover( [ dbc.PopoverHeader("Popover header"), dbc.PopoverBody("Popover body"), ], id="popover", is_open=False, target="popover-target", ), ] ) progress = html.Div( [
badges = html.Span([ dbc.Badge("Primary", href="https://github.com", pill=True, color="primary", className="mr-1"), dbc.Badge("Secondary", href="https://github.com", pill=True, color="secondary", className="mr-1"), dbc.Badge("Success", href="https://github.com", pill=True, color="success", className="mr-1"), dbc.Badge("Warning", href="https://github.com", pill=True, color="warning", className="mr-1"), dbc.Badge("Danger", href="https://github.com", pill=True, color="danger", className="mr-1"), dbc.Badge("Info", href="https://github.com", pill=True, color="info", className="mr-1"), dbc.Badge("Light", href="https://github.com", pill=True, color="light", className="mr-1"), dbc.Badge("Dark", href="https://github.com", pill=True, color="dark"), ])
def get_plot_options_form(): try: collection_options = [{ 'label': f'{collection.id}: {collection.name}', 'value': collection.id } for collection in get_collections(current_user, {'kind': 'data'})] except: collection_options = [] try: viz_data = VisualizationModel(load_data=True) label_options = [{ 'label': label, 'value': label } for label in viz_data.labels] loaded_badges = viz_data.get_collection_badges() collection_load_info = viz_data.get_collection_load_info() except: loaded_badges = [ html.Span([dbc.Badge('None', className='badge-pill')]) ] collection_load_info = 'Loaded collections.' label_options = [] return dbc.Form([ dbc.Row([ dbc.Col([ dbc.FormGroup([ dbc.Label('Collection ID', html_for='collection-id'), dcc.Dropdown(options=collection_options, id='collection-id', multi=True) ]) ]), dbc.Col([ dbc.FormGroup([ dbc.Label(collection_load_info, html_for='loaded-display', id='collections-label'), dcc.Loading([ dbc.InputGroup([ dbc.Button('Get', id='get-collection', className='col-sm-2 btn-success'), html.H4(loaded_badges, id='loaded-collections', className='col-sm-10') ], id='loaded-display') ]) ]) ]) ]), dbc.Row([ dbc.Col([ dbc.FormGroup([ dbc.Label('Group By', html_for='group-by'), dcc.Dropdown(options=label_options, id='group-by', multi=True) ]) ]), dbc.Col([ dbc.FormGroup([ dbc.Label('Display Groups', html_for='group-by-value'), dcc.Dropdown(options=[], id='group-by-value', multi=True) ]) ]), dbc.Col([ dbc.FormGroup([ dbc.Label('Label By', html_for='label-by'), dcc.Dropdown(options=label_options, id='label-by', multi=True) ]) ]) ]), dbc.Row([ dbc.Col([ dbc.FormGroup([ dbc.Label('Show Bins From', html_for='bin-collection'), dcc.Dropdown(options=collection_options, id='bin-collection', multi=False) ]) ], className='col-5'), dbc.Col([ dbc.FormGroup([ dbc.Label('Legend Style', html_for='legend-style-select'), dcc.Dropdown(options=[{ 'label': 'Full', 'value': 'full' }, { 'label': 'Groups', 'value': 'groups' }, { 'label': 'None', 'value': 'none' }], value='full', id='legend-style-select', clearable=False) ]) ], className='col-3'), dbc.Col([ dbc.FormGroup([ dbc.Label('Background Color', html_for='background-color-select'), dcc.Dropdown(options=[ { 'label': 'Transparent', 'value': 'rgba(0,0,0,0)' }, { 'label': 'White', 'value': 'rgba(255,255,255,1)' }, ], value='rgba(0,0,0,0)', id='background-color-select', clearable=False) ]) ], className='col-3'), dbc.Col([ dbc.FormGroup([ dbc.Label('Plot', html_for='plot-button-group'), dbc.InputGroup([ dbc.Button('Plot', color='primary', id='plot-button') ], id='plot-button-group') ]) ], className='col-1'), ]), dbc.Row([ dbc.Col([ dbc.FormGroup([ dbc.Label('Width', html_for='width-input'), dbc.Input(type='number', min=0, step=0.25, value=6.5, id='width-input') ]) ], className='col-2'), dbc.Col([ dbc.FormGroup([ dbc.Label('Height', html_for='height-input'), dbc.Input(type='number', min=0, step=0.25, value=4, id='height-input') ]) ], className='col-2'), dbc.Col([ dbc.FormGroup([ dbc.Label('Units', html_for='units-select'), dcc.Dropdown(options=[{ 'label': 'in', 'value': 'in' }, { 'label': 'cm', 'value': 'cm' }, { 'label': 'px', 'value': 'px' }], value='in', clearable=False, id='units-select') ]) ], className='col-1'), dbc.Col([ dbc.FormGroup([ dbc.Label('DPI', html_for='dpi-select'), dbc.Input(type='number', min=50, step=25, value=100, id='dpi-input') ]) ], className='col-2'), dbc.Col([ dbc.FormGroup([ dbc.Label('File Format', html_for='file-format-select'), dcc.Dropdown(options=[{ 'label': 'SVG', 'value': 'svg' }, { 'label': 'PNG', 'value': 'png' }, { 'label': 'JPEG', 'value': 'jpg' }, { 'label': 'PDF', 'value': 'pdf' }, { 'label': 'TIFF', 'value': 'tif' }, { 'label': 'EPS', 'value': 'eps' }], value='png', clearable=False, id='file-format-select') ]) ], className='col-2'), dbc.Col([ dbc.FormGroup([ dbc.Label('Prepare', html_for='download-button-group'), dbc.FormGroup([ dbc.Button([html.I(className='fas fa-cogs')], id='download-button', className='btn btn-info') ], id='download-button-group') ]) ], className='col-1'), dbc.Col([ dbc.FormGroup([ dbc.Label('Download', html_for='download-link-group'), dbc.FormGroup([ dcc.Loading( html.A([html.I(className='fas fa-download')], id='download-link', className='btn btn-secondary disabled')) ], id='download-link-group') ]) ], className='col-1') ]), dbc.Row( dcc.Loading( html.Small('', id='download-message', className='form-text'))), ])
app = dash.Dash() server = app.server app.config.supress_callback_exceptions = True # TODO: remove this? app.scripts.config.serve_locally = True app.title = "propnet" route = dcc.Location(id='url', refresh=False) cache = Cache(app.server, config={ 'CACHE_TYPE': 'filesystem', 'CACHE_DIR': '.tmp' }) layout_menu = html.Div(children=[ dcc.Link('What is propnet?', href='/home'), html.Span(' • '), dcc.Link('Explore', href='/explore'), html.Span(' • '), #dcc.Link('Models', href='/model'), #html.Span(' • '), #dcc.Link('Properties', href='/property'), #html.Span(' • '), dcc.Link('Generate', href='/generate'), html.Span(' • '), dcc.Link('Plot', href='/plot') ]) # header app.layout = html.Div( children=[ route, html.Div([html.H3(app.title), layout_menu,
), html.Div( [ #row1 dbc.Row( [ #AVERAGE SCORE AT DEPARTMENT CARD dbc.Col(html.Div(html.Div( [ html.H6(id="avg_dpt_text"), html.P( html.Span("Average Score at Department", id="tooltip-avg_dpt", style={"textDecoration": "underline", "cursor": "pointer"}, )) , dbc.Tooltip("Average value of selected score at Department.", target="tooltip-avg_dpt", placement="bottom") ], id="avg_dpt", style = mini_container ))), #AVERAGE SCORE COLOMBIA CARD dbc.Col(html.Div(html.Div( [ html.H6(id="avg_col_text"), html.P( html.Span("Average Score Colombia", id="tooltip-avg_col", style={"textDecoration": "underline", "cursor": "pointer"},
className="context", children=[ html.Div(className="title_co", children=["GENERAL CONTEXT"]), html.Article( className="context__row", children=[ html.Div(className="context__col", children=[ html.Img( src="./assets/images/datafolio/img1t.png") ]), html.Div( className="context__col", children=[ html.P(children=[ html.Span(className="blue", children=["Crime and violence "]), "are the main concerns of all citizens around the world and generates impacts on our society and exception." ]) ]) ]), html.Article( className="context__row", children=[ html.Div( className="context__col", children=[ html.P(children=[ html.Span( className="red", children=[ "Thefts, domestic violence, sexual crimes and personal injuries increased "
def update_metrics(self, n): style = {'padding': '5px', 'fontSize': '16px'} return [ html.Span('Text updates here', style=style), ]
def RefreshButton(children=None, btnid=None): return html.Button([html.Span(Fa('refresh')), ' Refresh'], className='btn', id=btnid)
sticky='top', color='light', light=True, dark=False) # Footer docs: # dbc.Container, dbc.Row, dbc.Col: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout # html.P: https://dash.plot.ly/dash-html-components # fa (font awesome) : https://fontawesome.com/icons/github-square?style=brands # mr (margin right) : https://getbootstrap.com/docs/4.3/utilities/spacing/ # className='lead' : https://getbootstrap.com/docs/4.3/content/typography/#lead footer = dbc.Container( dbc.Row( dbc.Col( html.P([ html.Span('Daanish Rasheed', className='mr-2'), html.A(html.I(className='fas fa-envelope-square mr-1'), href='mailto:[email protected]'), html.A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/daanishrasheed'), html. A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/daanish-rasheed-1855b6163/' ), html.A(html.I(className='fab fa-twitter-square mr-1'), href='https://twitter.com/RasheedDaanish'), ], className='lead')))) # Layout docs: # html.Div: https://dash.plot.ly/getting-started
</span> </p> </nav> {%config%} {%scripts%} </footer> </body> </html> ''' app.layout = html.Div( [ # header html.Div([ html.Span("Customer Relationship Management Dashboard", className='app-title'), html.Div( html.Img(src='https://www.halcyonagri.com/wp-content/themes/vw-lawyer-attorney/images/halcyon-logo.png',height="100%") ,style={"float":"right","height":"100%"}), html.P("Demo Dashboard App using Salesforce API for HalcyonAgri (HeveaConnect)") ], # className="row header" ), # tabs html.Div([ dcc.Tabs( id="tabs",
o processo investigativo informando aos agentes fiscalizadores quais compras possuem uma maior probabilidade de serem irregulares. ''' ), html.P( style={ 'textAlign': 'justify', 'color': 'rgba(255,255,255,0.9)', }, children=[ ''' As técnicas utilizadas para o desenvolvimento do sistema são: ''', html.Span( 'web scraping', className='font-italic' ), ', ', html.Span( 'data wrangling', className='font-italic' ), ', ', html.Span( 'machine learning', className='font-italic' ), ' e ', html.Span( 'web development', className='font-italic'
from app import APP from grab_list import object_save from userbased_filtering import Collaborative import display_popularity import display_content_base import display_recomm #import display_final_movie # we use the Row and Col components to construct the SIDEBAR header # it consists of a title, and a toggle, the latter is hidden on large screens SIDEBARHEADER = dbc.Row([ dbc.Col(html.H2("Movie Recommender", className="display-5")), dbc.Col( html.Button( # use the Bootstrap navbar-toggler classes to style the toggle html.Span(className="navbar-toggler-icon"), className="navbar-toggler", # the navbar-toggler classes don't set color, so we do it here style={ "color": "rgba(0,0,0,.5)", "border-color": "rgba(0,0,0,.1)", }, id="toggle", ), # the column containing the toggle will be only as wide as the # toggle, resulting in the toggle being right aligned width="auto", # vertically align the toggle in the center align="center", ), ])
style={'display': 'none'} ) divs.append(div) # Layout app.layout = html.Div( [ html.H2('Quantmod Charts'), html.Div( [ html.Span( core.Dropdown( id='dropdown', options=tickers, value='SPY', ), style={ 'width': '450px', 'display': 'inline-block', 'text-align': 'left' }, ), html.Span( core.Dropdown( id='multi', options=functions, multi=True, value=[], ), style={ 'width': '450px', 'display': 'inline-block',
'color': 'white', 'marginBottom': "20px", 'height': '50px', 'fontSize': 20 } app.layout = html.Div( [ # header html.Div( [ html.Span("Colour Analyzer", className='app-title', style={ 'color': 'white', 'fontSize': 38, "marginLeft": "10px", 'text-align': 'center', 'marginTop': '20px', 'marginBottom': '20px' }), html.Img( src=app.get_asset_url('QIO-IRONN_logo-white-on-blue.png'), style={ 'float': 'right', 'height': '8%', 'width': '8%' }) ], style={ 'marginTop': "20px", 'marginRight': "20px",
def create_graph( data_frame: pd.DataFrame, color_by: str, colors: Dict[str, List[str]], phase: str, plot: str, plot_title: str, theme: dict, ) -> html.Div: return html.Div( style={ "min-width": "500px", "min-height": "400px", "text-align": "center", "padding": "2%", "flex": "1 1 46%", }, children=( [ html.Span(plot_title, style={"font-weight": "bold"}), wcc.Graph( figure={ "layout": plot_layout( color_by, theme, fr"Pressure [{data_frame['PRESSURE_UNIT'].iloc[0]}]", fr"[{data_frame['VOLUMEFACTOR_UNIT'].iloc[0]}]", ), "data": create_traces( data_frame, color_by, colors, phase, "VOLUMEFACTOR", True, True, ), } ), ] if plot == "fvf" else [ html.Span(plot_title, style={"font-weight": "bold"}), wcc.Graph( figure={ "layout": plot_layout( color_by, theme, fr"Pressure [{data_frame['PRESSURE_UNIT'].iloc[0]}]", fr"[{data_frame['VISCOSITY_UNIT'].iloc[0]}]", ), "data": create_traces( data_frame, color_by, colors, phase, "VISCOSITY", True, True, ), } ), ] if plot == "viscosity" else [ html.Span(plot_title, style={"font-weight": "bold"}), wcc.Graph( figure={ "layout": plot_layout( color_by, theme, fr"Pressure [{data_frame['PRESSURE_UNIT'].iloc[0]}]", fr"[{data_frame['DENSITY_UNIT'].iloc[0]}]", ), "data": create_traces( data_frame, color_by, colors, phase, "DENSITY", True, True, ), } ), ] if plot == "density" else [ html.Span(plot_title, style={"font-weight": "bold"}), wcc.Graph( figure={ "layout": plot_layout( color_by, theme, fr"Pressure [{data_frame['PRESSURE_UNIT'].iloc[0]}]", fr"[{data_frame['RATIO_UNIT'].iloc[0]}]", ), "data": create_traces( data_frame, color_by, colors, phase, "RATIO", False, True, True, ), } ), ] if plot == "ratio" else [] ), )
color='primary', light=False, dark=True) # Footer docs: # dbc.Container, dbc.Row, dbc.Col: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout # html.P: https://dash.plot.ly/dash-html-components # fa (font awesome) : https://fontawesome.com/icons/github-square?style=brands # mr (margin right) : https://getbootstrap.com/docs/4.3/utilities/spacing/ # className='lead' : https://getbootstrap.com/docs/4.3/content/typography/#lead footer = dbc.Container( dbc.Row( dbc.Col( html.P( [ html.Span('Will SN', className='mr-2'), #html.A(html.I(className='fas fa-envelope-square mr-1'), href='mailto:<you>@<provider>.com'), html. A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/willstauffernorris/boat_data'), #html.A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/<you>/'), #html.A(html.I(className='fab fa-twitter-square mr-1'), href='https://twitter.com/<you>'), ], className='lead')))) # Layout docs: # html.Div: https://dash.plot.ly/getting-started # dcc.Location: https://dash.plot.ly/dash-core-components/location # dbc.Container: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout app.layout = html.Div([ dcc.Location(id='url', refresh=False), navbar,
light=True, dark=False ) # Footer docs: # dbc.Container, dbc.Row, dbc.Col: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout # html.P: https://dash.plot.ly/dash-html-components # fa (font awesome) : https://fontawesome.com/icons/github-square?style=brands # mr (margin right) : https://getbootstrap.com/docs/4.3/utilities/spacing/ # className='lead' : https://getbootstrap.com/docs/4.3/content/typography/#lead footer = dbc.Container( dbc.Row( dbc.Col( html.P( [ html.Span('Sharon Moran', className='mr-2'), html.A(html.I(className='fas fa-envelope-square mr-1'), href='mailto:[email protected]'), html.A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/cryptobellum'), html.A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/sharon-moran-8a289111/'), html.A(html.I(className='fab fa-twitter-square mr-1'), href='https://twitter.com/Cryptobellum'), ], className='lead' ) ) ) ) # Layout docs: # html.Div: https://dash.plot.ly/getting-started # dcc.Location: https://dash.plot.ly/dash-core-components/location # dbc.Container: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
html.Div( [ dcc.Slider( min=1, max=20, value=5, id="bem-accuracy-slider", ) ], style={"padding": "15px 0 0 0"}, ), html.Div( [ html.P(children=[ html.Span( "Average Accuracy:", className="fancyLabel", ), html.Span( "±3%", className="fancyValue", id="bem-savings-accuracy", ), ]), html.P( children=[ "95% confidence interval for average result. Smaller is better." ], className="help", ), html.Div([ html.Div(
def main_func(): # shape_path = "/Users/bruand/Documents Local/analisi/Limiti01012020_g/Reg01012020_g/Reg01012020_g_WGS84" # sf = shapefile.Reader(shape_path) # print(sf) repo_path = "https://raw.githubusercontent.com/pcm-dpc/COVID-19/master" nazionale = f'{repo_path}/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv' regioni = f'{repo_path}/dati-regioni/dpc-covid19-ita-regioni.csv' province = f'{repo_path}/dati-province/dpc-covid19-ita-province.csv' analysis = AnalisiDati(file_nazionale=nazionale, file_regioni=regioni, file_province=province, show=False, store=True, color_map="brg", max_days=30) last_update_date = dateutil.parser.parse(analysis.last_update) selected_region = 15 nuovi_positivi=analysis.data_nazionale_latest['nuovi_positivi'].iloc[0] incrementi_casi_testati=analysis.data_nazionale_latest['incrementi_casi_testati'].iloc[0] incrementi_tamponi=analysis.data_nazionale_latest['incrementi_tamponi'].iloc[0] perc_positive_people_tested = nuovi_positivi / incrementi_casi_testati perc_positive_tested = nuovi_positivi / incrementi_tamponi latest_data_region = analysis.data_regionale_latest[analysis.data_regionale_latest.codice_regione == selected_region] nuovi_positivi_region=latest_data_region['nuovi_positivi'].iloc[0] incrementi_casi_testati_region=latest_data_region['incrementi_casi_testati'].iloc[0] incrementi_tamponi_region=latest_data_region['incrementi_tamponi'].iloc[0] perc_positive_people_tested_region = nuovi_positivi_region/incrementi_casi_testati_region perc_positive_tested_region = nuovi_positivi_region/incrementi_tamponi_region riepilogo_nazionale = generate_riepilogo_nazionale(analysis) mappa_nazionale = generate_riepilogo_mappa(analysis) riepilogo_regioni = generate_riepilogo_regionale(analysis) riepilogo_province = generate_riepilogo_province(analysis, selected_region) bar_chart = generate_riepilogo_nazionale_bar_plain(analysis) bar_chart_percentuale = generate_riepilogo_nazionale_bar_percentuale(analysis) bar_chart_regione = generate_riepilogo_regionale_bar_plain(analysis, selected_region) bar_chart_regione_percentuale = generate_riepilogo_regionale_bar_percentuale(analysis, selected_region) bar_chart_po = generate_riepilogo_pressione_ospedali_nazionale_bar_plain(analysis) bar_chart_percentuale_po = generate_riepilogo_pressione_ospedali_nazionale_bar_percentuale(analysis) bar_chart_regione_po = generate_riepilogo_pressione_ospedali_regionale_bar_plain(analysis, selected_region) bar_chart_regione_percentuale_po = generate_riepilogo_pressione_ospedali_regionale_bar_percentuale(analysis, selected_region) full_dt = generate_table_from_data(analysis) print(f'Analisi covid 19 in Italia a {last_update_date.strftime("%A %d %B %Y")}') app = dash.Dash() app.layout = html.Div(children=[ html.H1(children=f'Analisi covid 19 in Italia a {last_update_date.strftime("%A %d %B %Y")}'), html.Hr(), html.Div(id="valori_essenziali", children=[ html.H3(children=[ 'Percentuale positivi/tamponi: ', html.Span(style={'color': 'red' if (perc_positive_tested >= 0.03) else 'green'}, children=f'{perc_positive_tested:.2%}'), f' ({nuovi_positivi} su {incrementi_tamponi:.0f})', ' - Percentuale positivi/persone testati: ', html.Span(style={'color': 'red' if (perc_positive_people_tested >= 0.03) else 'green'}, children=f'{perc_positive_people_tested:.2%}'), f' ({nuovi_positivi} su {incrementi_casi_testati:.0f})' ]), ]), html.Hr(), html.Div(id="mappa_italia", children=[ html.H2(children='Mappa del contagio in Italia'), html.Hr(), dcc.Graph(figure=mappa_nazionale) ]), html.Hr(), html.Div(id="riepilogo_table", children=[ html.H3(children='Tabella riepilogativa'), html.Hr(), full_dt ]), html.Hr(), html.Div(id="riepilogo_italia", children=[ html.H2(children='Andamento logaritmico nazionale'), html.Hr(), dcc.Graph(figure=riepilogo_nazionale) ]), html.Hr(), html.Div(id="riepilogo_regioni", children=[ html.H2(children='Andamento logaritmico regioni'), html.Hr(), dcc.Graph(figure=riepilogo_regioni) ]), html.Hr(), html.Div(id="riepilogo_bar", children=[ html.H3(children='Grafico a barre riepilogativo '), html.Hr(), dcc.Graph(figure=bar_chart) ]), html.Hr(), html.Div(id="riepilogo_bar_perc", children=[ html.H3(children='Grafico a barre riepilogativo in percentuale'), html.Hr(), dcc.Graph(figure=bar_chart_percentuale) ]), html.Hr(), html.Div(id="riepilogo_bar_po", children=[ html.H3(children='Grafico a barre riepilogativo pressione ospedali'), html.Hr(), dcc.Graph(figure=bar_chart_po) ]), html.Hr(), html.Div(id="riepilogo_bar_perc_po", children=[ html.H3(children='Grafico a barre riepilogativo pressione ospedali in percentuale'), html.Hr(), dcc.Graph(figure=bar_chart_percentuale_po) ]), html.Hr(), html.H2(children='Analisi covid 19 in Campania'), html.Hr(), html.Div(id="valori_essenziali_regione", children=[ html.H3(children=[ 'Percentuale positivi/tamponi: ', html.Span(style={'color': 'red' if (perc_positive_tested_region >= 0.03) else 'green'}, children=f'{perc_positive_tested_region:.2%}'), f' ({nuovi_positivi_region} su {incrementi_tamponi_region:.0f})', ' - Percentuale positivi/persone testate: ', html.Span(style={'color': 'red' if (perc_positive_people_tested_region >= 0.03) else 'green'}, children=f'{perc_positive_people_tested_region:.2%}'), f' ({nuovi_positivi_region} su {incrementi_casi_testati_region:.0f})', ]) ]), html.Hr(), html.Div(id="riepilogo_regione_bar", children=[ html.H3(children='Grafico a barre riepilogativo della Campania'), html.Hr(), dcc.Graph(figure=bar_chart_regione) ]), html.Hr(), html.Div(id="riepilogo_regione_bar_perc", children=[ html.H3(children='Grafico a barre riepilogativo della Campania in percentuale'), html.Hr(), dcc.Graph(figure=bar_chart_regione_percentuale) ]), html.Hr(), html.Div(id="riepilogo_regione_bar_po", children=[ html.H3(children='Grafico a barre riepilogativo pressione ospedali della Campania'), html.Hr(), dcc.Graph(figure=bar_chart_regione_po) ]), html.Hr(), html.Div(id="riepilogo_regione_bar_perc_po", children=[ html.H3(children='Grafico a barre riepilogativo pressione ospedali della Campania in percentuale'), html.Hr(), dcc.Graph(figure=bar_chart_regione_percentuale_po) ]), html.Hr(), html.Div(id="riepilogo province", children=[ html.H3(children='Andamento logaritmico province regione Campania'), html.Hr(), dcc.Graph(figure=riepilogo_province) ]), ]) app.run_server(debug=True)
className='nav-link')), dbc.NavItem( dcc.Link('Process', href='/process', className='nav-link')), ], sticky='top', color='light', light=True, dark=False) footer = dbc.Container( dbc.Row( dbc.Col( html.P([ html.Span('Michael Bundick', className='mr-2'), html.A(html.I(className='fas fa-envelope-square mr-1'), href='mailto:[email protected]'), html. A(html.I(className='fab fa-github-square mr-1'), href= 'https://github.com/bundickm/Predictive_Preventative_Maintenance' ), html.A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/michael-bundick/'), ], className='lead')))) app.layout = html.Div([ dcc.Location(id='url', refresh=False), navbar, dbc.Container(id='page-content', className='mt-4'),
def get_layout(interval: float): layout = html.Div([ dbc.Row([ dbc.Col( html.H1("Session dashboard", style={'text-align': 'center'})), ]), dbc.Row([ dbc.Button('STOP SIMULATION', id='new-pt-button', color='success', block=True), html.Span(id="example-output", style={"vertical-align": "middle"}), html.Br(), ]), dbc.Row([ # ********** balance bar charts ********** dbc.Col( dcc.Graph(id='btc-balance-chart'), width={ 'size': 1, 'offset': 0 }, ), dbc.Col(dcc.Graph(id='eur-balance-chart'), width={ 'size': 1, 'offset': 0 }), dbc.Col(dcc.Graph(id='bnb-balance-chart'), width={ 'size': 1, 'offset': 0 }), # ********** monitoring LEDs ********** dbc.Col( children=[ daux.get_led_display(led_id='cycle-count', led_label='from start'), daux.get_led_display(led_id='cycle-count-from-last', led_label='from last trade'), daux.get_led_display(led_id='trades-to-new-pt', led_label='trades to new pt'), daux.get_led_display(led_id='traded-balance', led_label='balance [satoshi]'), daux.get_led_display(led_id='traded-price-balance', led_label='balance [eur]'), daux.get_led_display(led_id='completed-pt-count', led_label='completed pt'), daux.get_led_display(led_id='pending-pt-count', led_label='pending pt'), ], width={ 'size': 2, 'offset': 0 }, ), # ********** symbol lone graph ********** dbc.Col([ dcc.Graph(id='indicator-graph', figure={}, config={'displayModeBar': False}), dcc.Graph(id='daily-line', figure={}, config={'displayModeBar': False}), ], width={'size': 2}), # ********** concentration for different gaps (100, 200, ..., 500) ********** dbc.Col([ dcc.Graph(id='kpi-bar-chart'), ], width={'size': 5}) ]), # ********** order tables (pending & traded) ********** dbc.Row([ dbc.Col( children=daux.get_pending_datatable( data=[ {} ], # session.get_orders_callback().to_dict('records'), table_id='table', buy_color_monitor='LightSeaGreen', sell_color_monitor='LightCoral', buy_color_placed='SeaGreen', sell_color_placed='firebrick', ), width={ 'size': 6, 'offset': 0 }, ), dbc.Col( children=daux.get_datatable( data=[ {} ], # due to the 'records' parameter of DataFrame.to_dict() table_id='table-traded', buy_color_traded='SeaGreen', sell_color_traded='firebrick'), width={ 'size': 6, 'offset': 0 }), ]), dbc.Row([]), # ********** interval ********** dcc.Interval(id='update', n_intervals=0, interval=1000 * interval) ]) return layout
def generate_sidebar(): # we use the Row and Col components to construct the sidebar header # it consists of a title, and a toggle, the latter is hidden on large screens sidebar_header = dbc.Row([ dbc.Col( html.A([ html.H2([ html.Img(src='/assets/covidata.png', style={ "height": "70px", "margin-right": "5px" }), "Covidata.be" ], id="sidebar-title", className="display-6") ], href="http://www.covidata.be/", style={ "color": "black", "text-decoration": "none" })), dbc.Col( [ html.Button( # use the Bootstrap navbar-toggler classes to style html.Span(className="navbar-toggler-icon"), className="navbar-toggler", # the navbar-toggler classes don't set color style={ "color": "rgba(0,0,0,.5)", "borderColor": "rgba(0,0,0,.1)", }, id="navbar-toggle", ), ], # the column containing the toggle will be only as wide as the # toggle, resulting in the toggle being right aligned width="auto", # vertically align the toggle in the center align="center", ), ]) menus_components = [] for menu_idx, menu in enumerate(menus): this_menu_links = [ dbc.NavLink([ html.I(className="fas fa-arrow-right mr-3"), str(x.link_name) ], id=menu_links[x]["id"], href=menu_links[x]["href"]) for x in menu.children if not x.invisible ] if not menu.fake_menu: menus_components += [ html.Li( # use Row and Col components to position the chevrons dbc.Row( [ dbc.Col( dcc.Link(str(menu.name), href=menu.base_link + menu.children[0].link)), dbc.Col( html.I(className="fas fa-chevron-right mr-3"), width="auto"), ], className="my-1", ), id=f"submenu-{menu_idx}", ), # we use the Collapse component to hide and reveal the navigation links dbc.Collapse( this_menu_links, id=f"submenu-{menu_idx}-collapse", ), ] else: menus_components += this_menu_links menus_components.append( html.Li(dbc.Row( [ dbc.Col(gettext("Language"), className="navbar-text"), dbc.Col( dbc.Button("EN", color="link", id="en-lang", disabled=str(get_locale()) == "en")), dbc.Col( dbc.Button("FR", color="link", id="fr-lang", disabled=str(get_locale()) == "fr")) ], className="my-1", ), id="language-switcher")) return [ sidebar_header, # we wrap the horizontal rule and short blurb in a div that can be # hidden on a small screen html.Div( [ #html.Hr(), html.P( get_translation( en= "Select any link below to learn more about the virus and how Belgium handles it.", fr= "Cliquez sur les liens ci-dessous pour en apprendre plus sur le virus et sur la manière dont la Belgique gère cette crise." ), className="lead", ), ], className="blurb"), # use the Collapse component to animate hiding / revealing links dbc.Collapse( [dbc.Nav(menus_components, vertical=True)], id="collapse", ), html.Div([ html.A("Tweets by Covidatabe", className="twitter-timeline", href="https://twitter.com/Covidatabe?ref_src=twsrc%5Etfw") ], id="twitterdiv", className="blurb") ] return sidebar
import dash_html_components as html import dash_bootstrap_components as dbc # from app import app ####### NavBar ####### navbar = dbc.NavbarSimple(children=[ html.Span([ html. A(html.I(className="fa-3x fab fa-github", style={'color': '#ffffff'}), href= "https://github.com/dkedar7/Web-Apps/tree/master/Pandas%20Profiler%20App", target="_blank", className="mx-3"), html.A(html.I(className="fa-3x fab fa-twitter-square", style={'color': '#ffffff'}), href="https://www.twitter.com/dkedar7/", target="_blank", className="mx-3"), html.A(html.I(className="fa-3x fab fa-linkedin", style={'color': '#ffffff'}), href="https://www.linkedin.com/in/dkedar7/", target="_blank", className="mx-3") ]), ], brand="Data Analyzer", brand_href=None, color="#40587C", dark=True, brand_style={"font-size": "200%"}, style={"padding": "2% 0% 0% 0%"})
def update_metrics(): d = datetime.datetime.now() style = {'padding': '5px', 'fontSize': '16px'} return [html.Span('Time: {0}'.format(d), style=style)]
def card_quality_adjustment(app): return dbc.Card(dbc.CardBody([ dbc.Row( [ dbc.Col(html.Img( src=app.get_asset_url("bullet-round-blue.png"), width="10px"), width="auto", align="start", style={"margin-top": "-4px"}), dbc.Col(html.H4("Quality Adjustment", style={ "font-size": "1rem", "margin-left": "10px" }), width=2), ], no_gutters=True, ), dbc.Row([ dbc.Col([ html.H6([ "Maximum Quality Adjustment on Savings", html.Span("\u24D8", style={"font-size": "0.8rem"}) ], id="tooltip-mqa-saving", style={"font-size": "0.8rem"}), dbc.Tooltip( "Maximum reduction in savings as a result of quality adjustment (i.e., when quality score = 0)", target="tooltip-mqa-saving", style={"text-align": "start"}), ], width="auto"), dbc.Col(dbc.InputGroup([ dbc.Input( id='bundle-input-adj-pos', type='number', debounce=True, value=10, persistence=True, persistence_type='memory', ), dbc.InputGroupAddon('%', addon_type='append'), ], size="sm"), width=2), dbc.Col(html.Div(), width=2), dbc.Col([ html.H6([ "Maximum Quality Adjustment on Losses", html.Span("\u24D8", style={"font-size": "0.8rem"}) ], id="tooltip-mqa-loss", style={"font-size": "0.8rem"}), dbc.Tooltip( "Maximum reduction in losses/repayment as a result of quality adjustment (i.e., when quality score = 100)", target="tooltip-mqa-loss", style={"text-align": "start"}), ], width="auto"), dbc.Col(dbc.InputGroup([ dbc.Input( id='bundle-input-adj-neg', type='number', debounce=True, value=10, persistence=True, persistence_type='memory', ), dbc.InputGroupAddon('%', addon_type='append'), ], size="sm"), width=2), ], style={"padding": "1rem"}), html.Div(children=bundle_measure_setup(update_measure), id='bundle-card-measselection', style={ "padding-left": "1rem", "padding-right": "1rem" }) ]), className="mb-3", style={ "background-color": "#f7f7f7", "border": "none", "border-radius": "0.5rem" })