Skip to content

Alan Clinic — local setup

One command bootstraps a working local Clinic environment:

alan run --scope backend -- env APP=fr_api flask clinic setup

Use --yes to skip the destructive-actions confirmation. Use --with-fake-conversations to also seed ~50 random conversations (override count with --fake-conversations-count). Default password is azerty (override with --password=...).

What it does

In order, the meta-command runs:

  1. Medical admins — creates the canned HPs from medical_admins_dataset.py (equivalent to flask clinic create_medical_admins --execute).
  2. Medical chat bot — creates the bot clinic-user used for redirections and automated messages (idempotent).
  3. Encryption keys + doctor group — wipes encryption tables and regenerates per-user keys; because admins exist by this point, they are enrolled into the doctor group on the same pass (equivalent to flask encryption generate_initial_keys --clean-first).
  4. Booking next-availability cache — refreshes therapist availability cache (flask booking update_cached_next_availability).
  5. (Optional) Fake conversations — when --with-fake-conversations is passed.

Each step is isolated: a failure in one doesn't abort the rest.

Manual steps left (one-off)

The command prints a checklist when it finishes. The non-scriptable parts:

  • Run the RQ worker in another terminal: alan run --scope backend -- env APP=fr_api flask rq worker.
  • Run the backend with -m if you need outbound emails.
  • Run the frontend: yarn workspace fr-server run dev.
  • HP booking config (browser only — Google OAuth required): open http://localhost:4001/marmot-v2/alan-clinic ⧉, edit an HP, set Dato id (mock 141232141), enable booking, complete Google OAuth, then in Google Calendar create a calendar (e.g. Alan Clinic / Alan Therapy) and create slot events with titles:
  • Alan Clinic — general practitioner / physio video
  • Alan Therapy — therapy
  • Alan Therapy (O) — orientation (≤30min, letter O, not 0)
  • Doctor chat (HP interface): http://localhost:4001/en/doctor-chat/login ⧉.
  • Log in as <unix-user>+<medical_admin_last_name>@alan.eu with the chosen password.

A locally-onboarded company with users is a prerequisite to access the member's app — use the fixture tool if you don't already have one.

Troubleshooting

Encryption-related errors in the medical chat usually clear with logout + login. If they persist:

flask clinic erase_all_conversation_data
flask clinic setup --yes

Other common issues:

  • "No row was found when one was required" updating an HP from Marmot → the medical admin has no clinic_user, create one in flask admin.
  • Chat access blocked → check member's profile settings → Privacy & security → Alan Clinic toggle.
  • Don't impersonate on mobile (encryption requires a real password).

Architecture & deeper context

For component layout and cross-cutting invariants (encryption channels, Pusher, country variants), see the clinic-platform skill (.claude/skills/clinic-platform/SKILL.md) or the per-module CONTEXT.md files under backend/components/clinic/ and frontend/shared/clinic/.

Getting started

Billing tool

The billing tool is available locally on http://localhost:4001/marmot-v2/alan-clinic/invoices ⧉.

You can generate fake invoices locally by running the following command:

flask clinic generate_fake_clinic_invoices --execute