Components · Data

Search

Usually the moment a clinician picks a patient — which makes it the most direct route to a wrong-patient error in the whole product, and the reason none of its conveniences are free.

Stable · v1.0 shadcn/ui Wrong-patient control WCAG 2.2 AA

Overview

Consumer search optimises for speed to a result: predictive, forgiving, first-hit-usually-right. Every one of those behaviours is a wrong-patient mechanism when the results are people, and surnames repeat far more often on one ward than designers expect.

So patient search here is deliberately slower: it will not guess, it will not auto-select, and it will not show a result the clinician cannot distinguish from its neighbour.

Never guesses

No auto-selection, no auto-navigation on a single hit, no "did you mean". Selection is always a deliberate act.

Distinguishing

Every result carries enough to tell it apart from a similar one. A list of names is not a list of patients.

Honest about scope

What was searched, and what was not, is stated. A result set with an unstated boundary is indistinguishable from a complete one.

Anatomy

Patient search · results
Family name or full MRN · 3 characters minimum
HARLAND, Arthur J. 1964-03-11 · 61 y · M · MRN 44 812 907
HARLAND, Arthur T. 1971-08-02 · 55 y · M · MRN 44 812 970
HARLANDSON, Mira 1988-01-24 · 38 y · F · MRN 51 004 218
3 results · current admissions at this site only

Two Arthur Harlands, born seven years apart, with MRNs differing by a transposed digit. This is the case the component is designed around, and it is not rare.

ElementRule
Input autocomplete="off", spellcheck="false", no autocorrect. Browser autofill on a patient field can suggest a different patient from earlier in the shift — see Text field.
Scope hint What can be searched and the minimum query length, before typing.
Result Name and date of birth and age and sex and full MRN. All five, always. Never name alone.
Footer Result count and the boundary of the search — the site, the admission status, the time window.
Distinguishing fields are not optional

A result showing only a name is unusable in exactly the situation where care is needed — two patients with the same surname on one ward. Date of birth is the field clinicians actually cross-check against a wristband, so it appears on every result, and the MRN is shown in full and grouped rather than truncated. The same reasoning as Patient header.

Behaviour

Recent searches are a wrong-patient vector

A dropdown of recently viewed patients is convenient and dangerous: it puts the previous patient one keystroke from the current one, on a shared workstation, for a clinician who has been interrupted. If it exists at all it is clearly separated from live results, explicitly labelled recently viewed — not a search result, cleared on user switch, and never the default focus target.

No results, and failed search

The same distinction as Empty state, and for the same reason: "this patient is not here" and "the search did not run" must never look alike.

Empty result versus failure
No patients match "harlnad"
Searched current admissions at this site. Check the spelling, or search by full MRN. Patients at other sites are not included.

The wording on the failure case is deliberate: "do not conclude the patient is absent". An unavailable search that renders as "no results" is the search equivalent of a failed queue rendering as an empty one.

Do
HARLAND, Arthur J. 1964-03-11 · MRN 44 812 907
HARLAND, Arthur T. 1971-08-02 · MRN 44 812 970

Both Arthurs shown, both distinguishable, neither pre-selected.

Don't
Arthur Harland best match

One result, pre-selected, no date of birth, no MRN, and a confidence claim in place of the information needed to check it.

Non-patient search

Searching documentation, settings or an option list is ordinary search and carries none of the above. It may autocomplete, may highlight a best match, and may act on Enter. The constraints on this page apply specifically where the result set is people, orders or clinical records — the component takes a subjects prop so the distinction is explicit rather than a matter of judgement at each call site.

Do's and don'ts

Do
HARLAND, Arthur J. 1964-03-11 · MRN 44 812 907
HARLAND, Arthur T. 1971-08-02 · MRN 44 812 970

Both Arthurs shown with dates of birth and full MRNs. Neither pre-selected.

Don't
Arthur Harlandbest match

One result, pre-selected, no date of birth, no MRN — and a confidence claim instead of the data needed to check it.

Do
Patient search unavailable
The directory could not be reached. This is not a result — do not conclude the patient is absent.

Failure says it is a failure, and says what not to conclude from it.

Don't
No patients found.

An unreachable directory rendered as an empty result. The clinician concludes the patient is not here.

Accessibility

Outcomes of use

What this contributes to, in the terms of Usability & context of use. These are attributes believed to contribute to an outcome; the outcome itself is settled by observing real use in a specified context, not by this page.

Clinical safety notes

Risk controls carried by this component

Trace these in your risk file (ISO 14971) and usability engineering file (IEC 62366-1).

Implementation

$ npx shadcn@latest add https://md.notjustany.tech/r/search.json
<Search
  label="Find a patient"
  subjects="people"          // enables every constraint on this page
  minLength={3}
  scope="Current admissions at this site"
  renderResult={(p) => (
    <PatientResult
      name={p.display} dob={p.dob} age={p.age} sex={p.sex} mrn={p.mrn} />
  )}
  onSelect={openRecord}
/>

// With subjects="people" the component refuses the conveniences that
// are safe elsewhere.
if (subjects === "people" && (autoSelect || fuzzyIdentifiers)) {
  throw new Error(
    "[Search] auto-selection and fuzzy identifier matching are not " +
    "permitted when results are patients."
  )
}
PropTypeDefaultNotes
subjectspeople | records | content content people and records enforce the clinical constraints.
minLengthnumber3 for clinical subjects Cannot be lowered below 3 for people.
scopestring Required for clinical subjects. Rendered in the footer.
onSearchError(e) => void Renders an Urgent alert, never an empty result set.
NotJustAnyMed.Tech Design System · Search · v1.0 · draft for review
Reference applications named in this system are fictional; all patient data shown is fabricated.