Upadted script to cache affiliations in a csv file rather than a json.