Esempio n. 1
0
def create_user_sign_up():
    username = request.forms.get('username')
    password = request.forms.get('password')
    first_name = request.forms.get('first_name')
    last_name = request.forms.get('last_name')
    birthdate = request.forms.get('birthdate')
    gender = request.forms.get('gender')

    user = {
        'first_name': first_name,
        'last_name': last_name,
        'birthdate': birthdate,
        'gender': gender
        }

    hashed = bcrypt.hashpw(password, bcrypt.gensalt())
    db = sqlite3.connect('database/jogrx.db')
    c = db.cursor()
    c.execute("INSERT INTO user (username, password, first_name, last_name, birthdate, gender) VALUES (?, ?, ?, ?, ?, ?)", (username, hashed, first_name, last_name, birthdate, gender))
    new_userid = c.lastrowid
    response.set_cookie('userid', new_userid, "teamfin")
    fhir = FHIR('http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base')
    fhir_id = fhir.create_new_patient(user)
    c.execute("UPDATE user SET fhir_id=? WHERE id=?", (fhir_id, int(new_userid)))
    db.commit()
    c.close()

    return fitBitConnect()
def displayData(fitbitID):
    fhir = FHIR('http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base')
    # fhir.send_exercise_obs(showProgress(fitbitID), getFhirID(fitbitID))
    observations = fhir.get_observations(getFhirID(fitbitID))
    data = json.loads(observations)
    observations_formatted = []
    for observation in data['entry']:
        obs_dict = {}
        obs_dict['value'] = observation['resource']['valueQuantity']['value']
        obs_dict['date'] = observation['resource']['appliesDateTime']
        observations_formatted.append(obs_dict)
    observations_formatted.sort()
    return dict(observations_pretty=observations_formatted, observations_raw=observations, year=datetime.datetime.now().year)
Esempio n. 3
0
def do_sync():
    fhir = FHIR("http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/base")
    fhir.sync_with_fhir()
    return dict(title="Synced", message="JogRx was successfully synced with FHIR", year=datetime.now().year)