# How to build a bounded after-hours clinic FAQ reply (open-source demo)

> Source: <https://dev.to/hermes_820f031ccd971d4dc5/how-to-build-a-bounded-after-hours-clinic-faq-reply-open-source-demo-f5a>
> Published: 2026-11-18 07:40:41+00:00

**Recommendation:** Order safety and handover routes ahead of FAQ matching, and return an approved answer only when the keyword score clears its threshold and uncertainty check; otherwise fall back to a human contact route.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

A clinic website can answer "When do you open?" after reception closes. It should not improvise an answer to "Should I take antibiotics?" Those questions need different handling, even when someone puts both in the same message.

This walkthrough uses an [MIT-licensed fictional dental-clinic demo](https://github.com/AHMEDFOUAAD/clinic-after-hours-faq-assistant). It illustrates approved operational answers, a booking link and explicit fallbacks. It is not client work, a medical device or a clinically validated system. There are no claimed booking increases or customer results.

**Disclosure:** This article was drafted and checked by an AI assistant on Ahmed Fouad's behalf. The demo was also built with AI assistance. Commands and implementation details below were checked against the public repository; its tests are developer-written regression checks, not an independent safety evaluation.

Keep the first version narrow: opening hours, accessibility, location, published fees and the clinic's existing booking route. Get the wording approved by the person responsible for clinic information. Give unknown questions a useful contact route rather than a plausible answer.

For a UK-facing deployment, keep general signposting visible: call 999 for emergencies; contact NHS 111 for urgent concerns when appropriate. Check the wording against [NHS emergency guidance](https://www.nhs.uk/nhs-services/urgent-and-emergency-care-services/when-to-call-999/) and [NHS 111](https://111.nhs.uk/), then have the clinic approve it. NHS 111 online is England-only; confirm the appropriate route for the clinic's nation. Outside the UK, obtain local wording instead of copying those numbers.

Never present keyword detection as triage. A missed keyword does not mean someone is safe. Do not collect symptoms, patient records, dates of birth or contact details in this demonstration. A request for a person should lead to a clear human route, without pretending someone has been notified.

Download the ZIP from GitHub, or clone it:

```
git clone https://github.com/AHMEDFOUAAD/clinic-after-hours-faq-assistant.git
cd clinic-after-hours-faq-assistant
```

Open `index.html` in your browser. There is no build step. Try "What are your opening hours?", "How do I book an appointment?" and "I want to speak to a real person". The booking button opens a labelled placeholder, not an appointment calendar. The handover message does not contact reception.

Despite the chatbot interface, no language model runs at runtime. `faq-data.js` contains invented operational FAQs; `engine.js` selects canned replies with deterministic keyword matching. AI-assisted development is different from sending every visitor message to an AI provider. This version makes the boundaries easier to inspect and avoids runtime model fees.

The engine checks routes before attempting an FAQ match:

```
emergency signposting
→ personal-data warning
→ clinical-question refusal
→ human-contact request
→ approved FAQ match
→ unknown-question fallback
```

These are internal software labels, not clinical classifications. The emergency and clinical patterns are incomplete regular expressions. They can miss unfamiliar phrasing, misspellings or a different language.

FAQ matching normalizes text, removes common words and scores overlapping keywords. It returns an approved answer only when the match clears its threshold and uncertainty check. Otherwise it refuses to guess. It can still return irrelevant answers for nonsense such as "teeth whitening for cats". A passing test suite does not fix that limitation.

Work through `SETUP.md` rather than replacing the clinic name alone:

`faq-data.js` with approved public wording. Keep who approved it and when outside the public repository.`bookingUrl` to the clinic's existing approved HTTPS booking page. Do not add a patient-data form to the demo.
The `source` fields are fictional page labels, not documents fetched by a retrieval system. Changing a label does not verify an answer. Read the underlying clinic material yourself.

For a static preview, the setup guide lists the files to copy to an approved host. `_headers` is host-specific; other hosts need equivalent configuration. Keep fictional previews labelled DEMO and excluded from search indexing. Hosting these files does not connect email, WhatsApp, SMS or a booking calendar.

With Node.js 22 or newer, run:

```
node tests/run-tests.js
node tests/unseen-probe.js
node --test tests/public-kit.test.js tests/interface.test.js
```

The checked revision passed its 36 scripted checks, 18 probe questions and three Node subtests. The historical `unseen-probe` name is misleading: those questions are now public and are not an independent evaluation.

Ask the clinic to supply fresh questions and paraphrases. Include mixed administrative and medical questions, requests for a person, unsupported services, personal details and incorrect assumptions. Check booking destinations, keyboard access and narrow screens. Confirm that input renders as plain text.

This kit does not transmit questions or persist chat history; questions remain in page memory until reload. Hosting visit logs and external booking pages have separate privacy implications. Review them too.

`AFTER-HOURS-REPLY.md` provides sample wording, not a connected responder. A real email or form workflow needs channel permissions, opening-hour and holiday rules, duplicate-reply prevention, retention decisions and a named person who handles replies. Agree those before adding automation. If reporting is needed, prefer counts over copying message content.

Deliver editable source, approval notes and update instructions, then remove temporary access. Never put patient data or credentials in GitHub issues.

You can adapt and self-host the [free demo kit](https://github.com/AHMEDFOUAAD/clinic-after-hours-faq-assistant) without hiring anyone. For done-for-you setup, contact Ahmed through his [Fiverr profile](https://www.fiverr.com/users/ahmedfouad765) to agree a fixed scope; enquiries, orders and payments stay on Fiverr.
