Exemplo n.º 1
0
def show_results(
    parent_region,
    regions,
    columns,
    targets,
    days,
    scenario,
    disease=covid19,
    transpose=False,
):
    """
    Show results from user input.
    """

    parent_region = mundi.region(parent_region)
    parent_region.ui.cases_and_deaths(disease=disease, grid=True, logy=True)

    if days and targets and columns:
        info = scenario["info"]
        info_cols = tuple(info)
        df = get_dataframe(
            regions, tuple(days), tuple(targets), tuple(columns), info_cols=info_cols
        )
        get = {**COL_NAMES, **info}.get
        df.columns = pd.MultiIndex.from_tuples(
            [tuple(_(get(x, x) for x in t)) for t in df.columns.to_list()]
        )
        if transpose:
            df = df.T

        st.subheader(_("Download results"))
        st.dataframe_download(df, name="report-brazil.{ext}")
Exemplo n.º 2
0
    def show(self):
        """
        Show results from user input.
        """
        parent_region = self.user_inputs["parent_region"]
        regions = self.user_inputs["regions"]
        columns = self.user_inputs["columns"]
        targets = self.user_inputs["targets"]
        days = self.user_inputs["days"]
        scenario = self.user_inputs["scenario"]
        transpose = self.user_inputs["transpose"]
        disease = self.user_inputs["disease"]

        parent_region = mundi.region(parent_region)
        parent_region.ui.cases_and_deaths(disease=disease, grid=True, logy=True)

        if days and targets and columns:
            info = scenario["info"]
            info_cols = tuple(info)
            df = self.get_dataframe(
                regions, tuple(days), tuple(targets), tuple(columns), info_cols=info_cols
            )
            get = {**COL_NAMES, **info}.get
            df.columns = pd.MultiIndex.from_tuples(
                [tuple(_(get(x, x) for x in t)) for t in df.columns.to_list()]
            )
            if transpose:
                df = df.T

            st.subheader(_("Download results"))
            st.dataframe_download(df, name="report-brazil.{ext}")
Exemplo n.º 3
0
def show_results(parent_region, regions, columns, targets, days, disease=covid19):
    """
    Show results from user input.
    """

    parent_region = mundi.region(parent_region)
    ax = parent_region.plot.cases_and_deaths(disease=disease, logy=True, grid=True)
    st.pyplot(ax.get_figure())
    if days and targets and columns:
        df = get_dataframe(regions, tuple(days), tuple(targets), tuple(columns), 61)

        st.subheader(_("Download results"))
        st.dataframe_download(df, name="report-brazil.{ext}")
Exemplo n.º 4
0
    def show(self):

        parent_region = self.__datahandler.user_inputs["parent_region"]
        columns = self.__datahandler.user_inputs["columns"]
        targets = self.__datahandler.user_inputs["targets"]
        days = self.__datahandler.user_inputs["days"]
        disease = self.__datahandler.user_inputs["disease"]

        parent_region = mundi.region(parent_region)
        axes = parent_region.plot.cases_and_deaths(disease=disease, logy=True, grid=True)
        st.pyplot(axes.get_figure())
        if days and targets and columns:
            df = self.__datahandler.get_dataframe(tuple(days), tuple(targets), tuple(columns))

            st.subheader(_("Download results"))
            st.dataframe_download(df, name="report-brazil.{ext}")