Ejemplo n.º 1
0
    def __init__(self, master):
        self.master = master
        super(Root, self).__init__()
        master.title("Exchange Rates 4.07 PROD")
        master.minsize(1200, 800)
        master.iconbitmap('window_icon.ico')
        master.configure(bg='#FFFFFF')

        self.win = tk.Toplevel()
        self.login_popup()

        root.withdraw()

        self.style = ttk.Style(root)
        self.style.configure('lefttab.TNotebook',
                             tabposition='wn',
                             bg='#FFFFFF')

        self.topbar = Topbar(master, self)
        self.navbar = Navbar(master, self)
        self.statusbar = Statusbar(master, self)
        self.threadedtasks = ThreadedTask(master, self)

        self.statusbar.pack(side=tk.BOTTOM, fill=tk.X, pady=2)
        self.topbar.pack(side=tk.TOP, pady=5)
        self.navbar.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
Ejemplo n.º 2
0
class Root:
    def __init__(self, master):
        self.master = master
        super(Root, self).__init__()
        master.title("Exchange Rates 4.07 PROD")
        master.minsize(1200, 800)
        master.iconbitmap('window_icon.ico')
        master.configure(bg='#FFFFFF')

        self.win = tk.Toplevel()
        self.login_popup()

        root.withdraw()

        self.style = ttk.Style(root)
        self.style.configure('lefttab.TNotebook',
                             tabposition='wn',
                             bg='#FFFFFF')

        self.topbar = Topbar(master, self)
        self.navbar = Navbar(master, self)
        self.statusbar = Statusbar(master, self)
        self.threadedtasks = ThreadedTask(master, self)

        self.statusbar.pack(side=tk.BOTTOM, fill=tk.X, pady=2)
        self.topbar.pack(side=tk.TOP, pady=5)
        self.navbar.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

    def login_popup(self):
        self.win.wm_title("Log in - Exchange Rates")
        self.win.attributes('-topmost', 'true')

        user_label = tk.Label(self.win, text="User name:")
        user_textbox = ttk.Entry(self.win, width=30)
        pass_label = tk.Label(self.win, text="Password:"******"*", width=30)

        login_button = ttk.Button(self.win,
                                  text="Log in",
                                  command=self.login_success)
        cancel_butoon = ttk.Button(self.win, text="Cancel")

        user_label.grid(row=0, column=0, padx=10, ipady=10)
        user_textbox.grid(row=0, column=1, columnspan=3, padx=10, pady=10)
        pass_label.grid(row=1, column=0, padx=10, pady=10)
        pass_textbox.grid(row=1, column=1, columnspan=3, padx=10, pady=10)
        cancel_butoon.grid(row=2, column=0, columnspan=2, padx=10, pady=10)
        login_button.grid(row=2, column=2, columnspan=2, padx=10, pady=10)

    def login_success(self):
        self.win.destroy()
        root.deiconify()
Ejemplo n.º 3
0
def Homepage():

    # Body container
    body = dbc.Container(
        [
            dbc.Row([
                dcc.Markdown('---'),
            ]),
            dbc.Row([
                dbc.Col(id='live_alert_header_btn'),
            ]),
            dbc.Row([
                dbc.Col(
                    user_selection_area(), id='user_selection_column', md=3),
                dbc.Col(
                    [
                        # map object added here
                        html.Div(build_alerts_map(), id='hp_map'),
                        # interval object handling api calls every 10 seconds
                        dcc.Interval(
                            id='interval-component',
                            interval=10 * 1000,  # in milliseconds
                            n_intervals=0),
                        html.Div(id='img_url', style={'display': 'none'})
                    ],
                    md=9),
            ]),
            # meteo graphs added here
            meteo_graphs(display=False)
        ],
        fluid=True,
    )
    # Instantiating navbar object from navbar.py
    layout = html.Div([Navbar(), body])
    return layout
Ejemplo n.º 4
0
def Dataset_documentation():
    nav = Navbar()
    footer = Footer()

    body = dbc.Container(
        [
            dbc.Row([
                dbc.Col([
                    html.H2(
                        "COVID-19 Aggregated Clinical Dataset Documentation"),
                    html.
                    P('As policy makers and healthcare professionals tackle the COVID-19 pandemic, a critical factor inhibiting effective decision making at regional, national, and global levels is a lack of relevant data on patient outcomes. We hope to partially alleviate this problem by sharing the following dataset, which aggregates data from over 160 published clinical studies and preprints released between December 2019 and April 2020. For each paper, an MIT researcher read the paper and gathered relevant numerical data from tables and from the text into a standard format.'
                      ),
                    html.
                    P('We would like to remind the reader that the raw data in this dataset should not be used to estimate trends in the general population such as mortality rates. Indeed, this dataset is largely derived from studies run in hospitals and nations affected with SARS-COV-2 generally only admit seriously affected patients to hospitals. However, it should be possible to derive reasonably accurate estimates of these quantities by (a) accounting for the prevalence of asymptomatic patients, and (b) only including sufficiently representative studies.'
                      ),
                    html.
                    P('At a high level, each row of the dataset represents a cohort of patients. Some papers study a single cohort, while others study several cohorts, and still others report results about one cohort and one or more subcohorts; all of these are included as rows in the dataset. Given a cohort, each column represents information about this cohort of patients, divided roughly in the following categories:'
                      ),
                    dcc.Markdown('''
						1. demographic information (e.g. number of patients in the cohort, aggregated age and gender statistics)
						2. comorbidity information (e.g. prevalence of diabetes, hypertension, etc.)
						3. symptoms (including fever, cough, sore throat, etc.)
						4. treatments (including antibiotics, intubation, etc.)
						5. standard labs (including lymphocyte count, platelets, etc.)
						6. outcomes (including discharge, hospital length of stay, death, etc.)
						'''),
                    html.
                    P('This database aggregates reported data from different hospitals across the world, which may have different equipment and reporting standards. It was obtained through a human reading process, which is inherently imperfect. In addition, we often chose to prioritize standardizing information across papers over perfect accuracy. We list some important observations about the data below.'
                      ),
                    dcc.Markdown('''
						1. The data in this spreadsheet includes data from preprints which have not yet been subject to peer review. We have chosen to include these studies because the additional predictive power from having 2-3 times more data outweighs the potential for errors in these data points. However, we remind the reader that caution should be taken when using data which has not yet been subject to peer review.
						2. To minimize human error in data reporting, we have verified some key features with additional scrutiny, including mortality, ICU and hospital length of stay, key symptoms (fever, cough, short breath, fatigue, diarrhea) and common comorbidities (hypertension, diabetes).
						3. Across papers, subcohort divisions may follow different criteria (which may be of independent interest), including: severity of disease (severe vs. mild), death (survivors vs. non-survivors), treatment (intubation vs. non-intubation), comorbidity (diabetic vs. non-diabetic).
						4. Papers are not consistent on their reporting of mortality or discharge rates. Some only report mortality; others report only discharges; many patients remain in the hospital at the conclusion of the study.
						5. Studies in this dataset do not always have the same purpose, which affects data reporting. For instance, many papers from Italy seem to report data only on non-survivors. In addition, some studies focus on the disease’s contagion profile, with little information on death, discharge, stay length. Data points from these studies may exhibit a high proportion of missing features.
						6. To the best of our ability, we avoid reporting data from metastudies to avoid double-counting patients. However, there remains a (low) risk that some patients will appear in multiple studies (for example two studies in Feb and Mar in the same hospital).
						7. We have tried to report all lab values in consistent units. We have included a companion document (Reference Ranges) with corresponding reference ranges to facilitate analysis. There are some instances where the reported lab units seem inconsistent with the expected ranges (e.g. for D-Dimer), but we have generally reported the raw values from the source papers.
						'''),
                    html.
                    P('To cite the dataset, you can use the following reference:'
                      ),
                    dcc.Markdown('''
						@online{bertsimas2020covidClinicalOutcomes,
						author = {Bertsimas, Dimitris and Bandi, Hari and Boussioux, Leonard and Cory-Wright, Ryan and Delarue, Arthur and Digalakis, Vasileios and Gilmour, Samuel and Graham, Justin and Kim, Adam and Lahlou Kitane, Driss and Lin, Zhen and Lukin, Galit and Li, Michael and Mingardi, Luca and Na, Liangyuan and Orfanoudaki, Agni and Papalexopoulos, Theodore and Paskov, Ivan and Pauphilet, Jean and Skali Lami, Omar and Sobiesk, Matthew and Stellato, Bartolomeo and Carballo, Kimberly and Wang, Yuchen and Wiberg, Holly and Zeng, Cynthia},
						title = {An Aggregated Dataset of Clinical Outcomes for COVID-19 Patients},
						url = {http://www.covidanalytics.io/dataset_documentation},
						year={2020}
						}'''),
                    #8. We intend to continuously update this dataset, for the duration of this epidemic. If you spot any errors in the dataset, or know of any papers which you believe this dataset would benefit from including, please do not hesitate to contact us, either by filing an issue in our GitHub repo, or emailing us at [email protected].
                ])
            ]),
        ],
        className="page-body",
    )
    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 5
0
def Collaborators():
    with open("assets/collaborators/organizations.yml") as f:
        collaborators = yaml.load(f, Loader=yaml.FullLoader)
    num_collaborators = len(collaborators)

    nav = Navbar()
    footer = Footer()

    def get_card(collab):
        return \
            dbc.Col(
                dbc.Card(
                    [
                        dbc.CardHeader(html.H4(collab["name"]),style={"textAlign": "center"}),
                        dbc.CardImg(src='assets/collaborators/photos/%s' % collab['photo'],
                                    top=False,
                                    style={"paddingLeft":   "10px",
                                           "paddingRight":  "10px",
                                           "paddingBottom": collab["padding"],
                                           "paddingTop":    collab["padding"],}),
                        dbc.CardFooter(
                            [
                                html.A(collab["text"],
                                href=collab["website"],
                                className="stretched-link collab-name"),
                            ],
                            className="h-100",
                        )
                    ],
                    style={"borderColor": "#800020"},
                    className="h-100 collab-card"
                ),
                style={"margin": "0 rem"},
            )

    body = dbc.Container([
        dbc.Row([
            dbc.Col([
                html.H2("Our Collaborators"),
                html.
                P('Our models would not have been possible without the valuable data and insights provided \
                                    by our partners. Our aspiration is to develop tools that they can positively affect the \
                                    care they provide to their patients.')
            ])
        ],
                style={'marginBottom': 20}),
        dbc.Row([get_card(collaborators[i])
                 for i in range(num_collaborators)], ),
    ],
                         className="page-body")
    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 6
0
def Projections_documentation():
	nav = Navbar()
	footer = Footer()

	body = dbc.Container([
		dbc.Row(
	        [
				dbc.Col([
	            	html.H2("DELPHI Epidemiological Model Documentation"),
	                html.P("""\
	                        This page provides insights on a new epidemiological model developed by this team \
	                        to provide estimates of the number of COVID-19 infections, hospitalizations, and \
	                        deaths in all states of the United States. The model is based on the widely applied \
	                        SEIR (Susceptible-Exposed-Infected-Recovered) modeling approach, which allocates every person to one of four states:
	                       """),
	                dcc.Markdown('''
	                  1. Susceptible: The general population that has not been infected and is not immune.
	                  2. Exposed: People who are currently infected, but are not contagious and lie within the incubation period.
	                  3. Infected: People who are currently infected and are contagious.
	                  4. Recovered: People who recovered and are immune.
	                '''),
	                html.P("""\
	                        Using appropriate case-specific parameters, the SEIR modeling approach can then be applied \
	                        to estimate the dynamics of a pandemic, as people move between these four states over time. \
	                        This base model is then greatly expanded and adjusted for many factors important in the current \
	                        COVID-19 pandemic, including under-detection, hospitalization, and societal counteracting measures. \
	                        The parameter values are based on a meta-analysis of the data in the papers that the group curated.\
	                        Important parameters are varied across different states:
	                      """),
	                # In developing the XYZ model, we have greatly expanded a basic SEIR model and made adjustments for many factors important
	                dcc.Markdown('''
	                  1. Effective contact rate: The effective contact rate measures the number of people that come into contact \
	                  with an infected person per day. This fundamental quantity largely controls the spread of the virus, and \
	                  would be greater in densely populated states (such as NY, CT) and smaller in sparsely populated ones (e.g. AZ, NV).
	                  2. Societal/Governmental Response: This parameter measures, through a parametric nonlinear function, the impact \
	                  of any governmental and societal responses on the spread of the virus over time. This includes such measures as \
	                  government decrees regarding social distancing and sheltering-in-place, as well as increased hygiene-related \
	                  awareness and reduced travel among the general population. This function is calibrated for every state to account \
	                  for the differing responses in different states.
	                '''),
					dcc.Markdown('''Detailed model specifications are available in the following \
	                [technical report](/DELPHI_documentation_pdf). The full source code can be accessed on\
	                [Github](https://github.com/COVIDAnalytics/epidemic-model).'''),
					 ])
			 ],
		 ),
	],
	className="page-body"
	)
	layout = html.Div([nav, body, footer],className="site")
	return layout
Ejemplo n.º 7
0
def RisksApp():
    layout = [
        Navbar(),  # Instantiating the navigation bar
        dcc.Markdown(
            '---'
        ),  # Adding a first separator between the navigation bar and the slider
        build_opacity_slider(),  # Instantiating the slider
        dcc.Markdown(
            '---'
        ),  # Adding a second separator between the navigation slider and the map
        build_risks_map()  # Instantiating the map object
    ]

    return html.Div(layout)
Ejemplo n.º 8
0
def AlertsApp():
    layout = [
        Navbar(),  # Instantiating the navigation bar
        dcc.Markdown(
            '---'
        ),  # Adding a first separator between the navigation bar and the button
        build_layer_style_button(
        ),  # Instantiating the button to change the map layer style
        dcc.Markdown(
            '---'),  # Adding a second separator between the button and the map
        build_alerts_map()
    ]  # Finally instantiating the map object

    return html.Div(layout)
Ejemplo n.º 9
0
def Policies():
    nav = Navbar()
    footer = Footer()

    with open('assets/policies/US_Scenarios.json', 'rb') as file:
        projections = json.load(file)

    states = list(projections.keys())
    num_policies = get_num_policies()

    body = dbc.Container(
        [
            dbc.Row(
            [
                dbc.Col(
                [
                    dbc.Jumbotron(
                    [
                        html.H2("Predictions of infections and deaths under a variety of policies"),
                        dcc.Markdown(
                             """Using an extension of our [DELPHI model](/projections), we make predictions \
                             until September 2020 for infections and deaths for all states of the US. \
                             By selecting the state,  the collection of policies imposed and their timing, \
                             the user can compare up to 3 policies simultaneously.
                             """,
                        ),
                        html.Hr(),
                        dcc.Markdown(
                             """The methodology of the model is explained [here](/Policy_evaluation_documentation). \
                             We are currently developing an extension of the model for the world.
                             """,
                        )
                    ],
                    style={'paddingBottom':'0.5rem','paddingTop':'0.8rem'}
                    )
                ]
                ),
            ],
            )
        ] + \
        get_state_num_policy_card(states) + \
        get_policy_cards(num_policies) + \
        get_projections(),
        className="page-body"
    )

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 10
0
def RiskCalc():
    nav = Navbar()
    footer = Footer()
    body = dbc.Container(
        get_lang('language-calc-mortality') +
        get_page_desc('page-desc-mortality') +
        get_labs_indicator('lab_values_indicator') +
        get_feature_cards('features-mortality') +
        get_submit_button('submit-features-calc') +
        get_results_card('score-calculator-card-body', 'calc-input-error') +
        get_inputed_vals('imputed-text-mortality') +
        get_personal_visual('visual-1-mortality') +
        get_model_desc('mortality-model-desc') +
        get_feature_importance('feature-importance-bar-graph'),
        className="page-body")

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 11
0
    def __init__(self, data_filename, labels_filename):

        # initialize tkinter
        self.tk = tkinter.Tk()
        self.tk.title("Extremely Fast Decision Tree visualizer")

        # get database in a pandas dataframe
        data = pd.read_csv(data_filename)
        labels = pd.read_csv(labels_filename)

        labels['y'] = labels['y'].astype('category')

        # create data provider, give the pandas dataframes as argument
        self.provider = DataProvider(x=data, y=labels)

        # create navbar object, give data provider and tkinter object (to add the navbar widget to it) as argument
        self.navbar = Navbar(tk=self.tk, provider=self.provider)

        # create tree object, give data provider and tkinter object (to add the tree widget to it) as argument
        self.tree = Tree(tk=self.tk, provider=self.provider)

        # initialize tkinter main loop
        self.tk.mainloop()
Ejemplo n.º 12
0
def VentilatorAllocations():

    nav = Navbar()
    footer = Footer()

    models = ["Washington IHME", "COVIDAnalytics"]

    body = dbc.Container(
        [
            dbc.Row(
                [
                    dbc.Jumbotron(
                        [
                            html.H1("Optimization can solve the ventilator shortage"),
                            html.P('''
                                   For severe COVID-19 patients, medical ventilators can spell \
                                   the difference between life and death, but many locations are \
                                   already experiencing shortages.
                                   ''',
                                   className="lead"),
                            html.Hr(),
                            dcc.Markdown('''Fortunately, the dynamics of the \
                                         pandemic differ from one place to another, \
                                         creating opportunities to mitigate shortages by \
                                         dynamically allocating the global ventilator supply.'''),
                        ],
                    ),
                ],
            ),
            dbc.Row(
                [
                    dbc.Col(
                        dbc.Card(
                            [
                                dbc.CardHeader(html.H4("Between hospitals"),
                                               style={"textAlign": "center"}),
                                dbc.CardImg(src="assets/collaborators/photos/Hartford_logo.jpg",
                                            top=False,
                                            style={"paddingLeft":   "10px",
                                                   "paddingRight":  "10px",
                                                   "paddingBottom": "40px",
                                                   "paddingTop":    "40px",}),
                                dbc.CardFooter(
                                    [
                                        html.P("We are working with our partners at Hartford \
                                               HealthCare to ensure that ventilator demand is met \
                                               across hospitals in their network."                                                                                  ),
                                    ],
                                    className="h-100",
                                )
                            ],
                            style={"borderColor": "#800020"},
                            className="h-100"
                        ),
                        xs=12,
                        sm=6,
                        md=6,
                        lg=4,
                        xl=4,
                        style={"padding": "20px"},
                    ),
                    dbc.Col(
                        dbc.Card(
                            [
                                dbc.CardHeader(html.H4("Between states"),
                                               style={"textAlign": "center"}),
                                dbc.CardImg(src="assets/images/allocation.png", top=False),
                                dbc.CardFooter(
                                    [
                                        html.P("We show below how ventilator pooling \
                                               across \
                                               states can solve the US shortage, even without \
                                               federal intervention."                                                                     ),
                                    ],
                                    className="h-100",
                                ),
                            ],
                            style={"borderColor": "#800020"},
                            className="h-100",
                        ),
                        xs=12,
                        sm=6,
                        md=6,
                        lg=4,
                        xl=4,
                        style={"padding": "20px"},
                    ),
                    dbc.Col(
                        dbc.Card(
                            [
                                dbc.CardHeader(html.H4("Between countries"),
                                               style={"textAlign": "center"}),
                                dbc.CardImg(src="assets/images/world-map.png", top=False,
                                            style={"paddingLeft":   "10px",
                                                   "paddingRight":  "10px",
                                                   "paddingBottom": "20px",
                                                   "paddingTop":    "20px",}),
                                dbc.CardFooter(
                                    [
                                        html.P("We hope our optimization model will provide a \
                                               blueprint for international collaboration on \
                                               ventilator inventory management."                                                                                )
                                    ],
                                    className="h-100",
                                )
                            ],
                            style={"borderColor": "#800020"},
                            className="h-100",
                        ),
                        xs=12,
                        sm=6,
                        md=6,
                        lg=4,
                        xl=4,
                        style={"padding": "20px"},
                    ),
                ],
                justify="around",
            ),
            dbc.Row(
                [
                    html.Iframe(src="https://www.youtube.com/embed/SwiOFEZc0Gs",
                                width="711",
                                height="400"),
                ],
                justify="around",
                style={"paddingBottom": "20px"},
            ),
            dbc.Row(
                [
                    dbc.Col(
                        [
                            dcc.Markdown('''Interested in more details? Check out this \
                                         [technical report](/ventilator_documentation_pdf), \
                                         or take a look at our [code]\
                                         (https://github.com/COVIDAnalytics/ventilator-allocation)!
                                         '''),
                        ],
                    ),
                ],
            ),
            dbc.Row(
            [
                dbc.Jumbotron(
                [
                    html.H2("Why share ventilators between states?"),
                    html.P('''As highlighted in the visuals below, the number of ventilators \
                              available across all 50 states - without even accounting for the \
                              federal stockpile - exceeds national demand.''',
                           className="lead"),
                    html.Hr(),
                    dcc.Markdown('''Yet with the current \
                                 allocation of ventilators, some states are expected to face strong \
                                 shortages over time. And this is true for different pandemic \
                                 projection models, including our own [DELPHI](/projections) \
                                 forecasts and those from the [University of Washington’s IHME model]\
                                 (https://covid19.healthdata.org/united-states-of-america).
                                 '''),
                ]
                ),
            ],
            )
        ] + \
        [
            dbc.Row(
            [
                dbc.Col(
                [
                    html.H6('Select the Data Source:',id="date-projections"),
                    html.Div(
                        dcc.Dropdown(
                            id = 'base-model-dropdown',
                            options = [{'label': x, 'value': x} for x in models],
                            value = 'COVIDAnalytics',
                        ),
                    ),
                ],
                ),
            ]
            )
        ] + \
            get_shortage() + \
        [
            dbc.Row(
                [
                    dbc.Jumbotron(
                    [
                        html.H2("How can states share ventilators optimally?"),
                        dcc.Markdown('''
                            We know how many ventilators are in each state from public data, and we \
                            estimate that up to 450 ventilators per day could be made available \
                            through a federal surge \
                            (see [documentation](/ventilator_documentation_pdf) for details). \
                            Our optimization model recommends surge supply allocations and interstate transfers to reduce ventilator shortage as quickly and efficiently as possible.'''),
                        html.Hr(),
                        html.P('Use the interactive tool below to experiment with different reallocation policies.', className="lead"),
                    ]
                    ),
                ],
            )
        ] + \
            get_transfers_visuals() + \
            get_transfers_table() + \
        [
            dbc.Row([
           dbc.Col(
            html.Div(
             html.A(
              "Download the Ventilator Shortage Data",
              id="download-link-demand",
             ),
             style={'textAlign':"center"}
            )
           ),
           dbc.Col(
            html.Div(
             html.A(
              "Download the Ventilator Transfers Data",
              id="download-link-tranfers",
             ),
             style={'textAlign':"center"}
            )
           ),
          ]
            ),
        ],
       className="page-body"
    )

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 13
0
def Contact():

    # Form details
    formspree_url="https://formspree.io/xqkdkggg"
    mailing_list="*****@*****.**"


    nav = Navbar()
    footer = Footer()

    name_input = dbc.FormGroup(
        [
            dbc.Row(
            [
                dbc.Col(html.Label("Topic", htmlFor="name-row"),width="auto"),
                dbc.Col(
                    dcc.Input(
                        type="text",
                        id="name-row",
                        name="name",
                        className="form-control",
                        placeholder="Enter the topic of your message",
                        style={"width":"50%"},
                    ),
                    width=True
                ),
            ],
            )
        ],
    )

    email_input = dbc.FormGroup(
        [
            dbc.Row(
            [
                dbc.Col(html.Label("Email", htmlFor="email-row"),width="auto"),
                dbc.Col(
                    [dcc.Input(
                        type="email",
                        id="email-row",
                        name="email",
                        className="form-control",
                        placeholder="Enter your email address",
                        style={"width":"50%"}
                    ),
                    dcc.Input(
                        type="hidden",
                        name="_subject",
                        value="Covidanalytics Mailing List",
                        style={"width":"50%"},
                    )
                ],
                width=True
                ),
            ],
            )
        ],
    )


    text_input = dbc.FormGroup(
        [
            dbc.Row(
            [
                dbc.Col(dbc.Label("Text", html_for="message-row"),width="auto"),
                dbc.Col(
                [
                    dcc.Textarea(
                        placeholder="Your message goes here...",
                        className="form-control",
                        id="message-row",
                        name="message",
                        style={"width":"50%","marginLeft":5},
                    )
                ],
                width=True
                ),
            ],
            )
        ],
    )

    submit_button = html.Button("Submit", className="btn btn-primary", formEncType="submit")

    form = html.Form([name_input, email_input, text_input, submit_button],
                     action=formspree_url,
                     method="POST")

    body = dbc.Container([
                dbc.Row(
                [
                    dbc.Col(
                        [
                            html.P("We are happy to collaborate and help you take our research one step further. " +
                                   "Feel free to send us an email using the following form."),
                            html.P(
                                ["You can also reach out to us by sending an email to ",
                                    html.A(
                                            mailing_list,
                                            href="mailto:%s" % mailing_list,
                                        ), "."
                                ]
                            ),
                            form
                          ]
                        )
                    ],

                    )
                ],
                className="page-body",
    )

    layout = html.Div([nav, body, footer],className="site")
    return layout
Ejemplo n.º 14
0
from navbar import Navbar, Sidebar

import dash
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import pandas as pd
import plotly.express as px
import plotly.graph_objs as go
import datetime
from dash.dependencies import Input, Output, State

import pyodbc

nav = Navbar()  # Подключаем код навигационной панели
sidebar = Sidebar()  # Подключаем код левого меню

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.UNITED
                                                ])  #Подключение темы для сайта

app.title = "Система ИАС УЭР Металлоинвест"  # Название сайта

preload_page = dbc.Fade(
    id='pr_load',
    children=[
        html.Div(id='p_prldr',
                 children=[
                     html.Div(className='contpre',
                              children=[
                                  html.Span(className='svg_anm'),
Ejemplo n.º 15
0
def FinancialReliefPlanning():
    nav = Navbar()
    footer = Footer()

    body = dbc.Container(
            [
                dbc.Row(
                [
                    dbc.Col(
                    [
                        dbc.Jumbotron(
                        [
                            html.H2("Analytics-Driven Financial Relief Planning"),
                            dcc.Markdown(
                                 """The unemployment rate in the US has reached levels not seen since the Great Depression
                                    as millions of workers are out of work and trying to navigate difficult financial decisions.
                                    Households are struggling to figure out revised budgets, estimated cuts in spending, and
                                    potential resources to access additional funds. The decisions are complicated because
                                    there is an overwhelming number of COVID related benefits to understand, for example, the
                                    recent [CARES Act](https://home.treasury.gov/policy-issues/cares) and the
                                    [IRS Tax relief benefits](https://www.irs.gov/newsroom/coronavirus-related-relief-for-retirement-plans-and-iras-questions-and-answers).
                                 """,
                            ),
                            html.Hr(),
                            dcc.Markdown(
                                 """Although it is now easier to tap into retirement funds for short term budgeting needs,
                                    households need to evaluate overall tax consequences and long-term retirement plan goals
                                    to make the best decisions. It is very complicated to sort through all the information and
                                    options available. Analytics can help structure the information, define short and long-term
                                    household objectives, as well as incorporate personal constraints. Optimization techniques
                                    can be used to evaluate all possible decisions and determine the specific actions the
                                    household can take to navigate the current crisis and stay the course toward their future
                                    goals.
                                 """,
                            )
                        ],
                        style={'paddingBottom':'0.5rem','paddingTop':'0.8rem'}
                        )
                    ]
                    ),
                ],
                )
            ] + \
            [
                dbc.Row(
                [
                    dbc.Col(
                    [
                        dbc.Jumbotron(
                        [
                            html.H2("Financial Relief Planning Tool"),
                            dcc.Markdown(
                                 """A team of MIT PhDs from the Operations Research Center with 20+ years of experience in finance,
                                    analytics, and robust optimization have created the COVID Relief Planning Assistant to help those
                                    impacted create a short-term financial plan. This online tool leverages advanced analytics and
                                    modeling to tell households what to do next and why. There is no cost to access the tool
                                    which provides actionable financial guidance, personalized for each household impacted by
                                    reduced or lost income. The methodology of the tool is explained [here](https://www.savvifi.com/files/COVID_Relief_Planning.pdf).
                                 """,
                            ),
                            html.Hr(),
                            html.H5("COVID Relief Planning Assistant", style={"color":"#800020"}),
                            dcc.Markdown(
                                 """Click [here](https://covid.savvifi.com/) to get started on your short-term financial plan.
                                 """,
                            ),
                            html.H5("COVID Educational Resources"),
                            dcc.Markdown(
                                 """Click [here](https://help.savvifi.com/en/collections/2289225-covid-19-educational-resources)
                                    to find additional educational content for those affected by the COVID-19 crisis.
                                 """,
                            )
                        ],
                        style={'paddingBottom':'0.5rem','paddingTop':'0.8rem'}
                        )
                    ]
                    ),
                ],
                )
            ],
            className="page-body"
        )

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 16
0
import plotly_express as px
import plotly.graph_objects as go

import numpy as np

df_matches = what_matches(df)
list_surebets = all_bets(best_surebet(df), 100)

app = dash.Dash(__name__,
                title='Sure Bet',
                external_stylesheets=[dbc.themes.BOOTSTRAP])

app.layout = html.Div(
    style={'backgroundColor': colors['background']},
    children=[
        html.Div(Navbar()),
        html.Div(className='app-header--title',
                 children=[
                     html.H1(className="app-header--title",
                             id='title',
                             children=f'Dashboard',
                             style={'textAlign': 'center'}),
                 ],
                 style={'marginTop': '50px'}),
        html.Div(children=[
            dbc.Row(
                dbc.Col(
                    html.Div(
                        dcc.Dropdown(
                            id='match_dropdown',
                            options=match_dd(df),
Ejemplo n.º 17
0
def Homepage():

    nav = Navbar()
    footer = Footer()

    def build_tom_us_map():
        tomorrow = datetime.date.today() + datetime.timedelta(days=1)
        return build_continent_map(tomorrow)

    def build_card(imgTop, titles, text, img, links):
        cardbody = []
        for i, t in enumerate(titles):
            cardbody.append(html.A(t, href=links[i], className="card-title"))
            cardbody.append(dcc.Markdown(text[i]))

        if imgTop:
            card_content = \
                    [
                        dbc.CardImg(src=img, top=False),
                        dbc.CardBody(
                            cardbody,
                            className="home-card-body"
                        ),
                    ]

        else:
            card_content = \
                    [
                        dbc.CardBody(
                            cardbody,
                            className="home-card-body"
                        ),
                        dbc.CardImg(src=img, top=True),
                    ]

        card = dbc.Card(card_content, className="home-card h-100")

        return dbc.Col(
            [card],
            style={"margin": "0.5rem"},
        )

    data_text = '''
           130+ international Covid-19 clinical studies,
           aggregated into a single dataset.
           '''
    insights_text = '''
        Key characteristics of COVID-19 patients in an
        interactive summary. '''

    projections_text = '''
        Epidemiological predictions of COVID-19 \
        infections, hospital stays, and mortalities.
        '''

    policy_text = '''
        Predicting infections and deaths based on various policy \
        implementations'''

    ventilator_text = '''
           Leveraging delays between state peaks to \
           optimally re-use ventilators.
           '''

    mortality_calculator_text = '''
          Personalized calculator predicting mortality upon hospitalization.
          '''

    infection_calculator_text = '''
        Personalized calculator predicting results of COVID test.
        '''

    financial_text = '''
        Unemployment is rising. How analytics can help inform COVID-19 related financial decisions.
        '''

    cards = \
        [
            {
                "titles": ["Data","Insights"],
                "text": [data_text,insights_text],
                "image": "assets/images/insights-4.png",
                "links": ["/dataset","/interactive-graph"]
            },
            {
                "titles": ["Infection risk calculator","Mortality risk calculator"],
                "text": [infection_calculator_text,mortality_calculator_text],
                "image": "assets/images/infection_logo.jpg",
                "links": ["/infection_calculator","/mortality_calculator"]
            },
            {
                "titles": ["Case predictions","Policy evaluations"],
                "text": [projections_text,policy_text],
                "image": "assets/images/forecast-1.png",
                "links": ["/projections","/policies"]
            },
            {
                "titles": ["Ventilator allocation"],
                "text": [ventilator_text],
                "image": "assets/images/allocation.png",
                "links": ["/ventilator_allocation"]
            },
            {
                "titles": ["Financial relief planning"],
                "text": [financial_text],
                "image": "assets/images/financial_logo.jpeg",
                "links": ["/financial_relief","/interactive-graph"]
            }

        ]

    body = dbc.Container([
        dbc.Row(
            dbc.Col(
                dcc.Markdown('''
                         We are a group of researchers from the [MIT](http://mit.edu/) [Operations Research Center](https://orc.mit.edu/), \
                         led by Professor [Dimitris Bertsimas](https://www.mit.edu/~dbertsim/). \
                         We aim to quickly develop and deliver tools for hospitals and policymakers in the US to combat the spread of COVID-19. \
                         This work represents a collaborative effort with [multiple hospitals](/collaborators) which have been providing us with \
                         data and support throughout the model creation process.
                         '''), ), ),
        dbc.Row(
            [
                build_card(False, cards[0]["titles"], cards[0]["text"],
                           cards[0]["image"], cards[0]["links"]),
                build_card(True, cards[1]["titles"], cards[1]["text"],
                           cards[1]["image"], cards[1]["links"]),
                build_card(False, cards[2]["titles"], cards[2]["text"],
                           cards[2]["image"], cards[2]["links"]),
                build_card(True, cards[3]["titles"], cards[3]["text"],
                           cards[3]["image"], cards[3]["links"]),
                build_card(False, cards[4]["titles"], cards[4]["text"],
                           cards[4]["image"], cards[4]["links"]),
            ],
            justify="around",
            no_gutters=True,
        ),
        dbc.Row([
            dbc.Col([
                html.Div(
                    id='us_map_homepage',
                    children=build_tom_us_map(),
                ),
                html.P(
                    children=get_world_map_text(),
                    style={'color': 'gray'},
                ),
            ])
        ], )
    ],
                         className="page-body")

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 18
0
def InteractiveGraph():
    nav = Navbar()
    footer = Footer()

    categories = ["Comorbidities", "Symptoms", "Treatment", "Lab Test Results"]

    demographics = ["Median Age", "% Male"]
    df = pd.read_csv('data/clinical_outcomes_database.csv')
    survivor_options = df.Survivors.unique()
    data_csv_string = df.to_csv(index=False, encoding='utf-8')
    data_csv_string = "data:text/csv;charset=utf-8," + urllib.parse.quote(
        data_csv_string)
    del df
    survivor_options = [x for x in survivor_options if str(x) != 'nan']

    body = dbc.Container(
        [
            dbc.Row([
                dbc.Col([html.H2("Insights")]),
            ], ),
            dbc.Row([
                dbc.Col([
                    html.Div([
                        dcc.Markdown(
                            """\
                                Effective decision making needs data. \
                                We interactively visualize a new [dataset](/dataset) \
                                that aggregates data from over 100 published clinical \
                                studies and preprints released between December 2019 \
                                and March 2020 on COVID-19. We hope that by summarizing\
                                the results of multiple studies, we can get a clearer \
                                picture on the virus.
                             """, ),
                        html.P(
                            """\
                                Below you will find a series of \
                                options to create descriptive graphs relating to patient \
                                demographic characteristics, symptoms, treatments, \
                                comorbidities, lab results, and outcomes. \
                                Each data point corresponds to a different study that \
                                comprises multiple patients. We hope that you can easily \
                                derive your own insights and discover the interesting \
                                implications of the disease.
                             """, )
                    ])
                ]),
            ], ),
            dbc.Row([
                dbc.Col(
                    [
                        html.H5('What would you like to compare?'),
                        html.Div(
                            dcc.Dropdown(id='categories_dropdown',
                                         options=[{
                                             'label': x,
                                             'value': x
                                         } for x in categories],
                                         value='Comorbidities',
                                         style={'marginBottom': 10}), ),
                        html.Div(id='display-selected-values', ),
                        html.Div([
                            html.Div(
                                dcc.Dropdown(id='y_axis_dropdown',
                                             value='Hypertension',
                                             optionHeight=50,
                                             style={
                                                 'marginBottom': 10,
                                                 'marginTop': 10
                                             }), )
                        ]),
                        html.P('Select the Demographic (Horizontal Axis)'),
                        html.Div(
                            dcc.Dropdown(id='x_axis_dropdown',
                                         options=[{
                                             'label': x,
                                             'value': x
                                         } for x in demographics],
                                         value='% Male',
                                         style={
                                             'marginBottom': 10,
                                             'marginTop': -5
                                         }), ),
                        html.P('Select the Population Type:'),
                        html.Div(
                            dcc.Checklist(
                                id='survivors',
                                options=[{
                                    'label': x,
                                    'value': x
                                } for x in survivor_options],
                                value=['Non-survivors only', 'Survivors only'],
                                labelStyle={'color': 'black'},
                                style={
                                    'width': '50%',
                                    'marginTop': -5
                                })),
                    ],
                    width="True",
                ),
            ],
                    justify="center"),
            dbc.Row([
                dbc.Col([
                    html.Div(
                        id='interactive_graph',
                        children=[],
                    ),
                ]),
            ]),
            dbc.Row([
                dbc.Col(
                    html.Div(html.A(
                        "Download the Data",
                        id="download-link",
                        download="covid_analytics_clinical_data.csv",
                        href=data_csv_string,
                        target="_blank"),
                             style={'textAlign': "center"})),
            ]),
        ],
        className="page-body",
    )

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 19
0
def Team():
    nav = Navbar()
    footer = Footer()

    # Load team members
    with open("assets/team_members/core_team.yml") as f:
        core_members = yaml.load(f, Loader=yaml.FullLoader)
    num_core_members = len(core_members)

    with open("assets/team_members/associated_team.yml") as f:
        associated_members = yaml.load(f, Loader=yaml.FullLoader)
    num_associated_members = len(associated_members)

    with open("assets/team_members/faculty.yml") as f:
        faculty = yaml.load(f, Loader=yaml.FullLoader)
    num_faculty = len(faculty)

    # Single member pic
    def member_pic(member):
        return dbc.Col([
            dbc.Card([
                dbc.CardImg(src='assets/team_members/photos/%s' %
                            member['photo']),
                dbc.CardBody(
                    html.A(member['name'],
                           href=member['website'],
                           className="stretched-link team-name"),
                    className="team-card-body",
                ),
            ],
                     className="team-card h-100 w-100")
        ],
                       xs=12,
                       sm=6,
                       md=3,
                       lg=3,
                       xl=2,
                       style={'marginBottom': 7})

    # Table rows
    core_member_rows = \
        [
            dbc.Row(
                [
                    member_pic(core_members[0])
                ],
                justify="around"
            )
        ] + \
        [
            dbc.Row(
                [
                    member_pic(core_members[i]) for i in range(1,num_core_members)
                ],
                justify="around",
            )
        ]

    faculty_rows = \
        [
            dbc.Row(
                [
                    member_pic(faculty[i]) for i in range(num_faculty)
                ],
                justify="around",
            )
        ]

    associated_member_rows = \
        [
            dbc.Row(
                [
                    member_pic(associated_members[i]) for i in range(num_associated_members)
                ],
                justify="around",
            )
        ]

    body = dbc.Container(
            [
                dbc.Row(
                    [
                        dbc.Col(
                        [
                            html.H2("Our Team"),
                            html.P('Our team comprises passionate researchers in Operations Research \
                            and Analytics. We are eager to use our collective skills and create new \
                            tools that can help the scientific community fight against the pandemic.'                                                                                                     )
                        ]
                        )
                    ],
                    style={'marginBottom': 20}
                )
            ] + \
            [dbc.Row([dbc.Col([html.H3("Core Team Members")])],style={'marginBottom': 20})] + \
            core_member_rows + \
            [dbc.Row([dbc.Col([html.H3("Collaborating Faculty")])],style={'marginBottom': 20,'marginTop': 40})] + \
            faculty_rows + \
            [dbc.Row([dbc.Col([html.H3("Associated Team Members")])],style={'marginBottom': 20,'marginTop': 40})] + \
            associated_member_rows,
            className="page-body"
        )

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 20
0
def ProjectState():
    nav = Navbar()
    footer = Footer()

    body = dbc.Container(
        [
           dbc.Row(
            [
                dbc.Col(
                [
                    html.H2("DELPHI Epidemiological Case Predictions"),
                    dcc.Markdown("""\
                            A critical tool for COVID-19 planning is charting out the progression \
                            of the pandemic across the United States and the world. \
                            We've developed a new epidemiological model called DELPHI, which \
                            forecasts infections, hospitalizations, and deaths. \
                            You can think of our model as a standard \
                            [SEIR model](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SEIR_model) \
                            with additional \
                            features specific to the COVID-19 pandemic, like under-detection and \
                            differentiated government intervention.
                           """),
                    dcc.Markdown('''If you want to learn more, check out the \
                                 [documentation](/projections_documentation) or \
                                 [source code](https://github.com/COVIDAnalytics/epidemic-model).'''),
                    dcc.Markdown('''**Note: The model has been updated on 7/4/2020 to better reflect the resurgence of \
                                 cases in various locations. The projections could differ significantly from previous results in certain areas.** '''),
                    dbc.Card(
                        [
                            dbc.CardBody(
                                [
                                html.H5("Note: what do we mean by \"active cases\"?"),
                                dcc.Markdown("We define a COVID-19 case as **active** \
                                             if it has not yet resulted in recovery \
                                             or death. You may notice a discrepancy \
                                             between the number of active cases here \
                                             and on the \
                                             [JHU map](https://coronavirus.jhu.edu/map.html). \
                                             The JHU map is very good at keeping track of new cases, \
                                             but does not always publish data on recovered cases, \
                                             which can lead to overestimating currently active \
                                             cases."),
                                dcc.Markdown("**Disclaimer:** Our total counts only account for \
                                             countries in which we have sufficient data and where \
                                             the pandemic is currently active. In particular, it \
                                             excludes some East Asian countries where the pandemic \
                                             has largely passed.\n \
                                             \nCountry-level projections are modelled based on all \
                                             historical data to increase the accuracy of future \
                                             predictions. As such, daily counts extracted from \
                                             the model may not exactly correspond with reports."),
                                ]
                            ),
                        ],
                        className='projections-general-card'
                    ),
                ]
                ),
            ],
            )
        ] + \
            get_top_visual() + \
            get_bottom_visual(),
       className="page-body"
    )

    layout = html.Div([nav, body, footer],className="site")
    return layout
Ejemplo n.º 21
0
def Collaborators():
    """Builds the AboutUs->Collaborators Page using assets/collaborators/organizations.yml"""

    with open("assets/collaborators/organizations.yml") as f:
        collaborators = yaml.load(f, Loader=yaml.FullLoader)

    def get_card(collab):
        return dbc.Col(
            style={"margin-bottom": "32px"},
            xs=12,
            sm=6,
            md=4,
            xl=4,
            children=dbc.Card(
                style={"borderColor": "#800020"},
                className="h-100 collab-card",
                children=[
                    dbc.CardHeader(html.H4(collab["name"]),
                                   style={"textAlign": "center"}),
                    dbc.CardImg(src='assets/collaborators/photos/%s' %
                                collab['photo'],
                                top=False,
                                style={
                                    "paddingLeft": "20px",
                                    "paddingRight": "20px",
                                    "paddingBottom": collab["padding"],
                                    "paddingTop": collab["padding"],
                                }),
                    dbc.CardFooter(
                        className="h-100",
                        children=[
                            html.A(collab["text"],
                                   href=collab["website"],
                                   className="stretched-link collab-name"),
                        ],
                    )
                ],
            ),
        )

    body = dbc.Container(
        className="page-body",
        children=[
            dbc.Row(
                style={'marginBottom': 20},
                children=[
                    dbc.Col([
                        html.H2("Our Collaborators"),
                        html.
                        P('Our models would not have been possible without the valuable data and insights \
                                provided by our partners. Our aspiration is to develop tools that they can positively \
                                affect the care they provide to their patients.'
                          )
                    ])
                ],
            ),
            dbc.Row([
                get_card(collaborators[i]) for i in range(len(collaborators))
            ]),
        ],
    )

    return html.Div([Navbar(), body, Footer()], className="site")
Ejemplo n.º 22
0
def Send(r, t):
    if r == 0:
        if os.path.exists("test.pdf"):
            t = "Report ready for distribution"
        else:
            t = "Please prepeare PDF file first"
    else:
        t = "Please download data first"

    nav = Navbar()

    header = html.H3(['{}'.format(t)],
                     style={
                         "color": "red",
                         "margin-top": "100px",
                         "margin-left": "100px"
                     })

    a = "*****@*****.**"
    b = "*****@*****.**"
    c = "*****@*****.**"
    d = "*****@*****.**"

    email_choice = html.Div([
        dcc.Dropdown(
            id='email-dropdown',
            options=[
                {
                    'label': 'Artur',
                    'value': a
                },
                {
                    'label': 'Zdzislaw',
                    'value': b
                },
                {
                    'label': 'Artur1',
                    'value': c
                },
                {
                    'label': 'Artur2',
                    'value': d
                },
            ],
            style={
                "width": "70%",
                "left": "100px"
            },
            multi=True,
        ),
        html.Br(),
        html.Br(),
        html.Div(id='email-container')
    ])

    sending = html.Div([
        dbc.Button(
            "Send report", id="send-button", className="btn btn-dark btn-lg"),
        html.Span(id="send-output",
                  style={
                      "vertical-align": "middle",
                      "margin-left": "50px"
                  }),
    ],
                       style={"margin-left": "100px"})

    layout = html.Div([
        nav, header,
        html.Br(),
        html.Br(), email_choice,
        html.Br(),
        html.Br(), sending
    ])
    return layout
Ejemplo n.º 23
0
def Homepage():
    """
    The following function is used in the main.py file to build the layout of the web application.

    It builds upon methods defined above or in alerts.py or navbar.py files to instantiate the various components.
    """

    # Body container
    body = dbc.Container(
        [
            # Markdown separator below the navigation bar
            dbc.Row(dcc.Markdown('---')),

            # Optional radio button to simulate alert events in debugging mode
            dbc.Row(dbc.Col(id='live_alert_header_btn')),

            # Main part of the page layout
            dbc.Row([
                # Left column containing the user selection area
                dbc.Col(build_user_selection_area(),
                        id='user_selection_column',
                        md=3),

                # Right column containing the map and various hidden components
                dbc.Col(
                    [
                        # Map object added here
                        html.Div(build_alerts_map(), id='hp_map'),

                        # Interval object triggering api calls every 10 seconds
                        dcc.Interval(
                            id='interval-component',
                            interval=10 * 1000,  # Timestep in milliseconds
                            n_intervals=0),

                        # Two placeholders updated by callbacks in main.py to trigger a change in map style
                        html.Div(
                            id='map_style_btn_switch_view'
                        ),  # Associated with the main map style button
                        html.Div(
                            id='alert_btn_switch_view'
                        ),  # Associated with the alert banner in risks mode

                        # Simple placeholder - Source of truth for the map style being viewed
                        html.Div(id='current_map_style', children='alerts'),

                        # Hidden html.Div storing the URL address of the detection frame of the latest alert
                        html.Div(id='img_url', style={'display': 'none'})
                    ],
                    md=9),
            ]),

            # Meteo graphs added here
            display_meteo_graphs(display=False)
        ],
        fluid=True,
    )

    # Instantiating navbar object from navbar.py
    layout = html.Div([Navbar(), body])

    return layout
Ejemplo n.º 24
0
def Dataset():
	nav = Navbar()
	footer = Footer()

	dataset = "data/clinical_outcomes_database.csv"
	demographics = ["Median Age", "% Male"]
	df = pd.read_csv(dataset)

	data_csv_string = df.to_csv(index=False, encoding='utf-8')
	data_csv_string = "data:text/csv;charset=utf-8," + urllib.parse.quote(data_csv_string)

	ref_data = "data/reference_ranges.csv"
	ref = pd.read_csv(ref_data)
	ref_data_csv_string = ref.to_csv(index=False, encoding='utf-8')
	ref_data_csv_string = "data:text/csv;charset=utf-8," + urllib.parse.quote(ref_data_csv_string)

	df = df.loc[:,get_data_cols()]
	df = df.head(50)

	table = dash_table.DataTable(
				id="data-table",
			    data=df.to_dict('records'),
			    columns=[{'id': c, 'name': c} for c in df.columns],
				style_data={
			        'whiteSpace': 'normal',
			        'height': 'auto',
			    },
				style_table={
					'overflowX': 'auto',
					'maxHeight': '400px',
					'overflowY': 'auto',
					'border': 'thin lightgrey solid',
				},
				style_cell={
			        'height': 'auto',
			        'minWidth': '0px',
					'width': '180px',
					'maxWidth': '180px',
			        'whiteSpace': 'normal',
					'textAlign': 'center',
					'font_size': '14px',
					'font-family': 'arial',
			    },
				style_data_conditional=[
			        {
			            'if': {'row_index': 'odd'},
			            'backgroundColor': 'rgb(248, 248, 248)'
			        }
			    ],
			    style_header={
			        'backgroundColor': 'rgb(230, 230, 230)',
			        'fontWeight': 'bold'
			    },
				fixed_rows={ 'headers': True, 'data': 0 },
			)

	body = dbc.Container([
		dbc.Row(
	        [
				dbc.Col([
	            	html.H2("Dataset"),
	                html.P('As policy makers and healthcare professionals tackle the COVID-19 pandemic, \
	                	a critical factor inhibiting effective decision making at regional, national, \
	                	and global levels is a lack of relevant data on patient outcomes. We hope to partially \
	                	alleviate this problem by sharing the following dataset, which aggregates data from over \
	                	160 published clinical studies and preprints released between December 2019 and April 2020.'),
					html.P('We would like to remind the reader that the raw data in this dataset should not \
					 be used to estimate trends in the general population such as mortality rates. \
					 Indeed, this dataset is largely derived from studies run in hospitals and nations\
					 affected with COVID-19 generally only admit seriously affected patients to \
					 hospitals. However, it should be possible to derive reasonably accurate estimates\
					 of these quantities by (a) accounting for the prevalence of asymptomatic \
					 patients, and (b) including only sufficiently representative studies. \
					 So far, the majority of the included studies are using patient data from China.\
					 We will keep on updating this resource as more research investigations from \
					 other countries are getting published.'),
					html.H5("Guidance for Use of the Dataset"),
					html.P('At a high level, each row of the dataset represents a cohort of patients.\
					 Some papers study a single cohort, while others study several cohorts, \
					 and still others report results about one cohort and one or more subcohorts;\
					 Each of these cohorts are included as rows in the dataset. \
					 The in-browser dataset is a subset of the recorded features and studies. For the full dataset, please \
					 download the data.'
					 ),
					dcc.Markdown('''Detailed information regarding the use of this resource is available [here](/dataset_documentation).'''),
					 ])
			 ]
		 ),
	    dbc.Row([
				dbc.Col(
					html.Div(
						html.A(
							"Download the Data",
							id="download-link",
							download="covid_analytics_clinical_data.csv",
							href=data_csv_string,
		        			target="_blank"						),
						style={'textAlign':"center"}
					)
				),
				dbc.Col(
					html.Div(
						html.A(
							"Download the Reference for Lab Values",
							id="download-reference-link",
							download="covid_analytics_reference_ranges.csv",
							href=ref_data_csv_string,
		        			target="_blank"						),
						style={'textAlign':"center"}
					)
				),
				]
		),
	  dbc.Row(
	           [
	              dbc.Col(
	                [
	                   dbc.Col([table,]) ,
	                ],
					width=12
	             ),
	            ],
	        ),

	],
	className="page-body"
	)
	layout = html.Div([nav, body, footer],className="site")
	return layout
Ejemplo n.º 25
0
def Press():
    with open("assets/press/important_press.yml") as f:
        key_article = yaml.load(f, Loader=yaml.FullLoader)
    num_key_articles = len(key_article)

    with open("assets/press/press.yml") as f:
        article = yaml.load(f, Loader=yaml.FullLoader)
    num_articles = len(article)

    nav = Navbar()
    footer = Footer()

    def build_card(a):
        card_content = \
                [
                    dbc.CardHeader(
                            [
                                html.H6(a['date'],className="press-date") if a['date'] != "ongoing" else None,
                                html.H5(a['title'],className="press-title"),
                                html.H5(a['source'],className="press-source"),
                            ],
                        ),
                    dbc.CardBody(
                        [   dcc.Markdown(a['text']),
                            html.A(
                                href=a['website'],
                                className="stretched-link"
                            ),
                        ],
                    )
                ]

        card = dbc.Card(card_content, className="press-card h-100")

        return dbc.Col(
            [card],
            style={"margin": "0.5rem"},
            xs=12,
            sm=12,
            md=12,
            lg=12,
        )
    articles = \
        [
            dbc.Row(
                [
                    build_card(key_article[i]) for i in range(num_key_articles)
                ],
                justify="around",
            ),
            dbc.Row(dbc.Col(html.Hr())),
            dbc.Row(
                [
                    build_card(article[i]) for i in range(num_articles)
                ],
                justify="around",
            )
        ]

    body = dbc.Container(
            [
                dbc.Row([dbc.Col([html.H2("COVID Analytics in the Press"),])])
            ] + \
            articles,
            className="page-body"
        )

    layout = html.Div([nav, body, footer], className="site")
    return layout
Ejemplo n.º 26
0
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go
from flask import Flask
import sys
sys.path.append('/opt/docker/pymodules')
import es_search
from navbar import Navbar
from dateselect import DateSelect

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
app.title = 'Daily Graph'
server = app.server

navbar = Navbar()
body = dbc.Container(
    [
        dbc.Row([
            dbc.Col(
                [
                    html.H2("Daily Graph"),
                    html.P("""\
The lifestyle is recorded.
Recordkeeping uses elasticsearch.
made with python and flask.
It is based on docker container."""),
                ],
                md=3,
            ),
            dbc.Col([DateSelect(),
Ejemplo n.º 27
0
                                    #change border to CLR_BCKGRND to remove tabs borders
                                ]),
                        ])
                ]),
        ],
    )


def Homepage(GLOBAL_DATA):
    return html.Div([Navbar(), home_layout(GLOBAL_DATA)])


############################################  DOCUMENTATION PAGE  #######################################################

doc_layout = html.Div([
    Navbar(),
    html.Br(),
    html.Br(),
    html.Br(),
    html.H1("NMAstudio (version 1.1)",
            style={
                'font-size': '20px',
                'color': 'white',
                'padding-left': '3%',
                'padding-right': '3%',
                'font-family': 'sans-serif'
            }),
    html.Br(),
    dcc.Markdown(
        'NMAstudio is a web application to produce and visualise interactive outputs from network meta-analyses',
        className="markdown_style"),
Ejemplo n.º 28
0
def Homepage():
    """
    The following function is used in the main.py file to build the layout of the web application.

    It builds upon methods defined above or in alerts.py or navbar.py files to instantiate the various components.
    """

    # Body container
    body = dbc.Container([

        # We add an HTML Div which displays the login background image as long as the user has not entered valid creden-
        # tials (so that he / she cannot see what lies behind on the platform before being connected)
        html.Center(
            html.Div(
                id='login_background',
                children=[
                    # The background image is directly stored in the /assets folder
                    html.Img(src='assets/background.png', width="100%", height="100%")
                ]
            )
        ),


        # Main part of the page layout
        dbc.Row(
            [
                # Left column containing the user selection area
                dbc.Col([
                    # At first, the map is hidden (until the user logs in with valid credentials)
                    html.Div(build_user_selection_area(), id='selection_area', style={'display': 'none'}),

                    html.Div(id="alert_overview_area"),

                    html.Div(id='new_alerts_selection_list', style={'display': 'none'}),
                    # Placeholder containing the detection data for any alert of interest
                    html.P(id="hp_alert_frame_metadata")],
                    id='user_selection_column',
                ),

                # Right column containing the map and various hidden components
                dbc.Col([
                    # Map object added here
                    html.Div(build_alerts_map(), id='hp_map', style={'display': 'none'}),

                    # Two placeholders updated by callbacks in main.py to trigger a change in map style
                    html.Div(id='map_style_btn_switch_view'),   # Associated with the main map style button
                    html.Div(id='alert_btn_switch_view'),   # Associated with the alert banner in risks mode

                    # Simple placeholder - Source of truth for the map style being viewed
                    html.Div(id='current_map_style', children='alerts', style={'display': 'none'}),

                    # Two placeholders updated by callbacks in main.py to change center and zoom attributes of the map
                    dcc.Store(id='login_zoom_and_center', data={}),
                    dcc.Store(id='alert_zoom_and_center', data={}),

                    # Placeholders for the three inputs that can affect the style attribute of the alert overview area
                    html.Div(id='alert_overview_style_zoom', style={'display': 'none'}),
                    html.Div(id='alert_overview_style_closing_buttons', style={'display': 'none'}),
                    html.Div(id='alert_overview_style_erase_buttons', style={'display': 'none'})

                ],
                    id='map_column',
                    md=12),
            ]
        ),

        # Login modal added here
        build_login_modal(),

        # HTML Div containing alert modals added here
        html.Div(id='alert_modals')
    ],
        fluid=True,
    )

    # Instantiating navbar object from navbar.py
    layout = html.Div([Navbar(), body])

    return layout
Ejemplo n.º 29
0
    marker_line_width=2))
fig_map_WD.update_layout(mapbox_style="carto-positron",
                         mapbox_zoom=2,
                         mapbox_center={
                             "lat": 46.372103,
                             "lon": 1.677944
                         })
fig_map_WD.update_layout(margin={"r": 0, "t": 0, "l": 0, "b": 0})

#del countries_geojson
#del dep_geojson

##################################
##################################

nav = Navbar()

header_FR = html.Div([
    dbc.Row(
        dbc.Col(
            html.H2('COVID-19 in France',
                    style={
                        'textAlign': 'center',
                        "background": "lightblue"
                    })))
])

map_FR = html.Div([
    dbc.Row(
        dbc.Col(
            dcc.Graph(id='map_france',
Ejemplo n.º 30
0
def Homepage(GLOBAL_DATA):
    return html.Div([Navbar(), home_layout(GLOBAL_DATA)])