def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     return [
         H2(self.content["new-admissions-title"]),
         Markdown(self.content["new-admissions-text"]),
         Graph(id="new-admissions-graph"),
         Table(id="new-admissions-table"),
         H2(self.content["admitted-patients-title"]),
         Markdown(self.content["admitted-patients-text"]),
         Graph(id="admitted-patients-graph"),
         Table(id="admitted-patients-table"),
     ]
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     return [Div(
         id="more_intro_wrapper",
         children=[Markdown(id="more_intro", dangerously_allow_html=True)]
     )]
Beispiel #3
0
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     content = self.content
     return [
         Div(children=[
             H1(className="penn-medicine-header__title",
                id="title",
                children=content["title"]),
             Markdown(content["description"])
         ])
     ]
Beispiel #4
0
def load_app(app):
    """
    Callback loading given app into the appropriate :class:`Div` class
    instance.

    Parameters
    ----------
    app : unicode
        App path.

    Returns
    -------
    Div
        :class:`Div` class instance of the app layout.
    """

    if app == app_1.APP_PATH:
        return app_1.LAYOUT
    elif app == app_2.APP_PATH:
        return app_2.LAYOUT
    else:
        return Div([
            P([
                'Various colour science ',
                A('Dash', href='https://dash.plot.ly/', target='_blank'),
                ' apps built on top of \n',
                A('Colour',
                  href='https://github.com/colour-science/colour',
                  target='_blank'), '.'
            ]),
            H3([
                Link(app_1.APP_NAME, href=app_1.APP_PATH, className='app-link')
            ]),
            Markdown(app_1.APP_DESCRIPTION.replace('This app c', 'C')),
            H3([
                Link(app_2.APP_NAME, href=app_2.APP_PATH, className='app-link')
            ]),
            Markdown(app_2.APP_DESCRIPTION.replace('This app c', 'C')),
        ])
Beispiel #5
0
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     return [Markdown(self.content)]
Beispiel #6
0
 def get_html(self) -> List[ComponentMeta]:  # pylint: disable=W0613
     """Initializes the header dash html
     """
     return [Markdown(id="intro", dangerously_allow_html=True, dedent=True)]
from dash_core_components import Markdown

# This file is where the markdown for the text in the dashboard is stored.

first_row_md = Markdown("""  
###### Introduction:
This project attempts to track sentiment (polarity and subjectivity) on Twitter from the top 20 cities in America and easily view the results and compare it to the spread of COVID-19 in those cities.

###### Instructions:

- Drag one end of the week range slider to change the week(s) shown in the data.
    - When the two ends are on top of eachother, such as when no changes have been made, click on a selected week to show the two ends of the slider.
    - When the selected week(s) change, the vertical lines in the total cases graph they show the start and end of the selected weeks.
- Hover over different cities in the map to change the displayed data to be about the selected city.
    - When hovering over a city, a pop-up will appear that shows information such as average polarity and subjectivty in that city in the given time frame.

""")

second_row_md = Markdown("""
###### Definitions:
- Polarity how positive or negative an individual Tweet is. The greater the polarity, the more positive the tweet and the lesser the polarity, the more negative a tweet.
- Subjectivity is how objective an individual Tweet is. The closer the subjectivity score is to 0, the more objective a tweet and the closer the subjectivity score is to 1, the more subjective it is.

###### Notes:
- This website was designed to be displayed on a fullsize 11+ inch screen and will likely not work on smaller screens.
- The website might be a bit slow as it dynamically process most of the its data.
  
  
Source code, citations, and a list of bugs can be found at this [github repository](https://github.com/Quadr0/COVID_Twitter_Sentiment).
""")
Beispiel #8
0
             [ Div(f'{label}:', className='control-header',), ] + \
             [ Div(c, className='sub-control') for c in (control if isinstance(control, list) else [control]) ],
             className='control',
         )
         for label, control in controls.items()
     ],
     className='no-gutters',
 ),
 Row(
     [
         Col([
             Div(
                 [
                     H2('About'),
                     Div([
                         Markdown(f'Use the controls above to filter the plot by region, user type, gender, or date, group/stack by user type or gender, and toggle aggregation of rides or total ride minutes.'),
                         Markdown(f'This plot should refresh when [new data is published by Citibike](https://www.citibikenyc.com/system-data) (typically around the 2nd week of each month, covering the previous month).'),
                         Markdown(f'[The GitHub repo](https://github.com/neighbor-ryan/ctbk.dev) has more info as well as [planned enhancements](https://github.com/neighbor-ryan/ctbk.dev/issues).'),
                     ]),
                     H3('🚧 Known data-quality issues 🚧', id="qc"),
                     Markdown('Several things changed in February 2021 (presumably when some backend systems were converted as part of [the Lyft acquistion](https://www.lyft.com/blog/posts/lyft-becomes-americas-largest-bikeshare-service)):'),
                     Markdown('''
                         - "Gender" information is no longer provided (all rides are labeled "unknown" starting February 2021)
                         - A new "Rideable Type" field was added, containing values `docked_bike` and `electric_bike` 🎉; however, it is mostly incorrect at present, and disabled here:
                           - Prior to February 2021, the field is absent (even though e-citibikes were in widespread use before then)
                           - Since February 2021, only a tiny number of rides are labeled `electric_bike` (122 in April 2021, 148 in May, 113 in June). This is certainly not accurate!
                             - One possibile explanation: [electric citibikes were launched in Jersey City and Hoboken around April 2021](https://www.hobokengirl.com/hoboken-jersey-city-citi-bike-share-program/); perhaps those bikes were part of a new fleet that show up as `electric_bike` in the data (where previous e-citibikes didn't).
                             - These `electric_bike` rides showed up in the default ("NYC") data, not the "JC" data, but it could be all in flux; February through April 2021 were also updated when the May 2021 data release happened in early June.                          
                         - The "User Type" values changed ("Subscriber" → "member", "Customer" → "casual"); I'm using the former/old values here, they seem equivalent.
                     '''),
                     Div([
Beispiel #9
0
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     today = date.today().strftime(self.content["date-format"])
     return [
         Container(
             className="mt-5",
             children=[
                 H2(self.content["new-admissions-title"]),
                 Markdown(self.content["new-admissions-text"]),
             ]
         ),
         Container(fluid=True, children=Graph(id="new_admissions_graph")),
         Container([
             A(
                 self.content["download-text"],
                 id="new_admissions_download",
                 download="admissions_{}.csv".format(today),
                 href="",
                 target="_blank",
                 className="btn btn-sm btn-info",
             ),
             Div(
                 children=Button(
                     "Lock Zoom", 
                     id="new_admissions_lock_zoom", 
                     color="info", 
                     outline=False,
                     className="btn btn-sm"
                     ),
                 style={"display": "inline-block", "padding": 10}
             ),
             Div(
                 className="row justify-content-center",
                 children=Div(
                     id="new_admissions_table_container",
                     className="col-auto",
                     children=Table(
                         id="new_admissions_table",
                         className="table-responsive mx-auto"
                     ),
                 ),
             ),
         ]),
         Container(
             className="mt-5",
             children=[
                 H2(self.content["admitted-patients-title"]),
                 Markdown(self.content["admitted-patients-text"]),
             ],
         ),
         Container(fluid=True, children=Graph(id="admitted_patients_graph")),
         Container([
             A(
                 self.content["download-text"],
                 id="admitted_patients_download",
                 download="census_{}.csv".format(today),
                 href="",
                 target="_blank",
                 className="btn btn-sm btn-info",
             ),
             Div(
                 children=Button(
                     "Lock Zoom", 
                     id="admitted_patients_lock_zoom", 
                     color="info", 
                     outline=False, 
                     className="btn btn-sm"
                     ),
                 style={"display": "inline-block", "padding": 10}
             ),
             Div(
                 className="row justify-content-center",
                 children=Div(
                     id="admitted_patients_table_container",
                     className="col-auto",
                     children=Table(
                         id="admitted_patients_table",
                         className="table-responsive"
                     ),
                 ),
             ),
         ]),
         Container(
             className="mt-5",
             children=[
                 H2(self.content["SIR-title"]),
                 Markdown(self.content["SIR-text"]),
             ],
         ),
         Container(fluid=True, children=Graph(id="SIR_graph")),
         Container([
             A(
                 self.content["download-text"],
                 id="SIR_download",
                 download="SIR_{}.csv".format(today),
                 href="",
                 target="_blank",
                 className="btn btn-sm btn-info my-4",
             ),
             Div(
                 children=Button(
                     "Lock Zoom", 
                     id="SIR_lock_zoom", 
                     color="info", 
                     outline=False, 
                     className="btn btn-sm"
                     ),
                 style={"display": "inline-block", "padding": 10}
             ),
             Div(
                 className="row justify-content-center",
                 children=Div(
                     id="SIR_table_container",
                     className="col-auto",
                     children=Table(
                         id="SIR_table",
                         className="table-responsive"
                     ),
                 ),
             ),
         ])
     ]
Beispiel #10
0
def latest_updates(language: str) -> List[ComponentMeta]:
    """Initializes the header dash html
    """
    content = read_localization_markdown(LOCALIZATION_FILE_2, language)

    return [Markdown(content)]
Beispiel #11
0
def introducing_chime(language: str) -> List[ComponentMeta]:
    """Initializes the header dash html
    """
    content = read_localization_markdown(LOCALIZATION_FILE_1, language)

    return [Markdown(content)]
Beispiel #12
0
App description.

APP_DESCRIPTION : unicode
"""

APP_UID = hash(APP_NAME)
"""
App unique id.

APP_UID : unicode
"""

LAYOUT = Div([
    H3([Link(APP_NAME, href=APP_PATH)], className='text-center'),
    Div([
        Markdown(APP_DESCRIPTION),
        H5(children='Colourspace'),
        Dropdown(id='colourspace-{0}'.format(APP_UID),
                 options=RGB_COLOURSPACES_OPTIONS,
                 value=RGB_COLOURSPACES_OPTIONS[0]['value'],
                 clearable=False,
                 className='app-widget'),
        H5(children='Illuminant'),
        Dropdown(id='illuminant-{0}'.format(APP_UID),
                 options=ILLUMINANTS_OPTIONS,
                 value=ILLUMINANTS_OPTIONS[0]['value'],
                 clearable=False,
                 className='app-widget'),
        H5(children='Chromatic Adaptation Transform'),
        Dropdown(id='chromatic-adaptation-transform-{0}'.format(APP_UID),
                 options=CHROMATIC_ADAPTATION_TRANSFORM_OPTIONS,
     ),
     className="header",
 ),
 Div(
     Details(
         [
             Summary(
                 "What is this about?",
                 style={
                     "color": "white",
                     "backgroundColor": "#1DD3A7",
                     "paddingLeft": "2%",
                     "fontSize": "12px",
                 },
             ),
             Div(Markdown(INTRO_MARKDOWN), style={"margin": "2%"})
         ]
     ),
 ),
 Div(  # body
     Div(
         children=[
             Div(  # left hand side (input)
                 children=[
                     Div(
                         "Compare two scenarios by changing the parameters below",
                         style={"padding-left": 20},
                         className="big-text",
                     ),
                     Div("Scenario 1", className="scenario-name"),
                     scenario_input_card("scen1"),
Beispiel #14
0
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     content = self.content
     return [Div(children=[Markdown(content["description"])])]
 def get_html(self) -> List[ComponentMeta]:
     """Initializes the header dash html
     """
     today = date.today().strftime(self.content["date-format"])
     return [
         H2(self.content["new-admissions-title"]),
         Markdown(self.content["new-admissions-text"]),
         Graph(id="new_admissions_graph"),
         A(
             self.content["download-text"],
             id="new_admissions_download",
             download="admissions_{}.csv".format(today),
             href="",
             target="_blank",
             className="btn btn-sm btn-info my-2",
         ),
         Div(
             className="row justify-content-center",
             children=Div(
                 id="new_admissions_table_container",
                 className="col-auto",
                 children=[
                     Table(id="new_admissions_table",
                           className="table-responsive"),
                 ],
             ),
         ),
         H2(self.content["admitted-patients-title"]),
         Markdown(self.content["admitted-patients-text"]),
         Graph(id="admitted_patients_graph"),
         A(
             self.content["download-text"],
             id="admitted_patients_download",
             download="census_{}.csv".format(today),
             href="",
             target="_blank",
             className="btn btn-sm btn-info my-4",
         ),
         Div(
             className="row justify-content-center",
             children=Div(
                 id="admitted_patients_table_container",
                 className="col-auto",
                 children=[
                     Table(id="admitted_patients_table",
                           className="table-responsive"),
                 ],
             ),
         ),
         H2(self.content["SIR-title"]),
         Markdown(self.content["SIR-text"]),
         Graph(id="SIR_graph"),
         A(
             self.content["download-text"],
             id="SIR_download",
             download="SIR_{}.csv".format(today),
             href="",
             target="_blank",
             className="btn btn-sm btn-info my-4",
         ),
         Div(
             className="row justify-content-center",
             children=Div(
                 id="SIR_table_container",
                 className="col-auto",
                 children=[
                     Table(id="SIR_table", className="table-responsive"),
                 ],
             ),
         ),
     ]