MEDB

Patient front door

Northstar Clinic intake

Information entered here is used for patient intake, scheduling, handoff, and clinic operations workflows. The assistant does not provide medical advice.

Conversation

Choose a request

ready
Welcome to Northstar Clinic intake. I can collect patient details, answer administrative questions, support scheduling, and route unsafe or clinical requests to staff.
Private beta

Source-linked context before the visit

MedBay assembles intake and available records into a traceable pre-consultation brief, shows what is missing, and keeps the clinic reviewer in control of approval.

What happens next

Scattered records become one reviewable brief.

MedBay connects extracted facts to their original sources, checks for missing records, and prepares the artifact for human review without making a clinical decision.

See the lifecycle

Message

I need an appointment and have a lab question.

Triage

Intent: scheduling · Policy: human review

Handoff

Case ready with reason and next action.

Redefining intake operations

Visit preparation with provenance.

The patient sees one simple intake path. The clinic receives a source-linked brief, missing-document list, safety decisions, and an explicit approval state.

Contact flow

Intake case lifecycle

Northstar Clinic · live routing preview

case #MB-2407

This preview follows a single patient request as MedBay turns free text into a structured case. The assistant can support administrative intake, but clinical interpretation is held for staff before any response is sent.

Capture the patient’s intent
Apply safety routing
Prepare the staff handoff

01

Patient message

Request enters the intake

02

Extract fields

Intent and risk become structured

03

Route safely

Clinical language is held for staff

04

Staff acts

Scheduling and review are ready

Patient message

I need to schedule an appointment and ask about recent lab results.
Received from landing intake

Extracted context

intentappointment
topiclab question
policyhuman review
Safety rule matched: clinical interpretation should route to staff.

Staff handoff

Ready for review

queued
Next: offer virtual scheduling slots
Reason: lab interpretation request
Open case
Book slot

message

extract

safety

handoff

Source-linked context

Every displayed fact points back to the intake form, referral, medication list, or record it came from.

Missing-record visibility

Staff can see what is still needed before the patient arrives instead of discovering gaps during the visit.

Human approval

A pre-consultation brief stays in review until an authorized clinic reviewer explicitly approves or rejects it.

Clinical boundary

The workflow organizes records; it does not diagnose, score risk, recommend treatment, or interpret exams.

Headless intake flexibility

MedBay separates the patient experience from the operational engine behind it. One request can become an intake case, policy decision, scheduling handoff, and staff review record without adding another loose chat transcript.

See the operating layer

Front door

Patient-facing intake stays simple and branded.

Policy core

Clinical risk routes before the assistant responds.

Staff console

Every handoff lands with context and next action.

Audit event stack

real flow

message_received

user message saved with audit context

policy_evaluated

decision, severity, and risk flags recorded

intake_extracted

fields, triage, and case status persisted

handoff_requested

staff notification sent when policy requires it

handle-patient-message.tsapplication
ts24 lines
1
export async function handlePatientMessage(rawInput, dependencies) {
2
  const input = handlePatientMessageSchema.parse(rawInput);
3
  const conversationId = input.conversationId || crypto.randomUUID();
4
 
5
  await dependencies.conversationRepository.saveMessage({
6
    conversationId,
7
    role: "user",
8
    content: input.message,
9
  });
10
 
11
  const policy = evaluateIntakePolicy({
12
    message: input.message,
13
    extractedFields: mergedFields,
14
    wantsScheduling: wantsScheduling(input.message),
15
  });
16
 
17
  const nextStatus = decideNextIntakeStatus({ policy, completeness });
18
  const updatedCase = await dependencies.caseRepository.save({
19
    ...intakeCase,
20
    status,
21
    fields: mergedFields,
22
    handoffRequired: policy.handoffRequired,
23
  });
24
}
Before / after

Before

Raw patient chat

raw
I need to schedule an appointment and ask about my recent lab work.
I can help with scheduling. What would you like to review?
Can you explain whether the result is normal?

signals

schedulelab workexplain result

MedBay

intake engine

After

Structured intake case

review ready
case_2048saved
intentappointment request
topicrecent lab work
riskclinical interpretation
statusneeds staff review
Policy hold

Assistant pauses and sends the case to staff with context attached.

intent appointment
topic lab work
policy human review
Before and after intake conversion

Patient intakes without the operational guesswork

Instead of a hidden chat transcript, the page shows what changes: loose patient language becomes a structured, reviewable case for operations.

01

Raw message

Patient asks in natural language, with scheduling and lab context mixed together.

02

Case record

MedBay turns the transcript into stable fields that the clinic can inspect.

03

Policy route

Clinical interpretation is held before the assistant answers beyond its scope.

04

Staff handoff

The admin console opens with reason, next action, and original message attached.

See the staff console
medbay-production-mapready

What is built

Patient intake

01

Guided chat, quick actions, safety routing, and persisted message history.

Admin operations

02

Case queue, lead review, appointment handoff, and knowledge base management.

Production path

03

Server-side secrets, managed Postgres, API routes, and adapter boundaries.

Production execution

env OPENAI_API_KEY server onlydb Supabase Postgres for cases and admin dataapi Next.js routes isolate browser from secretsdemo fallback keeps portfolio review instant

Runtime shape

The browser talks to MedBay API routes. The server evaluates policy, writes cases, and connects clinic adapters without exposing production credentials.

authintake casesappointmentsknowledgehandoff

Project overview

What MedBay does, and how it would run in production.

The portfolio version keeps the demo fast, but the project is structured like a real clinic product: patient intake, operational review, scheduling handoff, knowledge management, and server-side integrations.

Demo-first loading
Server-side API boundary
Admin review console
Production adapters

Safety boundary

Record preparation is assisted. Clinical judgment is not.

Medbay assists with intake, source-bounded extraction, record organization, scheduling, and handoff. Deterministic checks enforce provenance and decide when to clarify, escalate, or block.

policy-engine.tsdeterministic

Allowed

allow

Scheduling, clinic information, intake collection, and knowledge-base answers.

Clarify

ask_clarifying_question

Missing contact details, vague intent, or low-confidence extraction.

Escalate

needs_human_review

Lab interpretation, medication questions, diagnosis language, or staff requests.

Block

block

Emergency red flags, unsafe medical advice, or urgent high-risk language.

policy engine runs before and after the AI response / assistant output is validated before persistence

Project execution

A working clinic intake product, packaged for portfolio review.

MedBay is not only a visual concept. The project includes patient intake, admin review, knowledge management, appointment flow, and a demo path that avoids service delays during evaluation.

01

Patient intake

Chat flow, quick prompts, safety routing, and persisted conversation state.

02

Clinic operations

Admin queue, case review, appointment handoff, lead tracking, and knowledge updates.

03

Demo mode

Portfolio data loads immediately so the product can be reviewed without external latency.

production-blueprint.tsdeployable

Functional surface

Frontend

Next.js App Router

public site + admin

Intake API

/api/chat

policy-aware responses

Case store

Supabase / Postgres

cases, leads, messages

Clinic tools

Admin dashboard

review, schedule, handoff

Production runbook

01

Configure server secrets

OpenAI, Supabase, Resend, calendar credentials

02

Connect managed storage

Postgres tables for cases, knowledge, leads, and appointments

03

Deploy web runtime

Next.js server routes handle intake, admin, and API boundaries

04

Keep demo fallback

Portfolio mode stays fast when production services are unavailable

Runtime boundary

browser -> Next.js API -> policy engine -> database / clinic adapters

server-side secrets
portfolio fallback
admin auth
audit trail
knowledge base

Safety boundary

Source-linked visit preparation with human approval. Not diagnosis.