npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

doctorappointmentscheduler

v1.0.1

Published

Solution to Luma Test Technical challenge

Downloads

4

Readme

Luma Technical Interview

install the library with following command:

npm install doctorappointmentscheduler

Postman Test Cases are included in this repo under Postman directory

Technical and Functional Design is mentioned and expanded on the Readme.

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!

Problem Definition

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.

Interview Task

Create a REST API that enables a simple scheduling system that manages doctor availabilities and allows patients to book appointments.

Data Model

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

REST API

Implement the following functionality:

  • Find a doctor's working hours
  • Book an doctor opening
  • Create and update the list of doctor's working hours

Deliverables

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.

Functional Design:

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:

addNewDoctor:

User posts the Doctor Details in the request body.

this method stores the Doctor Details in the Doctor_Detail collection.

getWorkingHoursDoctor:

Method gets the email of doctor as parameter

Returns the list of Shedule of Doctor for eg:

6/6/2018 01:00:00 YES <- This means that Doctor is Available on the 6th june at 01 hours.

bookDoctorOpening:

User posts the Date Time and email info to this Method.

Method Fetches the Doctor from the collection using email then gets the schedule availability.

Method then goes on finding the requested Date and Time in the Schedule if found it check if the Doctor is available

If the Doctor is available it changes the Doctor availability to NO.

Method then creates the new Appointment in appointment collection with following information:

Patient phone no, Doctor email, Date and Time.

createUpdateWorkingHoursDoctor:

User posts the The Schedule and Email of the Doctor.

Method then fetched the Doctor by email it then updates the schedule.

For eg:

User posts the availability as: Doctor_Email : [email protected] 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.

Tests:

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.