Commit Graph

87 Commits

Author SHA1 Message Date
70092e932d feat(backend): resolve spoken deadlines to ISO dates
Jalali conversion is arithmetic here, not inference. A model asked to turn
"۲۵ مهر" into ISO answers confidently and is often wrong, and @IsDateString()
accepts the wrong answer — so the model emits a date intent and this decides
what it means.

Deviation from the spec, deliberately: the resolver takes todayIso rather than
an IANA zone. Working in civil dates means nothing here reasons about instants.
The zone is used one level up, where civilDateInZone() derives "today" from the
actor's zone server-side — better than the spec's client-supplied date, which
the client could set arbitrarily.

Conventions pinned by tests:
- "this <weekday>" is the soonest occurrence strictly after today, so "by
  Thursday" said on a Thursday means the next one; a deadline of today is
  almost never what was meant. "next" adds a further week.
- month offsets clamp to the end of shorter months (31 Jan + 1 = 28/29 Feb)
- a resolved date in the past, or more than five years out, is treated as
  unresolved however it was arrived at — an absolute date the model invented
  can land anywhere
- no due date at all is not an error; an unparseable one is, and echoes what
  was heard so the review sheet can show it

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 23:05:30 +03:30
1076c13472 feat(backend): voice intent contract and tooth-intent resolver
The extraction model emits intents, never resolved values — no FDI codes, no
ISO dates. This adds the contract it must satisfy and the resolver that turns
spoken tooth references into FDI, so quadrant mirroring is a unit test rather
than a hope.

resolveToothIntent never guesses and never clamps: position 9, a deciduous
tooth, or a malformed shape resolve to null and are reported as unresolved with
the transcript span that produced them, so the review sheet can show the
clinician exactly which words were not understood.

Everything here parses untrusted model output, so nothing may throw:

- a non-array where a list was expected degrades like any other malformed shape
- explicit codes are trimmed, for parity with normalizeTeeth
- '51' reports as not_permanent_tooth (a real primary tooth the chart cannot
  show) while '99' reports as malformed — the clinician should not be told a
  deciduous tooth was heard when nothing tooth-shaped was
- unresolved items only dedupe when they carry a spoken span; without one,
  collapsing them would hide a lost tooth behind a single blank review row

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 23:05:30 +03:30
4b4c197c03 feat(backend): extract shared FDI tooth geometry
Voice extraction needs quadrant mapping and adjacency server-side, and
treatment.utils.ts already held a private copy of the tooth set. Lift it into
common/fdi.ts rather than create a second source of truth; treatment.utils now
imports it, behaviour unchanged (existing suites still pass).

toFdi() is the single place the patient-right convention lives: quadrant 1 is
the patient's upper right, so upper+patient_right -> 1x, upper+patient_left ->
2x, lower+patient_left -> 3x, lower+patient_right -> 4x. Getting this backwards
mirrors every quadrant and yields a valid-looking code for the wrong tooth,
which no schema check can catch — so all four quadrants are pinned by tests,
along with out-of-range positions never being clamped and deciduous teeth being
rejected outright (the chart is permanent dentition only).

Adjacency mirrors the frontend's arch-order rule, so the midline pairs 11-21
and 41-31 count as neighbours exactly as the chart treats them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-23 23:05:30 +03:30
b1405b22b1 improvement: patient search moved to the top of treatment feature. 2026-08-22 20:11:43 +03:30
d2f07c0ed3 improvement: treatments UI/UX updated again to minimize clicking and scrolling. 2026-08-19 23:59:37 +03:30
96f698be98 improvement: UI/UX improved for v1 standalone treatments/cases feature. 2026-08-19 16:07:32 +03:30
8bfa8c88fe improvement: v1 standalone treatment/case creation made possible. 2026-08-19 15:05:58 +03:30
80167c622c bugfix: appointment hours now use the client timezone on UTC servers.
Logical API errors throw stable codes so users see translated messages instead of a generic bad request.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 01:43:50 +03:30
db515f9630 improvement: time period dropdown added to appropriate dashboard charts. 2026-07-19 00:37:59 +03:30
538121d653 improvement: pdf generation added to cases feature. 2026-07-18 22:00:44 +03:30
408b2c3329 improvement: task assignment notif added to notifications feature. 2026-07-18 17:23:47 +03:30
9941dca849 improvement: notification feature polished. feature tabs following the same notification socket emmited data to be updated. 2026-07-18 16:57:13 +03:30
9f6ec193d2 feature: version one notification feature implemented. 2026-07-18 01:09:54 +03:30
0740493384 improvement: fdi tooth chart selection modes polished. bugs related to teeth selecyion fixed. 2026-07-18 00:02:40 +03:30
68fc9d5d6d improvement: treatment plan turned into a wizard. shift+click control added to FDI tooth chart for cunnected prosthesises. 2026-07-17 00:39:32 +03:30
cf07b4d8a8 improvement: delete action added for unsent treatment details. some edit controls added to details and shipments. 2026-07-16 22:45:37 +03:30
334b7841ae improvement: treatment exits contoll adde to appoinment remove action. 2026-07-16 22:35:02 +03:30
08df2f71ea improvement: QRcode and shared link added to cases inorder to make it possible for staff users to share a case info with other staffs or other clinics. 2026-07-14 21:07:05 +03:30
a7ba33fb68 bugfix: clinic owner user access to other (dentist)staff's treatment plans terminated. 2026-07-14 03:39:42 +03:30
d383a4abc3 improvement: some new gadgets added to dashboard. some new functionality added to existed gadgets. 2026-07-14 03:06:56 +03:30
27eae25f61 improvement: lab/clinic commiunication flow completely overhauled. no more shit. 2026-07-13 22:53:23 +03:30
2ad572f4c8 improvement: notify counter badge added to treatment and tasks tabs for upadted and edited cases. 2026-07-13 17:44:44 +03:30
08a1f34c4f improvement: duedate added for shipped cases. cases and tasks ui and ux updated accordingly. 2026-07-13 16:30:36 +03:30
a391eee15f improvement: task assignment flow added. cases and tasks feature updated accordingly. 2026-07-13 15:47:32 +03:30
0d073f1ec0 improvement: sorts and filters updated for tasks feature. 2026-07-13 13:22:38 +03:30
4e6ed75844 improvement: tasks feature UX fully overhauled. 2026-07-13 02:09:49 +03:30
f28cd06615 improvement: treatment UX fully overhauled. 2026-07-13 01:03:26 +03:30
abf0371a5b improvement: appointment dialog UX improved. 2026-07-12 22:07:11 +03:30
1cdf853d32 improvement: appointments history component added to patients feature. 2026-07-12 18:56:01 +03:30
fab5111aa8 improvement: error handeling structure changed and unified all across the app. user no longer sees inappropriate messages. 2026-07-12 18:27:38 +03:30
901d838a2c bugfix: organization not selected problem fixed. being logged out too often fixed. 2026-07-12 17:51:31 +03:30
39935688ad improvement: a flow added for owner users to make it possible for them to participate in treatments or tasks. 2026-07-12 15:11:50 +03:30
0f1004a34a Case completion and tasks completion gadgets added. 2026-07-12 02:08:54 +03:30
d79aab907c Some functionality added to dashboard gadgets. 2026-07-12 00:28:43 +03:30
83f6003a2b Positioning, sizing and sorting of the gadgets improved. 2026-07-11 22:32:37 +03:30
ed8ff61205 Shitty gadgets removed. Some useful gadgets added. 2026-07-11 03:12:56 +03:30
3f2b332bd3 Add Today action lists and clickable KPI links (Phase 3).
Show upcoming appointments for the rest of today and link each KPI card to its relevant dashboard tab.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 00:48:35 +03:30
10959e3183 Add Recharts bar charts to Today dashboard summary.
Extend the Today summary API with treatment mix and workflow task breakdowns, and render permission-aware chart cards on the Today page using Recharts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 00:34:38 +03:30
22466490bf Add Today dashboard foundation with permission-aware KPI summary API.
Replace hardcoded Today cards with a backend summary endpoint and composable frontend widgets filtered by org type and tab permissions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-11 00:07:48 +03:30
be4ac3426e Merge branch 'master' into feature/cases 2026-07-10 15:26:36 +03:30
8d334833ff improvement: all demo bugs fixed. give me more baby. 2026-07-08 02:53:47 +03:30
86b1e3afff improvement: attachment selection for lab dispatch added. attachment preview added to cases feature. 2026-07-07 18:43:10 +03:30
b2d40b3e97 improvement: users can now comment on a case and it's details and have an option to make it visible for clinics too. 2026-07-07 17:14:31 +03:30
cb63ced4e3 improvement: tasks and cases feature updated based on the new prosthesis types and their steps. the whole assignment proccess removed from the flow. 2026-07-07 15:31:09 +03:30
ed7e7b1d8f improvement: all clinic side ui components related to treatment types updated based on the new real world data. 2026-07-07 13:13:04 +03:30
667b08ed0c TreatmentType and ProsthesisType database shcema and data updated. Lab dispatch wired through new data. 2026-07-06 20:40:19 +03:30
3f7364dbf0 forgot password in login page and account info implemented, sms.ir service works fine with sandbox key. 2026-07-04 00:01:58 +03:30
2f95559087 remember me with max age 30 days :). 2026-07-02 17:59:49 +03:30
3e81c110a3 improvement: added a history action button to connected orgs row inordr to see a brief report of the relevant cases between two orgs and the status of each related task. 2026-06-28 23:19:33 +03:30
2a48946a51 feature: Tasks tab added for lab organizations. tasks now can be assigned and their status can be updated by the assignee. 2026-06-28 22:56:56 +03:30