@@ -0,0 +1,1523 @@
+#!/usr/bin/env python3%0Aimport sys%0Aimport argparse%0Afrom os import path%0Afrom glob import glob%0Aimport pandas as pd%0A%0Adef merge(mappings_by_name):%0A    dfs = %5B%5D%0A    for event in sorted(mappings_by_name):%0A        df = mappings_by_name%5Bevent%5D%0A        df.insert(0, 'Event', event)%0A        dfs.append(df)%0A    return pd.concat(dfs)%0A%0Adef fix_tags(tags):%0A    if tags == tags:%0A        return ', '.join(%5Btag for tag in tags.split(', ') if tag.isupper()%5D)%0A    else:%0A        return None%0A%0Adef read_mappings(directory):%0A    res = %7B%7D%0A    for filename in glob(path.join(directory, %22*.xls%22)):%0A        event = path.basename(filename)%5B:-4%5D%0A        df = pd.read_excel(filename, sheetname='Codes')%0A        df%5B'Tags'%5D = df.Tags.map(fix_tags)%0A        res%5Bevent%5D = df%0A    return res%0A%0Adef output(filename, res):%0A    if filename == '-':%0A        print(res.to_csv(index=False))%0A    elif filename.endswith('.xls') or filename.endswith('.xlsx'):%0A        res.to_excel(filename, index=False)%0A    elif filename.endswith('.csv'):%0A        res.to_csv(filename, index=False)%0A    else:%0A        print(%22Only xls, xlsx, csv output files possible%22)%0A        sys.exit(1)%0A%0Adef main():%0A    parser = argparse.ArgumentParser(description='Stack code sets')%0A    parser.add_argument('--mappings', metavar='DIR', required=True)%0A    parser.add_argument('--output', metavar='FILE', required=True)%0A    args = parser.parse_args()%0A    mappings_by_name = read_mappings(args.mappings)%0A    res = merge(mappings_by_name)%0A    output(args.output, res)%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add stack-mapping.py