Doctorly API ~ A backend solution for appointing doctors online
Tags: redishackathon
Published: 2022-08-29 17:33:48


### 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehjty2agqy7ztq6a7p2z.png)

### 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

{% embed https://github.com/zain2323/docterlyapi %} to share a GitHub repository)

BTW, your Github code’s README file should contain the details as [per this template](https://github.com/redis-developer/hackathon-docs/blob/main/README.md).

### Additional Resources / Info

- Home Page

![Home Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tutw3j9qj979qkiehrlq.png) 

- User Registration

![User Signup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9xw78rinpgouadm4t4e.png)


* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._