def seedData():
    for seed_num in range(10):
        data = getProfile()
        patient = Patient(data['Olivia Davies'], data['F'],
                          data['124 Main Street'], data['423-65-8754'],
                          data['O+'], data['*****@*****.**'])

        db.session.add(patient)
        db.session.commit()
def create_patient():
    name = request.json['full_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    patient = Patient(name,gender,address,ssn,blood_type,email)
    results = patient_schema.dump(patient)
    return jsonify(results)
Ejemplo n.º 3
0
def create_patient(current_user_token):
    firstName = request.json['first_name']
    lastName = request.json['last_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    patient = Patient(firstName, lastName, gender, address, ssn, blood_type,
                      email)
    results = patient_schema.dump(patient)
    flash(f"Record for {patient} has been added.", "info")
    return jsonify(results)
Ejemplo n.º 4
0
def seedData():
    for seed_num in range(10):
        data = getProfile()
        print(os.environ.get('DATABASE_URL'))
        print(data['name'], data['blood_group'])
        patient = Patient(
            data['name'],\
            data['sex'],\
            data['address'],\
            data['ssn'],\
            data['blood_group'],\
            data['mail'])

        db.session.add(patient)
        db.session.commit()
def seedData():
    for seed_num in range(10):
        data = getProfile()
        patient = Patient(
            data['name'], data['sex'], data['address'], data['ssn'],\
            data['blood_group'], data['mail']
        )

        db.session.add(patient)
        db.session.commit()


# seedData()
# could do and run this program or will put this in app.py through import and only run
# flask run
Ejemplo n.º 6
0
def create_patient(current_user_token):
    name = request.json['full_name']
    gender = request.json['gender']
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']                                                                                           

    patient = Patient(name, gender, address, ssn, blood_type, email)

    db.session.add(patient)
    db.session.commit()

    results = patient_schema.dump(patient)
    return jsonify(results)
Ejemplo n.º 7
0
def create_patient(current_user_token):
    # here we are going to parse input from json style file
    # rather than a formas we did before
    name = request.json['full_name']
    gender = request.json['gender']
    # similar to how we used form.name.data
    address = request.json['address']
    ssn = request.json['ssn']
    blood_type = request.json['blood_type']
    email = request.json['email']

    # adding to model
    patient = Patient(name, gender, address, ssn, blood_type, email)

    # adding to database
    db.session.add(patient)
    db.session.commit()

    # looking at db and checking that requested information was added to the database
    results = patient_schema.dump(patient)
    # Marshmellow patient_schema is a Front End digestible version of the raw db output
    return jsonify(results)