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

@renoirb/availability-appointment-model

v0.2.1

Published

Availability and appointment Data Model

Downloads

2

Readme

@renoirb/availability-appointment-model

| Version | Size | Dependencies | | -------------------------------- | ------------------------------ | ----------------------------------------------------------------- | | npm | npm bundle size | Libraries.io dependency status for latest release |

Assuming we want to expose time slots to make appointments, we want a way to describe an availability schedule. An availability schedule (e.g. a professional is available for appointments on mondays in the afternoon, etc.) is spanning a number of days (e.g. a week, or any number of days), and can be repeated. Each day of that availability schedule (i.e. a collection of days) can have a shift (i.e. between 09:00 and 17:00).

With this model, we can have an availability schedule described as like this, say:

availabilities:
  - tz: America/Montreal
    label: Summer schedule
    days:
      - label: Monday
        shifts:
          - begin: '13:00'
            end: '19:00'
            label: 'Lazy monday'
      - label: Tuesday
        shifts:
          - begin: '09:00'
            end: '12:00'
          - begin: '13:00'
            end: '18:00'
      - label: Wednesday
        shifts:
          - begin: '09:00'
            end: '12:00'
          - begin: '13:00'
            end: '18:00'
      - label: Thursday
        shifts:
          - begin: '09:00'
            end: '12:00'
          - begin: '13:00'
            end: '18:00'
      - shifts:
          - begin: '09:00'
            end: '12:00'

This example is showing a typical white collar 09:00 to 17:00 work week, but this data model should be flexible enough to support more complex use-cases.

/**
 * A time slot
 */
export interface IShift {
  label?: string
  shifts: IDay[]
}

/**
 * Time Slots we can make appointments for that day
 */
export interface IDay {
  label?: string
  shifts: IDay[]
}

/**
 * Aggregate root, a description of shifts time-slots per day.
 */
export interface IAvailability {
  /**
   * The TimeZone in which the schedule is assuming hours are for
   */
  tz: string
  label?: string
  days: IDay[]
}

/**
 * When an availability is in effect.
 * The `beginDate` determines the relative date based on the days index.
 */
export interface IAvailabilitySchedule extends IAvailability {
  beginDate: Date
}

Each schedule are "templates", in a system, we would have to have such a schedule to have a start date, where we'd be able to query if today's date, according to the start date, if we can make an appointment.

The difference between a template and an effective schedule would be with the presence of a beginDate.

There are other aspects that can be expanded, but we will continue this another time.