Skip to content
Small robot workers connect a five-visit product, an AppointmentPlan, one confirmed visit, completion evidence, and a remaining-rights ledger on one workbench
A multi-visit purchase is a right to receive several treatments. It is not a command to occupy every future slot on the clinic calendar.

An N-visit product sounds like a repeated appointment: buy five visits, then put five rows on the calendar. That shortcut loses the business facts that matter after the first visit. A patient can reschedule, miss a visit, receive only part of the care, or have a future benefit changed by a separate commerce decision. A confirmed slot is only one operational promise; it is not the same thing as a purchased right or completed care.

Suppose Patient A buys a five-visit product. The reservation service must answer three different questions:

  1. How many visits did the commerce service sell?
  2. How many obligations has the authoritative clinical evidence completed?
  3. How many obligations are still executable, and which one is ready for a new proposal?

Purchased rights ≠ confirmed appointments ≠ completed care

This article follows one cycle for Patient A and then shows how the next cycle is calculated. The goal is not to invent a single counter for every service. The goal is to keep the purchase contract, the reservation plan, the visit commitment, and the completion fact explainable when the patient’s calendar changes.

Patient A buys five visits, not five confirmed slots

Section titled “Patient A buys five visits, not five confirmed slots”

We generalize the product name, price, clinic, and personal information. The number five is an example that makes the three counts visible; the model works for any positive repeatCount.

TimePatient A action or eventBusiness meaningWhat the reservation service preserves
T1Buys a five-visit productCommerce grants five uses under a product versionPurchase source, purchase ID, and purchase-time catalog snapshot
T2Purchase completion is receivedOne commercial fact must become one executable planOne AppointmentPlan for the authority-qualified purchase
T3The plan is expandedFive future obligations are created, not five calendar slotsPlannedTreatment 1..5, intervals, dependencies, and source history
T4Patient A requests a first dateA preference or proposal input, not consentImmutable BookingPreferenceSnapshot
T5One candidate is proposed and acceptedOne visit becomes a commitmentOne Appointment with the agreed AppointmentItem
T6Patient A attends and the treatment completesOne obligation is fulfilledCompletion evidence, used = 1, and remaining = 4

The first purchase does not create five Appointment aggregates. It creates one plan with five obligations. Only the first obligation that is ready, eligible, and consented becomes an appointment. The other four remain traceable future work even while Patient A’s first visit is held or confirmed.

The word right here means a commercial benefit that Patient A acquired. It is not an authentication or authorization grant. The reservation service does not decide the price or refund eligibility; it preserves the purchase interpretation needed to schedule the benefit.

Total, used, remaining, and reserved answer different questions

Section titled “Total, used, remaining, and reserved answer different questions”

The user-facing screen may display “4 visits remaining,” but the underlying facts should not be collapsed into one mutable integer. After Patient A completes the first visit while the second visit is only proposed, the facts can look like this:

MeasureExample after visit 1Question it answersWhat changes it
Total purchased rights5How many uses did commerce sell under this product snapshot?A new purchase creates a new plan; a product edit does not rewrite this snapshot
Used / fulfilled1How many obligations has authoritative completion evidence fulfilled?A clinical completion or fulfillment event, not a proposal or hold
Remaining executable obligations4How many plan items are still available for future fulfillment?Completion, an explicit future-item cancellation, or another source-qualified business event
Reserved slots0 or 1How many calendar commitments currently occupy capacity?PROPOSED, HELD, CONFIRMED, reschedule, expiry, or cancellation

A future HELD or CONFIRMED appointment can reduce available capacity without reducing used. Conversely, a commerce-approved cancellation of a future benefit can reduce executable obligations without pretending that Patient A received care. A no-show is an attendance fact and a policy input; it is not automatically a consumed visit.

The practical rule is simple: show “remaining rights” from plan and source-qualified business facts, and show “reserved slots” from appointment commitment facts. Never subtract a visit merely because a calendar row was created.

One purchase becomes one plan, then multiple PlannedTreatment items

Section titled “One purchase becomes one plan, then multiple PlannedTreatment items”

The selected model keeps the purchase boundary and the physical visit boundary separate:

Purchase 1 ──> AppointmentPlan 1 ──> PlannedTreatment 1..N
│ fulfills / attempts
Appointment 1 ──> AppointmentItem 1..N ──────┘
└── ResourceAllocation 1..N

One AppointmentPlan belongs to one authority-qualified purchase:

  • sourcePurchaseAuthority and sourcePurchaseId identify the purchase source and original fact.
  • catalogSourceAuthority, productId, and catalogVersion preserve the product interpretation used at purchase time.
  • Each PlannedTreatment keeps its sequence, expected duration, required capabilities, and interval constraints.
  • A later purchase creates a new AppointmentPlan; it is not silently merged into the first plan.

sequenceNo is useful metadata for “visit 1” or “visit 5.” It is not a child aggregate that owns a calendar. A physical visit is represented by Appointment; the treatment obligations attempted in that visit are represented by AppointmentItem. A single visit may include compatible items from more than one plan, but each item remains linked to its own purchase and planned treatment.

This distinction matters when Patient A buys another five-visit product later. The second purchase may share a visit with the first plan if the items are clinically and operationally compatible and the patient consents. It must still retain a second plan, a second purchase source, and separate remaining obligations.

Why we do not confirm all five appointments at purchase time

Section titled “Why we do not confirm all five appointments at purchase time”

The product snapshot can tell us that five obligations exist. It cannot know every future commitment at the moment of purchase:

  • The preferred interval may be measured from the actual completion of the previous treatment, not from the purchase timestamp.
  • Clinic hours, practitioners, rooms, and equipment can change before the next visit.
  • Patient A may want a different date, and a confirmed change requires a new proposal and consent.
  • A first-booking rule such as WithinDaysAfterPurchase is a limited fallback for the first proposal. It is not benefit expiry and it is not automatic confirmation.
  • Confirming all five slots would overstate capacity and would create promises Patient A has not yet reviewed.

The commitment states make that distinction explicit:

StateWhat Patient A seesCapacity meaningIs the product right used?
PROPOSEDA candidate time, item, and resource to reviewNo durable commitment; policy may still recalculateNo
HELDA short provisional holdCapacity is occupied until the hold expiresNo
CONFIRMEDOne consented visit promiseThe agreed visit occupies capacityNo, not until completion
COMPLETEDThe visit/item was actually fulfilledHistorical fact, no future slot occupancyYes, for that planned treatment

The first three states concern a visit commitment. The last fact concerns care completion. They must not be inferred from one another by a UI counter or a retry handler.

Patient A's five-visit purchase becomes one AppointmentPlan, five planned treatments, one candidate and confirmed visit, completion evidence, and four remaining obligations; rescheduling, no-show, and partial completion stay separate exception paths
One purchase creates five planned obligations, but only one consented visit enters the calendar at a time. Completion evidence changes the used and remaining counts; a hold, reschedule, or no-show does not.

The next visit is a new proposal, not a rewrite

Section titled “The next visit is a new proposal, not a rewrite”

After visit 1 completes, the reservation service uses the completion fact as the anchor for the next eligible obligation. It does not move a pre-created appointment row from “visit 2” to a new date because no such confirmed row should have existed.

CycleFact for Patient AReservation interpretationNext action
First cyclePlannedTreatment 1 completes at the clinicused = 1; item 2 is still PLANNEDCalculate a candidate using the actual completion time and policy
Next proposalA date satisfies interval, resource, and clinic rulesA new PROPOSED or HELD offerAsk for consent; do not reuse an old confirmation
ReschedulePatient A requests another time before the visitThe offer or commitment changes, not the purchase totalExpire or replace the proposal and retain the reason
Second completionItem 2 completesused = 2; remaining obligations become 3Repeat the cycle for the next eligible item

The predecessor’s actual completion is especially important when care is interrupted. If a treatment started on Monday but its clinical completion arrives on Wednesday, the next interval is calculated from Wednesday. A purchase date or an abandoned proposal is not a clinical milestone.

Rescheduling, cancellation, and no-show change different facts

Section titled “Rescheduling, cancellation, and no-show change different facts”

“The patient did not keep this calendar entry” is not enough information for the next service. The reservation service preserves an objective appointment fact and hands the decision to the owner of the next business rule.

SituationReservation factEffect on the five-visit rightNext owner or action
Proposal expires or is declinedThe offer never became a confirmed commitmentNo use is consumed; the planned treatment remains availableCalculate a new proposal or contact Patient A
Confirmed visit is rescheduledThe original commitment and the new proposal are both auditableThe purchase total and used count stay unchangedNew time/resource offer and customer consent
Patient is a NO_SHOWAttendance did not occur for the confirmed visitDo not decrement used automaticallyApply an explicitly approved policy and provide an objective CRM handoff
Visit is partially completedCompleted items and unfinished items are separatedConsume only the authoritative completed item(s)Defer unfinished work and create a linked attempt
Clinic disruption affects a confirmationThe affected resource, time, and commitment history are preservedNo silent consumption or deletion of the purchased rightNew proposal, explanation, and customer consent

A hospital may decide that repeated no-shows require a reconfirmation step, a deposit, or a counseling call. It may also define a transparent priority policy for VIP customers. Those are operating or commerce/CRM policies with their own source data and approval. They are not a hidden decrement in the reservation service, and they are not presented here as a current product feature.

The data flow becomes easier to review when each service can answer a different question about Patient A:

Business areaSource of recordFact exchangedReservation service responsibility
Product managementVersioned product, BOM, repeat count, intervals, and resource requirementsCatalog projection or synchronization eventValidate and preserve the purchase-time scheduling snapshot
Commerce / purchasePurchase contract, entitlement, refund, and original purchase IDPurchaseCompleted, refund, or plan-cancel eventCreate one plan per purchase and apply external entitlement decisions to future obligations
ReservationPlan, planned treatments, proposals, holds, confirmations, and appointment historyObjective appointment event and durable outboxOwn time, capacity, commitment state, and audit history
Clinical careActual start, completion, and partial completionCompletion or fulfillment factReflect completion in the plan and calculate downstream eligibility
Counseling / CRMCustomer profile, no-show conversation, complaint, compensation, and service tier decisionDelay, no-show, cancellation, and reschedule factsProvide an objective handoff; do not decide the counseling outcome
Notification and analyticsContact consent, delivery history, projections, and metricsReservation event and schema contractKeep channel delivery and read models outside the reservation transaction

sourceAuthority in these contracts means the source-of-record service that owns a fact. It is not a user role, permission, or claim that the reservation service can mutate another service’s data. The same boundary protects the meaning of “used”: a calendar commitment can be reported by reservation, while treatment completion comes from the clinical source and entitlement/refund decisions come from commerce.

Current implementation, approved design, awaiting operations, and roadmap

Section titled “Current implementation, approved design, awaiting operations, and roadmap”
Evidence labelScope in this articleQuestion for the reader
Current implementationVersioned catalog projection, one purchase-to-plan identity, repeated PlannedTreatment expansion, preference snapshot, and plan/item statesCan the contract be found in the observed source and tests?
Approved designOne-at-a-time candidate, PROPOSED · HELD · CONFIRMED, completion anchored follow-up, and explicit exception pathsIs a design document being described as an already deployed API?
Awaiting operationsBroker delivery, clinical/commerce event integration, notification outbox canary, and production backfill/readinessHas delivery, replay, and recovery been proven in operation?
RoadmapPatient-facing consent for later proposals, concrete no-show penalties, and an explainable VIP priority policyHave undecided policies been mistaken for current behavior?

The current foundation creates a plan and its planned treatments; it does not mean that every clinic already offers a complete five-visit commitment workflow. The approved design describes the boundary that later candidate, capacity, consent, and disruption work must honor. Keeping those labels visible is part of the technical contract.

An N-visit product repeats the same kind of care. The next article turns to a package product: how a product BOM becomes a graph of treatments with different durations, dependencies, and possible visits, without flattening it into one appointment or one remaining counter.

These companions supplement the source design; they do not replace the article or the clinic-appointment source repository.

Comments

Leave a note or reaction with your GitHub account.