Esempio n. 1
0
def start_question_detail():
    # get parameters
    cond = request.args.get('cond')
    locn = request.args.get('locn')
    age = request.args.get('age')
    gender = request.args.get('gender')
    domain = request.args.get('domain')
    user_picked_time = request.args.get('user_picked_time')
    exposure = request.args.get('exposure')
    stat = request.args.get('stat')
    preg = request.args.get('preg')
    pre_quest_answers = [
        age, gender, domain, user_picked_time, exposure, stat, preg
    ]

    # save the query in session
    session.clear()
    session['query'] = cond
    session.modified = True
    # get trials and tags
    rnct = ctgov.get_initial_nct_patient(cond, locn)
    working_nct_id_list = qst.init_working_nct_id_list(rnct, pre_quest_answers)
    question_answer_list = []
    if len(working_nct_id_list) > 0:
        question_answer_list = qst.find_new_question(question_answer_list,
                                                     working_nct_id_list)
        log.info('%s -- first question' % (request.remote_addr))

    return jsonify(question_answer_list=question_answer_list,
                   working_nct_id_list=working_nct_id_list)
Esempio n. 2
0
def confirm():
    requestion_dict = request.get_json()
    question_answer_list = requestion_dict['question_answer_list']
    print(question_answer_list)
    working_nct_id_list = requestion_dict['working_nct_id_list']
    domain = requestion_dict['domain']
    working_nct_id_list = qst.update_working_nct_id_list(question_answer_list,working_nct_id_list)
    question_answer_list = qst.find_new_question(question_answer_list,working_nct_id_list,domain)
    return jsonify(question_answer_list = question_answer_list, working_nct_id_list = working_nct_id_list)
Esempio n. 3
0
def confirm():
    requestion_dict = request.get_json()
    question_answer_list = requestion_dict['question_answer_list']
    working_nct_id_list = requestion_dict['working_nct_id_list']
    domain = requestion_dict['domain']
    working_nct_id_list = qst.update_working_nct_id_list(question_answer_list, working_nct_id_list)
    print('working nctid list: ' + str(working_nct_id_list))
    print('question answer list: ' + str(question_answer_list))
    question_answer_list = qst.find_new_question(question_answer_list, working_nct_id_list, domain)
    print('qlist 2: ' + str(question_answer_list))
    return jsonify(question_answer_list=question_answer_list, working_nct_id_list=working_nct_id_list)
Esempio n. 4
0
def start_question():
    # get parameters
    stxt = request.args.get
    ('stxt')
    # save the query in session
    # session['query'] = stxt
    # get trials and tags
    rnct = ctgov.get_initial_nct(stxt)
    working_nct_id_list = qst.init_working_nct_id_list(rnct)
    question_answer_list = []
    question_answer_list = qst.find_new_question(question_answer_list, working_nct_id_list)
    log.info('%s -- first question' % (request.remote_addr))
    return jsonify(question_answer_list=question_answer_list, working_nct_id_list=working_nct_id_list)
Esempio n. 5
0
def advs_start_question():
    qlabel = request.args.get('qlabel')
    # save the query in session
    session.clear()
    session['query'] = qlabel
    session.modified = True
    # get trials
    url = ctgov.form_advanced_search_url (request.args)
    rnct = ctgov.get_initial_nct_from_url (url)
    working_nct_id_list = qst.init_working_nct_id_list(rnct)
    question_answer_list = []
    if len(working_nct_id_list) > 0:
        question_answer_list = qst.find_new_question(question_answer_list,working_nct_id_list)
        log.info ('%s -- first question' % (request.remote_addr))
    return jsonify (question_answer_list = question_answer_list, working_nct_id_list = working_nct_id_list)
def start_question_detail():
    age = request.args.get('age')
    # gender = request.args.get('gender')
    exposure = request.args.get('exposure')
    domain = request.args.get('domain')
    user_picked_time = request.args.get('user_picked_time')
    stat = request.args.get('stat')
    preg = request.args.get('preg')
    miles = request.args.get('miles')

    pre_quest_answers = [age, exposure, domain, user_picked_time, stat, preg]
    locn = request.args.get('locn')
    trial_type = request.args.get('trial_type')

    #Save user access info into the database
    rnd = ''.join(str(random.choice(range(6))) for _ in range(6))
    tim = time.strftime('%Y%m%d%H%M%S')
    session_id = rnd + tim
    age = int(age.encode('ascii', 'ignore'))
    if 0 <= age < 10:
        age = 10
    else:
        age = int(age / 10) * 10

    conn = general_pool_criteria.connection()
    cur = conn.cursor()
    sql = "insert into dbo.access_stat values ('%s', '%s', '%s', '%s','%s','%s','%s','%s','%s','%s')" % (
        session_id, str(locn), str(miles), trial_type, str(age), exposure,
        domain, user_picked_time or '', stat, preg)
    #print sql
    cur.execute(sql)
    conn.commit()
    conn.close()
    cur.close()

    # get trials and tags
    rnct = session.get('working_nct_list_pre_process')
    working_nct_id_list = qst.init_working_nct_id_list(rnct, pre_quest_answers)
    question_answer_list = []

    if len(working_nct_id_list) > 0:
        question_answer_list = qst.find_new_question(question_answer_list,
                                                     working_nct_id_list)
        log.info('%s -- first question' % (request.remote_addr))

    return jsonify(question_answer_list=question_answer_list,
                   working_nct_id_list=working_nct_id_list)
Esempio n. 7
0
def start_question_detail():
    # get parameters
    cond = request.args.get('cond')
    locn = request.args.get('locn')

    # save the query in session
    session.clear()
    session['query'] = cond
    session.modified = True
    # get trials and tags
    rnct = ctgov.get_initial_nct_patient(cond,locn)
    working_nct_id_list = qst.init_working_nct_id_list(rnct)
    question_answer_list = []
    if len(working_nct_id_list) > 0:
        question_answer_list = qst.find_new_question(question_answer_list,working_nct_id_list)
        log.info ('%s -- first question' % (request.remote_addr))

    return jsonify (question_answer_list = question_answer_list, working_nct_id_list = working_nct_id_list)
Esempio n. 8
0
def start_question_detail():
    age = request.args.get('age')
    # gender = request.args.get('gender')
    exposure = request.args.get('exposure')
    domain = request.args.get('domain')
    user_picked_time = request.args.get('user_picked_time')
    stat = request.args.get('stat')
    preg = request.args.get('preg')
    miles = request.args.get('miles')

    pre_quest_answers = [age, exposure, domain, user_picked_time, stat, preg]

    # get trials and tags
    rnct = session.get('working_nct_list_pre_process')
    working_nct_id_list = qst.init_working_nct_id_list(rnct, pre_quest_answers)
    question_answer_list = []

    if len(working_nct_id_list) > 0:
        question_answer_list = qst.find_new_question(question_answer_list, working_nct_id_list)
        log.info('%s -- first question' % (request.remote_addr))

    return jsonify(question_answer_list=question_answer_list, working_nct_id_list=working_nct_id_list)