def display_page(pathname):
    if pathname == '/':
        return main.layout
    elif pathname == '/test':
        return dummy.layout
    else:
        return dbc.Jumbotron([
            html.H1("404: Not found", className="text-danger"),
            html.Hr(),
            html.P(f"The pathname {pathname} was not recognized..."),
        ])
Ejemplo n.º 2
0
def render_page_content(pathname):
    if pathname == "/":
        return page_content_face
    elif pathname == "/face-verification":
        return page_content_face
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 3
0
def render_page_content(pathname):
    if pathname == home_page_location:
        return home.layout
    elif pathname == home1_page_location:
        return home1.layout
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 4
0
 def render_page_content(pathname):
     if pathname == url_base_pathname:
         return home_layout
     elif pathname == url_base_pathname + "voters":
         return voters_layout
     elif pathname != "/":
         # If the user tries to reach a different page, return a 404 message
         return dbc.Jumbotron([
             html.H1("404: Not found", className="text-danger"),
             html.Hr(),
             html.P(f"The pathname {pathname} was not recognised..."),
         ])
Ejemplo n.º 5
0
def render_page_content(pathname):
    if pathname in ['/', '/uk']:
        return layout_uk
    elif pathname == '/world':
        return layout_world
    elif pathname == '/map':
        return layout_map
    return dbc.Jumbotron([
        html.H1('404: Not found', className='text-danger'),
        html.Hr(),
        html.P(f'The pathname {pathname} was not recognised...')
    ])
Ejemplo n.º 6
0
def display_page(pathname):
    if pathname in ['/', '/dashboard']:
        return [NAVBAR, BODY]
    elif pathname == '/download':
        return [NAVBAR, DOWNLOAD]
    return dbc.Jumbotron(
        [
            html.H1('404: Not found', className='text-danger'),
            html.Hr(),
            html.P(f'The pathname {pathname} is invalid'),
        ]
    )
Ejemplo n.º 7
0
def render_page_content(pathname):
    if pathname in ["/", "/home"]:
        return home.layout
    elif pathname == "/apps/technical":
        return technical.layout
    elif pathname == "/apps/resources":
        return resources.layout
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 8
0
def get_page_desc(id):
    return [
        dbc.Row([
            dbc.Col([
                dbc.Jumbotron(id=id,
                              style={
                                  'paddingBottom': '0.5rem',
                                  'paddingTop': '0.8rem'
                              })
            ]),
        ], )
    ]
Ejemplo n.º 9
0
 def get_header():
     return dbc.Jumbotron([
         html.H1("Carbon Footprint", style={"textAlign": "center"}),
         html.P(
             "Measure Compute Emissions",
             style={
                 "textAlign": "center",
                 "paddingLeft": "0.5%"
             },
             className="lead",
         ),
     ])
Ejemplo n.º 10
0
def get_model_desc(id):
    """This is the big text card that has the technical details of the model"""
    return [
        dbc.Row(
            justify="center",
            children=dbc.Jumbotron(id=id,
                                   style={
                                       'paddingBottom': '0.5rem',
                                       'paddingTop': '0.8rem'
                                   }),
        ),
    ]
Ejemplo n.º 11
0
def by_flavfeels(general_dropdown, flavor_dropdown, medical_dropdown):
    body2 = html.Div([
        dbc.Row([
            dbc.Col([
                dbc.Jumbotron([
                    html.Div([
                        html.H4("Search By Flavors & Feelings"),
                        html.Br(),
                        html.H6("What feelings do you like?"),
                        dcc.Dropdown(
                            id="feelings_drop",
                            options=general_dropdown.to_dict(orient='records'),
                            value=None,
                            placeholder="Select Feelings",
                            multi=True),
                        html.Br(),
                        html.H6("What flavors do you like?"),
                        dcc.Dropdown(
                            id="flavors_drop",
                            options=flavor_dropdown.to_dict(orient='records'),
                            value=None,
                            placeholder="Select Flavors",
                            multi=True),
                        html.Br(),
                        html.H6(
                            "What medical conditions do you want to treat?"),
                        dcc.Dropdown(
                            id="medical_drop",
                            options=medical_dropdown.to_dict(orient='records'),
                            value=None,
                            placeholder="Select Medical Condition to Treat",
                            multi=True),
                        html.Br(),
                        dbc.Button(
                            "CannaRec Me!", id="letsgo2", color="primary")
                    ],
                             className="question-section")
                ],
                              className="logon container margin-up")
            ],
                    width={
                        'size': 4,
                        'offset': 1
                    }),
            dbc.Col([
                dcc.Loading([html.Div([], id="results2", className="results")])
            ],
                    width={'size': 6},
                    className="margin-up")
        ], )
    ],
                     id="by-flavfeel")
    return body2
Ejemplo n.º 12
0
    def render_page_content(pathname):
        if pathname in ["", "/", "/dash", "/dash/table"]:
            return table.layout
        elif pathname == "/dash/map":
            return map.layout

        # If the user tries to reach a different page, return a 404 message
        return dbc.Jumbotron([
            html.H1("404: Not found", className="text-danger"),
            html.Hr(),
            html.P(f"The pathname {pathname} was not recognised..."),
        ])
Ejemplo n.º 13
0
def render_page_content(pathname):
    if pathname == "/":
        return about
    elif pathname == "/dash":
        return main.dashboard
    elif pathname == "/prediction":
        return predict.predict
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 14
0
def get_model_desc(id):
    return [
                dbc.Row(
                [
                    dbc.Jumbotron(
                            id = id,
                            style={'paddingBottom':'0.5rem','paddingTop':'0.8rem'}
                    ),
                ],
                justify="center"
                ),
            ]
Ejemplo n.º 15
0
def display_page(pathname):
    if pathname == "/":
        return layout
    elif pathname == "/jira":
        return jira.layout
    elif pathname == "/github":
        return github.layout
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 16
0
def content_for_url(pathname):
    if pathname == '/' or pathname == "/home":
        return [
            dcc.Markdown('''
            This project is inspired and developed more from a subject, Data Analytics 3, 
            I studied in Lapland University of Applied Sciences, also my home university.

            The original project is to work with **M Language** and **DAX** in **Power BI** to get used to analyzing data, 
            but I want to make the dashboard more interesting and accessible by 
            redoing them as my personal project with Python Dash plotly framework.
            ''')
        ]
    if pathname == "/about":
        return [
            dcc.Markdown('''
        I used callback function in Plotly/Dash framework to create interactive graphs 
        and CSS and Bootstraps to design layout of the websites. I also used Clustering algorithm to
        group the countries based on the cultural difference index.
            
        ** How I calculate the cultural difference index:**

        1. Fill the missing cultural index by calculating the adjacent/neigbour countries to it.
        2. Calculate the difference by add up all the absolute of difference of each index in each country 
        and each index in your chosen country
        3. Apply Machine Learning clustering method (KMeans algorithm) to define the countries group having the smallest difference 
        from you chosen one.
            ''')
        ]
    if pathname == "/sources":
        return [
            dcc.Markdown('''
        ** Data Sources:**

        1. Six metrics to measure a culture of a country: https://geerthofstede.com/research-and-vsm/dimension-data-matrix/
            - Description: containing 6 metrics indicate the culture of a countries \[`pdi`, `idv`, `mas`, `uai`, `ltowvs`, `ivr`\]
        2. Country and its bordering countries: https://en.wikipedia.org/wiki/List_of_countries_and_territories_by_land_borders
            - Description: listing all the adjacent/neighbouring countries of a country.
            
        ** Document source:**

        1. Dash plotly official website/document: https://dash.plotly.com/
            - Description: I have all my neccessary information to build this project through this source.
        2. Bootstrap with dash plotly official website/document: https://dash-bootstrap-components.opensource.faculty.ai/docs/
            - Description: I learned about Bootstrap fundamental manipulation to layout the website.
            ''')
        ]

    return dbc.Jumbotron([
        html.H1("404: Not found"),
        html.Hr(),
        html.P("your url doesn't exist")
    ])
Ejemplo n.º 17
0
def display_page(pathname):
    if pathname == '/':
        return layout1
    elif pathname == '/app2':
        return layout2
    elif pathname == '/app3':
        return layout3
    else:
        return dbc.Jumbotron([
            html.H1("404: Not found", className="text-danger"),
            html.Hr(),
            html.H6(f"The pathname {pathname} was not recognised...")
        ])
Ejemplo n.º 18
0
def render_page_content(pathname):
    if pathname in ["/", "/cross-type"]:
        return cross_type
    elif pathname == "/cross-situ":
        return cross_situation
    elif pathname == "/search":
        return search
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 19
0
 def displayPageCallback(pathname):
     print('displayPageCallback() pathname:', pathname)
     if pathname == "/":
         return indexLayout
     elif pathname == '/uploadPage':
         return uploadpage.uploadPageLayout
     else:
         # If the user tries to reach a different page, return a 404 message
         return dbc.Jumbotron([
             html.H1("404: Not found", className="text-danger"),
             html.Hr(),
             html.P(f"The pathname {pathname} was not recognised..."),
         ])
Ejemplo n.º 20
0
def render_page_content(pathname):
    if pathname in ["/", "/page-1"]:
        return html.P("This is the content of page 1!")
    elif pathname == "/page-2":
        return html.P("This is the content of page 2. Yay!")
    elif pathname == "/page-3":
        return html.P("Oh cool, this is page 3!")
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 21
0
def get_page_desc(_id):
    """Builds the first big text card that introduces users to the page"""
    return [
        dbc.Row([
            dbc.Col([
                dbc.Jumbotron(id=_id,
                              style={
                                  'paddingBottom': '0.5rem',
                                  'paddingTop': '0.8rem'
                              })
            ]),
        ])
    ]
Ejemplo n.º 22
0
def render_page_content(pathname):
    if pathname == "/":
        return home_page
    elif pathname == "/page-1":
        return html.P("filler")
    elif pathname == "/page-2":
        return html.P("filler")
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 23
0
def render_page_content(pathname):
    if pathname == "/":
        return fighter_comparison.layout
    elif pathname == "/ranking":
        return all_time_ranking.layout
    elif pathname == "/page-2":
        return html.P("Oh cool, this is page 2!")
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 24
0
def render_page_content(pathname):
    if pathname in ["/", "/page-1"]:
        return html.Div(['Personal Studies of Dash App'])
    elif pathname == "/page-2":
        return stockapp.layout
    elif pathname == "/page-3":
        return want_a_gear.layout
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 25
0
def render_page_content(pathname):
    if pathname == '/':
        return dbc.Jumbotron([
            html.H1("Welcome!"),
            html.Hr(),
            html.P("Select a tab..."),
        ])
    elif pathname == '/map':
        return map_content()
    elif pathname == '/schematics':
        return render_schematics_content()
    elif pathname == "/development":
        return development_content('development')
    elif pathname == "/gauges":
        return gauges_content()
    elif pathname == '/scenarios':
        return development_content('scenarios')
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
def render_page_content(pathname):
    if pathname == "/":
        return html.P("This is the home page!")
    elif pathname == "/calendar":
        return html.P("This is your calendar... not much in the diary...")
    elif pathname == "/messages":
        return html.P("Here are all your messages")
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 27
0
def render_page_content(pathname):
    if pathname in ["/", "/about"]:
        return about.layout
    elif pathname == "/daily-dashboard":
        return daily_dashboard.layout
    elif pathname == "/animations":
        return animations.layout
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 28
0
def render_page_content(pathname):
    if pathname in ["/", f"{requests_prefix}", f"{requests_prefix}metrics"]:
        return metrics.layout
    elif pathname == f"{requests_prefix}user-trends":
        return user_trends.layout
    elif pathname == f"{requests_prefix}reports":
        return reports.layout
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 29
0
def render_page_content(pathname):
    if pathname in ["/", "/home"]:
        return home.content
    elif pathname == "/project":
        return project.content
    elif pathname == "/team":
        return team.content
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron([
        html.H1("404: Not found", className="text-danger"),
        html.Hr(),
        html.P(f"The pathname {pathname} was not recognised..."),
    ])
Ejemplo n.º 30
0
def render_page_content(pathname):
    if pathname in ["/"]:
        return [assignments_page]
    elif pathname[1:] in page_names:
        return [page_names[pathname[1:]]]
    # If the user tries to reach a different page, return a 404 message
    return dbc.Jumbotron(
        [
            html.H1("404: Not found", className="text-danger"),
            html.Hr(),
            html.P(f"The pathname {pathname} was not recognised..."),
        ]
    )