Skip to content

Reduce AI interview session length with upfront patient context and fewer questions#5901

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/improve-hpi-chatbot-prompt-again
Draft

Reduce AI interview session length with upfront patient context and fewer questions#5901
Copilot wants to merge 3 commits intodevelopfrom
copilot/improve-hpi-chatbot-prompt-again

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

AI interview sessions were too long due to chatbot asking identity questions and allowing 15-20 questions total.

Changes

  • Dynamic patient context injection: Prompts now include patient name, age, gender, and reason for visit upfront instead of asking "Determine who the patient is"

  • Question limit reduced: Both urgent care (20→8) and workers comp (15→8) prompts now limit to 8 total questions

  • Parent/guardian detection: Added explicit instruction to determine if communicating with patient directly or guardian

Implementation

// New helper constructs patient context from FHIR resources
function buildPatientContext(patient: Patient, appointment: Appointment): string {
  const name = getFullName(patient);
  const age = calculatePatientAge(patient.birthDate) || 'unknown age';
  const gender = patient.gender ? mapGenderToLabel[patient.gender] : 'Unknown';
  const reasonForVisit = getReasonForVisitFromAppointment(appointment);
  
  return `The patient is ${name}, ${age}, ${gender.toLowerCase()}${reasonForVisit ? ` with reason for visit: ${reasonForVisit}` : ''}.`;
}

// Example output: "The patient is Amelia Low, 8 y, female with reason for visit: headaches."

Modified FHIR search to include Patient resource via _include parameter, eliminating need for separate query. Converted static prompt constants to builder functions accepting patient context.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • downloads.sentry-cdn.com
    • Triggering command: /usr/local/bin/node node ./scripts/install.js ndor/bin/grep grep -l ate nup.ts cal/bin/grep ate s ep grep -l (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Agentic Intake (HPI Chatbot) prompt to reduce length of chat session</issue_title>
<issue_description>In the current prompt replace this line:
"Determine who the patient is" (

• Ask only one question at a time.
)

with something like

"The patient is Amelia Low, 8 year old female with reason for visit: headaches". The patient name, age, sex, and reason for visit coming from the paperwork or patient record.

Add this line:
"Determine if you are communicating with the patient directly or a parent/guardian."


Change this line:
"Ask no more than 20 questions in total."

to

"Ask no more than 8 questions total."</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 20, 2026 19:30
Co-authored-by: saewitz <48358905+saewitz@users.noreply.github.com>
Co-authored-by: saewitz <48358905+saewitz@users.noreply.github.com>
Copilot AI changed the title [WIP] Update HPI chatbot prompt to reduce chat session length Reduce AI interview session length with upfront patient context and fewer questions Jan 20, 2026
Copilot AI requested a review from saewitz January 20, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments