コード例 #1
0
def check_all_csv(src_dir=''):
    """Run csv checks on all indicator csvs in the data directory
    
    Args:
        src_dir: str. Base path for the project. Csv 
            files are found relative to this
    """

    status = True

    ids = get_ids(src_dir=src_dir)

    if len(ids) == 0:
        raise FileNotFoundError("No indicator IDs found")
    
    print("Checking " + str(len(ids)) + " metadata files...")
    
    for inid in ids:
        csv = input_path(inid, ftype='data', src_dir=src_dir, must_work=True)
        try:
            status = status & check_csv(csv)
        except Exception as e:
            status = False
            print(csv, e)    
    return(status)
コード例 #2
0
def check_all_meta(src_dir=''):
    """Run metadata checks for all indicators
    
    Args:
        src_dir: str. Base path for the project. Metadata 
            files are found relative to this
    """

    status = True

    ids = get_ids(src_dir=src_dir)

    if len(ids) == 0:
        raise FileNotFoundError("No indicator IDs found")

    print("Checking " + str(len(ids)) + " metadata files...")

    for inid in ids:
        met = input_path(inid, ftype='meta', src_dir=src_dir, must_work=True)
        with open(met, encoding="UTF-8") as stream:
            meta = next(yaml.safe_load_all(stream))
        status = status & check_meta(meta, fname=met)

    return (status)
コード例 #3
0
def test_built_comb_data(test_site_dir):
    ids = get_ids(src_dir=src_dir)
    for inid in ids:
        assert compare_reload_data(inid,
                                   src_dir=src_dir,
                                   site_dir=test_site_dir)