/pssp-enhancements

HHA 504 / Cloud Computing / Assignment 9 / PssP Enhancements

Primary LanguageCSS

pssp-enhancements

HHA 504 / Cloud Computing / Assignment 9 / PssP Enhancements

This repo aims to:

  • Enhance the Patient Service Portal I previously created in PSSP with the goals below

GOALS

1. Stylizing the landing page to look more like a realistic fake patient portal

2. Create a new account type called: care provider

  • The care provider should have permissions to edit existing patients
  • There should be a new endpoint for creating this account type; and a new dropdown field value within SQL for account_type

3. Create EDIT functionality for profile

  • Be able to update email and username

4. Create a video demo showcasing the PSSP

  • Demonstrate accomplishments
  • Discuss any errors encountered

Creating a new schema for user accounts

  • Copy & Paste userTable.sql into a new Query tab in MySQL Workbench
  • Verify Admin user was created in your browser Log in page

Images Folder

  • contains screenshots of my live patient portal, styling, and functionalities

ERRORS:

  • [ERROR 1] Under @app.route('/login'), I received a "Build Error for get_patient_details, did you forget to specfiy values mrn?"

    • (screenshot included in images folder)
    • When attempting to add account type "careprovider" to log in using the coding below:

      pssp-enhancements/app.py

      Lines 231 to 257 in cccceff

      @app.route('/login', methods=['GET', 'POST'])
      def login():
      msg = ''
      if request.method == 'POST' and 'username' in request.form and 'password' in request.form:
      username = request.form['username']
      password = request.form['password']
      account = Users.query.filter_by(username=username, password=password).first()
      if account:
      session['loggedin'] = True
      session['id'] = account.id
      session['mrn'] = account.mrn
      session['username'] = account.username
      session['account_type'] = account.account_type
      msg = 'Logged in successfully !'
      ## push update to user with new login time
      account.last_login = datetime.datetime.now()
      db.session.commit()
      if session['account_type'] == 'admin':
      return redirect(url_for('get_gui_patients'))
      elif session['account_type'] == 'patient':
      ## go to /details/{{row.mrn}}
      return redirect(url_for('get_patient_details', mrn=session['mrn']))
      elif session['account_type'] == 'careprovider':
      return redirect(url_for('get_gui_patients'))
      else:
      msg = 'Incorrect username / password !'
      return render_template('/login.html', msg = msg)
  • [RESOLVED] by: adding elif to include care providers in the get_gui_patients

    pssp-enhancements/app.py

    Lines 447 to 457 in cccceff

    ##### CREATE BASIC GUI FOR CRUD #####
    @app.route('/patients', methods=['GET'])
    def get_gui_patients():
    if 'loggedin' in session and session['account_type'] == 'admin':
    returned_Patients = Patients.query.all() # documentation for .query exists: https://docs.sqlalchemy.org/en/14/orm/query.html
    return render_template("patient_all.html", patients = returned_Patients)
    elif 'loggedin' in session and session['account_type'] == 'careprovider':
    returned_Patients = Patients.query.all() # documentation for .query exists: https://docs.sqlalchemy.org/en/14/orm/query.html
    return render_template("patient_all.html", patients = returned_Patients)
    else:
    return redirect(url_for('get_patient_details', mrn=session['mrn']))

  • [ERROR 2] When I Add New Patient on the patients list page, the Date of Birth and Zip Code values are swapped