Exemplo n.º 1
0
    df = get_all_cause_vr(location_set_version_id)

    print_log_message("Aggregating under 1 and all ages")
    df = aggregate_age_groups(df)

    print_log_message("Aggregating sub national locations")
    df = aggregate_to_country_level(df, location_set_version_id)

    # append together
    # df = pd.concat([df1, df2])
    print_log_message("Got a dataframe with {} rows".format(len(df)))

    # add names and important metadata
    df = add_metadata(df)

    return df


if __name__ == "__main__":
    # can pass a dictionary of source: [source_list], nid: [nid_list], etc.
    # otherwise, will get ALL VR with cause of death data
    # vr_filter = {}
    location_set_version_id = CONF.get_id('location_set_version')
    write = True

    df = prepare_allcause_vr(location_set_version_id)

    if write:
        # write to archive and active directories
        write_vr_file(df)
Exemplo n.º 2
0
        )
        squarer = Squarer(cause_meta_df, age_meta_df)
        model_df = squarer.get_computed_dataframe(model_df)

    elif "HH_SURVEYS" in model_group:
        model_df = square_dhs_data(model_df, cause_meta_df,
                                   age_meta_df, location_hierarchy)

    print_log_message(log_statistic(model_df))

    print_log_message("Restricting model data to only existing cause_ids")
    model_df = restrict_to_cause_ids(code_system_cause_dict, model_df)

    print_log_message("Adding NR location info")
    model_df = format_for_nr(model_df, location_hierarchy)
    if model_group_is_run_by_cause(model_group):
        run_phase_by_cause(model_df, model_group, launch_set_id)
    else:
        run_phase_by_model_group(model_df, model_group, launch_set_id)

    print_log_message("Job complete. Exiting...")


if __name__ == "__main__":
    model_group = str(sys.argv[1])
    launch_set_id = int(sys.argv[2])
    location_set_version_id = CONF.get_id('location_set_version')
    cause_set_version_id = CONF.get_id('cause_set_version')
    main(model_group, location_set_version_id, cause_set_version_id,
         launch_set_id)