Пример #1
0
def computeAlertsChunk(chunkID):

    #########################################################################################################
    ############-----------------Creating a connection to output mongodb
    #########################################################################################################
    tablename = 'MonthlyMsgQueue'
    monconn_recommendations = MongoConnect(tablename,
                                           host='localhost',
                                           database='mailer_monthly')

    print 'Chunk:', chunkID, 'initiated at:', time.ctime()

    ifile = open('CompanyNames.csv', 'r')
    reader = csv.reader(ifile)
    company_dict = {}
    for row in reader:
        company_dict[row[0]] = row[1]

    #########################################################################################################
    ############-----------------Fetch the user data from the database
    #########################################################################################################
    tablename = "candidates_processed"
    monconn_users = MongoConnect(tablename,
                                 host='localhost',
                                 database='mailer_monthly')
    mongo_users_cur = monconn_users.getCursor()

    myCondition = {'p': chunkID}
    #myCondition = {}
    users = monconn_users.loadFromTable(myCondition)
    #print "Fetching the users data from Mongodb....completed for ChunkID:",chunkID

    #########################################################################################################
    ############-----------------Loop to generate recommendations and save in Mongo
    #########################################################################################################
    count = 0

    for user in users:

        #########################################################################################################
        ############-----------------Extracting the user details
        #########################################################################################################

        count += 1
        user_ctc = user['user_ctc']
        user_exp = user['user_experience']
        user_id = user['user_id']
        user_email = user['user_email']
        user_bow = user['user_bow']['bow']
        user_current_time = datetime.datetime.now()
        user_jobtitle = user['user_jobtitle']
        user_lastlogin = user['user_lastlogin']
        user_phone = user['user_phone']
        user_gender = user['user_gender']
        user_current_company = user['user_current_company']
        user_functionalarea_id = user['user_functionalarea_id']
        user_lastmodified = user['user_lastmodified']
        user_fullname = user['user_fullname']
        user_phone_verified = user['user_phone_verified']
        user_location_id = user['user_location_id']
        user_ctc_id = user['user_ctc_id']
        user_highest_qual = user['user_highest_qual']
        user_edu_special = user['user_edu_special']
        user_email_verified = user['user_email_verified']
        user_spam_status = user['user_spam_status']
        user_bounce_status = user['user_bounce_status']
        user_email_alert_status = user['user_email_alert_status']
        user_functionalarea = user['user_functionalarea']
        user_industry = user['user_industry']
        user_jobtitle = user['user_jobtitle']
        user_profiletitle = user['user_profiletitle']
        user_edom = user['user_edom']
        user_industry = user['user_industry']
        user_skills = user['user_skills']
        user_profiletitle = user['user_profiletitle']
        user_pid = user['p']
        user_firstname = user_fullname.split(" ")[0]

        lsi_user = lsiModel[tfIdfModel[user_bow]]
        simScrChunk = index[lsi_user]
        sortingExcelSheetList = []

        for (jobIntIndex, lsiCosine) in simScrChunk:

            if lsiCosine < 0.18:
                continue

            #########################################################################################################
            ############-----------------Loading the Jobs Data
            #########################################################################################################

            job = jobIntIdToJobDict[jobIntIndex]
            jobid = job['job_id']
            job_title = job['job_title']
            job_skills = job['job_skills']
            job_minsal = job['job_minsal']
            job_maxsal = job['job_maxsal']
            job_minexp = job['job_minexp']
            job_maxexp = job['job_maxexp']
            job_bow = job['job_bow']['bow']
            job_accounttype = job['job_accounttype']
            job_flag = job['job_flag']
            job_companyname = job['job_company_name']
            job_companyid = job['job_company_id']

            #########################################################################################################
            ############-----------------Calculating the CTC and Experience Match Scores
            #########################################################################################################
            ctc_match_score = CTCMatchScore(job_minsal, job_maxsal,
                                            user_ctc).CTCMatchScore()
            exp_match_score = ExpMatchScore(job_minexp, job_maxexp,
                                            user_exp).ExpMatchScore()
            paid_boost = PaidBoostScore(job_flag,
                                        job_accounttype).PaidBoostScore()

            #########################################################################################################
            ############-----------------Calculating the City Score between a candidate and a job
            #########################################################################################################

            if ctc_match_score == 1 and exp_match_score == 1:
                jobid = job['job_id']

                try:
                    job_city = job['job_location']
                except:
                    job_city = 'Delhi'
                try:
                    user_city = user['user_location']
                except:
                    user_city = 'Delhi'

                #print user_city, job_city
                try:
                    user_city_list = user_city.lower().replace(
                        'other', '').strip().split(',')
                    user_city_list = [x.strip() for x in user_city_list]
                except:
                    user_city_list = ['']

                try:
                    job_city_list = job_city.lower().replace(
                        'other', '').strip().split(',')
                    job_city_list = [x.strip() for x in job_city_list]
                except:
                    job_city_list = ['']
                #print user_city_list, job_city_list
                try:
                    cityScore = cm.getCityScore(user_city_list, job_city_list)
                except:
                    cityScore = 0

                #########################################################################################################
                ############-----------------Calculating the overall match score and appending the details to the list
                ############-----------------based on job's published date
                #########################################################################################################
                overallMatchScore = getOverallMatchScore(
                    lsiCosine, cityScore, paid_boost)

                s = (user_id, user_email, jobid, overallMatchScore, job_title,
                     job_skills, job_minsal, job_maxsal, job_minexp,
                     job_maxexp, job_companyid)
                sortingExcelSheetList.append(s)

            else:
                continue

        ##############################################################################################################
        ############-----------------Finding the top 10 Jobs based on Overall Score
        ##############################################################################################################
        topN = 30
        sortingExcelSheetListTopNJobs = heapq.nlargest(topN,
                                                       sortingExcelSheetList,
                                                       key=lambda x: x[3])
        #pprint(sortingExcelSheetListTopNJobs)

        jobs2bsent = []
        company_ids = []
        cosine_score = []
        for (user_id, user_email, jobid, overallMatchScore, job_title,
             job_skills, job_minsal, job_maxsal, job_minexp, job_maxexp,
             job_companyid) in sortingExcelSheetListTopNJobs:
            #print (userid, jobid, lsiCosine, job_title, job_skills, job_minsal, job_maxsal, job_minexp, job_maxexp)
            if job_companyid not in company_ids:
                company_ids.append(job_companyid)
                jobs2bsent.append(int(jobid))
                cosine_score.append(round(overallMatchScore, 2))
            else:
                if company_ids.count(job_companyid) < 3:
                    company_ids.append(job_companyid)
                    jobs2bsent.append(int(jobid))
                    cosine_score.append(round(overallMatchScore, 2))
                else:
                    pass
            if len(jobs2bsent) >= 10:
                break
            else:
                pass
        #print user_id
        #print company_ids
        #print jobs2bsent

        companies = []
        #print company_ids
        for comp_id in company_dict.keys():

            if int(comp_id) in company_ids:

                companies.append(company_dict[comp_id])
                #print companies
                #print "Hello"
            else:
                pass

        ##############################################################################################################
        ############-----------------Creating Subject Line for a candidate
        ##############################################################################################################                                     \

        if len(companies) != 0:
            try:
                user_subject = user_firstname + ": " + ', '.join(
                    companies
                ) + " and other top company jobs matching your profile"
                #print user_subject
            except Exception as e:
                pass
        else:
            try:
                if user_functionalarea == "Fresher (No Experience)":
                    user_subject = user_firstname + ", don't miss out on these new jobs"
                else:
                    user_subject = user_firstname + ", new " + user_functionalarea.replace(
                        ' /', ',') + " jobs for you"
                #print user_subject
            except Exception as e:
                user_subject = user_firstname + ", don't miss out on these new jobs"

        ##############################################################################################################
        ############-----------------Creating a document to be saved in mongo collection
        ##############################################################################################################

        document = {
            "c": user_id,
            "_id": user_email,
            "m": user_phone,
            "te": user_exp,
            "cr": user_jobtitle,
            "g": user_gender,
            "cc": user_current_company,
            "fa": user_functionalarea,
            "faid": user_functionalarea_id,
            "pd": user_lastmodified,
            "fn": user_fullname,
            "cpv": user_phone_verified,
            "sCLID": user_location_id,
            "sASID": user_ctc_id,
            "eq": user_highest_qual,
            "es": user_edu_special,
            "ev": user_email_verified,
            "ll": user_lastlogin,
            "sal": user_ctc,
            "cosine": cosine_score,
            "edom": user_edom,
            "t": user_current_time,
            "mj": jobs2bsent,
            "bj": [],
            "oj": [],
            "pid": user_pid,
            "s": False,
            "sub": user_subject
        }

        ##############################################################################################################
        ############-----------------Dumping the document in mongo collection if recommendations were generated
        ##############################################################################################################

        if len(jobs2bsent) > 0:
            monconn_recommendations.saveToTable(document)

        #print 'Chunk:', chunkID, 'processed in:', time.ctime()

    monconn_recommendations.close()
def computeAlertsChunk(chunkID):

    #########################################################################################################
    ############-----------------Creating a connection to output mongodb
    #########################################################################################################
    tablename = 'JobSuggestions'
    monconn_recommendations = MongoConnect(tablename,
                                           host='localhost',
                                           database='similar_jobs_onsite')

    print 'Chunk:', chunkID, 'initiated at:', time.ctime()

    #########################################################################################################
    ############-----------------Fetch the 3 month jobs data from mongo
    #########################################################################################################
    tablename = "active_jobs_dump"
    monconn_jobs_1 = MongoConnect(tablename,
                                  host='localhost',
                                  database='similar_jobs_onsite')
    mongo_jobs_1_cur = monconn_jobs_1.getCursor()
    myCondition = {'pid': chunkID}
    jobs_1 = monconn_jobs_1.loadFromTable(myCondition)

    #########################################################################################################
    ############-----------------Calculating the overall score of a 3month jobs based on cosine,ctc,
    ############-----------------experience,city scores for each 1month Job
    #########################################################################################################

    count = 0

    for job_1 in jobs_1:
        count += 1
        jobid_1 = job_1['job_id']
        job_title_1 = job_1['job_title']
        job_skills_1 = job_1['job_skills']
        job_minsal_1 = job_1['job_minsal']
        job_maxsal_1 = job_1['job_maxsal']
        job_minexp_1 = job_1['job_minexp']
        job_maxexp_1 = job_1['job_maxexp']
        job_bow_1 = job_1['job_bow']['bow']
        job_index_1 = job_1['job_index']

        lsi_job_1 = lsiModel[tfIdfModel[job_bow_1]]
        simScrChunk = index[lsi_job_1]

        sortingExcelSheetList = []

        for (jobIntIndex, lsiCosine) in simScrChunk:

            job = jobIntIdToJobDict[jobIntIndex]
            jobid = job['job_id']
            job_title = job['job_title']
            job_skills = job['job_skills']
            job_minsal = job['job_minsal']
            job_maxsal = job['job_maxsal']
            job_minexp = job['job_minexp']
            job_maxexp = job['job_maxexp']
            job_bow = job['job_bow']['bow']
            job_index = job['job_index']
            job_company_id = job['job_company_id']

            #########################################################################################################
            ############-----------------Calculating the CTC and Experience and City Match Scores
            #########################################################################################################

            ctc_match = CTCMatchScore(job_minsal_1, job_maxsal_1, job_minsal,
                                      job_maxsal)
            ctc_match_score = ctc_match.CTCMatchScore()
            exp_match_score = ExpMatchScore(job_minexp_1, job_maxexp_1,
                                            job_minexp,
                                            job_maxexp).ExpMatchScore()
            paid_boost = 0
            if ctc_match_score == 1 and exp_match_score == 1:
                if jobid != jobid_1:
                    try:
                        job_city_1 = job_1['job_location']
                    except:
                        job_city_1 = ["Delhi"]

                    try:
                        job_city = job['job_location']
                    except:
                        job_city = ["Delhi"]

                    #lsiCosine = getLSICosine(user_bow, job_bow).getLSICosine()
                    try:
                        cityScore = cm.getCityScore(job_city_1, job_city)
                    except:
                        cityScore = 0

                    overallMatchScore = getOverallMatchScore(
                        lsiCosine, cityScore, paid_boost)
                    s = (jobid_1, job_index_1, jobid, job_index,
                         overallMatchScore, job_company_id)
                    sortingExcelSheetList.append(s)

                else:
                    continue
            else:
                continue

        #########################################################################################################
        ############-----------------Finding the top 10 Jobs based on overall sccore
        #########################################################################################################

        topN = 30
        sortingExcelSheetListTopNJobs = heapq.nlargest(topN,
                                                       sortingExcelSheetList,
                                                       key=lambda x: x[4])

        jobs2bsent = []
        company_ids = []
        for (jobid_1, job_index_1, jobid, job_index, overallMatchScore,
             job_company_id) in sortingExcelSheetListTopNJobs:
            if job_company_id not in company_ids:
                company_ids.append(job_company_id)
                jobs2bsent.append(int(jobid))
            else:
                if company_ids.count(job_company_id) < 2:
                    company_ids.append(job_company_id)
                    jobs2bsent.append(int(jobid))
                else:
                    pass

            if len(jobs2bsent) >= 10:
                break
            else:
                pass

        ##############################################################################################################
        ############-----------------Creating a document to be saved in mongo collection
        ##############################################################################################################                                     \
        document = {
            '_id': jobid_1,
            'sj': jobs2bsent,
            'sjlen': len(jobs2bsent),
            'lud': datetime.datetime.now()
        }

        ##############################################################################################################
        ############-----------------Dumping the document in mongo collection if recommendations were generated
        ##############################################################################################################
        monconn_recommendations.saveToTable(document)

    monconn_recommendations.close()
Пример #3
0
def computeAlertsChunk(chunkID):

    #########################################################################################################
    ############-----------------Creating a connection to output mongodb
    #########################################################################################################
    tablename = 'DailyMsgQueue'
    monconn_recommendations = MongoConnect(tablename,
                                           host='localhost',
                                           database='mailer_daily_midout')
    print 'Chunk:', chunkID, 'initiated at:', time.ctime()

    #########################################################################################################
    ############-----------------Fetch the user data from the database
    #########################################################################################################
    tablename = "candidates_processed_midout"
    monconn_users = MongoConnect(tablename,
                                 host='localhost',
                                 database='Midout_Mailers')
    mongo_users_cur = monconn_users.getCursor()

    myCondition = {'pid': chunkID}
    users = monconn_users.loadFromTable(myCondition)

    #########################################################################################################
    ############-----------------Loop to generate recommendations and save in Mongo
    #########################################################################################################
    count = 0
    for user in users:
        count += 1

        #########################################################################################################
        ############-----------------Extracting the user details
        #########################################################################################################

        _id = user['user_email']
        user_ctc = user['user_ctc']
        user_exp = user['user_experience']
        user_id = user['user_id']
        user_email = user['user_email']
        user_bow = user['user_bow']['bow']
        user_current_time = datetime.datetime.now()
        user_countrycode = user.get('user_countrycode', '')
        user_pid = user['pid']
        user_phone_number = "+" + str(user_countrycode) + "-" + str(
            user.get('user_phone_number', ''))
        user_firstname = user.get('user_firstname', '')
        user_lastname = user.get('user_lastname', '')
        user_fullname = user_firstname + " " + user_lastname

        if len(user_fullname) < 3:
            user_fullname = "Candidate"

        try:
            user_registration_start_date = rfc3339(user.get(
                'user_registration_start_date', ''),
                                                   utc=True)
        except:
            user_registration_start_date = ""

        lsi_user = lsiModel[tfIdfModel[user_bow]]
        simScrChunk = index[lsi_user]
        sortingExcelSheetList = []

        for (jobIntIndex, lsiCosine) in simScrChunk:

            if lsiCosine < 0.18:
                continue

            #########################################################################################################
            ############-----------------Loading the Jobs Data
            #########################################################################################################

            job = jobIntIdToJobDict[jobIntIndex]
            jobid = job['job_id']
            job_title = job['job_title']
            job_skills = job['job_skills']
            job_minsal = job['job_minsal']
            job_maxsal = job['job_maxsal']
            job_minexp = job['job_minexp']
            job_maxexp = job['job_maxexp']
            job_bow = job['job_bow']['bow']

            #########################################################################################################
            ############-----------------Calculating the CTC and Experience Match Scores
            #########################################################################################################
            ctc_match_score = CTCMatchScore(job_minsal, job_maxsal,
                                            user_ctc).CTCMatchScore()
            exp_match_score = ExpMatchScore(job_minexp, job_maxexp,
                                            user_exp).ExpMatchScore()

            #########################################################################################################
            ############-----------------Calculating the City Score between a candidate and a job
            #########################################################################################################

            if ctc_match_score == 1 and exp_match_score == 1:
                jobid = job['job_id']
                #lsiCosine = getLSICosine(user_bow, job_bow).getLSICosine()

                #City Score
                try:
                    job_city = job['job_location']
                except:
                    job_city = 'Delhi'
                try:
                    user_city = user['user_location']
                except:
                    user_city = 'Delhi'

                #print user_city, job_city
                try:
                    user_city_list = user_city.lower().replace(
                        'other', '').strip().split(',')
                    user_city_list = [x.strip() for x in user_city_list]
                except:
                    user_city_list = ['']

                try:
                    job_city_list = job_city.lower().replace(
                        'other', '').strip().split(',')
                    job_city_list = [x.strip() for x in job_city_list]
                except:
                    job_city_list = ['']
                #print user_city_list, job_city_list
                try:
                    cityScore = cm.getCityScore(user_city_list, job_city_list)
                except:
                    cityScore = 0

                #if cityScore == 0:
                #count = count +1
                #print user_city_list, job_city_list, cityScore
                paidboost = 0

                #########################################################################################################
                ############-----------------Calculating the overall match score
                #########################################################################################################
                overallMatchScore = getOverallMatchScore(
                    lsiCosine, cityScore, paidboost)

                s = (user_id, user_email, jobid, overallMatchScore, job_title,
                     job_skills, job_minsal, job_maxsal, job_minexp,
                     job_maxexp)
                sortingExcelSheetList.append(s)

            else:
                continue

        ##############################################################################################################
        ############-----------------Finding the top 10 Jobs based on Overall Score
        ##############################################################################################################
        topN = 10
        sortingExcelSheetListTopNJobs = heapq.nlargest(topN,
                                                       sortingExcelSheetList,
                                                       key=lambda x: x[3])

        jobs2bsent = []
        for (user_id, user_email, jobid, overallMatchScore, job_title,
             job_skills, job_minsal, job_maxsal, job_minexp,
             job_maxexp) in sortingExcelSheetListTopNJobs:

            jobs2bsent.append(int(jobid))

        ##############################################################################################################
        ############-----------------Creating a document to be saved in mongo collection
        ##############################################################################################################

        document = {"_id":user_email, \
                    "fn" : user_fullname,\
                    "c": user_id,\
                    "mj":jobs2bsent, \
                    "oj":[], \
                    "s": False ,\
                    "t": user_current_time ,\
                    "pid": user_pid,\
                    "m": user_phone_number, \
                    "pd":user_registration_start_date
                    }

        ##############################################################################################################
        ############-----------------Dumping the document in mongo collection if recommendations were generated
        ##############################################################################################################

        if len(jobs2bsent) > 0:
            monconn_recommendations.saveToTable(document)

    monconn_recommendations.close()
Пример #4
0
def computeAlertsChunk(chunkID):

    #########################################
    '''Creating a connection to output mongodb'''
    #########################################

    tablename = 'WeeklyMsgQueue'
    monconn_recommendations = MongoConnect(tablename,
                                           host='localhost',
                                           database='mailer_weekly')

    print 'Chunk:', chunkID, 'initiated at:', time.ctime()

    #################################################
    '''Fetch the user data from the database'''
    #################################################

    #print "Fetching the users data from Mongodb for ChunkID:",chunkID
    #tablename="candidates_processed"
    tablename = "candidates_processed"
    monconn_users = MongoConnect(tablename,
                                 host='localhost',
                                 database='mailer_weekly')
    mongo_users_cur = monconn_users.getCursor()

    myCondition = {'p': chunkID}
    #myCondition = {}
    users = monconn_users.loadFromTable(myCondition)
    #print "Fetching the users data from Mongodb....completed for ChunkID:",chunkID

    ##################################################################
    '''Get the top 10 matching jobs based on cosine for each candidate'''
    ##################################################################

    count = 0

    for user in users:

        count += 1
        user_ctc = user['user_ctc']
        user_exp = user['user_experience']
        user_id = user['user_id']
        user_email = user['user_email']
        user_bow = user['user_bow']['bow']
        user_current_time = datetime.datetime.now()
        user_jobtitle = user['user_jobtitle']
        user_lastlogin = user['user_lastlogin']
        user_phone = user['user_phone']
        user_gender = user['user_gender']
        user_current_company = user['user_current_company']
        user_functionalarea_id = user['user_functionalarea_id']
        user_lastmodified = user['user_lastmodified']
        user_fullname = user['user_fullname']
        user_phone_verified = user['user_phone_verified']
        user_location_id = user['user_location_id']
        user_ctc_id = user['user_ctc_id']
        user_highest_qual = user['user_highest_qual']
        user_edu_special = user['user_edu_special']
        user_email_verified = user['user_email_verified']
        user_spam_status = user['user_spam_status']
        user_bounce_status = user['user_bounce_status']
        user_email_alert_status = user['user_email_alert_status']
        user_functionalarea = user['user_functionalarea']
        user_industry = user['user_industry']
        user_jobtitle = user['user_jobtitle']
        user_profiletitle = user['user_profiletitle']
        user_edom = user['user_edom']
        user_industry = user['user_industry']
        user_skills = user['user_skills']
        user_profiletitle = user['user_profiletitle']
        user_pid = user['p']

        lsi_user = lsiModel[tfIdfModel[user_bow]]
        simScrChunk = index[lsi_user]
        sortingExcelSheetList = []

        for (jobIntIndex, lsiCosine) in simScrChunk:

            if lsiCosine < 0.18:
                continue

            job = jobIntIdToJobDict[jobIntIndex]
            jobid = job['job_id']
            job_title = job['job_title']
            job_skills = job['job_skills']
            job_minsal = job['job_minsal']
            job_maxsal = job['job_maxsal']
            job_minexp = job['job_minexp']
            job_maxexp = job['job_maxexp']
            job_bow = job['job_bow']['bow']
            job_accounttype = job['job_accounttype']
            job_flag = job['job_flag']

            #######################################################
            ''' Calculating the CTC and Experience Match Scores'''
            #######################################################

            ctc_match_score = CTCMatchScore(job_minsal, job_maxsal,
                                            user_ctc).CTCMatchScore()
            exp_match_score = ExpMatchScore(job_minexp, job_maxexp,
                                            user_exp).ExpMatchScore()
            paid_boost = PaidBoostScore(job_flag,
                                        job_accounttype).PaidBoostScore()
            #ctc_match_score = 1
            #exp_match_score = 1
            paid_boost = 0

            #######################################################
            ''' For Low earning desperate guy uncomment this '''
            #######################################################
            '''
            if (1 + user_ctc)/(1 + user_exp) < 0.3: 
                ctc_match_score = 1
                exp_match_score = 1
            
            '''

            if ctc_match_score == 1 and exp_match_score == 1:
                jobid = job['job_id']

                try:
                    job_city = job['job_location']
                except:
                    job_city = 'Delhi'
                try:
                    user_city = user['user_location']
                except:
                    user_city = 'Delhi'

                #print user_city, job_city
                try:
                    user_city_list = user_city.lower().replace(
                        'other', '').strip().split(',')
                    user_city_list = [x.strip() for x in user_city_list]
                except:
                    user_city_list = ['']

                try:
                    job_city_list = job_city.lower().replace(
                        'other', '').strip().split(',')
                    job_city_list = [x.strip() for x in job_city_list]
                except:
                    job_city_list = ['']
                #print user_city_list, job_city_list
                try:
                    cityScore = cm.getCityScore(user_city_list, job_city_list)
                except:
                    cityScore = 0

                #if cityScore == 0:
                #count = count +1
                #print user_city_list, job_city_list, cityScore

                overallMatchScore = getOverallMatchScore(
                    lsiCosine, cityScore, paid_boost)

                s = (user_id, user_email, jobid, overallMatchScore, job_title,
                     job_skills, job_minsal, job_maxsal, job_minexp,
                     job_maxexp)
                sortingExcelSheetList.append(s)

            else:
                continue

        #################################
        '''Finding the top 10 Jobs'''
        #################################
        topN = 10
        sortingExcelSheetListTopNJobs = heapq.nlargest(topN,
                                                       sortingExcelSheetList,
                                                       key=lambda x: x[3])
        #pprint(sortingExcelSheetListTopNJobs)

        jobs2bsent = []
        for (user_id, user_email, jobid, overallMatchScore, job_title,
             job_skills, job_minsal, job_maxsal, job_minexp,
             job_maxexp) in sortingExcelSheetListTopNJobs:
            #print (userid, jobid, lsiCosine, job_title, job_skills, job_minsal, job_maxsal, job_minexp, job_maxexp)

            jobs2bsent.append(int(jobid))

        document = {
            "c": user_id,
            "_id": user_email,
            "m": user_phone,
            "te": user_exp,
            "cr": user_jobtitle,
            "g": user_gender,
            "cc": user_current_company,
            "fa": user_functionalarea,
            "faid": user_functionalarea_id,
            "pd": user_lastmodified,
            "fn": user_fullname,
            "cpv": user_phone_verified,
            "sCLID": user_location_id,
            "sASID": user_ctc_id,
            "eq": user_highest_qual,
            "es": user_edu_special,
            "ev": user_email_verified,
            "ll": user_lastlogin,
            "sal": user_ctc,
            "edom": user_edom,
            "t": user_current_time,
            "mj": jobs2bsent,
            "bj": [],
            "oj": [],
            "pid": user_pid,
            "s": False
        }

        if len(jobs2bsent) > 0:
            monconn_recommendations.saveToTable(document)

        #print 'Chunk:', chunkID, 'processed in:', time.ctime()

    monconn_recommendations.close()