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"),
     ]
Exemple #2
0
def create_pore_table(frame_dic):
    pore_ls = []
    name_ls = []
    for image in frame_dic["image_data_ls"]:
        if (image != "EMPTY_IMAGE_LS"):
            pore_ls.append(image["pores"])
            name_ls.append(image["img_name"])
    table_header = [
        html.Thead(html.Tr([
            html.Th("Image Name"),
            html.Th("Porosity"),
        ]))
    ]
    rows = []
    if (len(pore_ls) == 0):
        return []
    i = 0
    while i < len(pore_ls):
        row = html.Tr([
            html.Td(name_ls[i]),
            html.Td(pore_ls[i]),
        ])
        rows.append(row)
        i = i + 1

    table_body = [html.Tbody(rows)]
    table = Table(table_header + table_body,
                  bordered=True,
                  dark=True,
                  striped=True)
    return table
Exemple #3
0
def create_area_table(frame_dic):
    area_ls = sort_areas(frame_dic)
    table_header = [
        html.Thead(
            html.Tr([
                html.Th("Pore Size"),
                html.Th("Image Name"),
                html.Th("(x,y)"),
                html.Th("Diameter of Largest Circle"),
                html.Th("center")
            ]))
    ]
    rows = []
    print(type(area_ls), "area_ls")
    #print(area_ls)
    if (len(area_ls) == 0):
        return []
    for area in area_ls:
        px_str = ' (' + str(area[5]) + 'pixels' + ')'
        row = html.Tr([
            html.Td(int(area[1])),
            html.Td(area[0]),
            html.Td("(" + str(area[2]) + "," + str(area[3]) + ")"),
            html.Td(str(area[5] * float(frame_dic["scale"])) + px_str),
            html.Td(str(area[4]))
            #html.Td(area[4]),
            #html.Td(area[5])
        ])
        rows.append(row)

    table_body = [html.Tbody(rows)]
    table = Table(table_header + table_body,
                  bordered=True,
                  dark=True,
                  striped=True)
    return table
Exemple #4
0
    def callback(self, *args, **kwargs) -> List[Any]:
        """Renders the parameter dependent plots and tables
        """
        pars = kwargs["pars"]

        if kwargs["show_additional_projections"]:
            title = self.content["infected-v-revovered-title"]

            time_evolution = self._build_frame(**kwargs)

            time_evolution_data = plot_dataframe(
                time_evolution.drop(columns=self.content["susceptible"]),
                max_y_axis=pars.max_y_axis,
            )

            children = [
                H4(title, id="infected-v-revovered-title"),
                Graph(figure=time_evolution_data,
                      id="infected-v-revovered-graph"),
            ]

            if kwargs["show_tables"]:
                if kwargs["as_date"]:
                    time_evolution.index = time_evolution.index.strftime(
                        "%b, %d")
                time_evolution_table_data = (df_to_html_table(
                    time_evolution, data_only=True, n_mod=7)
                                             if kwargs["show_tables"] else {})
                children.append(
                    Table(time_evolution_table_data,
                          id="infected-v-revovered-table"))

        else:
            children = []

        return [children]
 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"
                     ),
                 ),
             ),
         ])
     ]
 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"),
                 ],
             ),
         ),
     ]