DEV Community

zain2323
zain2323

Posted on

Doctorly API ~ A backend solution for appointing doctors online

Overview of My Submission

Obtaining an appointment with a doctor for a checkup is commonly observed to be time consuming and demanding. Usually, there are already booked slots and long waiting lists, so going to the hospital or clinic goes in vain. A patient may be late for a new appointment for any reason, and the slot may be filled by someone else.

A proposed solution is to have a complete backend system that can manage booking slots in advance, patient's appointment history and much more. By utilizing this API, a user can check the available slots for a doctor he wishes to see, from home. The patient does not have to stand in long lines to learn about the doctor's expenses or know the free slots or to get an appointment. All of this can be done from any client application that can consume this API.

Technical Overview

I have used Flask Framework with PostgreSQL as a primary database with Redis as a caching solution on top of PostgreSQL to avoid querying data again and again. When the user will request the data, it will be first searched in the cache and if it happens to be the cache hit, then it will be returned to the client without querying the database and hence overall performance will be improved. In the cache miss, the requested data will be returned to the user by querying the database. The data will be cached in the Redis database to save time if the user requests the same thing again. All the data in the Cache will automatically expire after a particular amount of time.

To provide search functionality, I have used Redis JSON and RediSearch modules. The client application can search the doctors by name, specializations, qualifications and by day. Important thing to note here is that not all of the data that is saved in relational database is replicated in Redis JSON but only the data that is related to the doctor is replicated. The data in Redis JSON is kept in sync with the relational database to avoid providing inaccurate search results.

System Architecture

Features

  • User registration, login and logout
  • Search functionality to search for doctors by different attributes
  • Separate endpoints for Doctor like registration and creation of profile.
  • Complete appointment history of the patients

Future Expansions

  • Email recovery and password reset support.
  • Real time Notifications.
  • More advanced search functionality.
  • A client application that consumes this API
  • Integration of rating service.
  • Patient's prescription, recommended diet plan, next appointment date, reminders about workout and much more.
  • A robust recommendation service so that the patients always get the most reliable doctors on the home screen.

Submission Category:

MEAN/MERN Mavericks

Language Used

  • Python
  • Flask Framework

Redis Features Used

  • Redis as a Cache
  • Redis JSON
  • RediSearch

Link to Code

GitHub logo zain2323 / docterlyapi

Backend for the doctor's appointment application

Doctorly API

Obtaining an appointment with a doctor for a checkup is commonly observed to be time-consuming and demanding. Usually, there are already booked slots and long waiting lists, so going to the hospital goes in vain, especially in post-Covid time.

I devised a solution to these issues. Utilizing this backend system, any client application, be it web-based or mobile can be made that provides the solution to the above issues.

Home Page

Api Home Page

Register Page

Api Register Page

Sign in Page

Api Auth Page

Slots Page

Api Slots Page

Redis Cached data

Api cache

How it works

Let's first understand the application architecture

  1. Client will request the data from the REST API.
  2. The API will first check the requested data in Redis Cache
  3. If a cache hit occurs, it will directly return the data to the client.
  4. If the API did not find the requested data in Redis Cache, then it will issue the query to the relational database. Upon the…
to share a GitHub repository)

BTW, your Github code’s README file should contain the details as per this template.

Additional Resources / Info

  • Home Page

Home Page

  • User Registration

User Signup

Top comments (0)