from email_test import sendmail
from cont_modules import read_api_to_wrapper, split_collection, construct_ID, read_csv_to_list_wrapper, run_algorithm, primo_api, is_available_ishare, how_many_ishare, add_ishare_to_wrapper, write_csv_from_list
# load config handled by config1
from config1 import dept_librarian_emails
import re, time

if __name__ == "__main__":

    ## load training data
    # training_wrapper = read_csv_to_list_wrapper('./api_list.csv')

    ## translate test
    # translate_csv_reader()

    ## pull in api data
    print(time.time())
    test_wrapper, duplicates, weird_dates = read_api_to_wrapper()

    ## split collections
    # training_collections = split_collection(training_wrapper)
    # test_collections = split_collection(test_wrapper)

    ## feed data into algo
    ## predictions are saved to file to be attached to email later, this could be changed to save space maybe?
    # for collection_code in training_collections:
        # run_algorithm(collection_code, test_collections[collection_code], training_collections[collection_code])
        # send email(s)
        # sendmail('./data/predictions/%s' % construct_ID('predictions', collection_code), dept_librarian_emails[collection_code])


    write_csv_from_list('api_list_10142021.csv', test_wrapper)