Esempio n. 1
0
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)
Esempio n. 2
0
def top_artists_viz(access_token, time_range: RANGE):
    top_artist_df = get_top_artists(access_token=access_token, time_range=time_range.value)
    list_items = []
    for i, artist_id in top_artist_df['id'].items():
        name = top_artist_df.loc[top_artist_df['id'] == artist_id, 'name'].squeeze()
        image_url = top_artist_df.loc[top_artist_df['id'] == artist_id, 'images'].squeeze()[0]['url']
        img_div = html.Img(src=image_url, style={'border-radius': '50%', 'width': '30px', 'float': 'left',
                                                 'margin-right': '5%', 'align': 'center'})
        heading = dbc.ListGroupItemHeading(f"{i + 1}. {name}")
        list_items.append(dbc.ListGroupItem(children=[img_div, heading]))

    top_artist_card = dbc.Card(children=[
        dbc.CardHeader(children=[html.H4("Top Artists")]),
        dbc.ListGroup(
            list_items,
            flush=True,
            style={'overflow': 'scroll', 'max-height': '400px'}
        ),
    ]
    )
    return top_artist_card
Esempio n. 3
0
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")
Esempio n. 4
0
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
    )
Esempio n. 5
0
         ]),
     ]),
     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,
Esempio n. 6
0
app.layout = dbc.Container([
    html.H1("Uncovering the network"),
    html.H4("Group Georgia"),
    html.Hr(),
    html.H5("Select graph"),
    dbc.Row(
        [dbc.Col(control_centrality, md=3),
         dbc.Col(control_quarter, md=6)],
        align='center'),
    dbc.Row(
        [
            dbc.Col(dcc.Graph(id="cluster-graph"), md=7),
            dbc.Col([
                dbc.ListGroup([
                    dbc.ListGroupItemHeading("Connectivity of graph"),
                    dbc.ListGroupItem(id="diameter"),
                    dbc.ListGroupItem(id="edge_connectivity"),
                    dbc.ListGroupItem(id="node_connectivity"),
                ]),
                html.Hr(),
                dbc.ListGroup([
                    dbc.ListGroupItemHeading("Most central companies"),
                    dbc.ListGroupItem(id="1_Rank-centrality"),
                    dbc.ListGroupItem(id="2_Rank-centrality"),
                    dbc.ListGroupItem(id="3_Rank-centrality"),
                ]),
                html.Hr(),
                dbc.ListGroup([
                    dbc.ListGroupItemHeading("Most de-central company"),
                    dbc.ListGroupItem(id="Smallest-centrality"),
Esempio n. 7
0
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", persistence = True, persistence_type = 'session', 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", persistence = True, persistence_type = 'session', 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"}, width=3),
							dbc.Col([
								dbc.Button("\u25BC", id = 'button-collapse-age', size="sm", color='primary', style={"border-radius":"10rem"}),
								],
								width=1),
							dbc.Col(
								html.Div(['Fill below or ',
										html.Br(),
										html.A('Download Template', 
											id = 'download-age',
											href='http://139.224.186.182:8098/downloads/Age Distribution template.xlsx',
											target = "_blank")
										], style={"font-size":"0.8rem"}),
								width=2
								),
							dbc.Col(
								dcc.Upload(
									id = 'upload-age',
									children = html.Div([
										'Select Related Files to Upload'
										],style={"font-family":"NotoSans-Regular","font-size":"0.8rem","text-decoration":"underline","color":"#1357DD"}),
									style={
										'height': '40px',
										'lineHeight': '40px',
										'borderWidth': '1px',
										'borderStyle': 'dashed',
										'borderRadius': '5px',
										'textAlign': 'center'
										}
									), width=3
								),
							dbc.Col(
								html.Div(id = 'output-age-upload', style={"text-align":"center","padding":"0.5rem","font-family":"NotoSans-Regular","font-size":"0.6rem"}),
								width=3,
								)
						], style={"padding-top":"1rem"}
					),
					html.Div(
						dbc.Collapse(
							[
								card_collapse_age()
							],
							id = 'collapse-age', is_open = False,
							style={"padding":"1rem","border-radius":"0.5rem","background-color":"#f5f5f5"}
						), style={"padding":"0.5rem"}
					),
					dbc.Row([
						dbc.Col("Gender Distribution", style={"font-family":"NotoSans-Regular","font-size":"1rem"}, width=3),
						dbc.Col(dbc.Button("\u25BC", size="sm", color='primary', style={"border-radius":"10rem"}, id = 'button-collapse-gender'))
						], style={"padding-top":"1rem"}),
					html.Div(
						dbc.Collapse(
							[
								card_collapse_gender()
								
							],id = 'collapse-gender', is_open = False,
							style={"padding":"1rem","border-radius":"0.5rem","background-color":"#f5f5f5"}
						), style={"padding":"0.5rem"}
					),
					dbc.Row([
						dbc.Col("Geography Distribution", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
						dbc.Col(
								html.Div([
										html.A('Download Template', 
											id = 'download-geo',
											href='http://139.224.186.182:8098/downloads/Geographic Distribution template.xlsx',
											target = "_blank")
										]),
								),
						dbc.Col(
							dcc.Upload(
								id = 'upload-geo',
								children = html.Div([
									'Select Related Files to Upload'
									],style={"font-family":"NotoSans-Regular","font-size":"0.8rem","text-decoration":"underline","color":"#1357DD"}),
								style={
									'height': '40px',
									'lineHeight': '40px',
									'borderWidth': '1px',
									'borderStyle': 'dashed',
									'borderRadius': '5px',
									'textAlign': 'center'
									}
								), width = 3
							),
						dbc.Col(
							html.Div(id = 'output-geo-upload', style={"text-align":"center","padding":"0.5rem","font-family":"NotoSans-Regular","font-size":"0.6rem"}),
							)
						], style={"padding-top":"1rem"}),
					dbc.Row([
						dbc.Col("Pharmacy Benefit Design", style={"font-family":"NotoSans-Regular","font-size":"1rem"}, width=3),
						dbc.Col(dbc.Button("\u25BC", size="sm", color='primary', style={"border-radius":"10rem"}, id = 'button-collapse-benefit'))
						], style={"padding-top":"1rem"}),
					html.Div(
						dbc.Collapse(
							[
								card_collapse_tier()
							],
							id = 'collapse-benefit', 
							is_open = False,
							style={"padding":"1rem","border-radius":"0.5rem","background-color":"#f5f5f5"}
						), style={"padding":"0.5rem"}
					),
				]
			),
			]
		),
		dbc.ListGroupItem([
			dbc.ListGroupItemHeading("Drug Information", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}),
			dbc.ListGroupItemText([
				dbc.Row([
					dbc.Col("Formulary Tier for Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Input(value = "Tier 3", bs_size="sm", persistence = True, persistence_type = 'session', 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 Pricing Information", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Input(value = "$9.6 / unit (tablet)", bs_size="sm", persistence = True, persistence_type = 'session', style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})),
					dbc.Col(
							dcc.Upload(
								id = 'upload-price',
								children = html.Div([
									'Select Related Files to Upload'
									],style={"font-family":"NotoSans-Regular","font-size":"0.8rem","text-decoration":"underline","color":"#1357DD"}),
								style={
									'height': '40px',
									'lineHeight': '40px',
									'borderWidth': '1px',
									'borderStyle': 'dashed',
									'borderRadius': '5px',
									'textAlign': 'center'
									}
								), width = 3
							),
					dbc.Col(
						html.Div(id = 'output-price-upload', style={"text-align":"center","padding":"0.5rem","font-family":"NotoSans-Regular","font-size":"0.6rem"}),
						)
					], style={"padding-top":"1rem"}),
				dbc.Row([
					dbc.Col("Market Basket Definition", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Input(value = "ACE, ARB", bs_size="sm", persistence = True, persistence_type = 'session', style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"}))
					], style={"padding-top":"1rem"}),
				dbc.Row([
					dbc.Col("Rebate Assumption", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Input(value = "40%", bs_size="sm", persistence = True, persistence_type = 'session', style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"})),
					dbc.Col(
							dcc.Upload(
								id = 'upload-rebate',
								children = html.Div([
									'Select Related Files to Upload'
									],style={"font-family":"NotoSans-Regular","font-size":"0.8rem","text-decoration":"underline","color":"#1357DD"}),
								style={
									'height': '40px',
									'lineHeight': '40px',
									'borderWidth': '1px',
									'borderStyle': 'dashed',
									'borderRadius': '5px',
									'textAlign': 'center'
									}
								), width = 3
							),
					dbc.Col(
						html.Div(id = 'output-rebate-upload', style={"text-align":"center","padding":"0.5rem","font-family":"NotoSans-Regular","font-size":"0.6rem"}),
						)
					], style={"padding-top":"1rem"}),
				]),
			]),
		dbc.ListGroupItem([
			dbc.ListGroupItemHeading("Value Based Measures", style={"font-family":"NotoSans-SemiBold","font-size":"1.2rem"}),
			dbc.ListGroupItemText([
				dbc.Row([
					dbc.Col("Assumptions for Value Based Measure", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(
						html.A("Measure Library Preview", href = "http://139.224.186.182:8097/vbc-demo/measure-library/", target='_blank')
						),
					dbc.Col(download_template()),
						], 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", "text-align":"center"}),
				]),
			]),
		dbc.ListGroupItem([html.H4("Modeling Assumptions")]),
		dbc.ListGroupItem([
			dbc.ListGroupItemHeading("CHF Prevalence Rate", 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", persistence = True, persistence_type = 'session', style={"border-radius":"5rem","padding-left":"1rem","padding-right":"1rem","color":"#000","font-family":"NotoSans-Regular"}))
					], 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 Related Cost PPPY (Per Patient Per Year) Before Taking Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Input(value = "$ 25,000", bs_size="sm", persistence = True, persistence_type = 'session', 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 CHF Related Cost PPPY Trend Before Taking Entresto", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Input(value = "0%", bs_size="sm", persistence = True, persistence_type = 'session', 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 by Patient Cohort and Service Category Workbook", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(
							html.Div([
									html.A('Download Workbook', 
										id = 'download-cohort',
										href='http://139.224.186.182:8098/downloads/CHF Cost and Utilization Assumptions.xlsx',
										target = "_blank")
									]),
							),
					], style={"padding-top":"1rem"}),

				]),
			]),


		dbc.ListGroupItem([
			dbc.ListGroupItemHeading("Entresto Market Share", 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", persistence = True, persistence_type = 'session', 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 Market Share Monthly Ramp Up Rate", style={"font-family":"NotoSans-Regular","font-size":"1rem"}),
					dbc.Col(dbc.Button("\u25BC", size="sm", color='primary', style={"border-radius":"10rem"}, id = 'button-collapse-month'))
					], style={"padding-top":"1rem"}),
				html.Div(
					dbc.Collapse(
						[
							card_collapse_month()
						],
						id = 'collapse-month', 
						is_open = False,
						style={"padding":"1rem","border-radius":"0.5rem","background-color":"#f5f5f5"}
					), style={"padding":"0.5rem"}
				),
				]),
			]),
		],
		style={"border-radius":"0.5rem"})
Esempio n. 8
0
latest_data = df.loc[
    fast_facts_filter,
    ['Country', "Deaths", 'Cases', 'New Cases (n)', 'New Deaths (n)', 'Date'
     ]].sort_values('Country', axis=0)

pandemic_length = df['Date'].unique().size
active_countries = latest_data.loc[latest_data['New Cases (n)'] > 100,
                                   'Country'].size
total_deaths = latest_data['Deaths'].sum()
total_cases = latest_data['Cases'].sum()

# In[350]:

fast_fact_card = dbc.Col(
    dbc.ListGroup(dbc.ListGroupItem(children=[
        dbc.ListGroupItemHeading(dcc.Markdown('''# Fast Facts''')),
        html.Hr(),
        dbc.ListGroupItemText(f"Global Cases : {total_cases}"),
        dbc.ListGroupItemText(f"Global Deaths : {total_deaths}"),
        dbc.ListGroupItemText(
            f"Days Since First Reported Case : {pandemic_length}"),
        dbc.ListGroupItemText(
            f"Countries reporting > 100 cases / Day : {active_countries}")
    ],
                                    style={
                                        'color': '#2f4f4f',
                                        'backgroundColor': '#ede7c6'
                                    }),
                  flush=True),
    style={
        'border': 'none',
Esempio n. 9
0
    def partial_match(x, y):
        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([
Esempio n. 10
0
                        max=param_bounds[key][1],
                        step=min(
                            1,
                            abs(param_bounds[key][1] - param_bounds[key][0]) /
                            1000)),
                ],
                style={'display': 'block'}), )

table_init = [{
    "Parameter": key,
    "Value": table_dict[key]
} for key in table_dict.keys() if key not in disped_params]
controls = dbc.Card([
    dbc.FormGroup([
        dbc.ListGroup([
            dbc.ListGroupItemHeading("Dispersion bins"),
            dcc.Slider(min=1,
                       max=26,
                       step=1,
                       marks={
                           key: value
                           for key, value in zip(range(
                               1, 26, 5), [str(x) for x in range(1, 26, 5)])
                       },
                       value=16,
                       id="dispersion_slider"),
        ],
                      id="slider_group",
                      style={'display': 'none'}),
        dbc.ListGroup([
            dbc.ListGroupItemHeading("Parameters"),
Esempio n. 11
0
            ]
        ),
    ]
)

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(
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"})
Esempio n. 13
0
                            className="lead",
                        ),
                        html.Hr(className="my-2"),
                        dcc.Markdown('''
                            NOTHING.
                            '''
                                     )
                    ],
                    fluid=True,
                )
            ],
            fluid=True,
            className="jumbotron bg-white text-dark"
        ),
        dbc.Col([dbc.Row([
        dbc.ListGroup([dbc.ListGroupItemHeading("Ramped plot type"),
        dcc.RadioItems(
        options=[
            {'label': 'Current-Voltage ', 'value': 'r_x_volt',},
            {'label': 'Current-Time ', 'value': 'r_x_time',},
            {'label': 'Voltage-Time ', 'value': 'r_x_volt_time',},
            {'label': 'Fourier spectrum (abs) ', 'value': 'r_x_fft',},
            {'label': 'Freeze plot ', 'value': 'r_x_freeze',},
        ],
        id="r_button",
        value='r_x_time',
        labelStyle={'display': 'inline-block'},
        style={"margin-right": "5px"})],style={"margin-right": "15px"}),]),

        dbc.Row([dbc.ListGroup([dbc.ListGroupItemHeading("Sinusoidal plot type"),
        dcc.RadioItems(
Esempio n. 14
0
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
Esempio n. 15
0
def similar_text_from_db(paper_search, n_clicks, n_articles=10):
    if paper_search is None:
        raise PreventUpdate
    store_vals = list()
    topic_dist = [
        float(i)
        for i in covid_papers.loc[int(paper_search),
                                  'topic_dist'].strip('[]').split(', ')
    ]

    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))]
        ]
    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
Esempio n. 16
0
            dbc.ListGroupItem("Sebastian Clavijo")
        ],
                               flush=True,
                               className="align-self-center h-50"),
                 style={"width": "100%"},
                 className="align-self-center h-50")
    ])
],
                     align="center")

problem_layout = dbc.Card(
    dbc.CardBody([
        html.H4("The Problem: ", className="card-title"),
        dbc.ListGroup([
            dbc.ListGroupItem([
                dbc.ListGroupItemHeading("CTA Ridership is declining"),
                dbc.ListGroupItemText(
                    "From 2012 to 2019, annual rides have declined by about 77.5 million."
                ),
                dbc.ListGroupItemText(
                    "With the stresses on the system from the COVID-19 pandemic, ridership stands to decline even further."
                )
            ]),
            dbc.ListGroupItem([
                dbc.ListGroupItemHeading(
                    "City Hall has stopped supporting its public transportation"
                ),
                dbc.ListGroupItemText(
                    "The share of Chicago’s sales tax going to public transit has been cut in several of the past city budgets"
                ),
                dbc.ListGroupItemText(
Esempio n. 17
0
def update_country_card(iso3, new_metric, new_group):

    #helper method for card text
    def trend(n):
        return "increased" if n > 1 else 'decreased'

    #Country-Specific Epidemiology
    new_country = country_reference.loc[country_reference['ISO-3'] == iso3,
                                        'Country'].iloc[0]
    df_c = df[df['ISO-3'] == iso3]
    last_two_weeks = df_c.loc[:,
                              ['New Deaths (SMA)', 'New Cases (SMA)', 'Date'
                               ]].tail(14)
    pct_deaths_two_weeks = round(
        (last_two_weeks.loc[:, 'New Deaths (SMA)'].iloc[0] /
         last_two_weeks.loc[:, 'New Deaths (SMA)'].iloc[13] * 100) - 100, 2)
    pct_cases_two_weeks = round(
        (last_two_weeks.loc[:, 'New Cases (SMA)'].iloc[0] /
         last_two_weeks.loc[:, 'New Cases (SMA)'].iloc[13] * 100) - 100, 2)
    days_since_first_case = (df_c['Date'].max() - df_c['Date'].min()).days
    first_case_date = df_c.loc[(
        df_c['Cases'] > 0), ['Date']].iloc[0].dt.strftime('%B %d, %Y').iloc[0]
    country_cases = df_c.loc[:, ['Cases']].iloc[-1][0]
    country_deaths = df_c.loc[:, ['Deaths']].iloc[-1][0]
    country_cases_per_1m = df_c.loc[:, ['Deaths per 1M']].iloc[-1][0]
    country_deaths_per_1m = df_c.loc[:, ['Cases per 1M']].iloc[-1][0]

    new_cases = df_c.loc[:, ['New Cases (n)']].astype('int').iloc[-1][0]
    under_control = "widespread" if new_cases > 500 else "limited"

    # Non-COVID19 Country Data
    wfpi_score = country_reference.loc[country_reference['ISO-3'] == iso3,
                                       'WPFI Score'].iloc[0]
    wfpi_rank = country_reference.loc[country_reference['ISO-3'] == iso3,
                                      'WPFI Rank'].iloc[0]
    wfpi_max_rank = country_reference['WPFI Rank'].max()
    country_life_exp = country_reference.loc[
        country_reference['ISO-3'] == iso3, 'Life Exp 2018'].round(2).iloc[0]

    #Regional Line Chart Variable
    un_group = country_reference.loc[country_reference['ISO-3'] == iso3,
                                     'UN Group'].iloc[0]
    income_group = country_reference.loc[country_reference['ISO-3'] == iso3,
                                         'Income Group'].iloc[0]

    country_card_text = (
        f"{new_country} reported its first case on {first_case_date}. The country has reported a total of {country_cases:n} "
        f"cases and {country_deaths:n} deaths. Currently, COVID-19 transmission is {under_control} in {new_country}, and the number of new cases "
        f"per day is approximately {new_cases:n}. In the past two weeks, the average daily case count in {new_country} has {trend(pct_cases_two_weeks)} by "
        f"{pct_cases_two_weeks}%, and the death rate has {trend(pct_deaths_two_weeks)} by {pct_deaths_two_weeks}%."
    )

    country_card_description_content = dbc.Card(
        [
            html.H3('Country Overview', className='card-title'),
            html.P(country_card_text, className='card-text')
        ],
        style={
            'border': 'none',
            'marginBottom': '5vh'
        },
    )

    country_card_list_content = dbc.ListGroup(
        dbc.ListGroupItem(
            children=[
                dbc.ListGroupItemHeading(
                    html.H4('{} Summary'.format(new_country))),
                html.Hr(),
                #                     dbc.ListGroupItemHeading(country_card_text),
                #                     html.Hr(),
                dbc.ListGroupItemHeading("Statistics"),
                dbc.ListGroupItemText(f"Total Cases : {int(country_cases):n}"),
                dbc.ListGroupItemText(
                    f"Cases per 1M : {int(country_cases_per_1m):n}"),
                dbc.ListGroupItemText(
                    f"Total Deaths : {int(country_deaths):n}"),
                dbc.ListGroupItemText(
                    f"Deaths per 1M : {int(country_deaths_per_1m):n}"),
                dbc.ListGroupItemText(
                    f"Life Expectancy (2018) : {country_life_exp} years"),
                dbc.ListGroupItemText(
                    f"Press Freedom Index Rank (2020) : {int(wfpi_rank)} out of {int(wfpi_max_rank)}"
                ),
                dbc.ListGroupItemText(
                    f"United Nations Regional Group : {un_group}"),
                dbc.ListGroupItemText(
                    f"World Bank ATLAS Group : {income_group}")
            ],
            style={
                'color': '#2f4f4f',
                'backgroundColor': '#ede7c6'
            }),
        flush=True)
    return (country_card_description_content, country_card_list_content)
Esempio n. 18
0
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'])
                ]),
            ])
        ])
    ]
Esempio n. 19
0
            # 不显示图例
            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")
Esempio n. 20
0
 dbc.ModalHeader("Как пользоваться этим приложением?"),
 dbc.ModalBody([
     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%',
Esempio n. 21
0
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)
    ]
Esempio n. 22
0
                t = round(t + 0.09, 2)
            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',
Esempio n. 23
0
                ),
            ],
        )
    ], 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,
                ),
            ]
        )
    ]
)
                dbc.Input(
                id = key+"_slider",
                placeholder = key,
                type="number",
                min=param_bounds[key][0], max=param_bounds[key][1], step=min(1,abs(param_bounds[key][1]-param_bounds[key][0])/1000)
                ),
            ], style= {'display': 'block'}
            ),
        )

table_init=[{"Parameter":key, "Value":table_dict[key]} for key in table_dict.keys() if key not in disped_params]
print(table_init)
controls = dbc.Card([dbc.FormGroup([


                                dbc.ListGroup([dbc.ListGroupItemHeading("Dispersion bins"),dcc.Slider(
                                    min=1,
                                    max=26,
                                    step=1,
                                    marks={
                                    key:value for key,value in zip(range(1, 26, 5), [str(x) for x in range(1, 26, 5)])

                                    },
                                    value=16,
                                    id="dispersion_slider"
                                ),],id="slider_group",style= {'display': 'none'}),
                                dbc.ListGroup([dbc.ListGroupItemHeading("Parameters"),
                                dcc.Dropdown(
                                                id='parameter_list',
                                                options=[{'label': x, 'value': x} for x in table_names if key not in forbidden_params],
                                                multi=True,
Esempio n. 25
0
global_first_card = dbc.Card(
    dbc.CardBody([
        html.H5(f"{globalstats['total_cases'][0]:,d} total cases",
                className="card-title"),
        html.
        P(f"of which {globalstats['total_active_cases'][0]:,d} are currently active and \
                {globalstats['total_recovered'][0]:,d} have recovered and {globalstats['total_deaths'][0]:,d} have died."
          ),
        dcc.Link(dbc.Button("Go somewhere", color="primary"), href="/world"),
    ]))

index_tab_card1 = html.Div(
    dbc.Card([
        dbc.CardBody([
            dbc.ListGroup([
                dbc.ListGroupItemHeading("Total"),
                dbc.ListGroupItem(f"Total: ", id="lg_item1_card1"),
                dbc.ListGroupItem(f"Deceased", id="lg_item2_card1"),
                dbc.ListGroupItem(f"New Cases Today: ", id="lg_item3_card1"),
            ],
                          id="index_tab_card1")
        ])
    ]))

index_tab_card2 = html.Div(
    dbc.Card([
        dbc.CardBody([
            dbc.ListGroup([
                dbc.ListGroupItemHeading("Today"),
                dbc.ListGroupItem(f"Total: ", id="lg_item1_card2"),
                dbc.ListGroupItem(f"Deceased:", id="lg_item2_card2"),
Esempio n. 26
0
def result(app: dash.Dash, data: GameData) -> html:
    """Layout for the result page. This page get display after every user prediction.
    This pages displays the predictions from the user and the ai together with
    the ground truth. An explanation for the ai prediction is also provided.

    Arguments:
        app {dash.Dash} -- dash app instance
        data {GameData} -- game data

    Returns:
        html -- html layout
    """
    item = data.items[data.current_round]
    img_raw = str(item.picture_raw)
    img_explained = item.picture_explained
    ai_prediction: Dict[str, Any] = {'x': [], 'y': []}
    ai_prediction['type'] = 'bar'
    ai_prediction['orientation'] = 'h'
    ai_prediction['marker'] = {'color': COLOR_STATWORX}
    max_axis_value = ceil(item.prediction_ai[0].certainty * 10.0) / 10.0

    # Prepare data for the plot
    for ai_item in item.prediction_ai:
        ai_prediction['y'].append(ai_item.brand + ' ' + ai_item.model)
        ai_prediction['x'].append(ai_item.certainty)

    # Determine result and color
    if item.prediction_user == item.ground_truth:
        clr_user = '******'

    else:
        clr_user = '******'

    if item.prediction_ai[0] == item.ground_truth:
        clr_ai = 'success'

    else:
        clr_ai = 'danger'

    layout = dbc.Container([
        dbc.Row(children=[
            dbc.Col(dbc.Card(dbc.CardImg(src=img_raw))),
            dbc.Col(
                dbc.Card([
                    dbc.ListGroup([
                        dbc.ListGroupItem([
                            dbc.ListGroupItemHeading("Your Prediction:"),
                            dbc.ListGroupItemText(item.prediction_user.brand +
                                                  ' - ' +
                                                  item.prediction_user.model)
                        ],
                                          color=clr_user),
                        dbc.ListGroupItem([
                            dbc.ListGroupItemHeading("AI Prediction:"),
                            dbc.ListGroupItemText(item.prediction_ai[0].brand +
                                                  ' - ' +
                                                  item.prediction_ai[0].model)
                        ],
                                          color=clr_ai),
                        dbc.ListGroupItem([
                            dbc.ListGroupItemHeading("Correct Answer:"),
                            dbc.ListGroupItemText(item.ground_truth.brand +
                                                  ' - ' +
                                                  item.ground_truth.model)
                        ],
                                          color='secondary',
                                          className='mb-3')
                    ]),
                    dbc.ButtonGroup(
                        dbc.Button("Continue!",
                                   id="btn",
                                   color='primary',
                                   style={
                                       "background-color": COLOR_STATWORX,
                                       "border-color": COLOR_STATWORX
                                   }))
                ],
                         body=True))
        ],
                className='mb-4'),
        dbc.Row(
            children=[
                dbc.Col(
                    dbc.Card([
                        # dbc.CardBody(
                        #    html.H4("How the AI sees the car", className="card-title")),
                        dbc.CardImg(src=img_explained)
                    ])),
                dbc.Col(
                    dbc.Card(
                        dbc.CardBody([
                            # html.H4("Top 5 AI Predictions", className="card-title"),
                            dcc.Graph(figure={
                                'data': [ai_prediction],
                                'layout': {
                                    'margin': {
                                        'l': 100,
                                        'r': 0,
                                        'b': 0,
                                        't': 0
                                    },
                                    'yaxis': {
                                        'automargin': True,
                                        'autorange': 'reversed'
                                    },
                                    'xaxis': {
                                        'automargin': True,
                                        'tickformat': '.2%',
                                        'range': [0, max_axis_value]
                                    },
                                    'autosize': True
                                }
                            },
                                      config={
                                          'showTips': False,
                                          'displayModeBar': False,
                                          'doubleClick': False,
                                      },
                                      style={
                                          'flex': 1,
                                          'margin': '10px'
                                      })
                        ]), ))
            ],
            className='mb-4'),
        # Needed to circumvent dash limitations
        # See: https://community.plot.ly/t/you-have-already-assigned-a-callback-to-the-output/25334
        html.Div([
            dcc.Input(id='car-brand', value='ignore'),
            dcc.Input(id='car-model', value='ignore')
        ],
                 hidden=True)
    ])

    return layout
Esempio n. 27
0
     width=6,
     lg=6,
     md=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']} "
                     ),
Esempio n. 28
0
                    width='600',
                    style={
                        'border-width': '2',
                        'border': '2px solid black',
                        'backgroundColor': "white"
                    },
                    ################ The magic happens here
                    srcDoc=Plotter.make_bar().to_html()
                    ################ The magic happens here
                ))),
    ]),
    className="card border-primary mb-3")

var_list = dbc.ListGroup([
    dbc.ListGroupItem([
        dbc.ListGroupItemHeading("Variable Codebook"),
        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)"
                  )),
Esempio n. 29
0
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"),
    ]),
])
Esempio n. 30
0
                 html.H4("시간대별 산악 사고 발생 건수"),
                 dcc.Graph(id="main_graph",
                           figure=go.Figure(data=data2))
             ],
             className="pretty_container six columns",
         ),
     ],
     className="row flex-display",
 ),
 html.Div(
     [
         html.Div(
             [
                 dbc.ListGroup([
                     dbc.ListGroupItem(
                         [dbc.ListGroupItemHeading("최근 산악 사고 관련 기사")]),
                     dbc.ListGroupItem(
                         "강릉서 폭포에 빠진 60대 산악회원 숨져",
                         href=
                         "https://www.yna.co.kr/view/AKR20190820126100062?input=1195m",
                         className="row pretty_container columns"),
                     dbc.ListGroupItem(
                         "“은누리야”…폭염속 애타는 외침",
                         href=
                         "http://www.ccdn.co.kr/news/articleView.html?idxno=587862#09SX",
                         className="row pretty_container columns"),
                     dbc.ListGroupItem(
                         "[기고]여름철 산행 안전사고 주의해야",
                         href=
                         "http://www.asiatoday.co.kr/view.php?key=20190820010010413",
                         className="row pretty_container columns"),