Exemplo n.º 1
0
class DatasetIntegrityView(View):
    TITLE = "Dataset Integrity Overview"
    N_COLUMNS = 3
    N_ROWS = 2

    def __init__(self, parent, controller):
        super().__init__(parent, controller)
        self.state_bar = StateBar(self, controller.status)
        self.table = Table(self, controller.overview)
        self.update_button = tk.Button(self,
                                       text="Check for update",
                                       command=Callback(
                                           self.controller.update_app))
        self.layout()

    def layout(self):
        self.navigation.grid(row=0,
                             column=0,
                             columnspan=self.N_COLUMNS,
                             sticky="we")
        self.title.grid(row=1, column=0)
        self.state_bar.grid(row=1, column=1)
        self.update_button.grid(row=1, column=2)
        self.table.grid(row=2,
                        column=0,
                        columnspan=self.N_COLUMNS,
                        pady=(25, ))
        self.make_flexible(n_rows=self.N_ROWS, n_cols=self.N_COLUMNS)
        self.grid(row=0, column=0, sticky="nsew")

    def update(self):
        self.state_bar.update(self.controller.status)
        self.table.update(self.controller.overview)
def exposure_summary_page(exposure):
    page = html.Div([
        Header(),
        html.Div([
            HalfRowCard("TIV by State",
                        Table(exposure.tiv_by_state(), display_header=True)),
            HalfRowCard("TIV by State",
                        TIVBarGraph(exposure.tiv_by_state(), "State"))
        ],
                 className="row "),
        html.Div([
            HalfRowCard(
                "TIV by Occupancy",
                Table(exposure.tiv_by_occupancy(), display_header=True)),
            HalfRowCard("TIV by Occupancy",
                        TIVBarGraph(exposure.tiv_by_occupancy(), "Occupancy"))
        ],
                 className="row "),
        html.Div([
            HalfRowCard(
                "TIV by State",
                Table(exposure.tiv_by_construction(), display_header=True)),
            HalfRowCard(
                "TIV by State",
                TIVBarGraph(exposure.tiv_by_construction(), "Construction"))
        ],
                 className="row "),
    ],
                    className="container")
    return page
Exemplo n.º 3
0
 def __init__(self, parent, controller):
     super().__init__(parent, controller)
     self.state_bar = StateBar(self, controller.status)
     self.table = Table(self, controller.overview)
     self.update_button = tk.Button(self,
                                    text="Check for update",
                                    command=Callback(
                                        self.controller.update_app))
     self.layout()
Exemplo n.º 4
0
def overview_page(summary, company_facts, key_losses):

    page = html.Div([
        Header(),
        html.Div([
            HalfRowCard("Summary", TextArea(summary, "summary")),
            HalfRowCard("Key Info", Table(company_facts))
        ],
                 className="row"),
        html.Div([
            FullRowCard("Key Losses", Table(key_losses, display_header=True))
        ],
                 className="row")
    ],
                    className="container")

    return page
Exemplo n.º 5
0
def ep_curve_page(ep_curves):
    page = html.Div([
        Header(),
        
        html.Div([
            HalfRowCard("EP all peril", Table(ep_curves.get_ep_curves(['netprecat'], ['ALL'], ['AEP', 'OEP']), display_header=True)),
            HalfRowCard("EP all peril", EPGraph(ep_curves.get_ep_curves(['netprecat'], ['ALL'], ['AEP', 'OEP'])))
        ], className="row "),

        html.Div([
            HalfRowCard("EP Windstorm", Table(ep_curves.get_ep_curves(['netprecat'], ['Windstorm'], ['AEP', 'OEP']), display_header=True)),
            HalfRowCard("EP Windstorm", EPGraph(ep_curves.get_ep_curves(['netprecat'], ['Windstorm'], ['AEP', 'OEP'])))
        ], className="row "),

        html.Div([
            HalfRowCard("EP Earthquake", Table(ep_curves.get_ep_curves(['netprecat'], ['Earthquake'], ['AEP', 'OEP']), display_header=True)),
            HalfRowCard("EP Earthquake", EPGraph(ep_curves.get_ep_curves(['netprecat'], ['Earthquake'], ['AEP', 'OEP'])))
        ], className="row "),

        ], className="container")
    return page
Exemplo n.º 6
0
    def add_data_table(self, identifier, dataframe, name, plot_options=None):
        """add a datatable to the root-level section

        Args:
            identifier (str): MP category ID (`mp_cat_id`)
            dataframe (pandas.DataFrame): tabular data as Pandas DataFrame
            name (str): table name, optional if only one table in section
            plot_options (dict): options for according plotly graph
        """
        # TODO: optional table name, required if multiple tables per root-level section
        table_start = mp_level01_titles[1] + '_'
        if not name.startswith(table_start):
            name = table_start + name
        name = ''.join([replacements.get(c, c) for c in name])
        self.document.rec_update(
            nest_dict(Table(dataframe).to_dict(), [identifier, name]))
        self.document[identifier].insert_default_plot_options(
            dataframe, name, update_plot_options=plot_options)
Exemplo n.º 7
0
from utils import Data
from constants import peak_values_and_dates, slope_changes_and_dates, insights
from components import DatePickerRange, Table, BarPlot, BoxPlot, InteractivePlot

import dash_html_components as html
from dash.dependencies import Input, Output
from datetime import datetime

## Data Loading
data = Data()
prepared_data = data.retrieve_prepared_data()
splitted_data = data.retrieve_splitted_date_data()

# Importing components
date_picker_range = DatePickerRange()
table = Table()
bar_plot = BarPlot()
box_plot = BoxPlot()
interactive_plot = InteractivePlot()

## App Layout
app.layout = html.Div(
    [
        html.H1('Data Report',
                style={
                    'textAlign': 'center',
                    'background': '7f44f8',
                    'color': 'white'
                }),
        html.Div([
            'Date selector for the interactive graphic',
Exemplo n.º 8
0
    open('./assets/data_remaining_persons.pkl', 'rb'))
remaining_places = pickle.load(open('./assets/data_remaining_places.pkl',
                                    'rb'))
cos_sim_matrix = pd.read_pickle("./assets/data_cosine_similarity_matrix.pkl")

overview = html.Div(
    id="body1",
    children=[
        Header("overview"),
        html.Div(id="ColumnBlockOverview",
                 children=[
                     Scatter(overview_tsne),
                     BarOverview(overview_persons),
                     html.Div(id="tableHeadline",
                              children=[html.H4(["Collection of Books"])]),
                     Table(author_data[["Title", "Author",
                                        "Publishing Date"]]),
                 ]),
        html.Div(id="MapBlock", children=[Map(overview_places)])
    ])

book = html.Div(
    id="body1",
    children=[
        Header("book"),
        Dropdown("book", list(specific_entities.keys())),
        html.Div(id="ColumnBlockBook",
                 children=[
                     Author(),
                     html.Div(
                         id="specTitBox",
                         children=[html.H1(id="specificTitle", children=[])]),