Settings → Clinic Profile
Purpose
Configure the clinic-wide settings that drive other features: clinic address (printed on every PDF report and DEA Form 41 / 106), timezone (used to render every transaction timestamp), container numbering template (the format used by every received container's auto-generated identifier), storage locations (the <select> options on the receive-container form), and substance-prefix overrides (per-substance prefix overrides for the numbering template).
Regulatory basis: DEA recordkeeping (the registrant maintains records at the registered location — name and address are part of the registration record; records must include the date of every transaction in the local clinic timezone — daylight-savings transitions count as same-day).
When to use it
- Clinic onboarding: first thing after the wizard. Set address + timezone before any transactions are recorded; timezone changes don't retroactively recompute existing rows.
- Address change: the clinic moved or rebranded. Update here; the new address flows to every report generated from this date forward.
- Numbering scheme change: you want container numbers to look different (e.g.,
2026-MTH-001instead ofMTH-2026-001). The format is per-clinic, not per-substance, unless you set a per-substance override. - New storage area: you started using a second safe / new location. Add it here so it appears as an option on the receive-container form.
- State / regulatory request: an inspector wants to see your numbering format documented; the clinic profile renders it.
Walkthrough
Step 1 — Open the clinic profile page
Navigate to /home/<slug>/settings/clinic. The page is split into 4 cards: Clinic Information, Storage Locations, Container Numbering, and Substance-Specific Overrides.
(Screenshot deferred — Sprint A 15g spec did not navigate to /settings/clinic; capture in a follow-up.)
Step 2 — Update the clinic address
The Clinic Information card has 7 fields: Address Line 1, Address Line 2 (optional), City, State (50 US states), Postal Code, Country, Timezone (US timezones).
Click Save Clinic Settings at the bottom of the section. A toast confirms success.
⚠️ The clinic account name + URL are managed on
/home/<slug>/settings(one level up), NOT here. This page is for the clinic-specific operational fields.
Step 3 — Add or remove a storage location
The Storage Locations card shows a list of locations with a remove button per row and an add-new input. Locations are stored as a text[] array on clinic_settings.storage_locations. Order matters — the first location in the array is the default selected option on the receive-container form.
Step 4 — Configure container numbering
The Container Numbering card has two controls:
- Enable container numbering (Switch): when off, no automatic numbers are generated; you'll be prompted to enter a manual number on receive
- Template (text input): the format string. Tokens:
{YEAR}(4-digit),{CODE}(substance prefix),{SEQ:3}(per-substance sequence padded to 3 digits)
Default template: {YEAR}-{CODE}-{SEQ:3} → 2026-MTH-001, 2026-MTH-002, ...
Click Preview to see what the next container number will look like.
Step 5 — Override numbering per substance
The Substance-Specific Overrides card shows every controlled substance with two configurable values per row:
- Code (text): the prefix used in the template (defaults to the first 3 letters of the substance name uppercased)
- Current sequence (number): manual override of the next sequence number
This is rare; most clinics don't need it. Use it when you migrate from another system and need to start at a specific sequence number.
Field reference
clinic_settings columns surfaced by this page
| Field | Column | Type | Required |
|---|---|---|---|
| Address Line 1 | address_line1 |
text | optional |
| Address Line 2 | address_line2 |
text | optional |
| City | city |
text | optional |
| State | state |
text (2-char code) | optional |
| Postal Code | postal_code |
text | optional |
| Country | country |
text | optional |
| Timezone | timezone |
text | required (default America/New_York) |
| Storage Locations | storage_locations |
text[] | required (default ['Safe', 'Backup Safe']) |
| Container Numbering Enabled | container_numbering_enabled |
boolean | required (default true) |
| Container Number Template | container_number_template |
text | required when enabled (default {YEAR}-{CODE}-{SEQ:3}) |
| Substance Prefixes | substance_prefixes |
jsonb | derived from controlled_substances.container_code_prefix |
Edge cases
Timezone changes are not retroactive
Existing transaction created_at values are stored as timestamptz in UTC and rendered using the current timezone setting. Switching from America/New_York to America/Los_Angeles does NOT shift the displayed timestamps for past rows; it changes the rendering for newly-recorded transactions. If you cross daylight-savings while changing timezones, expect a 1-hour skew on the day of the change.
Numbering template tokens are case-sensitive
{YEAR} works; {year} does not. The validator at submit time will reject malformed templates. The Preview button is your safety net.
Storage locations cannot be edited inline
Once a transaction or container references a storage location string, removing that string from the array does NOT cascade. Existing rows keep the old value; new receives no longer see that option in the dropdown. If a typo crept in, fix it directly in the database via support — UPDATE against containers.storage_location requires care.
Substance prefix overrides land on controlled_substances.container_code_prefix
The Substance-Specific Overrides card writes to the substance row, not to clinic_settings. Soft-deleted substances disappear from this card.
Common mistakes
- Editing the wrong "settings" page.
/home/<slug>/settings(clinic account name + URL) and/home/<slug>/settings/clinic(clinic operational fields) are different pages. The clinic-account page lives one level up. - Forgetting to save. The Clinic Information + Storage Locations + Container Numbering cards each have their own save button. Editing one card doesn't auto-save the others.
- Setting a numbering template that produces collisions. If you remove
{SEQ:3}from the template, every container would get the same number — the unique constraint on(account_id, container_number)will block the second receive. The validator catches this. - Setting timezone after recording transactions. Set timezone first, then start using the system. Retroactive changes confuse staff who try to reconcile against paper records.
Related
- Inventory → Containers — the receive-container form uses
storage_locationsand the numbering template - Reporting — every PDF report includes the clinic name + address
- Settings → Members — the clinic position field captured at onboarding
- Glossary § Container numbering