npm install doctorappointmentscheduler
The solution for this library is punlished on public npm repo. Name: doctorappointmentscheduler.
Things that i can add while a PR is open: Authentication using passport. Method and class documentation. More test cases!
A busy hospital has a list of dates that a doctor is available to see patients. Their process is manual and error prone leading to overbooking. They also have a hard time visualizing all of the available time for a doctor for specific dates.
Create a REST API that enables a simple scheduling system that manages doctor availabilities and allows patients to book appointments.
Define a set of data models that include:
- a way track assign booked appointments
- a way to track patients
- a way to track doctors
- a way to track a doctor's working hours and days
Implement the following functionality:
- Find a doctor's working hours
- Book an doctor opening
- Create and update the list of doctor's working hours
The code should be delivered as a library that anyone can import and use. It should contain documentation and unit tests that show your understanding of the problem. Once you're finished, submit a PR to this repo.
The Solution is layered as Standard MVC pattern with an additional Service layer for making the solution reusable.
The app.js file is the entry point for this REST api.
Flow for the requests:
app -> Routes -> Controller -> Service
The core logic is in the file: appointmentSchedulerService.
The BDD Test are contained in the file appointmentSchedulerTest under test folder.
The core Functionality is defined as follows:
6/6/2018 01:00:00 YES <- This means that Doctor is Available on the 6th june at 01 hours.
Method then goes on finding the requested Date and Time in the Schedule if found it check if the Doctor is available
Patient phone no, Doctor email, Date and Time.
User posts the availability as: Doctor_Email : hiteshka@buffalo.edu YES : 6/6/2018 YES : 9/9/2018 YES : 2/2/2018 NO : 1/1/2018 NO : 3/2/2018
This will create the Schedule of the doctor with above entries in the Availability. This will also update the exsisting entries for eg:
if the earlier "NO : 9/9/2018" but since now the user has posted the new schedule as : YES : 9/9/2018 this will update the info in the schedule.
I am following the BDD. Mocha and chai are used for test cases. You can clone the repo on the local and load the test config from config folder.