GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - olegbacalu-maker/dental-booking-bot: DentPilot — practice management for dental clinics in Moldova: schedule, patient card with odontogram, treatment plans, payments, printed form 043/e. Windows desktop app, data stays at the clinic.

BranchesTags
Open more actions menu

Latest commit

 

History

1,502 Commits
1,502 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bot
bot
 
 
cloud
cloud
 
 
demo
demo
 
 
docs
docs
 
 
examples/clinic-zambet
examples/clinic-zambet
 
 
frontend
frontend
 
 
installer
installer
 
 
screenshots
screenshots
 
 
scripts
scripts
 
 
shell
shell
 
 
tests
tests
 
 
.dockerignore
.dockerignore
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
Build-Engine.ps1
Build-Engine.ps1
 
 
Build-Installer.ps1
Build-Installer.ps1
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
RELEASE.md
RELEASE.md
 
 
Sign-File.ps1
Sign-File.ps1
 
 
Start_Admin.bat
Start_Admin.bat
 
 
Start_Demo.bat
Start_Demo.bat
 
 
clinic.json
clinic.json
 
 
dev.ps1
dev.ps1
 
 
docker-compose.yml
docker-compose.yml
 
 
ruff.toml
ruff.toml
 
 

Repository files navigation

🦷 DentPilot — reception journal for dental clinics

A self-hosted practice management system for small dental clinics, built with the Moldovan market in mind. The clinic runs its whole day in one program: the schedule, patient cards with an odontogram, treatment plans, an anamnesis questionnaire, payments and documents — and the medical form the Ministry of Health asks for (043/e) prints already filled in from the card.

One codebase, run two ways: a desktop app (DentPilot.exe, SQLite in the clinic's own data folder, one clinic, one Windows machine — other workstations open the same journal over the clinic's network) and the same engine as a server (Docker, SQLite in a volume, sign-in by ADMIN_KEY) — which is what the live demo runs. A PostgreSQL edition existed until October 2026 and was removed unused; the last code with it is the tag archive/pg-edition. The desktop edition is the one clinics actually install. It runs on a monthly or yearly licence kept by a small separate service (cloud/) that knows the clinic, its computers and its payments and nothing about its patients: no server ever holds patient data.

Screenshots and clinic.json in this repo use synthetic data — invented patients, invented doctors. Phone numbers, e-mail addresses and national ID numbers are masked in the screenshots. One clinic.json = one clinic. The shots below are v1.40.1, taken on a staged clinic with two months of work behind it.

Screenshots

Patient card — one header for the whole card (alerts, insurance, balance, the risks from the anamnesis in a red strip, the next visit) over seven tabs: summary, odontogram, periodontal chart, plan and payments, visits, documents, patient data. On the odontogram tab here 25 is missing and 24/26 carry the abutments of a metal-ceramic bridge, drawn as the brace a dentist would put on paper:

Patient card

The same odontogram in 3D — both arches in three.js on the same server data, with side and occlusal views, layers (roots, numbers, either arch, occlusion) and a camera that flies to the selected tooth. Here the right side: 16 is selected, its mesial and occlusal fillings show on the crown and in the inspector, 45 carries caries and 47 has been extracted. It is a render of the model, never a source of clinical truth, and it prints nothing:

3D odontogram

Form 043/e, printed from the card — letterhead, general data, a numeric odontogram with its legend, the plan and the visit journal come from the database; the yellow gaps and the blank rows at the bottom stay for the pen. The bridge prints twice: as codes in the formula (Co Cor / D A / Co Cor) and as its own line under the grid:

Printed 043/e form

Dashboard — the day on one canvas: a column per doctor headed by that day's count, the hour the doctor is free from and a chair-occupancy bar; every visit drawn to scale by duration and read in three lines (who · when and how long and what · the status in words), coloured by the kind of work, with a no-show and acute pain in red; the "now" line; and in the right rail the month with busy days dotted and today's agenda, filtered by where the patient is — late, arrived, in the cabinet. The page keeps itself current without reloading:

Dashboard

Patient list — filters by doctor, status, channel and balance, derived statuses, a side preview that opens a patient without leaving the list, and Excel export:

Patient list

Periodontal chart — six points per tooth (probing depth, recession, bleeding) plus mobility and furcation, stored as a dated examination rather than as a state, so two examinations can be compared. The numbers on the right are computed, not typed: bleeding on probing, mean depth, pockets of 4 mm and deeper:

Periodontal chart

Doctors — one card per doctor with state, load and 30-day figures; the doctor's own page holds the working window, the services performed and the calendar colour:

Doctors

Doctor card

Owner stats — money actually taken at the desk kept apart from price-list estimates, per-doctor occupancy measured in busy minutes rather than in a count of slots, and every comparison made against the preceding period of the same length:

Stats

Clinic side (/admin)

Four views of the schedule:

  1. Dashboard — the day timeline: one column per doctor, every visit drawn to scale by its duration, a red "now" line on today, and overlapping visits split side by side so nothing hides behind anything. A visit reads in three lines — the patient first, then hour · duration · service, then the status as a word — because the name is what the desk looks for, and a patient marked a venit carries how long they have been waiting (silent for the first five minutes, amber from fifteen: "a venit and was called in at once" is not waiting, and a counter that shows zero on every arrival stops being read). A free hour says what a click will do (+ Programare) rather than showing a bare "+"; a block is coloured by the kind of work, with a no-show and acute pain overriding that to red; and the navigation rail alongside wears the clinic's own colour end to end. Each doctor's header carries the day's count, the hour that doctor is free from and a chair-occupancy bar — busy minutes over that doctor's working minutes, the same formula and the same work_minutes() the Stats page uses, so the two screens can never quote different percentages for the same doctor. The right rail holds the month calendar with busy days dotted and today's agenda, split by the patient's flow: Întârzie (late for the hour), A venit, În cabinet.
  2. Doctor day view — single-column schedule, add-form locked to that doctor.
  3. Full grid — all doctors side by side.
  4. Week view (/admin/week) — seven columns of compact chips with a per-week total.

Clicking "+" on any free slot opens a modal: book a patient or leave a note / block the slot ("lunch break", "seminar") — a note blocks a whole range. Clicking any appointment opens its card: patient info with age, an editable reception comment (allergies, call-back notes — never visible to patients), a link to the full patient card, and the status buttons the visit's current status allows — arrived, in the cabinet, finished, no-show, cancel; the same set opens on a right click over any visit. A booking reads programată until the call to the patient is marked as answered, and only then confirmată: "confirmed" is something the patient said, not something the form assumed.

Arrived keeps the slot occupied — moving a patient into the cabinet never frees the hour. Returning a cancelled visit to an active status is refused if the interval has meanwhile been taken: the journal shows an "interval occupied" banner instead of silently double-booking.

Only the dashboard keeps itself current, and it does not reload: the screen asks the data channel /api/schedule/live every 12 seconds and gets 204 when the fingerprint of the state has not changed, redrawing only when it has. The pilot clinic reported the reason: a whole page reloading every twelve seconds flickers all day, and it took the scroll position, an open dialog and a half-typed form with it.

One consequence is load-bearing rather than cosmetic. Anything that changes continuously — the "now" line, the waiting minutes — is drawn by the browser from timestamps, because a minute counter rendered by the server would make the fingerprint differ on every poll and bring the flicker back through the back door. The contract of the channel is in docs/dentpilot-2/live-contract.md.

Patient list

/admin/search — the clinic's whole base in one working table: avatar and name, phone, birth date, doctor, last visit (with the next one flagged in green), balance, status, pages. Filters by doctor, status, channel and balance; sorting by name or by last visit; the current selection can be exported to Excel or previewed in a side panel that shows the treatment-plan progress, alerts and documents without leaving the list. Search by name or phone digits (any format), e-mail or file number, ignoring Romanian diacritics and case ("Balan" finds "Bălan"). It also understands a birth date the way it is dictated at the desk (01.01.2003, and 1.1.2003 too) and looks for digits inside the patient's notes — which is where the second person on a family number is written down. Available from the header of any page, or with Ctrl+K.

A patient may have no phone at all. The booking and patient forms carry a fără telefon checkbox, and only that checkbox makes an empty field an intention: a bare empty phone is still refused, because it is far more often a half-filled form than a real absence. Phoneless patients are stored with NULL rather than an empty string — an empty digit key would have quietly merged every one of them into a single card.

Patient status is derived, not stored: archived → medical alert → unfinished plan → no visit for a year → active. Nothing to keep in sync, and no status that says "in treatment" about a patient whose plan was finished last spring. The Medic column falls back to the doctor of the last visit when nobody filled the primary doctor in the card — dimmed, so a fallback never reads as an assignment.

Patient card

/admin/patient/{id}, opened from search or from any appointment. An avatar with age, channel and file number; badges assembled from data already there (active / archived, medical alerts, insurance, implant count taken straight from the odontogram); a KPI row; then seven tabs, each with its own address (?tab=odonto, ?tab=plan…), so a link or a reload lands on the same tab.

  • Odontogram — 32 permanent teeth in FDI notation (upper 18→28, lower 48→38) plus the primary dentition (55→65, 85→75) on a second arch that opens on demand and unfolds by itself when a child's tooth already has records. Each tooth is drawn as an actual tooth in SVG rather than a coloured box: roots follow anatomy, an implant replaces the root with a threaded screw, in treatment draws the root-canal axes, an extraction a cross, a missing tooth a dashed ghost. Clicking a tooth sets its state with the doctor and a short note; the dialog lists that tooth's own history. The doctor's name is stored as a snapshot, so renaming a doctor never rewrites tooth history. All teeth are generated from one description rather than drawn — see Design decisions. A third view, 3D, shows both arches in three.js on the same server data (sizes, states, colours) — a render of the same model, never a source of clinical truth; it loads on demand and prints nothing. The camera flies to the selected tooth (F, the Apropie button or a double-click) and a view button brings it back. The legend under either view is a filter: press Carie and every tooth that is not about caries fades, in 2D and in 3D alike, with a count next to each item; the filter is the screen's own and never reaches a save or a print. A tooth's menu and its inspector offer Adaugă în plan: a plan item with that tooth's number, posted to the same plan route as the form in the card.

    Three things there answer three different questions, and each of them used to be one column too few:

    • The state says what is wrong with the tooth. A mark says what is being done to it. În tratament was the eighth value of the state list until a dentist marked caries, came back to say the work had started, and the caries disappeared — from the chart, from the ledger and from the 043/e that gets signed. Marks are a set, so a second one ("under observation", "referred") needs no column and no migration.
    • Each surface carries its own state, not a bare list of letters next to one word. Caries mesially and a filling occlusally is an ordinary finding; "MO · Carie" left the reader to assume both were caries. The printed form and the Law 195 export spell a mixture out instead of collapsing it, and the detailed page has an occlusal view where the marks sit on the crown rather than in the middle of the tooth.
    • A bridge (punte) is a layer over the teeth, in its own table: an abutment over caries and a pontic over a missing tooth leave both teeth their own truth. Roles are per tooth and an abutment may stand in the middle of the span — the pilot's dentist dictated the canon, 47/45/43 abutments with 46/44 pontics. The server enforces one arch, adjacent teeth, no primary teeth and at least one abutment, and it refuses overlapping constructions out loud. Both screens draw the brace with its material over the actual tooth buttons, which is what makes it survive the grid gap, the window width and both views.
  • Periodontal chart (/admin/patient/{id}/parodontograma) — the gum's own chart, six points per tooth: probing depth, recession and bleeding, with mobility (Miller) and furcation (Hamp) for the whole tooth. Attachment level is not stored — it is depth plus recession, and computable things are not written down.

    What makes it different from every other screen here: the unit of storage is a dated examination, not a current state. Periodontology is entirely about change over time — "5 mm in March, 3 mm now" is the result of the treatment — and a chart without yesterday answers nothing anyone measures it for. So each examination keeps its own numbers and the earlier ones stay untouched.

    A probing depth of 0 means not measured, not zero millimetres: a healthy sulcus is 1–3 mm, and zero is how a skipped point is written down. That is what keeps the two summary numbers honest — bleeding on probing and mean depth are divided by the points actually probed, so half a mouth left blank cannot halve them and make the treatment look better than it is.

    Entry is built for dictation, because a chart of 192 numbers is otherwise never filled in: the cursor moves to the next point as soon as a number cannot grow (3 is finished, 1 waits for a second digit), and bleeding is the b key. The chart prints as a sheet of its own; the 043/e form gets a one-line summary in section 4, because order 828 fixes that form's structure and there is no room in it for a table of ours.

  • Treatment plan — tooth, procedure, doctor, price in MDL, due date. Three statuses (planned → in progress → done) move along a directed path the server validates as a pair (from, to), tabs filter by status with counts, the total of the unfinished plan is shown in MDL, and an overdue item is flagged red.

  • Consultations — a visit diary, one record per appointment, on the rubrics the 043/e form asks for: complaints, objective examination, diagnosis, treatment performed, recommendations. Templates fill only empty fields, so a template never overwrites what a doctor typed. There is no delete button: a medical record is corrected, not made to disappear. Finishing plan items from the diary bypasses the usual status path on purpose — the diary records what actually happened.

  • Anamnesis — twelve yes/no questions (cardiac, diabetes, coagulation, hepatitis, HIV, pregnancy, allergies…), a thirteenth line "none of the above" that is the explicit answer to the list (otherwise "all NO" and "never asked" look the same), plus four free-text fields, which is exactly what section 2 of the 043/e sheet wants. The card therefore has three states: not collected, declared healthy (with the date), risks present. It also prints as a paper questionnaire in the patient's language, because reading twelve questions aloud across the reception desk is not how a waiting room works; reception copies the answers into the card afterwards. The paper is not stored as a document: the card is the single source of truth, or two versions of the same anamnesis would drift apart.

  • Payments and balance — a payment belongs to the patient, not to a procedure, and the debt is computed: finalised plan minus paid, negative amounts being refunds. Any role can take a payment; only the director can delete one. A patient with payments can no longer be physically erased — a cash record is not rewritten after the fact — but anonymisation keeps the amounts and clears the notes.

  • Documents and images — up to 25 MB per file in four categories (X-ray, consent, referral, other), a gallery with generated thumbnails, download under the original filename. Stored names are random, the extension is whitelisted, and only PNG/JPEG/WebP/GIF are ever served inline: an uploaded SVG or HTML would otherwise be a same-origin script inside the journal.

  • Medical alerts in four kinds (allergy, medication, warning, info) — structured data on the patient, not a comment attached to one appointment. The first three are pinned as coloured pills in the card header, so an allergy is on screen before anyone scrolls.

  • Activity feed — every change logged with an actor and a timestamp, including who merely opened the card. Logging never fails the operation it describes.

Printed documents

  • Fișa 043/e (/admin/patient/{id}/fisa043) — the ministry form, order 828/2011: title block from the card, a numeric odontogram with a letter legend on the sheet itself, the plan, and the visit diary in chronological order with a signature column and blank rows after it. A tooth cell leads with the bridge code where there is one — Co C on a decayed abutment, D A on a pontic over a missing tooth — the legend explains both, and the brace is repeated under the grid as a line naming the span and its material.
  • Informare și acord — an information sheet for signature, filled with the patient's and the clinic's data. Treatment runs on a contract and on the law, so the consent checkboxes cover only marketing and photography; the grounds listed here must match the sheet on the reception desk.
  • Anamnesis questionnaire for the waiting room, in the patient's language.
  • Both the acord and the 043/e print in Romanian or Russian, chosen per patient. What is never translated: the form code 043/e, the ministry order, the law's name, the authority's abbreviation, IDNO/IDNP and the letter codes of the odontogram. The Russian information sheet carries a line saying the Romanian version is the authoritative one — otherwise it would quietly diverge from the printed sheet at the desk.

Analytics

/admin/stats, director-only, for today, seven days, this month, thirty days or any interval: four KPI cards — money taken, appointments, attendance, chair occupancy — each with a trend against the preceding period of the same length (a week compares to the previous week, a day to yesterday — "vs. last month" for an arbitrary range would be a lie); columns by day or by week, switchable between appointments and money, with only the tallest one labelled and the rest on hover; money taken at the desk shown separately from estimated revenue, the latter explicitly labelled as a price-list estimate rather than accounting, with the split by payment method and what the no-shows cost; a per-doctor table of attendance and occupancy; top services; a recent-activity feed signed with the name of the logged-in employee; and an Excel export. No chart library: the program works offline, so one would have to be bundled into the exe wholesale, and the figures are plain markup in the clinic's own colours.

Recalls

/admin/rechemari — the desk's list of patients due for a repeat procedure (hygiene, check-ups). The interval lives on the service (Settings › Services, column Rechemare: 3 / 4 / 6 / 9 / 12 / 24 months), nothing is hard-coded, and only services with an interval take part. The list is computed on every request from finished visits — a no-show, a cancellation or a visit still "programată" starts no clock — and a patient appears fourteen days before the due date, stays until booked again for the same service, and shows "vine pe …" when booked for a different one. The only thing stored is the desk's mark, as an append-only journal (Sunat — revine and E-mail trimis hide the row for two weeks, Nu răspunde keeps it and counts the attempts, Amânat până la hides it until a date, Nu mai reaminti for good); a new finished visit resets everything except the last one. Paper history goes in through Programare nouă on a past date with the Vizita a avut loc box, which files the visit as finished in one step. E-mail is a mailto: plus Copy address / Copy text — nothing leaves the clinic's computer — and the text is clinical (no prices, no offers). The first three rows and the count sit at the bottom of La recepție; the patient card carries one line per service. Doctors do not see the list, only the line in the card. No statistics yet, by decision: the marks are kept as a journal so that "contacted N · booked M" can be counted later without a migration.

Accounts and roles

Asked for by the first pilot clinic. Three roles: director (money, settings, accounts, the doctors catalogue), reception (everything except money and settings, the doctors catalogue included — leave and working hours are front-desk work) and doctor (the journal and patient cards only). A role is a set of permissions in one table, not a string compared at each route, so "the senior administrator needs reports too" is one line rather than a hunt through every comparison.

  • Login takes the password alone; the user id is optional. Reception types it dozens of times a day, and demanding an id as well is friction for nothing — so passwords must be unique, which the app enforces when an account is created. Otherwise the access log would name the wrong person.
  • The session cookie signs uid|role|sid. That sid changes when that person's password changes, so the director can reset one employee's password without logging out everyone else — and without leaving the old tab alive.
  • The role is read from the file by id, never from the cookie: a demotion takes effect immediately, and a deleted account stops working on the very next request.
  • Hiding a menu entry is not protection: every restricted route — GET and POST — refuses on its own, because a URL can be typed and a form can be posted from anywhere.
  • At least one director always has to remain. Otherwise the settings lock shut permanently: there would be nobody left who could hand the rights back.

Access from the clinic's network

By default everything binds to 127.0.0.1. Acces din rețea in the settings writes one line into dental.env, and the launcher then binds 0.0.0.0 so other machines, phones and tablets on the clinic's own network open the same journal in a browser; the app window and the single-instance guard stay on loopback. This is how a clinic runs two workstations — reception and surgery — off one installation, and the page insists on that word one: a second copy of the program would come up with a second, empty database, and both would look perfectly healthy while the appointment booked at reception failed to appear in the surgery. The page shows a QR to http://<lan-ip>:port and says plainly what this is not: it does not reach the clinic from home. The firewall rule is created by the program itself, from a button on that page, through a UAC prompt the director confirms; its result is read from the exit code, never by parsing the localised text netsh prints.

The secure flag is deliberately absent from the session cookie here: over plain HTTP on a LAN it would break login outright, and the clinic's Wi-Fi encrypts one layer below.

Doctors and clinic settings

  • Doctors (/admin/medici): one card per doctor — photo (stored locally, never shown to patients, validated by file signature rather than by name), room, internal phone, personal working window, calendar colour, services performed, and 30-day figures. Three states instead of an on/off switch: active / on leave / archived; a doctor is never deleted (their appointments keep the link) and archiving is refused while future bookings exist.
  • Catalogue edits are gated so the service menu cannot go silently empty: the last active doctor cannot be put on leave, and a service may not lose its last active performer — a list of doctors who are all on leave does not count.
  • Settings (/admin/settings) is a hub of tiles, saved section by section: clinic name, phone, address, per-weekday hours with a lunch break, the service table, security, backup, updates, and an FAQ page whose answers are versioned in the same commit as the behaviour they describe. clinic.json is rewritten atomically (tmp + os.replace, plus a .bak) and re-applied in-process — no restart, no hand-edited JSON.
  • Appearance (Setări › Aspect) — the clinic picks its own colour and uploads its logo, which it may also hang in the middle of the journal's top bar (off by default: an existing clinic must not wake up with a new header). The colour is a set of CSS variables computed per clinic, including the text colour on the brand fill — which is why no rule in the interface may hardcode the default green or a literal white: on a pale brand colour that would print white text on a light background for exactly the clinic that chose it, and never for the developer looking at the screen.
  • Encrypted backup — the whole clinic (database, files, profile) into one AES ZIP under the clinic's own password, written with pyzipper. It opens with 7-Zip on any machine without DentPilot installed, which is the point: a backup that only its own program can read is a hostage, not a backup. The instruction on how to open it is stored unencrypted inside the archive, after the first version locked that note behind the very door it explains.
  • One switch for the daily copy (Setări › Copie de rezervă › Copie zilnică automată, the director's call, on by default). Off means only the launcher's copy at start, as before 17.10, and no amber lines anywhere: the director chose it. The page is written for the front desk, not for IT: the switch, a folder and a password in one short form, one line of fact (Ultima copie: date → where), the history grouped by day, restore folded below; file names, rotation and DPAPI live in the FAQ.
  • Daily copy outside the computer (the folder under that switch) — the same archive, once a day while the program runs, into a folder the clinic names: a second disk, a USB stick left in the machine, the clinic's cloud folder. The last seven are kept, the password lives in dental.env under DPAPI, and the program remembers the date of the last successful copy and shows it as a fact on the page and in Stare sistem. A failed copy is a line in the clinic's activity feed and an amber banner for the director on every screen, until a copy succeeds.
  • Restore from a copy (Restaurare din copie, folded) — a copy picked by date, an archive from that folder or an archive by path (a USB stick) is unpacked into a staging folder, checked by opening it (patients, appointments, documents are shown before the confirmation) and ordered for the launcher: the swap happens on the next start, never under an open connection. The current database is moved aside with a date, never deleted; document paths are relinked to the new data folder, and a restored archive is moved under the clinic's key when the card index is encrypted.

Patient self-booking (removed)

Until November 2026 the program carried a messenger-style booking chat and a Telegram bot on the same engine and database. Clinics told us a QR on the door reads as "anyone can book", and asked for reminders they control instead, so the channel was frozen in August 2026 and removed on 3 November 2026; the code lives on in the git tag archive/telegram-bot. Appointments and patient records the bot created stay in the database and read as ordinary data (the patient list can still filter them by origin). Reminders today are the SMS package.

One file = one clinic

Everything clinic-specific lives in clinic.json: name, phone, address, working hours per weekday (with lunch break and days off), doctors with specialties and state, services with prices, durations and allowed doctors. The engine loads it at startup (CLINIC_CONFIG env) and re-applies it in-process on every save from the settings page — the compose volume is mounted read-write precisely so the journal can write it back.

A second clinic = a folder with its own clinic.json + a compose file pointing at the same image — see examples/clinic-zambet/: different doctors, services, prices and a Saturday off, zero code changes.

Tests

.venv-desktop\Scripts\python.exe tests\run_tests.py            # everything
.venv-desktop\Scripts\python.exe tests\run_tests.py журнал     # one suite by name

The run prints how many checks it did and how long it took — a figure written down here would be stale by the next feature, and the number only ever grows. Standard library only, no pytest and no httpx. .venv-desktop is the build environment, and whatever is installed there eventually ends up inside the exe; tests must also run where nobody can install packages. The React client has its own checks in frontend/: npm run typecheck, npm run lint and npm test (vitest).

GitHub Actions (tests.yml) runs all of it on every push: the engine suites and the mutation of the guards on Windows, cargo test of the Tauri shell, the client checks, the licence server, and ruff check over the Python sources — a rule set chosen to catch undefined names, unused imports and dropped asyncio tasks, not style (ruff.toml). Python dependencies are installed from hash-pinned lock files (bot/requirements-desktop.lock, cloud/requirements.lock), and scripts/lock_check.py fails the run when a lock falls behind its requirements*.txt.

Each suite starts its own server on a free port with its own temporary database (Windows happily lets a second process bind a busy port and then routes requests to the first one, so a fixed port would silently test the wrong server). The clinic used is tests/fixtures/clinic_test.json: open every day 07:00–21:00 so a Sunday-evening run fails on real breakage rather than on "clinic closed", one archived doctor, and one service nobody can perform.

One suite starts no server at all. test_structure.py parses the sources with ast and holds the layout rules that otherwise live only in prose: no __file__ outside the two modules allowed to know where the program sits, no module name computed from __package__, no role compared as a string instead of asking the permission table, no write to auth.json without re-recording its fingerprint. Those are the mistakes that break the packaged exe while leaving a source run perfectly green. Every such rule is proven by tests/mutate.py, which breaks it in a copy of the tree and demands red: a guard that cannot fail is not a guard.

tests/smoke_exe.py is separate and answers a different question — does the built program open its pages. /health replies without a single file on disk, so it never notices a lost --add-data or a broken path to static; those break only in the exe, at the clinic. Build-Installer.ps1 runs it and refuses to package a binary whose pages do not open.

Desktop edition

Since 2.0.0 the program is a folder: the code-signed shell DentPilot.exe (Tauri, Rust: window with WebView2, menu, tray icon, update watcher) and the engine engine\DentPilot-Engine.exe (PyInstaller onedir, the server without a window, talking to the shell over DP1 lines on stdin/stdout). Persistent WebView2 profile, SQLite in the clinic's data folder (see Installer below), no ports open to the outside. A second launch brings the open window forward instead of starting a second copy over the same database. The engine does not start without the shell (the old pywebview window, its browser fallback and the portable.flag USB mode were removed on 22.10.2026). Build with Build-Installer.ps1 (shell + engine + installer); Build-Engine.ps1 builds the engine alone.

  • First launch writes an empty clinic — one placeholder doctor, six generic services, Mon–Fri 07:00–18:00, Sat 07:00–14:00, no prices borrowed from someone else's list. The demo clinic is a second bundled profile, chosen only when the installer's demo checkbox left a demo.flag next to the exe. An invented "Dr. Elena Rusu" in a real journal is worse than a demo patient: a live person can be booked to a doctor who does not exist.
  • A PIN of 4–6 digits per employee, PBKDF2 with 600k iterations in data\auth.json. Stretching the hash and counting the attempts cure two different attacks and neither replaces the other: iterations do nothing against a script hammering the login form, and an attempt counter means nothing to someone who already has the file. Failed attempts walk up a ladder of pauses. Since the file sits next to the database anyway, the strong hash is really protecting a reused PIN, not the database.
  • Tamper signal on the auth file — its SHA-256 lives in the database, and a mismatch at startup raises a banner for the director and a line in the activity log. It is a trace, not a lock: whoever holds the file is standing next to the database as well, and on a clinic that has not turned encryption on, that database opens with any SQLite viewer.
  • Secrets in dental.env are encrypted with Windows DPAPI (the external backup password) — a stolen dental.env is dead on another machine. The flip side is written down rather than discovered: a reinstalled Windows or a different account makes that ciphertext unreadable forever, so only values the clinic can re-enter are ever encrypted this way.
  • Automatic backup on every start and once a day while running into data\backups\ through the SQLite backup API — consistent even after a crash with WAL — keeping the last 14. A clinic that never shuts the computer down used to go weeks without a fresh copy.
  • One-click update from GitHub Releases, with the release's own signed installer behind a UAC prompt, checked before that prompt ever appears — see Design decisions.

Installer: Build-Installer.ps1 wraps that exe into a single DentPilot-Setup-<version>.exe (Inno Setup, installer/DentPilot.iss) — a normal Windows wizard, entirely in Romanian, x64, installed per machine. The exe, the wizard and its uninstaller are signed (Certum), so the UAC prompt and SmartScreen name a publisher instead of "unknown". A release carries the wizard zipped: the updater picks its asset by name, and a second .exe next to DentPilot.exe would sort first and be downloaded as the program.

Program and data are kept apart. The program goes to C:\Program Files\DentPilot and is read-only while it runs; the clinic's clinic.json, dental.env and data\ live in C:\ProgramData\DentPilot, a folder shared by every Windows account on the machine — a clinic where two shifts log in under different accounts must not end up with two separate databases. The launcher hands that folder to the app before it starts, and recognises an install from before September 2026, when the data still sat next to the exe, rather than guessing. Upgrades never touch the data folder, and uninstalling removes only the program, its shortcuts and the update leftovers.

Update channels. Clinics stay on stable and see only published releases. DENTART_CHANNEL=beta in dental.env makes one machine see pre-releases ahead of the clinics, with no credential at all; draft additionally needs a GitHub token with write access. A non-stable machine says so in Settings, so a canary box cannot be mistaken for a clinic's install. Why it is built this way: Design decisions. Release procedure: RELEASE.md.

Licence and the clinic account

The desktop edition runs on a signed licence file, checked offline by the program against a public key compiled into it — the clinic's journal never depends on a server being up. A new install asks the licence service for a free month by itself; a new computer of a clinic the service already knows is activated with a code sent to the clinic's e-mail, and the clinic accepts the terms on the activation page. A month or a year is paid by bank transfer.

When a paid period ends without renewal, fourteen days of grace follow, and after them the program turns read-only rather than locked: no new appointments or visit records, while the card index, printing (043/e, the consent sheet, the periodontal chart), the patient export and the backup stay open. The records belong to the clinic, and it has to be able to read them and hand them over whatever happens to the licence.

The service itself is cloud/ — a separate program with its own tests and no imports from bot/. It keeps the clinic account, the licences, the computers each clinic runs on and the payments, plus a cabinet at cloud.dentpilot.md where the clinic signs in with Google or with a one-time code by e-mail; there is no password to leak. It has no route that accepts or returns medical data.

Server mode — quick start

From a fresh clone, with Docker only — no Node or Python on the host:

cp .env.example .env              # then put a long random string after ADMIN_KEY=
docker compose up -d --build      # first build: a few minutes (npm ci + the React bundle)
# clinic journal: http://localhost:8088/admin — sign in with the ADMIN_KEY

The image (bot/Dockerfile) is built from the repository root in two stages: Node builds the React client (the bundle is not committed), then Python installs the engine from bot/requirements-desktop.lock — the same pinned, hash-checked versions the desktop build ships — and copies the bundle in. SQLCipher is left out on purpose: its key lives under Windows DPAPI, so the server edition has no database encryption.

ADMIN_KEY is required: the first-run PIN setup answers only a browser on the machine itself, and a request into the container comes from Docker's network. The database and the uploaded files live in the dbdata volume (/data); clinic.json is mounted from the repository read-write. Reset to a fresh demo dataset: docker compose down -v && docker compose up -d.

Live demo (demo.dentpilot.md)

The "Try the demo" button on the website opens the real desktop edition (SQLite) behind a small gate: every visitor gets a private copy of a fictional clinic, seeded from "today", for thirty minutes, out of a pool of twelve. A copy goes only to a browser tab's own navigation, so link previews and crawlers do not burn the pool. The program runs with DENTART_DEMO=1 (bot/app/core/demo.py): one flag, one list of closed routes (update, database key, backup/restore, PIN and users, LAN, licence) that closes pages, JSON and the settings tiles alike, and a banner on every screen. The gate, the seed and the image live in demo/, outside bot/, so none of it ships to clinics.

Data and privacy

The patient card stores a full date of birth, sex, IDNP (validated), insurance, address, medical alerts, anamnesis answers, consultation records and uploaded documents including X-rays. That is special-category personal data, and any real deployment has to answer for it.

The design's answer is to keep the data where its controller is — on the clinic's own machine — and to give the clinic the operations the law expects it to be able to perform:

  • Export everything about one patient as an archive (right of access and portability).
  • Erasure on two branches, chosen by what the record contains: a real delete where that is allowed, anonymisation where a medical record or a cash record must remain. The confirmation is a typed word, not an OK button.
  • Access log — who opened which card and when, by name, which is what the law asks for rather than "channel: reception".
  • Encrypted backup the clinic can open without this program, a daily copy of it outside the computer, and a restore button that shows what is inside before anything is replaced.
  • Printed information sheet for signature, plus a document set for the reception desk (patient information, processing register, a supplier agreement, a disk-encryption record).

Patient files live on disk, not in the database, in files/<patient_id> next to dental.db: in the desktop edition that is the clinic's data folder, which survives updates and uninstall; in server mode it is the compose volume.

The card index itself can be encrypted (Setări › Criptarea evidenței): the database moves to SQLCipher under a key the clinic never types, kept by Windows DPAPI. Three things follow from that and each one is a rule rather than a detail. The key dies with the Windows account — a reinstalled system, a new PC or a different account makes the ciphertext unreadable forever — so the only thing that saves the clinic is the printed recovery sheet, and the program therefore keeps a screen that runs when nothing else can, to take that code. The swap of the file itself is done by the launcher before the app starts, because replacing a database under an open connection with its -wal/-shm gives corruption that surfaces hours later. And nothing in the program may open dental.db with the plain sqlite3 module any more; the backup and the launcher's auto-copy both had to learn that, one of them silently. Disk encryption (BitLocker) remains the measure for everything around the database, and the program reports its status on the security page.

Access: the desktop journal is behind the PIN, and an empty ADMIN_KEY does not mean an open journal — the setup screen appears instead, and only for a browser on the machine itself: on a clinic that has opened the journal to its own network, a first-run setup screen answering a second computer would hand the keys to whoever got there first. Server mode therefore signs in by ADMIN_KEY (HMAC cookie), and compose refuses to start without it.

Stack

  • FastAPI + Uvicorn; SQLite + aiosqlite (SQLCipher when the clinic turns encryption on), additive migrations.
  • DentPilot 2.0 (since September 2026): the screens are a React + TypeScript client (frontend/, Vite), built into the exe as one bundle and moved over one screen at a time on top of the same engine; the server-rendered pages they replaced were removed section by section in October 2026 (print sheets, sign-in and recovery screens stay server-rendered by design). JSON routes under /api/ have their own guard that answers 401/403 instead of redirecting, so a fetch can never mistake the login form for success. The 3D odontogram is three.js on the same server data.
  • The journal and the booking engine share one database by design — "integration" is a query, not a sync job.
  • Reviewed adversarially (multi-agent code review) before releases; findings are fixed and covered by regression suites in the same commit.

Design decisions

The parts that were not obvious, and what each one cost to get right.

The odontogram is generated, not drawn

32 permanent teeth, each with a state of its own and a state per surface, 20 primary teeth on a second arch, two views, braces of bridges drawn across them, and the two arches are mirror images. Drawing that by hand is dozens of files that drift apart the first time the shape changes. Instead there is one contour per tooth class, a width coefficient and a root-count rule — upper molars three roots, lower molars and the upper first premolar two, everything else one — and the upper arch is the same code flipped (bot/app/teeth_svg.py).

The primary dentition is not that code with different numbers. Quadrants 5–8 decide which arch a tooth belongs to, and positions 4 and 5 there are molars, because a child has no premolars — precisely the detail a "just renumber it" implementation gets wrong in the place a dentist looks first.

The same idea covers the brand: the program's mark exists once as geometry (bot/app/brand.py) and is rendered two ways — PIL for the .ico Windows shows on the desktop, SVG for the interface. They cannot drift apart because there is nothing to keep in sync.

A printed form has to survive the pen

The 043/e sheet is not a screenshot of the database. Everything the program knows for certain — patient, doctor, teeth, plan, visit journal — is printed. Everything the dentist writes at the chair — mucosa, occlusion, the radiological exam — is printed as a yellow gap, and the visit journal ends with blank rows and a signature column. A form that leaves no room for handwriting is a form the clinic stops using by the second week.

What is deliberately not promised is a pixel copy of the typographic blank: the sections and their order match order 828/2011 and the sheet says so in its header, but imitating the printing house is a claim nobody can honour across printers.

The canary channel carries no secret

Before a release reaches clinics it runs for a day on one machine. The first version did that with GitHub draft releases, which are invisible without a token — so the canary machine had to keep a token that could push code, in a file next to the exe, in a folder every Windows account on that machine can read. That is a large payment for hiding a build from people who are not looking for it.

Pre-releases cost nothing. They are public, so no key is involved, and a clinic still cannot reach one: on stable the updater asks exactly one endpoint, /releases/latest, which by construction serves neither drafts nor pre-releases. The guard is an endpoint with nothing extra to show, not a filter someone can loosen by accident later.

Getting there cost an evening to a wrong conclusion. A read-only token reports zero drafts — not "access denied", just zero — because GitHub shows drafts only to callers who can write. Three sources agreed there was no draft; all three were blind for the same reason, which makes them one source. The lesson that stuck: a negative result needs proof that the instrument could have seen the thing at all.

Double-booking outlived its own defence

Unique indexes on (doctor, starts_at) and (patient_id, starts_at) made overlapping bookings impossible — until appointments got durations. 10:00 for sixty minutes and 10:30 for sixty minutes collide without sharing a start, and an index on the start column cannot see it. The real guard is an interval test and the insert under one lock.

That lock is per process. The program runs a single worker (the desktop app has a single-instance guard), so it holds — and every path that books goes through one wrapper, so a second process would change the lock in one place.

Never identify a failure by the engine's wording

The same violation is reported differently by the two backends: SQLite names the columns, PostgreSQL names the index. A check written as "is our index name in this message" was therefore true on one edition and quietly false on the other, and the clinic saw "this hour is taken for the doctor" where the truth was "this patient already has an appointment then". The booking code now asks the question before inserting instead of parsing what the engine says afterwards.

A neighbouring version of the same trap: a computed date arrives from PostgreSQL as a timestamp and from SQLite as a string, so an aliased date column has to be declared in one list in the data layer. Forget it and the code works in the cloud and raises at the clinic.

A new clinic starts empty

First launch writes a blank profile: one placeholder doctor, six generic services, no prices borrowed from someone else's list. The demo clinic is a second bundled profile, used only when the installer's demo checkbox left a flag next to the exe.

This was a bug first. An early version left the demo doctors in a real clinic's journal, and a real patient can be booked to a doctor who does not exist — which is worse than a demo patient, because it looks like data rather than like a sample.

Updating without breaking the clinic

One click, and the risk is that the clinic ends up with no working program at all. So the download is checked against the release's byte size and SHA-256 before anything is touched: a truncated 30 MB download raises no exception in urllib and used to overwrite the working exe in silence. The swap moves the running program aside and puts it back if the new file does not land, so a failed update is distinguishable from a deleted one. The asset name is matched exactly, because the installer sitting next to it in the same release would otherwise be pulled in as the program.

Moving the program to Program Files took that swap away from the clinic's own Windows account: replacing a file there needs administrator rights. So the update became the release's signed installer behind a UAC prompt, and the prompt is the last step rather than the first — size, SHA-256 and the Authenticode signature against the one publisher the program trusts are checked before Windows asks anybody anything, so a clinic is never asked to elevate a file the program has not already recognised. Which release to fetch is asked first of a small update server; its answer is checked like any other input (this repository, the same tag, the exact file name, a newer version), and when the server is silent the program goes to GitHub as before.

Migrations are additive by rule — new columns, never a rewrite — because the desktop edition upgrades in place on a machine nobody administers, and there is no way to roll a clinic back at 9am on a Monday.

A new door makes old locks visible

Adding LAN access did not create a permission hole; it exposed one that had been there since roles were introduced. The doctors catalogue had never been put behind a permission, which nobody could reach while everything bound to loopback — and the day a doctor opened the journal from a phone, he could edit his colleagues' cards. The rule that came out of it: every time the surface grows, the permission audit runs again, not only the feature's own tests.

Guardrails that assume a tired receptionist

The catalogue refuses edits that would silently empty the service menu: the last active doctor cannot be put on leave, and a service may not lose its last active performer — a list of doctors who are all on holiday does not count. That rule exists because it once did not: a service quietly vanished while the journal showed a green "saved" banner.

In the same spirit, arrived keeps the slot occupied rather than freeing the hour, and returning a cancelled visit to an active status is refused if the interval has meanwhile been taken.

A screen that refreshes itself has to be deterministic

Replacing the twelve-second page reload with a poll-and-swap looked like a rendering change and turned out to be a rule about the body of a live page: with unchanged data it must produce byte-identical HTML, because its fingerprint is what decides whether anything gets replaced at all. One server-rendered minute counter — the "now" line, "waiting 7 min" — makes every fingerprint differ, every poll swap the fragment, and the flicker return through the back door, where it is invisible until somebody stands on the page for half a minute. So everything continuously changing moved into the browser, and everything the browser re-executes on a swap had to stop being a const.

The second half of the rule is the reverse: a page that is never swapped must still be correct. The animation switch is a class on <html>, and any rule that depends on it has to leave the element in its final state when the class is absent — a static page is normal, not a breakage.

Roadmap

  • SMS package: reminders and confirmations the clinic controls, which is what clinics ask for instead of a public booking link.
  • Storage periods and scheduled clean-up, the last open item under the new data-protection law.
  • Multi-tenant single instance (today: one lightweight compose stack per clinic).

Pe scurt / Кратко

Registru pentru clinici stomatologice: programul zilei, fișa pacientului cu odontogramă, plan de tratament, anamneză, plăți și documente, cu fișa 043/e tipărită din program. O clinică nouă = un singur fișier clinic.json. / Журнал для стоматологий: расписание, карточка пациента с одонтограммой, план лечения, анамнез, платежи и документы, с печатью формы 043/e из программы. Новая клиника = один файл clinic.json.

License

Source-available, not open source. © 2026 Oleg Bacalu, all rights reserved. The code is here to be read; using it in a product, redistributing it or building on it needs written permission — see LICENSE. Versions published before 2026-08-04 went out under MIT, and that grant is not withdrawn for them.

Compiled releases are licensed to the clinic that installs them, for its own use. Permissions: [email protected]

About

DentPilot — practice management for dental clinics in Moldova: schedule, patient card with odontogram, treatment plans, payments, printed form 043/e. Windows desktop app, data stays at the clinic.

dentpilot.md

Topics

dentaldental-clinicdentistryfastapimoldovaodontogrampractice-managementreactsqlitewindows-desktop

Resources

Readme
License
Activity

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.