How We Built an Online Health Consultation Marketplace
- 140039 views
- 9 min
- Aug 23, 2017
Millions of people suffer from diseases due to unhealthy and sedentary lifestyles. Lots of health-related issues, however, can be prevented if a person gets a consultation from a qualified health practitioner and strictly follows the advice given. Yet getting an appointment with a health practitioner can be quite a challenge with the hectic lifestyles of modern people.
Our clients, a qualified nutrition expert and an accredited practicing dietician, came up with an idea of a live online nutrition clinic to help people keep fit and live healthy lives. The health consultation marketplace our RubyGarage team helped to build allows practitioners to have live video conversations with their patients to design individual meal plans and exercise routines. Moreover, health practitioners can monitor their patients’ daily results and adjust their plans if needed. Our clients’ application is available from any part of the world, so patients don’t need to waste time in waiting rooms and can book consultations at a time convenient for them.
When our clients reached out to RubyGarage, their project had already been under development but they didn’t have a production version. Moreover, they wanted to significantly upgrade the application, so our team had to accomplish the following tasks:
- Check the integrity of the existing code and analyze it for bugs and vulnerabilities
- Get the application ready for further improvements and upgrades
- Scale up the application in order to make it capable of handling lots of traffic
- Ensure scalability of the business model
- Make the application responsive and convenient for users
- Provide tools for streamlined communication between health practitioners and patients
- Make the application accessible from mobile devices via a native mobile app
- Add an ecommerce solution to let patients buy items prescribed during a consultation
- Develop content marketing solutions to attract more clients
With so many challenges to cope with, our team got down to work. Since our clients’ project was a startup, we had to find the best solutions in the shortest possible time.
Our rescue mission started with a thorough analysis of the initial code. We used several code quality gems (including AbstractAnalyzer, Brakeman, RailsBestPractices, and RubyCritic) and discovered lots of code smells and security vulnerabilities and several major problems with the app architecture in general. Our team implemented best practices to refactor the code and fix all critical problems.
The initial code came without automated tests, so the application was likely to malfunction if new functionalities were added. To ensure the quality of the application, our team wrote automated tests with the help of Ruby gems including RSpec, DatabaseCleaner, Capybara, VCR, and PhantomJS.
To ensure scalability of the business model, our team implemented full-scale marketplace functionality.
Our clients wanted to let other skilled health practitioners consult patients, so we implemented this functionality. Once approved by the moderators, other health practitioners can choose between one of two subscription models: free or paid. The difference lies in the amount of commission charged by the health consultation marketplace.
Patients, in turn, can choose either basic or premium membership; needless to say, premium membership offers a richer set of features. Patients can re-schedule their appointments as needed.
To make the web application responsive and user-friendly, our team decided to transform it into a single-page application that’s fast and doesn’t need to frequently refresh the page. We used AngularJS to implement dynamic page rendering.
Efficient communication tools
To ensure efficient communication between practitioners and patients, the health consultation marketplace required live video and text chat. The initial version of the application already had a live video chat integration based on the OpenTok WebRTC platform. Our team added the Faye messaging system for live text chat. Thanks to these solutions, health practitioners can not only see their patients, but message them as well. For example, they might message the names of health products or medicines.
We also made it possible for practitioners to leave recommendations on the personal profiles of their patients.
We developed a mobile application for iOS to help patients receive online face-to-face consultations with health practitioners anywhere and anytime. The iOS application also allows patients to message their practitioners during video calls and leave feedback after consultations.
Since our clients’ application was a health consultation marketplace, patients needed to be able to purchase their prescribed health solutions right on the website. Our RubyGarage team implemented an online store based on Spree, an effective tool for powering storefronts. Patients can buy not only health foods and supplements, but digital products as well (such as exercise and diet plans).
There are two types of exercise and diet plans to choose from: standard (based on diseases) and custom (developed by a health practitioner individually for each patient). After patients have bought a digital product, it’s uploaded to their personal profile.
Our clients’ application also required an effective marketing strategy to find and attract new users (practitioners and patients alike). First of all, our team implemented a blog managed by health practitioners; the blog helps patients quickly find answers to some of their questions. Secondly, we added a special health directory where patients can find detailed information about the most common diseases and their symptoms. Next, our team implemented support of promotional codes; health practitioners can send emails with promo codes to their patients. Finally, we made it possible for application admins to edit meta tags to optimize search engine results.
- Programming language
- Web server
- Nginx – a high-performance and easy-to-configure HTTP server
- PostgreSQL – an object-relational database
- Application server
- Puma – a highly concurrent application server for Ruby on Rails
- Web hosting
- Amazon Web Services – the world’s leading cloud services platform
- Configuration management tool
- Chef – a tool for server configuration and management
- Messaging system
- Faye – a publish-subscribe messaging system
- Payment service
- Stripe – an online payment processing system
- File storage
- Amazon S3 – highly scalable cloud-based storage
- Performance and bug tracking
- Airbrake – a bug tracking tool for detecting and fixing errors in code
- Social media
- Mobile messaging service
- Twilio – messaging software that can send programmable SMS messages as well as make programmable voice calls and more
- Live video and voice service
- OpenTok – a WebRTC platform for integrating live video chat into web applications
Working on the project, our team faced several significant challenges, so we’d like to show you how we overcame them.
Selecting the most suitable payment system
Being a marketplace, the application required a reliable online payment system. Patients had to be able to pay for consultations and purchase products in the in-app store, while practitioners needed to get paid for their services. Moreover, our clients needed to manage transactions in the payment system in order to monitor the quality of consultations and settle possible financial disputes between patients and practitioners.
Our team carried out market research to find the most suitable online payment solution. Out of several payment systems (Braintree, Stripe, PayPal, Dwolla, etc.), we opted for Stripe as it was the best in terms of management, configurability, integration, and reliability.
Stripe allowed our team to fully implement the control logic of payments in the application. Money earned by health practitioners is kept on their custom Stripe accounts (created automatically during registration), which are managed by the administrators. Once a week, administrators transfer money from these custom Stripe accounts to practitioners’ bank accounts. This allows administrators to check the quality of consultations and receive feedback from patients before making payments to health practitioners.
Making the application scalable
Being online, the health consultation marketplace had enormous potential for expansion, as it could be used by patients (as well as health practitioners) from other any part of the world. Therefore, our team faced the challenge of building a truly scalable application that would work well if the number of users grew.
This task required an appropriate cloud service. Our team opted for Amazon Web Services (AWS), the top cloud services provider in the world. AWS provides a variety of cloud-based solutions that help build amazingly scalable applications. We used several Amazon services: Amazon Simple Storage Service (also called Amazon S3) for storing and backing up files in the cloud; Amazon Relational Database Service (or simply Amazon RDS) for administering a PostgreSQL database; and Amazon Elastic Compute Cloud (commonly known as Amazon EC2) for running the application on virtual machines in combination with the Auto Scaling feature for automatically scaling Amazon EC2 capacity.
Bringing the application to life as soon as possible
The initial code we received was of terrible quality, which made any further development of the application extremely difficult. Yet the project was a startup, so our team had to deliver a fully-fledged application really fast.
Therefore, our team drew up a detailed plan for getting the code up and running. We started by fixing errors and bugs in the initial code. For example, it contained the Refinery CMS, which was useless in the application, so we decided to simply remove it. Also, the application didn’t have a proper authorization system, so our team added the CanCanCan gem to fix this problem.
Once the initial code was put in order, we moved on to writing and running automated tests to ensure that the application was ready for further upgrades. As a result, we delivered a scalable and reliable application with smooth and secure code.
Our team successfully coped with all the tasks and delivered a top-notch application that brings together experienced health practitioners and patients. If you have an idea for a similar app, our team can help you turn it into a fully-fledged product.
Subscribe via email and know it all first!