def poledir(d, i, r): if d and i and r: x, y, z = dir_to_xyz(d, i, r) x, y, z = round(x, 1), round(y, 1), round(z, 1) return (dbc.ListGroup([ dbc.Row([ dbc.Col([ dbc.ListGroupItemText("X", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(x), ], width=4), dbc.Col([ dbc.ListGroupItemText("Y", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(y), ], width=4), dbc.Col([ dbc.ListGroupItemText("Z", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(z), ], width=4), ]) ]))
def poledir(x, y, z): if x and y and z: dec, inc, mag = xyz_to_dir(x, y, z, "MAG") return (dbc.ListGroup([ dbc.Row([ dbc.Col([ dbc.ListGroupItemText("Declination", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(dec), ], width=4), dbc.Col([ dbc.ListGroupItemText("Inclination", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(inc), ], width=4), dbc.Col([ dbc.ListGroupItemText("Magnitude", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(mag), ], width=4), ]) ]))
def get_port_view(name, port): return [ dbc.Row(html.H3(name), align='center', justify='center'), dbc.Row(dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(f'{port["Returns"]:.2%}'), dbc.ListGroupItemText('RETURNS') ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading(f'{port["Volatility"]:.4f}'), dbc.ListGroupItemText("VOLATILITY") ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading(f'{port["Sharpe Ratio"]:.4f}'), dbc.ListGroupItemText("SHARPE RATIO") ]), ], horizontal=True), align='center', justify='center'), dbc.Row(dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(f'{weight:.2%}'), dbc.ListGroupItemText(symbol) ]) for symbol, weight in port['Expected Weights'].items() ], horizontal=True), align='center', justify='center'), html.Hr() ]
def show_news_list(self, zipcode="21029", radius=70): colors = ['primary', 'secondary', 'success', 'warning', 'danger', 'info'] color_cycle = cycle(colors) try: news_list = self.get_local_news_by_zipcode(zipcode, radius) except BaseException as ex: print('-' * 60) traceback.print_exc(file=sys.stdout) print('-' * 60) news_list = [] try: # return html.Ol([ # html.Li([ # html.A(x['title'], href=x['url'], target='_blank'), # html.Div(x['publishedAt'], style={'size': 1, 'color': "blue"}) # ]) # for x in news_list]) return dbc.ListGroup( [ dbc.ListGroupItem( [ dbc.ListGroupItemHeading(html.H5(x['title'])), dbc.ListGroupItemText(html.H6(x['publishedAt'])), ], href=x['url'], target='_blank', color=next(color_cycle) ) for x in news_list ] ) except BaseException: print('-' * 60) traceback.print_exc(file=sys.stdout) print('-' * 60) return html.Ol("API call limit")
def make_list_item(song,unique_id): name = song.name artist = song.artist external_url = song.url uri = song.uri heading = dbc.ListGroupItemText("{} - {}".format(name, artist)) return dbc.ListGroupItem(heading,id=unique_id, key=str(uri))
def poledir(lat, lon, dec, inc, a95): if lat and lon and dec and inc and a95: PLat, PLon, dp, dm, PaleoLat = paleo_pole(lat, lon, dec, inc, a95) return (dbc.ListGroup([ dbc.Row([ dbc.Col([ dbc.ListGroupItemText("PLat", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(PLat), ], width=3), dbc.Col([ dbc.ListGroupItemText("PLon", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(PLon), ], width=3), dbc.Col([ dbc.ListGroupItemText("dp/dm", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(str(dp) + "/" + str(dm)), ], width=3), dbc.Col([ dbc.ListGroupItemText("PaleoLat", style={ "margin-bottom": "-2px", }), dbc.ListGroupItem(PaleoLat), ], width=3) ]) ]) # html.P( # "PLat: " + str(PLat) + " PLon: " + str(PLon) + # " dp/dm: " + str(dp)+"/"+str(dm) + " PaleoLat: " + str(PaleoLat), # className="text-center" # ), )
def macro_component(): """ The main macro panel :return: """ title = "Macro Data" output_row = dbc.Row( dbc.Tabs( id="macro-tab-selector", active_tab="ust-curve", children=[ dbc.Tab(label="US Treasury Curve", tab_id="ust-curve", children=[subpanel.usd_treasury_curve()]), dbc.Tab( label="USD Swap Curve", tab_id="usd-swap-curve", children=[ subpanel.usd_swap_curve(), dbc.Col([ html.A( dbc.Button("Data Citations", className="mr-1", id="usd-swap-citations-button")) ], width=4), dbc.Popover( [ dbc.PopoverHeader("USD Swap Citations"), dbc.PopoverBody([ dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading( f"ICE USD Swap {yr} Yr"), dbc.ListGroupItemText( dl.macro.get_usd_swap_citation( yr)) ]) for yr in dl.macro.maturities ]) ]) ], id="usd-swap-citations", is_open=False, target="usd-swap-citations-button", ) ]), dbc.Tab(label="Coming Soon...", tab_id="coming-soon", disabled=True) ])) obj = panel_template(title, output_row) return obj
def update_meta_data_list(series_data_dict, **kwargs): model_name = kwargs["model_selector"] model_description = series_data_dict["all_forecasts"][model_name][ "model_description"] if model_description == model_name: model_description = "" model_cv_score = series_data_dict["all_forecasts"][model_name][ "cv_score"] return dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading("Model Details"), dbc.ListGroupItemText([ html.P(model_name), html.P(model_description), html.P("CV score: %f" % model_cv_score), ]), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Forecast Updated At"), dbc.ListGroupItemText( series_data_dict["forecasted_at"].strftime( "%Y-%m-%d %H:%M:%S")), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Data Collected At"), dbc.ListGroupItemText( series_data_dict["downloaded_dict"] ["downloaded_at"].strftime("%Y-%m-%d %H:%M:%S")), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Data Source"), dbc.ListGroupItemText([ html.A( series_data_dict["data_source_dict"]["url"], href=series_data_dict["data_source_dict"]["url"], ) ]), ]), ])
def tab_right_countries(dropdown): if len(dropdown) == 0: for country in top_4: dropdown.append(country) return html.Div([ html.Ul([ html.Li([ html.Div([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(f'{country}:'), html.Hr(), dbc.ListGroupItemText(f'Confirmed cases: {df_tab_right.iloc[0][country]:,}'), dbc.ListGroupItemText(f'Deaths: {df_tab_right.iloc[1][country]:,}'), list_item('Mortality rate: ', float('%.2f'%(df_tab_right.iloc[2][country]*100)), '%'), dbc.ListGroupItemText(f'Infection rate: {df_tab_right.iloc[3][country]*100:.2f}%'), dbc.ListGroupItemText(f'Share out of global confirmed cases: {df_tab_right.iloc[4][country]*100:.4f}%'), list_item('Share out of global deaths: ', float('%.4f'%(df_tab_right.iloc[5][country]*100)), '%'), dbc.ListGroupItemText(f'Date of 1st confirmed case: {df_tab_right.iloc[6][country]}'), list_item('Date of 1st confirmed death: ', df_tab_right.iloc[7][country], ''), list_item('Policy Index: ', df_tab_right.iloc[8][country], ''), dbc.ListGroupItemText(f'Population in 2019: {df_tab_right.iloc[9][country]:,}'), ], className="items") for country in dropdown ], className='media-body border-0' ), ], className='media border-0' ), ], className='list-unstyled' ), ], className="tabr overflow-auto" )
def list_item(opening, data, ending): ''' input: info data about a statistic for a country a string describing it a string of eventual text after data output: if the data is valid returns an item, otherwise nothing ''' if pd.isna(data) or data == 'None' or data == 0: return else: return dbc.ListGroupItemText(f'{opening}{data}{ending}')
def display_rebalance_output(n_clicks, text_area: str, results): if not n_clicks: raise PreventUpdate if not text_area: raise PreventUpdate if not results: raise PreventUpdate try: portfolio = json.loads(text_area) except (Exception): return dbc.Alert("Invalid JSON format", color="danger"), min_vol = results[MIN_VOL]['Expected Weights'] max_sharpe = results[MAX_SHARPE]['Expected Weights'] symbols = portfolio.keys() with open('config.json', 'r') as file: config = json.load(file)['crypto'] api_key = config['crypto_compare_api_key'] url = 'https://min-api.cryptocompare.com/data/pricemulti' params = {"fsyms": ','.join(symbols), "tsyms": "USD", "api_key": api_key} exchange_rate = requests.get(url, params=params).json() usd_price = {key: value['USD'] for key, value in exchange_rate.items()} display_result = {} results = pd.DataFrame({"a": portfolio, 'usd_price': usd_price}) results['holding'] = results['a'] * results['usd_price'] results['w'] = results['holding'] / results['holding'].sum() total_asset_value = results['holding'].sum() for entry in [('Maximmum Sharpe Ratio', max_sharpe), ('Minimmum Volatitly', min_vol)]: results['ew'] = pd.Series(entry[1]) results['ew_r'] = results['ew'] - results['w'] results['ew_usd'] = results['ew_r'] * \ results['holding'].sum() results['ew_a'] = results['ew_usd'] / results['usd_price'] display_result[entry[0]] = results['ew_a'].to_dict() return [html.H4(f'Total Asset Value: ${total_asset_value:.4f}'), html.Hr()] +\ [dbc.Row(dbc.Col([ html.H5(name), dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(f"{value:.5f} {key}"), dbc.ListGroupItemText(f"{value*usd_price[key]:=.2f} USD"), ]) for key, value in ew.items() ], horizontal=True), html.Hr() ]), align='center', justify='center' ) for name, ew in display_result.items()] +\ [dbc.Label("* positive value is for buy" + " and negative value is for sell")]
def make_activity_info_header(activity: Activity): metrics = ActivityMetrics(activity=activity, config={'ftp': 290}) if activity.type == 'Run' or 'Walk': return html.Div([]) line1 = dbc.ListGroup( [ dbc.ListGroupItem([ dbc.ListGroupItemHeading(activity.name, style={'font-size': '0.7rem'}), dbc.ListGroupItemText(activity.date), dbc.ListGroupItemText(""), ], style={ 'font-size': '0.6rem', 'line-height': '0.1em' }), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Power", style={'font-size': '0.7rem'}), dbc.ListGroupItemText(f"{metrics.average_power}"), dbc.ListGroupItemText(f"{metrics.normalized}"), dbc.ListGroupItemText(f"{metrics.work}"), ], style={ 'font-size': '0.6rem', 'line-height': '0.1em' }), dbc.ListGroupItem([ dbc.ListGroupItemHeading("HR", style={'font-size': '0.7rem'}), dbc.ListGroupItemText(f"{metrics.average_hr}"), dbc.ListGroupItemText(f"{metrics.max_hr}"), ], style={ 'font-size': '0.6rem', 'line-height': '0.1em' }), ], horizontal=True, className="mb-1", style={'font-size': '0.8rem'}, ) line2 = dbc.ListGroup([]) list_group = html.Div([ line1, line2, ]) return list_group
def make_transaction_group(df: pd.DataFrame): """Create a group of transactions""" list_items = [] for idx, transaction in df.iterrows(): list_items.append( dbc.ListGroupItem( [ dbc.ListGroupItemHeading(html.H6(transaction.payee)), dbc.ListGroupItemText([ html.P(transaction.display_name), html.P(f"$ {transaction.total}") ]), ], action=True, )) return dbc.ListGroup(list_items)
def create_list_item(contents, filename, idx): ''' creates component from file''' data = base64.b64decode(contents[contents.find(',')+1:].encode('ascii')) data = ast.literal_eval(data.decode("UTF-8")) v = jsonschema.Draft7Validator(schema) for error in v.iter_errors(data): error = {'JSON_FORMAT_ERROR': str(error.message)} return #kw = str('json-button-'+str(idx)) kw = idx return dbc.ListGroupItem([ dbc.ListGroupItemHeading(filename), dbc.ListGroupItemText(data['id']), #html.Div(data['muestras'], style={'display': 'none'}), #html.Div(data['data'], style={'display': 'none'}) ], id={ 'role': 'data-button', 'index': kw }, style=ITEM_STYLE, action=True )
def tab_right_provinces(BE_total_prov_merged): temp_data = BE_total_prov_merged.copy() return html.Div([ html.Ul([ html.Li([ html.Div([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(f'{prov}:'), html.Hr(), dbc.ListGroupItemText( f"Confirmed cases: {int(temp_data.loc[temp_data['PROVINCE'] == prov]['Cumulative cases'].max()):,}", color='info'), dbc.ListGroupItemText( f"Hospitalized: {int(temp_data.loc[temp_data['PROVINCE'] == prov].iloc[-1]['Hospitalized']):,}", color='warning'), dbc.ListGroupItemText( f"ICU: {int(temp_data.loc[temp_data['PROVINCE'] == prov].iloc[-1]['ICU']):,}", color='danger'), dbc.ListGroupItemText( f"Respiratory: {int(temp_data.loc[temp_data['PROVINCE'] == prov].iloc[-1]['Respiratory']):,}", color='warning'), dbc.ListGroupItemText( f"Released from hospital: {int(temp_data.loc[temp_data['PROVINCE'] == prov].iloc[-1]['Released from hospital']):,}", color='info'), dbc.ListGroupItemText( f"Total hospitalized: {int(temp_data.loc[temp_data['PROVINCE'] == prov].iloc[-1]['Total hospitalized']):,}", color='warning'), ], className="items") for prov in sorted( list(set(BE_total_prov_merged['PROVINCE']))) ], className='media-body border-0'), ], className='media border-0'), ], className='list-unstyled'), ], className="tabr overflow-auto")
num -= x / 20 styles.append({ 'if': { 'state': 'active' }, 'backgroundColor': 'rgba(0, 116, 217, 0.3)', 'border': '0px solid rgb(0, 116, 217)' }) return styles page = html.Div( [ dbc.ListGroupItem([ dbc.ListGroupItemHeading(html.H3('市场宽度')), dbc.ListGroupItemText( html.P('代表市场的涨跌的钟摆运动。当总数低于200-高于1000,进入极值区间。投资者在极值区操作最佳。')), ]), html.Br(), dash_table.DataTable( id='martket-breadth', columns=([{ 'id': p, 'name': col[p] } for p in df.columns]), data=df.to_dict('records'), style_header={ 'backgroundColor': 'gold', 'fontWeight': 'bold', 'textAlign': 'center', 'height': '60px', 'whiteSpace': 'normal',
def similar_text_new(n_clicks, load_page, process_text, n_articles=10): if process_text is None: raise PreventUpdate vec = CountVectorizer(decode_error="replace", vocabulary=pickle.load( open("model/feature.pkl", "rb"))) new_vec = vec.transform([process_text]) lda = pickle.load(open("model/lda_model.pkl", "rb")) topic_dist = list(lda.transform(new_vec)[0]) store_vals = list() for i in range(len(covid_papers)): if (i in covid_papers.index): store_vals.append((int(i), (sqrt( mean_squared_error(topic_dist, [ float(i) for i in covid_papers.loc[ int(i), 'topic_dist'].strip('[]').split(', ') ]))))) most_similar = sorted(store_vals, key=itemgetter(1)) if n_clicks is None: data = [ covid_papers.loc[ int(i[0]), ['title', 'url', 'abstract', 'authors', 'publish_time']] for i in most_similar[1:(n_articles + 1)] ] else: data = [ covid_papers.loc[ int(i[0]), ['title', 'url', 'abstract', 'authors', 'publish_time']] for i in most_similar[1:(n_articles + 1 + (n_articles * n_clicks))] ] if load_page is None: raise PreventUpdate else: out = [] for info in data: out.append( dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItem(dbc.ListGroupItemHeading(info[0]), href=info[1], target="_blank"), html.Br(), dbc.ListGroupItemText(f"Authors: {info[3]}", style={ 'text-align': 'left', 'font-size': 'small' }), dbc.ListGroupItemText(f"Published: {info[4]}", style={ 'text-align': 'left', 'font-size': 'smaller' }), dbc.ListGroupItemText(info[2], style={'text-align': 'justify'}), ]) ], flush=True)) out.append(html.Br()) out.append( dbc.Button("Load More", id='button', outline=True, color="primary", className="mr-1", style={ 'margin-left': '46%', 'margin-bottom': '10%px', 'verticalAlign': 'middle' })) return out
return (fuzz.partial_ratio(x, y)) partial_match_vector = np.vectorize(partial_match) combined_dataframe['score'] = partial_match_vector( combined_dataframe['Match'], combined_dataframe['compare']) combined_dataframe = combined_dataframe[combined_dataframe.score >= 80] return combined_dataframe attributes = html.Div([ dbc.Row([ dbc.ListGroupItem([ dbc.ListGroupItemHeading("Rating"), dbc.ListGroupItemText(id="rating"), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Genre"), dbc.ListGroupItemText(id="Genre"), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Duration"), dbc.ListGroupItemText(id="Duration"), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Director"), dbc.ListGroupItemText(id="Director"), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Language"),
], ) ], color = "dark", outline = True, ) infocard = dbc.Card( [ dbc.CardHeader(html.H5("Metadata", className = 'text-left')), dbc.CardBody( [ dbc.ListGroup( [ dbc.ListGroupItem( [ dbc.ListGroupItemHeading("Hypo. Dist (km)"), dbc.ListGroupItemText("", id = 'hypo-dist'), ] ), dbc.ListGroupItem( [ dbc.ListGroupItemHeading("Epi. Dist (km)"), dbc.ListGroupItemText("", id = 'epi-dist'), ], ), ], horizontal = True, ), ] ) ] ) app.layout = dbc.Container(
def tab_left_regions(BE_reg_total_deaths, BE_reg_total_cases, BE_reg_male_deaths, BE_reg_female_deaths, BE_reg_male_cases, BE_reg_female_cases, BE_reg_pop, region): if region == 'Flanders': index = 0 elif region == 'Wallonia': index = 1 elif region == 'Brussels': index = 2 return html.Div([ html.Ul([ html.Li([ html.Div([ dbc.ListGroupItem([ dbc.ListGroupItemText( f"Confirmed cases: {int(BE_reg_total_cases.loc[region, 'CASES'].max()):,}", color='info'), dbc.ListGroupItemText( f"Confirmed cases (female): {int(BE_reg_female_cases.loc[region, 'CASES'].max()):,}", color='info'), dbc.ListGroupItemText( f"Confirmed cases (male): {int(BE_reg_male_cases.loc[region, 'CASES'].max()):,}", color='info'), dbc.ListGroupItemText( f"Deaths: {int(BE_reg_total_deaths.loc[region, 'DEATHS'].max()):,}", color='danger'), dbc.ListGroupItemText( f"Deaths (female): {int(BE_reg_female_deaths.loc[region, 'DEATHS'].max()):,}", color='danger'), dbc.ListGroupItemText( f"Deaths (male): {int(BE_reg_male_deaths.loc[region, 'DEATHS'].max()):,}", color='danger'), dbc.ListGroupItemText( f"Mortality rate: {(BE_reg_total_deaths.loc[region, 'DEATHS'].max()/BE_reg_pop.iloc[index]['Total'])*100:.2f}%", color='warning'), dbc.ListGroupItemText( f"Mortality rate (female): {(BE_reg_female_deaths.loc[region, 'DEATHS'].max()/BE_reg_pop.iloc[index]['Female'])*100:.2f}%", color='warning'), dbc.ListGroupItemText( f"Mortality rate (male): {(BE_reg_male_deaths.loc[region, 'DEATHS'].max()/BE_reg_pop.iloc[index]['Male'])*100:.2f}%", color='warning'), dbc.ListGroupItemText( f"Infection rate: {(BE_reg_total_cases.loc[region, 'CASES'].max()/BE_reg_pop.iloc[index]['Total'])*100:.2f}%", color='warning'), dbc.ListGroupItemText( f"Infection rate (female): {(BE_reg_female_cases.loc[region, 'CASES'].max()/BE_reg_pop.iloc[index]['Female'])*100:.2f}%", color='warning'), dbc.ListGroupItemText( f"Infection rate (male): {(BE_reg_male_cases.loc[region, 'CASES'].max()/BE_reg_pop.iloc[index]['Male'])*100:.2f}%", color='warning'), dbc.ListGroupItemText( f"Population in 2019: {int(BE_reg_pop.iloc[index]['Total']):,}", color='success'), dbc.ListGroupItemText( f"Population in 2019 (female): {int(BE_reg_pop.iloc[index]['Female']):,}", color='success'), dbc.ListGroupItemText( f"Population in 2019 (male): {int(BE_reg_pop.iloc[index]['Male']):,}", color='success'), ], className="items") ], className='media-body'), ], className='media'), ], className='list-unstyled'), ], className="tabcard overflow-auto")
def layout(url): project = get_project_from_url(url) if project is None: return [ dbc.Row(className="mt-5", children= dbc.Col(width=12, children=[ html.H3("Project not found"), html.P([ "Go back to the ", dcc.Link("homepage", href="/") ]), ]) ) ] return [ crumbs([("Home", "/"), (project.name, "/" + project.slug)]), dbc.Row( dbc.Col(width=12, children=[ dbc.Row([ dbc.Col(width=9, children= html.Div(className="bg-white pt-3 px-4 pb-2 mb-3 border border shadow-sm", children=[ html.H3(f"{project.name}"), html.Hr(), dbc.Tabs([ dbc.Tab(label='Overview', tab_id="tab-overview"), dbc.Tab(label='FlexiScatter', tab_id="tab-flexiscatter") ], id="project-tabs", active_tab='tab-overview'), html.Div(id="content") ]), ), dbc.Col(width=3, children=[ html.Div( className="bg-white pt-3 pb-2 mb-3 border border-primary shadow-sm", children=[ html.H3([ f"Combinations ", dbc.Badge(f" {project.combinations.count()} ", color='info') ], className="d-flex justify-content-between align-items-center px-3 mb-0"), html.Span(f"in {project.name}, sorted by target", className='small px-3'), dbc.ListGroup(className='combinations-list mt-2', flush=True, children=[ dbc.ListGroupItem( href=c.url, action=True, children=[ dbc.ListGroupItemHeading( f"{c.lib1.name} + {c.lib2.name}"), dbc.ListGroupItemText( f"{c.lib1.target} + {c.lib2.target}") ] ) for c in project.combinations ]) ]) ]) ]) ]) ), html.Div(className="d-none", id='project-id', children=project.id) ]
), ] ) list_group = html.Div( [ html.H2("ListGroup"), dbc.ListGroup( [ dbc.ListGroupItem("Item 1", color="primary", action=True), dbc.ListGroupItem("Item 2"), dbc.ListGroupItem("Item 3"), 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( [
# 不显示图例 showlegend=False, legend=dict(x=0, y=1.0), margin=dict(l=20, r=20, t=40, b=40)), ), style={ 'height': 500, 'width': "100%" }, config={ 'responsive': True, 'autosizable': True, 'showAxisDragHandles': True, 'staticPlot': False, # 静态图 'displayModeBar': False # 关闭工具箱 }, id='swpt_graph', ) page = html.Div(children=[ dbc.ListGroupItem( [ dbc.ListGroupItemHeading(html.H3('美联储干预市场的力度')), dbc.ListGroupItemText(html.P('Glod Holdings 与 U.S All Rates数据以后更新。')), ] ), fed_assets_graph, html.Hr(), liq_swap_graph], className="container")
def get_stats(data: dict): return [ dbc.Col([ html.H5('Social Stats'), dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(" ".join(key.title().split("_"))), dbc.ListGroupItemText(value) ]) for key, value in data['community_data'].items() if value is not None ] + [ dbc.ListGroupItem([ dbc.ListGroupItemHeading('Alexa Ranking'), dbc.ListGroupItemText(data['public_interest_stats'] ['alexa_rank']) ]) ]) ]), dbc.Col([ html.H5('Github Stats'), dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading(" ".join(key.title().split("_"))), dbc.ListGroupItemText(value) ]) for key, value in data['developer_data'].items() if not isinstance(value, dict) ]) ]), dbc.Col([ html.H5('Community Stats'), dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading('Market Cap Rank'), dbc.ListGroupItemText(data['market_cap_rank']) ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading('CoinGecko Rank'), dbc.ListGroupItemText(data['coingecko_rank']) ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading('CoinGecko Score'), dbc.ListGroupItemText(data['coingecko_score']) ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading('Developer Score'), dbc.ListGroupItemText(data['developer_score']) ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading('Community Score'), dbc.ListGroupItemText(data['community_score']) ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading('Liquidity Score'), dbc.ListGroupItemText(data['liquidity_score']) ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading('Public Interest Score'), dbc.ListGroupItemText(data['public_interest_score']) ]), ]) ]) ]
html.Span( "На этой странице представлены данные о землетрясениях в Байкальском регионе. Все данные получены с " ), html.A("сайта БФ ФИЦ ЕГС РАН", href="http://seis-bykl.ru", target='_blank'), html.Br(), html.A("Сообщить о проблеме", href="https://github.com/rishm069/earthquakes38", target='_blank'), html.Br(), dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading("Селектор"), dbc.ListGroupItemText( "Селектор позволяет выбрать отображение на карте всех землетрясений за текущий год ('Землетрясения за текущий год'), только последнего землетрясения ('Последнее землетрясение') или все землетрясения с 1994 года ('Исторические данные')" ), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Таблица"), dbc.ListGroupItemText( "Таблица позволяет выбирать землетрясения для отображения на карте: по умолчанию отображаются все землетрясения, при выборе одного и более землетрясений на карте будут отмечены только эти землятресения. Данные можно сортировать и фильтровать с помощью таблицы, например:" ), dbc.ListGroupItemText( "'-09-' в столбце 'Дата' покажет только данные за Сентябрь" ), html.Img( style={ 'height': '100%', 'width': '100%' },
width=6, lg=6, md=6, xs=12, ), dbc.Col( dbc.ListGroup( [ dbc.ListGroupItem([ html.Img( src="assets/github_pr.PNG", style={"width": "64px"}, ), dbc.ListGroupItemHeading( f"{num_done}"), dbc.ListGroupItemText( "pull requests"), ]), # dbc.ListGroupItem( # [ # html.Img( # src="assets/jira_story.SVG", # style={"width": "64px"}, # ), # dbc.ListGroupItemHeading(f"{num_done['Story']} "), # dbc.ListGroupItemText("stories"), # ] # ), ], horizontal=True, ), width=6,
xs=12, ), dbc.Col( dbc.ListGroup( [ dbc.ListGroupItem( [ html.Img( src="assets/jira_bug.SVG", style={"width": "64px"}, ), dbc.ListGroupItemHeading( f"{num_done['Bug'] if 'Bug' in num_done.keys() else 0}" ), dbc.ListGroupItemText( "bugs" ), ] ), dbc.ListGroupItem( [ html.Img( src="assets/jira_story.SVG", style={"width": "64px"}, ), dbc.ListGroupItemHeading( f"{num_done['Story']} " ), dbc.ListGroupItemText( "stories" ),
def input_session(): return dbc.ListGroup([ dbc.ListGroupItem([html.H4("Client Input Assumptions")]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Plan Information", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}), dbc.ListGroupItemText([ dbc.Row([ dbc.Col("Plan Type", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "MAPD", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Total Members", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "150,000", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Age Distribution", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col([ dbc.Button("···", id = 'button-popover-age', size="sm", color='primary', style={"border-radius":"10rem"}), dbc.Popover([ dbc.PopoverHeader("Age Distribution", style={"font-family":"NotoSans-SemiBold","font-size":"1rem"}), dbc.PopoverBody([dbc.Row([ dbc.Col("Age Band", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col("Member %", style={"font-family":"NotoSans-Regular","font-size":"1rem"}) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("<65", style={"font-family":"NotoSans-Regular","font-size":"0.8rem"}), dbc.Col(dbc.Input(value = "12%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("65-74", style={"font-family":"NotoSans-Regular","font-size":"0.8rem"}), dbc.Col(dbc.Input(value = "48%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("75-84", style={"font-family":"NotoSans-Regular","font-size":"0.8rem"}), dbc.Col(dbc.Input(value = "27%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col(">=85", style={"font-family":"NotoSans-Regular","font-size":"0.8rem"}), dbc.Col(dbc.Input(value = "13%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col(dbc.Button("Save", id = 'popover-age-submit', size="sm", color='primary')), ], style={"padding":"2rem","text-align":"center"}), ], style={"font-family":"NotoSans-Regular","font-size":"1rem", "padding-left":"1rem", "padding-right":"1rem"}), ],id = 'popover-age', is_open = False, target = 'button-popover-age') ]) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Gender Distribution", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Region", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "Northeast", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("MSA (if applicable)", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "New York-Newark-Jersey City, NY-NJ-PA MSA", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Formulary Tier for Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "Preferred Brand", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Copayment for Entresto by Channel and Days of Supply", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), ]), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Drug Information", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}), dbc.ListGroupItemText([ dbc.Row([ dbc.Col("Entresto Pricing Information", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "$9.6 / unit (tablet)", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Assumptions for Each Measure", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(html.A('Download the template file'), style={"font-family":"NotoSans-Regular","font-size":"1rem","text-decoration":"underline","color":"#1357DD"}), ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col( dcc.Upload( id = 'upload-data', children = html.Div([ 'Select Related Files to Upload' ],style={"font-family":"NotoSans-Regular","font-size":"1rem","text-decoration":"underline","color":"#1357DD"}), style={ 'height': '60px', 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'margin': '10px' } ),style={"padding-top":"1rem"}, width=12), ]), dbc.Row([ html.Div(id = 'output-data-upload', style={"text-align":"center","padding":"0.5rem","font-family":"NotoSans-Regular","font-size":"0.6rem"}), ], style={"padding-top":"1rem"}), ]), ]), dbc.ListGroupItem([html.H4("Modeling Assumptions")]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("CHF Prevalence Rate & Severity Assumptions", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}), dbc.ListGroupItemText([ dbc.Row([ dbc.Col("Projected CHF Patients as a % of Total Plan Members", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "13.6%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("CHF Comorbidity Condition %CHF Comorbidity Condition %", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), ]), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("CHF Patient Cost and Utilization Assumptions", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}), dbc.ListGroupItemText([ dbc.Row([ dbc.Col("CHF Patient Cost Assumptions", style={"font-family":"NotoSans-Regular","font-size":"1.2rem"}), ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Total Cost PPPY (Per Patient Per Year) Before Taking Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "$ 42,000", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("CHF Related Cost as a % of Total Cost", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "60%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Total Cost PPPY by Service Category", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Total Cost PPPY by Patient Cohort", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("CHF Patient Cost Trend Assumptions", style={"font-family":"NotoSans-Regular","font-size":"1.2rem"}), ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Annual PPPY Cost Trend Before Taking Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "7%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Annual PPPY Cost Trend by Service Category", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Annual PPPY Cost Trend by Patient Cohort", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("CHF Patient Utilization Assumptions", style={"font-family":"NotoSans-Regular","font-size":"1.2rem"}), ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Projected Inpatient Admissions PPPY Before Taking Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "1.4", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("CHF Related Inpatient Admissions as a % of Total Admissions", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "80%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Total Inpatient Admissions PPPY by Medical Condition", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Total Inpatient Admissions PPPY by Patient Cohort", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("CHF Patient Utilization Trend Assumptions", style={"font-family":"NotoSans-Regular","font-size":"1.2rem"}), ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Annual PPPY Inpatient Utilization Trend Before Taking Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "5.4%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Annual PPPY Inpatient Utilization Trend by Patient Cohort", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), ]), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("Entresto Utilization Assumptions", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}), dbc.ListGroupItemText([ dbc.Row([ dbc.Col("Projected Entresto Utilizer as a % of Total CHF Population", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "7%", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Entresto Utilizer Monthly Ramp Up Rate", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Button("···", size="sm", color='primary', style={"border-radius":"10rem"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Average Entresto Script PPPY (Per Patient Per Year)", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "6.9", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), dbc.Row([ dbc.Col("Average Units/ Script", style={"font-family":"NotoSans-Regular","font-size":"1rem"}), dbc.Col(dbc.Input(value = "70", bs_size="sm", style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})) ], style={"padding-top":"1rem"}), ]), ]), ], style={"border-radius":"0.5rem"})
import dash_bootstrap_components as dbc list_group = dbc.ListGroup([ dbc.ListGroupItem([ dbc.ListGroupItemHeading("This item has a heading"), dbc.ListGroupItemText("And some text underneath"), ]), dbc.ListGroupItem([ dbc.ListGroupItemHeading("This item also has a heading"), dbc.ListGroupItemText("And some more text underneath too"), ]), ])
dbc.ListGroupItemText([ dbc.Row(html.P("age -- age in years")), dbc.Row(html.P("sex -- (1 = male; 0 = female)")), dbc.Row( html. P("cp -- chest pain type (0 - Typical Angina (Heart related), 1 - Atypical Angina (Non-heart related), 2 - Non-Anginal pain (Non-heart related), 3 - Asymptomatic (No disease)" )), dbc.Row( html. P("trestbps -- resting blood pressure (in mm Hg on admission to the hospital)" )), dbc.Row( html. P("chol -- serum cholestoral in mg/dl (health levels are < 200mg/dl)" )), dbc.Row( html. P("fbs -- (fasting blood sugar > 120 mg/dl) (1 = true; 0 = false)" )), dbc.Row( html. P("restecg -- resting electrocardiographic results ( 0 = normal, 1 = ST-T wave abnormality, 2= probable or definite left ventricular hypertrophy by Estes' criteria )" )), dbc.Row(html.P("thalach -- maximum heart rate achieved")), dbc.Row( html.P("exang -- exercise induced angina (1 = yes; 0 = no)")), dbc.Row( html. P("oldpeak -- ST depression induced by exercise relative to rest" )), dbc.Row( html. P("slope -- the slope of the peak exercise ST segment (1 = upsloping, 2 = flat, 3 = downsloping)" )), dbc.Row( html.P( "ca -- number of major vessels (0-3) colored by flourosopy" )), dbc.Row( html. P("thal -- (1 = normal; 2 = fixed defect; 3 = reversable defect)" )), dbc.Row( html.P("target -- (1 -heart problem or 0 - no heart problem)")) ]),