Jan Kaczorowski
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Constrained Product availability for appointments [TOC] ## Business Requirements: ### R1. SPs in certain time periods should be excluded from Housecall routine and be committed to stationary Service Center duties. In such case all services that this SP is able to provide are available. ### R2. In certain cases (Vaccination) service entries should be limited to only some products (subset of those SP is able to provide). This is likely not to be a very frequent case. ### R3. Booking acts as a container (and time frame) for Appointments. ### R4. Booking can be assigned to multiple ServiceProviders. We assume that if 3 SPs are on a booking, they are blocked for entire duration of the booking. ### R5. SlotCalculator should be able to produce timeslots (Appointments) from either of the two: - ServiceCenterRules (as it is now) - Bookings (used as a rule, you pass[time period, people_count, product, slot_duration, slot_interval]) ### R6. Some functionalities of Vaccinations current implementation should be transplanted to Appointments, to make Appointment engine default solution. In particular, checkboxes should be dependant on the product ## Solution proposals: ### for R1: We'd add a `service_center_id` column to `calendar_entries` if is NULL <- calendar_entry is for housecalls if not null <- calendar_entry is for stationary services (clinics) we can ditch current relation ServiceCenters <> ServiceProviders. Outdated ### for R2: We'd add a relation CalendarEntry many-to-many V2::Product CalendarEntry has_many ProductCalEntryAssignments CalendarEntry has_many V2::Products, throu**gh: ProductCalEntryAssignments if **calendar_entry.products.count.zero?** in this CEntry all products that SP is able to provide are available.else (calendar_entry.products.count.positive?) in this CEntry only those products are avaliable. ### for R3: - Booking has_many Appointments (hyphotesis). Appointment belongs_to Booking, optional: true there's actually a pretty clear separation of concerns between the two models: Bookings <- are important in terms of SP availability planning, business consequences to orders and sales, but do NOT answer to a question how (if a booking is for 4h and 100 ppl) to process all these patients Appointments <- Have no direct impact or meaning to the Orders, LineItems, sales and what-not. They just answer the question, how to break down booking time and patients efficiently, so that 1 or several SPs tending them, could effectively provide services. Hence need of time slots. ### for R4: Booking HABTM ServiceProviders (join table) **we need some safeguards to make sure that the supply is guaranteed for every booking** [TDP] R5. SlotCalculator should be able to produce timeslots (Appointments) from either of the two ### for R5: SlotCalculator should either accept mode param and (booking | regular_params) or maybe better: we should have a tiny abstraction layer on top of that :-) ### for R6: We create a new relation eg. CheckboxQuestion HABTM (many-to-many) with V2::Product. That way we'll define the checkbox questions on per-product basis. no more hardcoding stuff. ### Matching strategy 2.0 (Concept) there are 2 modes of querying for Availability - housecalls - clinics **if(mode=housecalls)** - we only pick calendar_entries.where(service_center_id: nil) - we ignore service_center_rules - we check against ongoing/booked appointments and bookings in the given scope - we apply coverage_maps/proximity/distance logic **if(mode=clinics)** - we ignore coverage_maps/proximity logic - we apply service_center_rules - we check against ongoing/booked appointments and bookings in the given scope - we check for CalendarEntry<>ServiceCenterId assoc - we abandon V2::Product <> ServiceCenter assoc **common for both modes:** - we first create a booking - then we create one or more underlying Appointment - we deduce product availability from CalendarEntries->ServiceProviders->V2::Products - we check for product list overrides in CalendarEntries<>V2::Product assoc. ## Big questions and doubts? ### Q1. On which levels to enforce/guard doctors availability? on Booking level or on Appointment level #### arguments for booking level: easier because it's how it is now. #### arguments for appointment level: future-proof-ity? If, at some point we'd like to have to have time-ranged bookings, it's nice to have a booking of 3hrs, that'll really manifest itself as a 30min-long Appointment assigned for a booking, appointment which you can safely move around within that 3hrs range. Then, for ex. 1h prior it taking place you can move it (still within 3hrs), or reassign to some other SP (provided he's available)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully