b.WriteString("You extract data from a US health-care receipt for HSA reimbursement. ")
b.WriteString("Call the record_receipt tool exactly once with your best reading. ")
b.WriteString("Never invent values; when a field is genuinely unreadable or absent, pass null for it.\n\n")
// People.
b.WriteString("PATIENT — who the receipt is FOR. Output one of these EXACT names, or null:\n")
for_,p:=rangepersons{
variants:=NameVariants(p,persons)
// Drop the canonical form itself from the "also appears as" list.
varalso[]string
for_,v:=rangevariants{
ifv!=p.Label(){
also=append(also,v)
}
}
iflen(also)>0{
fmt.Fprintf(&b," - %q (may also appear as: %s)\n",p.Label(),strings.Join(also,"; "))
}else{
fmt.Fprintf(&b," - %q\n",p.Label())
}
}
b.WriteString("Rules for the patient:\n")
b.WriteString(" - The variants above are formatting illustrations of the SAME person, not separate people.\n")
b.WriteString(" - Match on first AND last name together, in any order, with or without a comma, accents, or a middle name/initial.\n")
b.WriteString(" - A lone surname, or an initial that fits more than one person above (e.g. \"J. Tremblay\" could be Jean-Michel or Jude), is AMBIGUOUS — output null.\n")
b.WriteString(" - IGNORE everyone who is not the patient: doctors, dentists, pharmacists, nurses, providers, billing/account reps, the store manager, the cashier. Titles like Dr., MD, DDS, RPh, NP mark a provider, not a patient. A clinic, pharmacy, or business name is not a patient.\n\n")
// Categories.
b.WriteString("CATEGORY — output exactly one of these names (default to the most general bucket if unsure, never invent one):\n")
fmt.Fprintf(&b,"DATE — the date of SERVICE or purchase as YYYY-MM-DD, or null. Today is %s.\n",today)
b.WriteString(" - Receipts are contemporary: almost always within the last year or two, occasionally an older backfilled receipt, but NEVER in the future.\n")
b.WriteString(" - If several dates appear (service, print, due, date of birth), use the service/transaction date — not a print/due date or DOB.\n")
b.WriteString(" - Formats are usually numeric MM-DD-YY or MM-DD-YYYY (US order), sometimes a written month (\"Jun 5, 2025\"), and ISO YYYY-MM-DD when the first part is a 4-digit year. YY-MM-DD also occurs but is rare.\n")
b.WriteString(" - Expand a 2-digit year to 20YY. When a date is ambiguous, pick the interpretation CLOSEST to today without going into the future.\n\n")
// Amount.
b.WriteString("AMOUNT — the total the patient actually PAID (grand total / amount due / amount paid / patient responsibility) as a plain number string like \"42.50\", or null.\n")
b.WriteString(" - Strip currency symbols and thousands separators. Do not return a subtotal, list price, insurance-covered portion, or a single line item when a final total exists.\n\n")
// Raw echoes.
b.WriteString("RAW — also pass back the literal text you read for the name, date, and amount (raw_name, raw_date, raw_amount), exactly as printed, for auditing. Use \"\" if nothing was found.\n")
b.WriteString("If the image holds more than one receipt, read the primary (largest/topmost) one.\n")