Example #1
0
def create_match_object(job_id):
    print('create match object')
    match = JobMatch(job_id=job_id, status='processing')
    match.save()
    match_scores = get_match_scores(job_id)
    scores_list = json.loads(match_scores.T.to_json()).values()
    try:
        connect_db()
        match = JobMatch.objects.get(job_id=job_id)
        match.update(scores=list(scores_list), status='complete')
        print('match updated')
    except Exception as e:
        print("error: ", e)
    finally:
        disconnect_db()
Example #2
0
def init_db(req, resp, resource, kwargs=None):
    connect_db()
Example #3
0
    test_X.to_csv('test_X.csv')
    output.to_csv('output.csv')
    return output

"""
Create match database object and get scores
"""
def create_match_object(job_id):
    print('create match object')
    match = JobMatch(job_id=job_id, status='processing')
    match.save()
    match_scores = get_match_scores(job_id)
    scores_list = json.loads(match_scores.T.to_json()).values()
    try:
        connect_db()
        match = JobMatch.objects.get(job_id=job_id)
        match.update(scores=list(scores_list), status='complete')
        print('match updated')
    except Exception as e:
        print("error: ", e)
    finally:
        disconnect_db()

# This is just used for testing
if __name__ == '__main__':
    connect_db()
    job_id = 'TPHLBC'
    scores = create_match_object(job_id)
    disconnect_db()
    print('scores')