Stela Mihova
DESIGN SYSTEM 
Page 1Page 2Page 3Page 4Page 5Page 6Page 7Page 8Page 9Page 10Page 11Page 12Page 13Page 14Page 15Page 16Page 17Page 18Page 19Page 20Page 21Page 22Page 23Page 24Page 25Page 26
AGENT DESIGN SPECS
Page 1Page 2Page 3Page 4Page 5Page 6Page 7Page 8Page 9Page 10Page 11
DEVELOPER HANDOFF

Doc Connect / Care Guide — Developer Handoff

Updated: 23 November 2026

Scope and source of truth

This document describes the current conversational search and booking implementation, the latest product requirements, and known gaps. It is a developer handoff, not a claim that every requirement in earlier design documents is implemented.

Later explicit product instructions override older diagrams and PDFs. In particular:

  • Partial matches may proceed to booking review.
  • Follow-up and prescription renewal now go directly to clinic selection, not day/run-out questions.
  • Guest authentication happens when entering booking, in the same side panel.
  • Appointment requests saved by the current application are not automatically confirmed clinic appointments.

1. Product behavior

Care Guide entry points

Offer these four conversation starters:

  1. Tell me your symptoms
  2. Urgent care
  3. I know my specialist
  4. Lab tests & imaging

Follow-up and prescription renewal belong inside the known-doctor journey, not in separate starter tiles.

The normal application header has a guest sign-in button. Do not add a separate sign-in control to the Care Guide header or restore the removed floating bottom chat bubble.

One side panel throughout

Keep conversation, clinic selection, authentication, and booking in the same panel:

Conversation → Clinic selection → Guest authentication, if needed → Booking form

Never open another sidebar underneath or behind the active panel. Desktop panels share the existing approximately 420px width. Mobile layouts must fit the viewport without horizontal overflow.

2. Known doctor: follow-up and prescription renewal

Required journey

I know my specialist
  → Patient enters the doctor's name
  → Show matching doctor identity
  → Offer direct Book, Follow-up, and Prescription renewal
  → Follow-up or renewal selected
  → “See available medical centers.”
  → Show clinic-location cards for that doctor
  → Patient selects a clinic
      → Guest: sign in or create an account
      → Signed in: booking form immediately
  → Review accepted coverage, date preference and visit details
  → Explicitly save

Clinic cards

Each card displays:

  • Medical-center name, when recorded; otherwise a neutral “Medical center” label.
  • Listed address.
  • Selected doctor's name and specialty.
  • One booking action, or a contact action for an external/contact-only clinic.

Rules:

  • Only use locations linked to the selected doctor.
  • Do not substitute another doctor of the same specialty.
  • Do not invent a second center to fill the layout.
  • Deduplicate repeated addresses.
  • If only one location is listed, show one card.
  • “Available medical centers” means listed locations, not verified appointment-slot availability.

Current implementation identifies additional location records by normalized doctor name and matching category, then deduplicates normalized addresses. A stable provider identity with separate clinic-location records would be safer if the directory grows; matching names alone is not an authoritative identity registry.

No intermediate day or location questions

Do not offer Today / Tomorrow / Later / Not sure pills or ask when medication runs out in this journey.

Do not make patients re-enter city/postcode before showing the selected doctor's centers. Preserve previously supplied location, coverage and preferred date.

Legacy conversations that still contain the retired run-out question resume at clinic selection.

Preserve the visit purpose

Selection Conversation intent Booking reason
Follow-up follow_up Follow-up
Prescription renewal prescription Prescription renewal

Keep the selected doctor, clinic record, and purpose through login/signup and into the booking form.

Renewal uses accepted public or private coverage, not Self pay. Clear a previously selected Self pay value only for this local renewal journey; do not overwrite the patient's saved preference globally.

Selecting renewal does not guarantee a prescription. A clinician decides whether renewal is appropriate.

3. Symptom journey

Patient describes symptoms
  → Safety checks / triage
  → Tentative, symptom-appropriate specialist suggestion
  → Coverage pills immediately
  → Collect only missing search details
  → Exact or same-specialty partial results
  → Select doctor and enter booking review
  • Base the recommendation on the patient's own words.
  • Consider multiple complaints together.
  • Do not repeat denied symptoms as though they were present.
  • Use tentative wording such as “may be a suitable starting point.”
  • Never diagnose, prescribe, or display generated medication instructions.
  • Use primary-care guidance when symptoms are unclear rather than inventing a precise specialty.
  • Do not choose an unrelated specialty merely because the directory has doctors in it.
  • Routine duration questions must not delay the initial coverage pills.
  • New symptom journeys show coverage choices even when a preference is saved.

The visible acknowledgement uses controlled symptom descriptions. The triage model's free-text diagnostic summary is not displayed as clinical advice.

4. Coverage and location

Coverage

Use pills for insurance selection:

  • Public healthcare
  • Actual listed private insurers
  • Self pay, except in prescription renewal

Known-doctor booking must use that doctor's accepted options. Selecting a coverage pill is not consent to save a preference to the account.

Saved coverage may be displayed inline with a Make a change link. Avoid duplicate prompts, repeated action pairs, or extra authentication controls.

Public specialist booking normally requires referral confirmation. Do not silently replace the patient's coverage when a doctor does not accept it.

Location

  • Accept city, street, or postcode.
  • Retain the original supplied location across specialty/coverage changes.
  • Do not ask for it again unless the patient explicitly changes it or it is missing.
  • Do not pad malformed postcodes into invented valid codes.
  • Missing clinic postcodes cannot count as exact postcode matches.
  • A known city can still support a partial location match.
  • Do not claim “nearest” without reliable location/distance evidence.

The current search uses address/city/postcode evidence, not verified distance-based geocoding.

5. Exact and partial matches

Required behavior

When filters do not match exactly, show doctors of the same requested specialty, allowing differences in:

  • Region/location
  • Private insurer
  • Public healthcare eligibility
  • Self pay, where the journey permits it

Explain the relevant differences on the cards. Partial matches can open booking review; this is not permission to silently accept incompatible coverage or bypass validation.

Never fill partial results with unrelated specialists solely because their insurance or location matches.

An established specialty remains authoritative across location/coverage edits. Only a deliberate patient specialty change or appropriate new safety/clinical routing should replace it.

Important directory limitation

Alternatives can only be shown if that specialty exists in the directory. The current catalog does not cover every specialty to which triage can route, including primary care. Therefore, the product goal of always showing a same-specialty alternative is not fully satisfied.

Do not solve absent provider supply by inventing doctors, claiming unsupported coverage, or relabeling an unrelated specialist.

6. Urgent care and safety

  • Show a clickable tel:112 call action immediately when Urgent care is selected.
  • Emergency red flags override insurance collection and booking.
  • Preserve mental-health crisis guidance, including 024 where appropriate and 112 for immediate danger.
  • Do not imply same-day availability from an urgent date preference.
  • Hospital directions or distance claims must be supported by actual location data.
  • Keep urgent-care continuations in the existing panel.

7. Authentication and booking

Guest

Selecting a bookable clinic opens Sign in or create an account inside the booking panel. Nothing is submitted automatically.

Successful authentication returns to the selected doctor's booking form, preserving the clinic and visit purpose.

Signed-in patient

Selecting a clinic opens the booking form directly, without another login prompt.

The form validates required details, accepted coverage, and referral requirements. A partial mismatch must remain visible and resolvable.

Save outcome

After a successful local save:

  1. Show only “Your appointment has been saved.”
  2. Close the booking panel.
  3. Navigate to /appointments.

Do not add another confirmation recap or a required Done action. A failed save keeps the form open and must not navigate away.

Server ownership comes from the authenticated session, never a patient/user ID supplied by the client. Legacy ownerless appointments must not be assigned by guessing from names or emails.

Booking truthfulness

The current flow saves an appointment request/preferred date, not a live confirmed slot.

Calendly has been connected, but the application does not yet provide the fully integrated live-slot selection and confirmed-booking behavior previously requested. Do not describe this handoff as confirmation that this integration is complete.

External/contact-only clinic records open contact information rather than pretending that an appointment has been booked.

8. Implementation map

File Responsibility
shared/doxy.ts Conversation filter state and structured block types
shared/doxy-presentation.ts Deduplicate presentation/actions and constrain same-specialty result cards
shared/specialist-search.ts Specialty aliases and normalized name matching
shared/location-matching.ts Address/city/postcode match evidence
shared/doxy-safety.ts Red flags, emergency blocks and crisis contacts
shared/verified-clinics.ts Verified external-clinic metadata and contact-only behavior
server/doxyAgent.ts Turn orchestration, deterministic shortcuts and controlled tool/model interaction
server/doxyNamedDoctor.ts Name lookup, purpose selection and clinic choices
server/doxyTools.ts Actual provider lookup, coverage checks and booking preparation
server/doxySymptomGuidance.ts Controlled symptom-specific recommendation copy
server/healthAssistant.ts Triage model instructions and legacy assistant support
server/appointmentRoutes.ts Authenticated appointment retrieval and save validation
client/src/components/DoxyChat.tsx Conversation rendering, state and booking handoff
client/src/components/DoxyBlockRenderer.tsx Structured blocks, pills and clinic cards
client/src/pages/Home.tsx Shared side-panel ownership and booking context
client/src/components/BookingModal.tsx Embedded guest authentication and booking form
client/src/pages/Login.tsx Existing custom PIN sign-in/sign-up UI

Authentication is the project's existing custom PIN/session implementation. This change does not introduce Clerk or Replit Auth.

9. Clinic-choice contract

The follow-up and renewal actions use these internal user-message markers:

__doctor_visit__:<doctorId>:follow-up
__doctor_visit__:<doctorId>:prescription renewal

The server resolves the doctor against the current directory and returns:

type ClinicChoicesBlock = {
  type: "clinic_choices";
  doctors: DoxyDoctor[];
};

DoxyDoctor snapshots supply identity, address and listed coverage; they are not evidence of a confirmed slot.

The response also includes the updated conversation state with selectedDoctorId, intent, and visit_reason. It clears retired awaitingRunOut state and stale result display state.

On card click, the client:

  1. Checks that the card belongs to the active conversation turn.
  2. Checks that its doctor ID still exists in the loaded directory.
  3. Rejects stale filter context or an emergency-state booking attempt.
  4. Carries the selected location record and current context into the existing booking handoff.
  5. Lets the embedded booking component decide between guest authentication and the authenticated form.

Current test selectors:

button-known-doctor-follow-up-<doctorId>
button-known-doctor-renewal-<doctorId>
doxy-clinic-choices
button-doxy-clinic-<doctorId>
booking-auth-in-panel

Do not allow an LLM to supply authoritative clinic/provider records or bypass server-side booking validation.

10. Verification

Local commands

npm run dev
npm run check

node --import tsx --test \
  server/doxy.test.ts \
  shared/doxy-presentation.test.ts \
  client/src/components/DoxyBlockRenderer.test.ts

node --import tsx --test server/doxySymptomGuidance.test.ts

The three-file clinic-flow test set passed 119 tests at this handoff. Type checking also passed.

Browser journeys checked

  • Guest known-doctor renewal → immediate clinic card → same-panel login/signup.
  • Signup → selected doctor's form with renewal reason preserved.
  • Signed-in follow-up → clinic card → form directly, preserving the follow-up reason.
  • Single-panel behavior; no second stacked sidebar.
  • Clinic-card and signed-in form layout at a 390px viewport.
  • No appointment was submitted during these browser checks.

The narrow-screen guest authentication path was not separately exercised in the latest browser pass.

Regression checklist

  • Both purpose pills skip day, coverage and location questions before clinic selection.
  • Only the selected doctor's real listed locations appear.
  • Duplicate addresses do not generate duplicate cards.
  • One listed location produces one card, not fabricated alternatives.
  • Missing/removed doctor IDs cannot open a fabricated booking.
  • Guest login and signup preserve doctor, clinic and reason.
  • Signed-in patients reach the booking form without re-authentication.
  • Cancelling booking returns to usable clinic choices.
  • Renewal does not offer Self pay.
  • Emergency symptoms still interrupt the journey.
  • Changes to location/insurance do not discard an established specialty.
  • Successful saves show the concise saved message and navigate to Appointments.
  • Failed saves remain on the form.
  • No route exposes another patient's appointments.

11. Known gaps to retain in planning

  • Live clinic slot availability and automatic booking confirmation are not implemented end to end.
  • Some catalog providers are sample/unverified records; do not present their details as verified clinical supply.
  • Some routed specialties have no directory providers.
  • Geographic alternatives are not sorted by verified patient-to-clinic distance.
  • Multi-location identity currently depends on matching doctor name/category rather than a dedicated stable provider-location relationship.
  • The booking form currently asks for Patient Name again after signup rather than prefilling the authenticated profile name.
  • Current signup entry copy includes “Subscribe Now”; review that wording if the intent is ordinary account creation.

Keep these gaps explicit. Do not conceal them with fabricated availability, duplicate UI, silently changed filters, or unsupported confirmation language.

Take aways

Finding the right doctor starts with understanding the patient's need and guide them. Care Guide translates what patients describe into a relevant search, making healthcare easier to navigate without requiring them to understand the medical system first.

Trust comes from transparency and keeping patients in control. Explaining why a doctor matches, making coverage limitations visible and distinguishing exact from partial matches helps patients make informed decisions. The patient should always decide what happens next.

What I plan to measure

As Doc Connect is still a prototype, I cannot claim that Care Guide improves doctor discovery or booking completion. If used by patients, I would focus on three areas:

  • Whether it helps patients find the right doctor: how often patients reach relevant specialists, receive suitable matches and complete their search without repeatedly changing criteria.
  • Whether it builds confidence and trust: how well patients understand why doctors are recommended, what their insurance covers and where limitations exist. I would also track whether they feel in control of their choices.
  • Whether it leads to a clear next step: how often patients proceed to booking or clinic contact, and how many complete the process. I would also validate that Care Guide handles emergency situations safely and never makes unsupported medical or booking claims.

The next step is to validate these assumptions with real patients and understand whether Care Guide makes finding and choosing the right doctor easier, clearer and more trustworthy.