Project 3 - Physical Therapy App

https://physician-patient-app.herokuapp.com/

Scope

Pitch

Getting injured is tough, and recovery is even tougher. Traditionally, a patient visting her physical therapy doctor will get assessed then given a list of exercises on paper sheets to take home and rehabilitate between doctor visits. These lists are often generic and inconvient to use during stretching.

Enter DigicarePT, a fine offering from the team that brought you DigicareOBGYN, DigicareRN, and DigicareRehab.

With this application, a doctor can customize treatment for her patients, leading to more effective treatment time and clearer outcomes for the patient.

Goal

Allow the user and the physician to communicate and interact online. Physician will be able to assign exercises to patients undergoing physical therapy via digital media (pictures/gif, videos, descriptions).

User Stories

There are two users: patient and doctor.

Patient

The patient will be able to log in/sign up, view the doctors, choose a doctor, view the list of exercises prescribed by the doctor, and view the overall exercise index page.

Doctors

The physician will be able to log in/sign up, to view the patient profile, assign/remove the exercises to the patient.

We'll have three models: patients, doctors and exercises. The patient and exercises are connected by a join table.

Planning

Trello

Schedule/Milestones

Entity Relationship Diagram

Wireframes Home DoctorSignup DoctorProfile PatientProfile ExerciseAssignment ExerciseIndex ExerciseShow PatientSignup PatientProfile DoctorProfile DoctorIndex About PatientIndex

Technologies Used

  • Ruby on Rails
  • ActiveRecord
  • PostgreSQL
  • Uploadcare
  • JS/Jquery for front-end
  • AJAX

Install

It's a web application. Click and go! DigitcarePT

To test drive, login to existing accounts

Doctor user: jorge@doctors.com pwd: password

Patient user: ddavis@msn.com pwd: password

Wish List

Given more time, our team would develop the ability to:

  • Allow patient to report progress to the doctor by checking off exercises
  • Display patient progress in a chart or sparkline
  • View patient, doctor, and exercise pages with friendly URLs
  • Allow commenting, chat, or emailing between patient and doctor directly from the app

Contributors

With generous support from
  • Alex White, client and consultant
  • The GA TA's, including Nick, Justin, Vikash, and Celeste
  • WDI29 developers
Share this project:

Updates

posted an update

One feature I'm proud of -- turning a user's front-end button press into a back-end edit. It starts with this button press:

    <div class="row">
        <div class="patient">
        <% if @patient.exercises.include?(exercise) %>
                <button class="edit-exercise btn btn-warning" id='<%= exercise.id %>'>Remove</button>
        <% else %>
                <button class="edit-exercise btn btn-info" id='<%= exercise.id %>'>Add</button>
            <% end %>
        </div>
    </div>

which this listener catches and fires a call that POSTs a little JSON to a custom, internal URL:

$(".edit-exercise").click(function(e){
    e.preventDefault();
    if (this.innerHTML == 'Remove') var action = 'remove'
    if (this.innerHTML == 'Add') var action = 'assign'
    sendData(this,action);
    switchAddRemove(this);
    e.stopPropagation();
    return false;
    });

});

function sendData(target,action){
  path = window.location.href.split("/").slice(0,5).join("/")+"/"+action+"_exercise"
  $.ajax({
    url: path,
    type: 'POST',
    data: {ids: {exercise_id: target.id}},
    headers: {
     'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
  },
  });
}

which is a route in Ruby on Rails where the PostgreSQL is affected:

    #special route to assign or unassign exercise to patient
    def assign_exercise
        patient_id = params[:id]
        exercise_id = params['ids'][:exercise_id]
        patient = Patient.find(patient_id)
        exercise = Exercise.find(exercise_id)
        if patient.exercises.include?(exercise)
            render json: {
              error: "This exercise already belongs to the patient",
              status: 412 }, status: 412
        else
            patient.exercises << exercise
            patient.save
            render json: {}, status: 200
        end
    end

    def remove_exercise
        patient_id = params[:id]
        exercise_id = params['ids'][:exercise_id]
        patient = Patient.find(patient_id)
        exercise = Exercise.find(exercise_id)
        if patient.exercises.include?(exercise)
            patient.exercises.delete(exercise)
            patient.save
            render json: {}, status: 200
        else
            render json: {
              error: "This exercise already is absent from the patient",
              status: 412 }, status: 412
        end
    end

Log in or sign up for Devpost to join the conversation.