def get_data(data,date_from):
    first_date = {}
    date_lists = {}
    timestamps = {}
    for d_gap in [7,28,90]:
        if d_gap not in first_date:
            first_date[d_gap] = lsl.get_date(date_from,d_gap)
            date_lists[d_gap] =[]
            date_lists[d_gap].append(first_date[d_gap])
        for d in range(0,d_gap):
            date_lists[d_gap].append(lsl.increment_date(date_lists[d_gap][-1],1))

    for subid in data:
        if subid not in timestamps:
            timestamps[subid] = {}
        dates_data = data[subid] 
        for d_gap in [7,28,90]:
            dates = date_lists[d_gap]
            print dates
            if d_gap not in timestamps[subid]:
                timestamps[subid][d_gap] = []
            for date1 in dates:
                if date1 in dates_data:
                    for ts in dates_data[date1].keys():
                        timestamps[subid][d_gap].append(int(ts))
              
    sav_file = "../sav_files/axaie_data_for_production_timestamps_{0}.sav".format(date_from)
    with open(sav_file,'w') as g:
        pickle.dump(timestamps,g)
def get_dates(date_from):
    first_date = {}
    date_lists = {}
    timestamps = {}
    for d_gap in [7,28,90]:
        if d_gap not in first_date:
            first_date[d_gap] = lsl.get_date(date_from,d_gap)
            date_lists[d_gap] =[]
            date_lists[d_gap].append(first_date[d_gap])
        for d in range(0,d_gap):
            date_lists[d_gap].append(lsl.increment_date(date_lists[d_gap][-1],1))
    return date_lists