コード例 #1
0
    def __init__(self, sponsor_name, package_yaml, sponsor_yaml):
        yaml_packages = report_generatoryaml.read_yaml(package_yaml)
        yaml_sponsors = report_generatoryaml.read_yaml(sponsor_yaml)
        self.yaml_sponsors = yaml_sponsors

        self.name = sponsor_name
        self.package_name = yaml_sponsors[sponsor_name]["package"]

        self.content = yaml_sponsors[self.name]
        self.package_content_flag = yaml_packages[self.package_name]
        self.package_content_generic_flag = yaml_packages["generic"]
def main(csv, interactive, cjk_support, conf, yaml, package_yaml, sponsor_yaml,
         output_path):
    conf_singlet = report_generatorconfig.Configuration.get_instance()
    conf_singlet.read_configuration(template)
    if conf:
        logger.debug("User customized conf is specified: %s" % conf_singlet)
        conf_singlet.read_configuration(conf)

    # welcome user, ask year of data
    year = vtext.welcome_ask_year(interactive)

    frames = []
    for csv_single in csv:
        csv_index = csv.index(csv_single)

        df = report_generatorcsv.csv_to_dataframe(csv_single)

        # select necessary columns from df
        df = vtext.select_column(df, interactive, csv_index)

        frames.append(df)

    df_all = pd.concat(frames, join="outer", axis=0, ignore_index=True)

    # all raw data is imported. let's call analyzer to do something
    df_all = ag.add_cat_title(df_all)
    df_all = df_all.fillna(value="No Record")
    df_all = ag.get_sanity_data(df_all, cjk_support)

    # all datafram general data object
    df_all_g_data_obj = attendee.Attendee(df_all)

    # analyzed data frame is ready. let's plot
    figs = plotter.plot_counts(df_all, year, cjk_support)

    # read the other report data
    report_yaml = report_generatoryaml.read_yaml(yaml)

    sponsors = apsponsor.get_all_sponsors(package_yaml, sponsor_yaml)

    # generate the report
    # general info (everyone could see it):
    #   figs: plots from attendee dataframe
    #   df_all_g_data_obj: numbers from attendee dataframe
    #   report_yaml: plot description of figs
    # sponsors:
    #   sponsor specific information based on yaml descriptor
    exporter_html.generate(figs, report_yaml, df_all_g_data_obj, sponsors,
                           output_path)

    print("Analysis process finished completely.")
コード例 #3
0
def get_all_sponsors(package_yaml, sponsor_yaml):
    yaml_sponsors = report_generatoryaml.read_yaml(sponsor_yaml)

    sponsors = []
    for entry in yaml_sponsors:
        sponsor = Sponsor(entry, package_yaml, sponsor_yaml)
        # TODO: to port these debug information to be a part of test scripts
        # description = sponsor.description
        #
        # flag_promotion = sponsor.if_one_true_promotion
        #
        # flag_web = sponsor.if_one_true_web
        # web_click = sponsor.web_click
        # web_click_rank = sponsor.web_click_rank
        #
        # flag_facebook = sponsor.if_one_true_facebook
        # flag_facebook_reach = sponsor.flag_facebook_reach
        # facebook_reach = sponsor.facebook_reach
        # flag_facebook_reach_rank = sponsor.flag_facebook_reach_rank
        # facebook_reach_rank = sponsor.facebook_reach_rank
        #
        # flag_facebook_engagement = sponsor.flag_facebook_engagement
        # facebook_engagement = sponsor.facebook_engagement
        # flag_facebook_engagement_rank = sponsor.flag_facebook_engagement_rank
        # facebook_engagement_rank = sponsor.facebook_engagement_rank
        #
        # flag_booth = sponsor.if_one_true_booth
        # flag_booth_participant = sponsor.flag_booth_participant
        # booth_participant = sponsor.boot_participant
        # # flag_booth_participant_rank = sponsor.flag_booth_participant_rank
        # # booth_participant_rank = sponsor.booth_participant_rank
        #
        # flag_workshop = sponsor.if_one_true_workshop
        # workshop_pictures = sponsor.flag_workshop_pictures
        # workshop_description = sponsor.workshop_description
        # workshop_event_url = sponsor.workshop_event_url
        # pass

        sponsors.append(sponsor)

    return sponsors
コード例 #4
0
def main(
    csv,
    talks_csv,
    proposed_talks_csv,
    booth_csv,
    interactive,
    cjk_support,
    conf,
    yaml,
    package_yaml,
    sponsor_yaml,
    output_path,
):
    conf_singlet = report_generatorconfig.Configuration.get_instance()
    conf_singlet.read_configuration(template)
    if conf:
        logger.debug("User customized conf is specified: %s" % conf_singlet)
        conf_singlet.read_configuration(conf)

    # welcome user, ask year of data
    year = vtext.welcome_ask_year(interactive)

    frames = []
    for csv_single in csv:
        csv_index = csv.index(csv_single)

        df = report_generatorcsv.csv_to_dataframe(csv_single)

        # select necessary columns from df
        df = vtext.select_column(df, interactive, csv_index)

        frames.append(df)

    df_all = pd.concat(frames, join="outer", axis=0, ignore_index=True)

    # all raw data is imported. let's call analyzer to do something
    df_all = ag.add_cat_title(df_all)
    df_all = df_all.fillna(value="No Record")
    df_all = ag.get_sanity_data(df_all, cjk_support)

    # all datafram general data object
    df_all_g_data_obj = attendee.Attendee(df_all)

    # analyzed data frame is ready. let's plot attendee data
    figs = plotter.plot_attendee_counts(df_all, year, cjk_support)

    # prepared the selected topic pie chart
    talks_df = report_generatorcsv.csv_to_dataframe(talks_csv)
    talks_fig = plotter.plot_talk_categories(talks_df)
    figs.update(talks_fig)

    # prepared the proposed topic pie chart
    p_talks_df = report_generatorcsv.csv_to_dataframe(proposed_talks_csv)
    p_talks_fig = plotter.plot_talk_categories(p_talks_df,
                                               fig_title="Proposed_Topics")
    figs.update(p_talks_fig)

    booth_df = report_generatorcsv.csv_to_dataframe(booth_csv)
    # TODO: if we want to enhance the issue #11 in the future like #23, we may start here by using the returned value
    plotter.plot_booth(booth_df, "booth")

    # read the other report data
    report_yaml = report_generatoryaml.read_yaml(yaml)

    sponsors = apsponsor.get_all_sponsors(package_yaml, sponsor_yaml)

    accepted_talk_number = talks_df["category"].value_counts().sum()
    all_talk_number = p_talks_df["category"].value_counts().sum()
    talk_info_ratio = accepted_talk_number / all_talk_number
    talk_info = "{:.1%}".format(talk_info_ratio)
    # generate the report
    # general info (everyone could see it):
    #   figs: plots from attendee dataframe and talks
    #   df_all_g_data_obj: numbers from attendee dataframe
    #   report_yaml: plot description of figs
    # sponsors:
    #   sponsor specific information based on yaml descriptor
    exporter_html.generate(figs,
                           report_yaml,
                           df_all_g_data_obj,
                           sponsors,
                           talk_info,
                           "sponsor.html",
                           output_path=output_path)

    # summary for internal review
    exporter_html.generate_summary(figs, report_yaml, df_all_g_data_obj,
                                   sponsors, talk_info, "internal.html",
                                   "internal-post-event", output_path)

    print("Analysis process finished completely.")