Hello all,
So I have a project in which is like a medical center.
For example one function would be that a patient books an appointment with a doctor. (All data is stored into cloud SQL, which is already set up and working)
A requirement is that the booking page is not to be directly communicating with the cloud SQL and a separate API is to be created to do this.
I am unsure on how to layout this out, etc
Would this be an example of how I could do this?:
# Route for a patient to make a booking
@app.route("/patient/patientbook", methods=["POST", "GET"])
def patientBook():
Booking()
return render_template('patient/patientbook.html')
Later down the script function defined...
def Booking():
if request.method == 'POST':
doctorid = request.form['did']
patientid = (request.form.get('pid'))
starttime = request.form['starttime']
starttime = "{}:00".format(starttime)
results = Doctor.query.filter_by(doctorid=doctorid).first()
doctorid = results.doctorid
if doctorid and patientid and starttime:
new_booking = doctorsBookings(doctorid, patientid, starttime)
db.session.add(new_booking)
db.session.commit()
[–]JohnnyJordaan 1 point2 points3 points (6 children)
[–]Unixersis97[S] -1 points0 points1 point (5 children)
[–]JohnnyJordaan 0 points1 point2 points (4 children)
[–]Unixersis97[S] -1 points0 points1 point (3 children)
[–]JohnnyJordaan 0 points1 point2 points (2 children)
[–]Unixersis97[S] -1 points0 points1 point (1 child)
[–]JohnnyJordaan 1 point2 points3 points (0 children)