feature: prosthesis catalog mapping with exocad catalog updated. #136
@@ -14,7 +14,7 @@ alwaysApply: false
|
||||
- **Comments:** a generated case hides the eye until a linked clinic is selected; that eye publishes the comment to the clinic. A linked lab reads the thread on the share page and does not use the eye. A received case uses the eye for the clinic. A lab-to-lab case uses it for the sending lab; the sender's handoff lists only comments with that control on.
|
||||
- **Outsource** (`POST /cases/:id/outsource`, label `cases.sendCase`): one linked lab, checked in-progress prosthesis-job steps plus `model_design` / `model_create`, one `LAB_OUTSOURCE` child case. The child stores the sending lab as `referringClinicName` and clears dentist and partner clinic. Those parent steps leave Tasks until the child completes them (written back with no actor). Sender detail shows only that direct lab. The sender chart stays the full plan; the child chart is the selected jobs plus pontics on that bridge, or that line’s teeth for a model step (the whole plan for a historical `__case__` model step). Recall before any of those steps is completed. Received child cases have Outsource, not Start, Delete, or Edit. Scan, packing, and shipping stay on the owning lab. Child `sourceKey` is the child case id. When two selected steps share tooth, prosthesis type, and workflow step, `outsourceChildSourceKey` uses `childId:parentSourceKey` so the current-round unique index accepts both. `dedupeToothJobs` includes `sourceKey`.
|
||||
- **Share link:** QR + URL when the case is sent **or** a lab-origin case is started; token API + focus page — see `.cursor/skills/lab-case-share-link/SKILL.md`.
|
||||
- **Send to Exocad:** writes an official `.dentalProject` XML into DentalDB’s Project Auto-Import folder (`showDirectoryPicker`, Chrome/Edge only). Does not open or mutate DentalDB SQLite. Builder: `components/lab/exocad/exocadDentalProject.ts`. Folder session: `ExocadExportFolderProvider` (changeable Auto-Import folder). Active indirect leaves and implant stacks are mapped; empty plans refuse export; Coping pontics use `ReducedPontic`, full-contour use `AnatomicPontic`; shade is `VCL` or bleach `V3DM`. No antagonists or scan files in this phase. `externalCode` stays manual. See `.cursor/skills/lab-cases/SKILL.md`.
|
||||
- **Send to Exocad:** writes an official `.dentalProject` XML into DentalDB’s Project Auto-Import folder (`showDirectoryPicker`, Chrome/Edge only). Does not open or mutate DentalDB SQLite. Builder: `components/lab/exocad/exocadDentalProject.ts` (PDF Tables 2–4 are the value source of truth). Folder session: `ExocadExportFolderProvider` (changeable Auto-Import folder). Monolithic = `AnatomicCrown`/`ZI`; prefab/Ti-base/multi-unit = `CustomAbutment`/`TI`; empty plans refuse export; Coping pontics use `ReducedPontic`, full-contour use `AnatomicPontic`; shade is `VCL` or bleach `V3DM`. No antagonists or scan files in this phase. `externalCode` stays manual. See `.cursor/skills/lab-cases/SKILL.md`.
|
||||
- **One plan:** a live case has one prosthesis plan. Clinic send still uses `treatmentDetailId` as `sourceKey`. Lab-origin cases use the case id. Outsource children use the child case id, or `childId:parentSourceKey` when two selected steps would collide (see Outsource). `LabCaseLine` is gone. Detail and New case use `UnderlineTabs`: Details, Files, Messages. Files and Messages show unread counts (`LabCaseSectionReadState`); opening Details does not clear them. `ATTACHMENT_ADDED` is not a sidebar badge. Origin is one combobox of linked clinics and labs, or a typed name. Dentist/Technician stays optional. Arch jobs (`UA`/`LA`) highlight the read-only FDI chart.
|
||||
- **Case Sheet PDF:** same layout for portrait and landscape (Download PDF menu). One A4 page, scaled to fit — the chart is never split. Header is a flex row: current organization name (one line, 56px line box so html2canvas does not clip the 28px glyphs), Nudentic lockup aligned with that text, share QR at 88px inside a 96px frame with `fill` off (a stretched SVG is dropped by html2canvas; not a table cell). Print root top padding is 16px portrait / 24px landscape so the QR is not clipped; `html2canvas` `scrollY` is 0. The page stays LTR in every locale. On `fa`, the org name is a shrink-wrapped `inline-block` (`direction: ltr` unless the name itself contains Arabic script) with `letter-spacing` and `word-spacing` `0px` — a full-width RTL box gaps Latin words. Party and meta values use `printRtlValueStyle` (Arabic script stays RTL; Latin stays LTR and right-aligned). Section rules keep a 12px gap and 8px padding so the line clears the values; `FA_RULE_DROP` (6px) clears Persian descenders. `onclone` must not overwrite the name span’s direction. Print ink is `prosthesisTypePrintColorFromCatalog` (heaviest family swatch). Prosthesis rows are SVG boxes. Chart is 85% of the page width with capped glyph height, shared upper column widths, outline-only unselected teeth, root vs crown fills, a larger gap under the upper caption, and matching tooth/number/midline gaps on both arches. Bridge marks match the FDI chart: 10px `#009cae` dots on the column boundary in the tooth-to-number gap. `onclone` sizes the lockup SVGs and the organization-name line box. Hex inline styles only. Optional `externalCode` replaces the printed order number and the `case-sheet-{orderNumber}.pdf` filename.
|
||||
- **Detail chrome:** The header follows the detail panel width (`@container`, not the viewport): two columns (info start, actions end) from `@2xl`, otherwise one stack with the buttons under the info: name and the same QR thumb (`w-24 sm:w-32`) on the first row, mobile/from/date on one wrapping line, then progress bar, external code, **Mark as important**, and billed, stacked and left aligned. The destination lab with `TAB_BILLING_EDIT` edits that fee (`PUT /billing/cases/:id/amount`) and the open case updates immediately; anyone else sees the stored fee, or the calculated quote when no fee is stored. Edit / Outsource / Send to Exocad / Get PDF are one equal-width grid (`responsiveFill`, truncating caption): 2 columns when narrow, one column per button from `@xl`, 2 columns in the `@2xl` end column with the QR below. Get PDF is a primary `CaseLifecycleButton` with no icon. Add files uses that button at the treatment action width. **Add case** is a full-width `px-6 py-3 text-base` split (label + mic) matching New treatment and Add detail voice. There is no Comments button, and opening Messages does not scroll the page. File cards: name at the start and checkbox at the end, then a clipped preview, then size over date at the start with the View/Download menu centered at the end. Remove is on that menu (`DELETE /cases/:id/attachments/:attachmentId`, confirm first). An in-progress upload is its own card with a progress bar. The sent-date line reads “Outsource {date}”.
|
||||
|
||||
@@ -64,7 +64,7 @@ Writes an official `.dentalProject` XML into DentalDB’s Project Auto-Import fo
|
||||
- `ExocadExportFolderProvider` remembers the Auto-Import directory handle (IndexedDB). The next export reopens that folder when permission remains and skips Browse. A missing or denied folder shows the folder picker again.
|
||||
- The connect dialog asks for the DentalDB Project Auto-Import folder and notes that this release exports case data only (scan companion files are still placed by the user when needed).
|
||||
- Builder: `frontend/src/components/lab/exocad/exocadDentalProject.ts`. Root is `<Treatment UseRecipientMaterialConfiguration="True">`. `ProjectGUID` is the Dyolink case id. `PracticeName` is the clinic name (no `PracticeId`). Patient family/given names are mandatory (`PatientName` / `PatientFirstName`); a one-word name is refused. `Notes` are the case comment bodies, or the detail comment when the thread is empty. File name is `{date}-{shortCaseId}.dentalProject`.
|
||||
- Tooth mapping (XML `ReconstructionType` / `Material`): Monolithic Zirconia and PFZ = `Coping`/`ZI`; PFM = `Coping`/`NP`; Full Metal = `AnatomicCrown`/`NP`; PMMA = `AnatomicCrown`/`PMMA`; Glass Ceramic = `AnatomicCrown`/`GCER`; Pressed Ceramic = `AnatomicCrown`/`LS2`; PEEK = `AnatomicCrown`/`PEEK`; Temporary Resin = `ProvisionalCrown`/`TEMP`. Active indirect: `veneer_*` → `Veneer`/`LS2`; `*_full_contour` inlay/onlay/overlay → `AnatomicInlay`/`LS2`; `*_layered` inlay/onlay/overlay → `OffsetInlay`/`LS2`. Legacy veneer/overlay leaves keep their old pairs; overlays never use OverlayCrown. Pontic follows the abutment family: `Coping` → `ReducedPontic`, full-contour → `AnatomicPontic`, with the abutment material. `customized_abutment` → `CustomAbutment`/`TI`; `zirconia_abutment` → `CustomAbutment`/`ZI`; `screw_retained` → `WithoutAbutment`. Unmapped stacks (`ti_base_abutment`, prefab/multi-unit, post & core) are skipped and never force `ImplantType None`. A plain Coping with no implant stack sets `ImplantType` `None`. Bridge groups set `MesialConnector` toward the mesial neighbor in the same `selectionGroupId`. Empty exports are refused (`NOTHING_TO_EXPORT`). Antagonists and scan files are not exported in this phase. Case shade → `ToothShade` as `VCL:<code>` or bleach `V3DM:0M*`.
|
||||
- Tooth mapping follows the official `.dentalProject` Tables 2–4 in `docs/exocad_Specification_Document_dentalProject_Format_to_Be_Written.pdf` (XML `ReconstructionType` / `Material` / `ImplantType`). Full-contour Monolithic Zirconia = `AnatomicCrown`/`ZI`; cutback PFZ = `Coping`/`ZI`; PFM = `Coping`/`NP`; Full Metal = `AnatomicCrown`/`NP`; PMMA = `AnatomicCrown`/`PMMA`; Glass Ceramic = `AnatomicCrown`/`GCER`; Pressed Ceramic = `AnatomicCrown`/`LS2`; PEEK = `AnatomicCrown`/`PEEK`; Temporary Resin = `ProvisionalCrown`/`TEMP`. Active indirect: `veneer_*` → `Veneer`/`LS2`; `*_full_contour` inlay/onlay/overlay → `AnatomicInlay`/`LS2`; `*_layered` inlay/onlay/overlay → `OffsetInlay`/`LS2`. Legacy veneer/overlay leaves keep their old pairs; overlays never use OverlayCrown. Pontic follows the abutment family: `Coping` → `ReducedPontic`, full-contour → `AnatomicPontic`, with the abutment material. Implant stacks (Table 4 only has `None` / `CustomAbutment` / `WithoutAbutment`; DentalDB “On stock abutment” is not writable): `customized_abutment` → `CustomAbutment`/`TI`; `zirconia_abutment` → `CustomAbutment`/`ZI`; prefab / Ti-base / multi-unit → `CustomAbutment`/`TI`; `screw_retained` → `WithoutAbutment`. Post & core stacks are skipped and never force `ImplantType None`. A plain implant-capable restoration with no stack sets `ImplantType` `None`. Bridge groups set `MesialConnector` toward the mesial neighbor in the same `selectionGroupId`. Empty exports are refused (`NOTHING_TO_EXPORT`). Antagonists and scan files are not exported in this phase. Case shade → `ToothShade` as `VCL:<code>` or bleach `V3DM:0M*`.
|
||||
- Auto-Import folder can be changed from the case header; success toast names the folder when known.
|
||||
- `externalCode` stays manual-only — export does not auto-fill it.
|
||||
- There is no Local database tab.
|
||||
|
||||
@@ -74,7 +74,7 @@ frontend/src/
|
||||
|
||||
**Lab Tasks tab:** Newest case first (`listedAt`); grouping only for date sort; filters include completed step, origin, due date, assignment, and prosthesis. New tasks are plan-scoped: one scan → prosthesis sections → optional Model design/creation (when any type has `requiresModelSteps`) → packing/shipping. `lineCount` stays 1. `__line__` tasks are independently completable. A type with both dry milling and sintering generates `milling_dry_sinter`; both wet milling and sintering generate `milling_wet_sinter`; both stain and glaze generate `stain_glaze`. A type with only one half keeps that half, and existing task rows are not rewritten. Model design and model create can be outsourced with that line’s teeth, or the whole plan for a historical `__case__` model step; scan, packing, and shipping cannot. Historical `__case__` scan keeps whole-case fan-out. Same-type exclusive steps coalesce across matching teeth; duplicate non-model steps for stacked types become `typeA+typeB` sections. Pontics fold into connected crown/indirect sections. Task identity includes source, first tooth, section type, and workflow code because one section may produce different tooth sets across steps. Job titles use `ProsthesisJobLineLabel`; task assignment is in Cases; only assignee/unassigned pool can update status in Tasks. `CASE_COMPLETED` drives inbox/tab badges only after all case tasks finish. See `.cursor/skills/lab-tasks/SKILL.md`.
|
||||
|
||||
**Lab Cases tab:** Filter by **prosthesis type** (not treatment type); auto-select newest case on open; list **10 per page**; left rail list fills column height (`flex-1 overflow-y-auto`). Unstarted lab-origin **drafts** sit in a collapsed expandable rail section (opens on click or **Add case**); received + started cases list below, newest first by send or start time (`listedAt`, same key as Tasks). List cards use `LabCaseProsthesisGroupsList` (colored type + teeth, shared with Treatment rail) plus **From clinic** / **Generated** / **From lab** origin badges. Job titles use `ProsthesisJobLineLabel` the same as Treatment/Tasks (`13 · Pontic - 14 · PFZ Crown`; no category; indirect keeps Inlay · Layered ceramic). Deep link: `?caseId=`, `?clinicOrganizationId=`. **Share link:** QR + URL on sent cases **and** started lab-origin cases (attachment left, QR right); opens `/lab-case/[token]` focus page. **Case Sheet PDF:** same portrait/landscape layout, one A4 page (`jspdf`/`html2canvas`, scaled to fit); realistic FDI chart; hex-only print layout; share QR stays in the flex header; optional `externalCode` replaces the printed order number and the `case-sheet-{orderNumber}.pdf` filename. The page stays LTR; on Persian sheets the org name is shrink-wrapped (RTL only when the name itself is Arabic script) and labels use `0px` letter-spacing. Lab-origin Start has no clinic send and notifies the linked org once (`PARTNER_CASE_CREATED`, share link); generated-case comments have no visibility toggle. A lab-to-lab case uses the eye button so the sending lab can see that comment. Comments use Cases **or** Tasks permission. Unstarted generated drafts can be deleted (`DELETE /cases/:id`). **Edit** (`POST /cases/:id/stop`) returns a started generated case to that drafts rail: completed steps and the previous prosthesis plan stay as history, in-progress steps are dropped, and the case can be edited and started again. Open outsources with no finished step are cancelled; a finished outsourced step blocks Edit. **Outsource** gives selected in-progress prosthesis steps, plus model design and model create, to one linked lab as a child case. Child `sourceKey` stays the child case id unless two selected steps share tooth, type, and workflow (`childId:parentSourceKey`). The child shows only that sending lab (no original clinic or dentist). Those steps leave Tasks until that lab completes them, and only the sending lab sees that direct handoff. The sender chart stays the full plan; the receiver chart is the selected jobs plus pontics on that bridge. **Live:** inbox Socket.IO → `notifyTabBadgesChanged()` soft-refreshes list + selected detail (no remount). A file upload emits `case-section.changed` on that socket (no inbox card) so Files and Messages unread counts refresh the same way. **Add case** is a full-width split button with the lab mic. One file can be removed from its card menu. An upload keeps running after leaving Files or Cases; the open case adds the file from the upload response without another fetch. Attachments have no size cap; production must recreate nginx from the SSL template or `/api` stays at 50MB. **Send to Exocad** (Chrome and Edge only, any screen size; no helper or download) writes an official `.dentalProject` XML into DentalDB's Project Auto-Import folder (`showDirectoryPicker`). It does not open or mutate DentalDB SQLite. Prosthesis pairs stay the same (`Coping`/`ZI` for monolithic/PFZ, custom abutment on Coping, etc.); IPS Overlay uses `AnatomicInlay`/`LS2`; active indirect leaves and implant stacks are mapped; Coping bridges use `ReducedPontic`, full-contour use `AnatomicPontic`. Case shade maps to `VCL:<code>` or bleach `V3DM:0M*`. Empty plans refuse export. The Auto-Import folder can be changed. `externalCode` stays manual. No antagonists or scan files in this phase. There is no Local database tab. See `.cursor/skills/lab-cases/SKILL.md` and `.cursor/skills/lab-case-share-link/SKILL.md`.
|
||||
**Lab Cases tab:** Filter by **prosthesis type** (not treatment type); auto-select newest case on open; list **10 per page**; left rail list fills column height (`flex-1 overflow-y-auto`). Unstarted lab-origin **drafts** sit in a collapsed expandable rail section (opens on click or **Add case**); received + started cases list below, newest first by send or start time (`listedAt`, same key as Tasks). List cards use `LabCaseProsthesisGroupsList` (colored type + teeth, shared with Treatment rail) plus **From clinic** / **Generated** / **From lab** origin badges. Job titles use `ProsthesisJobLineLabel` the same as Treatment/Tasks (`13 · Pontic - 14 · PFZ Crown`; no category; indirect keeps Inlay · Layered ceramic). Deep link: `?caseId=`, `?clinicOrganizationId=`. **Share link:** QR + URL on sent cases **and** started lab-origin cases (attachment left, QR right); opens `/lab-case/[token]` focus page. **Case Sheet PDF:** same portrait/landscape layout, one A4 page (`jspdf`/`html2canvas`, scaled to fit); realistic FDI chart; hex-only print layout; share QR stays in the flex header; optional `externalCode` replaces the printed order number and the `case-sheet-{orderNumber}.pdf` filename. The page stays LTR; on Persian sheets the org name is shrink-wrapped (RTL only when the name itself is Arabic script) and labels use `0px` letter-spacing. Lab-origin Start has no clinic send and notifies the linked org once (`PARTNER_CASE_CREATED`, share link); generated-case comments have no visibility toggle. A lab-to-lab case uses the eye button so the sending lab can see that comment. Comments use Cases **or** Tasks permission. Unstarted generated drafts can be deleted (`DELETE /cases/:id`). **Edit** (`POST /cases/:id/stop`) returns a started generated case to that drafts rail: completed steps and the previous prosthesis plan stay as history, in-progress steps are dropped, and the case can be edited and started again. Open outsources with no finished step are cancelled; a finished outsourced step blocks Edit. **Outsource** gives selected in-progress prosthesis steps, plus model design and model create, to one linked lab as a child case. Child `sourceKey` stays the child case id unless two selected steps share tooth, type, and workflow (`childId:parentSourceKey`). The child shows only that sending lab (no original clinic or dentist). Those steps leave Tasks until that lab completes them, and only the sending lab sees that direct handoff. The sender chart stays the full plan; the receiver chart is the selected jobs plus pontics on that bridge. **Live:** inbox Socket.IO → `notifyTabBadgesChanged()` soft-refreshes list + selected detail (no remount). A file upload emits `case-section.changed` on that socket (no inbox card) so Files and Messages unread counts refresh the same way. **Add case** is a full-width split button with the lab mic. One file can be removed from its card menu. An upload keeps running after leaving Files or Cases; the open case adds the file from the upload response without another fetch. Attachments have no size cap; production must recreate nginx from the SSL template or `/api` stays at 50MB. **Send to Exocad** (Chrome and Edge only, any screen size; no helper or download) writes an official `.dentalProject` XML into DentalDB's Project Auto-Import folder (`showDirectoryPicker`). It does not open or mutate DentalDB SQLite. Mapping follows the official PDF tables: monolithic = `AnatomicCrown`/`ZI`, PFZ/PFM = `Coping`, prefab/Ti-base/multi-unit/custom abutments = `CustomAbutment` (+ material), screw-retained = `WithoutAbutment`; IPS Overlay uses `AnatomicInlay`/`LS2`; active indirect leaves are mapped; Coping bridges use `ReducedPontic`, full-contour use `AnatomicPontic`. Case shade maps to `VCL:<code>` or bleach `V3DM:0M*`. Empty plans refuse export. The Auto-Import folder can be changed. `externalCode` stays manual. No antagonists or scan files in this phase. There is no Local database tab. See `.cursor/skills/lab-cases/SKILL.md` and `.cursor/skills/lab-case-share-link/SKILL.md`.
|
||||
|
||||
**Tooth shade (quick ref):** One optional VITA shade per lab case (`LabCase.toothShadeCode`, nullable; historical shades stay in notes). Full guide in Treatment (lab-dependent) and Cases create/detail; text only on Tasks, share page, and Case Sheet. Locks once any step in the outsource tree is completed; an unchanged resend is a no-op. See `.cursor/rules/tooth-shade.mdc`.
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@
|
||||
"sendToExocad": "Send to Exocad",
|
||||
"sendToExocadSaved": "Exported {fileName}. DentalDB will import it from the Auto-Import folder.",
|
||||
"sendToExocadSavedWithFolder": "Exported {fileName} to {folder}. DentalDB will import it from that Auto-Import folder.",
|
||||
"sendToExocadSkipped": "Not exported: {lines}.",
|
||||
"sendToExocadSkipped": "File exported. Exocad has no match for: {lines}. Set those in DentalDB if needed.",
|
||||
"sendToExocadConnectTitle": "Choose Exocad Auto-Import folder",
|
||||
"sendToExocadChangeFolderTitle": "Change Exocad Auto-Import folder",
|
||||
"sendToExocadFolderHint": "Select the Project Auto-Import folder configured in DentalDB. The next export reuses that folder when it is still available.",
|
||||
|
||||
@@ -560,7 +560,7 @@
|
||||
"sendToExocad": "ارسال به Exocad",
|
||||
"sendToExocadSaved": "پرونده {fileName} صادر شد. DentalDB آن را از پوشه Auto-Import وارد میکند.",
|
||||
"sendToExocadSavedWithFolder": "پرونده {fileName} در {folder} صادر شد. DentalDB آن را از همان پوشه Auto-Import وارد میکند.",
|
||||
"sendToExocadSkipped": "صادر نشد: {lines}.",
|
||||
"sendToExocadSkipped": "پرونده صادر شد. اکزوکد معادلی برای این موارد ندارد: {lines}. در صورت نیاز در DentalDB تنظیم کنید.",
|
||||
"sendToExocadConnectTitle": "انتخاب پوشه Auto-Import اکزوکد",
|
||||
"sendToExocadChangeFolderTitle": "تغییر پوشه Auto-Import اکزوکد",
|
||||
"sendToExocadFolderHint": "پوشه Project Auto-Import تنظیمشده در DentalDB را انتخاب کنید. ارسال بعدی در صورت در دسترس بودن همان پوشه را دوباره استفاده میکند.",
|
||||
|
||||
@@ -560,7 +560,7 @@
|
||||
"sendToExocad": "Naar Exocad sturen",
|
||||
"sendToExocadSaved": "{fileName} geëxporteerd. DentalDB importeert dit vanuit de Auto-Import-map.",
|
||||
"sendToExocadSavedWithFolder": "{fileName} geëxporteerd naar {folder}. DentalDB importeert dit vanuit die Auto-Import-map.",
|
||||
"sendToExocadSkipped": "Niet geëxporteerd: {lines}.",
|
||||
"sendToExocadSkipped": "Bestand geëxporteerd. Exocad heeft geen match voor: {lines}. Stel dit indien nodig in DentalDB in.",
|
||||
"sendToExocadConnectTitle": "Exocad Auto-Import-map kiezen",
|
||||
"sendToExocadChangeFolderTitle": "Exocad Auto-Import-map wijzigen",
|
||||
"sendToExocadFolderHint": "Selecteer de Project Auto-Import-map die in DentalDB is geconfigureerd. De volgende export hergebruikt die map wanneer die nog beschikbaar is.",
|
||||
|
||||
@@ -96,14 +96,21 @@ describe('buildExocadDentalProject', () => {
|
||||
expect(project.xml).toContain('<PatientFirstName>John</PatientFirstName>');
|
||||
expect(project.xml).toContain('<Notes>Please check occlusion</Notes>');
|
||||
expect(project.xml).toContain('<Number>16</Number>');
|
||||
expect(project.xml).toContain('<ReconstructionType>Coping</ReconstructionType>');
|
||||
expect(project.xml).toContain('<Material>ZI</Material>');
|
||||
expect(project.xml).toContain('<Material>NP</Material>');
|
||||
expect(project.xml).toContain('<ReconstructionType>AnatomicCrown</ReconstructionType>');
|
||||
expect(project.xml).toContain('<ReconstructionType>Coping</ReconstructionType>');
|
||||
expect(project.xml).toContain('<Material>LS2</Material>');
|
||||
expect(project.xml).toContain('<ToothShade>VCL:A2</ToothShade>');
|
||||
expect(project.xml).toContain('<ImplantType>None</ImplantType>');
|
||||
expect(project.xml).not.toContain('Antagonist');
|
||||
// Monolithic is full-contour (AnatomicCrown); PFM is cutback (Coping).
|
||||
expect(project.xml).toMatch(
|
||||
/<Number>16<\/Number>\s*<ReconstructionType>AnatomicCrown<\/ReconstructionType>[\s\S]*?<Material>ZI<\/Material>/,
|
||||
);
|
||||
expect(project.xml).toMatch(
|
||||
/<Number>26<\/Number>\s*<ReconstructionType>Coping<\/ReconstructionType>[\s\S]*?<Material>NP<\/Material>/,
|
||||
);
|
||||
});
|
||||
|
||||
it('uses the export date for the file name, not the due date', () => {
|
||||
@@ -211,18 +218,38 @@ describe('buildExocadDentalProject', () => {
|
||||
expect(screw.xml).not.toContain('MaterialAbutment');
|
||||
});
|
||||
|
||||
it('omits ImplantType None when an unmapped implant stack is present and lists it as skipped', () => {
|
||||
it('maps prefabricated, Ti-base, and multi-unit abutments as CustomAbutment/TI', () => {
|
||||
for (const code of [
|
||||
'prefabricated_abutment',
|
||||
'ti_base_abutment',
|
||||
'multi_unit_abutment',
|
||||
] as const) {
|
||||
const project = buildExocadDentalProject(
|
||||
baseInput({
|
||||
teeth: [
|
||||
{ tooth: '14', prosthesisTypeCode: 'pfz_crown' },
|
||||
{ tooth: '14', prosthesisTypeCode: code },
|
||||
],
|
||||
}),
|
||||
);
|
||||
expect(project.skipped).toEqual([]);
|
||||
expect(project.xml).toContain('<ImplantType>CustomAbutment</ImplantType>');
|
||||
expect(project.xml).toContain('<MaterialAbutment>TI</MaterialAbutment>');
|
||||
}
|
||||
});
|
||||
|
||||
it('omits ImplantType None when an unmapped post-and-core stack is present and lists it as skipped', () => {
|
||||
const project = buildExocadDentalProject(
|
||||
baseInput({
|
||||
teeth: [
|
||||
{ tooth: '16', prosthesisTypeCode: 'pfz_crown' },
|
||||
{ tooth: '16', prosthesisTypeCode: 'ti_base_abutment' },
|
||||
{ tooth: '16', prosthesisTypeCode: 'cast_post_core' },
|
||||
],
|
||||
}),
|
||||
);
|
||||
expect(project.xml).not.toContain('<ImplantType>');
|
||||
expect(project.skipped).toEqual([
|
||||
{ tooth: '16', prosthesisTypeCode: 'ti_base_abutment', reason: 'unmapped' },
|
||||
{ tooth: '16', prosthesisTypeCode: 'cast_post_core', reason: 'unmapped' },
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
/**
|
||||
* Build an official Exocad `.dentalProject` XML file (3rd-party auto-import).
|
||||
* Prosthesis → ReconstructionType / Material pairs follow the prior DentalDB mapping
|
||||
* where those values appear in the official specification tables.
|
||||
*
|
||||
* Source of truth for allowed XML values: exocad’s
|
||||
* `.dentalProject` 3rd-party specification (Tables 2–4). Dyolink catalog codes are
|
||||
* mapped onto those values by the PDF definitions (e.g. full-contour → AnatomicCrown,
|
||||
* cutback framework → Coping). Older DentalDB reverse-engineering is kept only when
|
||||
* it does not contradict those tables.
|
||||
*/
|
||||
|
||||
export type ExocadExportFailure = 'PATIENT_NAME_INCOMPLETE' | 'NOTHING_TO_EXPORT';
|
||||
@@ -19,12 +23,13 @@ type MaterialMatch = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Catalog codes with one obvious Exocad work type and material.
|
||||
* OverlayCrown is not in the official 3rd-party ReconstructionType table, so overlays
|
||||
* use AnatomicInlay. Active indirect leaves use Veneer / AnatomicInlay / OffsetInlay.
|
||||
* Catalog → ReconstructionType / Material (PDF Tables 2–3).
|
||||
* - Full-contour crowns → AnatomicCrown; cutback frameworks (PFZ/PFM) → Coping.
|
||||
* - OverlayCrown is outside Table 2, so overlays use AnatomicInlay / OffsetInlay.
|
||||
* - Active indirect leaves use Veneer / AnatomicInlay / OffsetInlay.
|
||||
*/
|
||||
const MATERIAL_MATCH: Record<string, MaterialMatch> = {
|
||||
monolithic_zirconia: { reconstructionType: 'Coping', material: 'ZI' },
|
||||
monolithic_zirconia: { reconstructionType: 'AnatomicCrown', material: 'ZI' },
|
||||
pfz_crown: { reconstructionType: 'Coping', material: 'ZI' },
|
||||
pfm_crown: { reconstructionType: 'Coping', material: 'NP' },
|
||||
full_metal_crown: { reconstructionType: 'AnatomicCrown', material: 'NP' },
|
||||
@@ -55,27 +60,30 @@ type ImplantMatch = {
|
||||
materialAbutment?: string;
|
||||
};
|
||||
|
||||
/** Implant stacks we can express with official ImplantType / MaterialAbutment values. */
|
||||
/**
|
||||
* Implant stacks → PDF Table 4 ImplantType (and MaterialAbutment when CustomAbutment).
|
||||
* Table 4 only lists None / CustomAbutment / WithoutAbutment. DentalDB’s separate
|
||||
* “On stock abutment” UI option is not writable here, so stock / Ti-base / multi-unit
|
||||
* abutments use CustomAbutment + TI — the only Table 4 value that means implant with
|
||||
* abutment (sample tooth 33 in the PDF uses the same pair).
|
||||
*/
|
||||
const IMPLANT_MATCH: Record<string, ImplantMatch> = {
|
||||
customized_abutment: { implantType: 'CustomAbutment', materialAbutment: 'TI' },
|
||||
zirconia_abutment: { implantType: 'CustomAbutment', materialAbutment: 'ZI' },
|
||||
prefabricated_abutment: { implantType: 'CustomAbutment', materialAbutment: 'TI' },
|
||||
ti_base_abutment: { implantType: 'CustomAbutment', materialAbutment: 'TI' },
|
||||
multi_unit_abutment: { implantType: 'CustomAbutment', materialAbutment: 'TI' },
|
||||
screw_retained: { implantType: 'WithoutAbutment' },
|
||||
};
|
||||
|
||||
/**
|
||||
* Implant / post stacks that are not representable in the official ImplantType table.
|
||||
* When present with a restoration, they are listed as skipped and ImplantType is omitted
|
||||
* (never written as None — that would claim a natural prep).
|
||||
* Stacks with no ReconstructionType / ImplantType in the official tables.
|
||||
* When present with a restoration they are listed as skipped and ImplantType is
|
||||
* omitted (never written as None — that would claim a natural prep).
|
||||
*/
|
||||
const UNMAPPED_STACK_CODES = new Set([
|
||||
'ti_base_abutment',
|
||||
'prefabricated_abutment',
|
||||
'multi_unit_abutment',
|
||||
'cast_post_core',
|
||||
'fiber_post_core',
|
||||
]);
|
||||
const UNMAPPED_STACK_CODES = new Set(['cast_post_core', 'fiber_post_core']);
|
||||
|
||||
/** Reconstruction types that may carry ImplantType in the official table. */
|
||||
/** Reconstruction types that may carry ImplantType (PDF Table 2 “yes” column). */
|
||||
const IMPLANT_ALLOWED = new Set([
|
||||
'AnatomicCrown',
|
||||
'AnatomicWaxup',
|
||||
@@ -83,7 +91,6 @@ const IMPLANT_ALLOWED = new Set([
|
||||
'Coping',
|
||||
'OverpressCrown',
|
||||
'PrimaryTelescope',
|
||||
'ProvisionalCrown',
|
||||
'ReducedWaxup',
|
||||
]);
|
||||
|
||||
@@ -310,8 +317,8 @@ function planTeeth(jobs: ExocadToothJob[]): { writes: ToothWrite[]; skipped: Exo
|
||||
let materialAbutment: string | undefined;
|
||||
if (allowImplant) {
|
||||
if (implant.implantType === 'None') {
|
||||
// Natural prep: only Coping historically always carried an explicit None.
|
||||
implantType = mapped.reconstructionType === 'Coping' ? 'None' : null;
|
||||
// Natural prep on an implant-capable type (PDF Example II sets None explicitly).
|
||||
implantType = 'None';
|
||||
} else if (implant.implantType) {
|
||||
implantType = implant.implantType;
|
||||
materialAbutment = implant.materialAbutment;
|
||||
|
||||
@@ -16,6 +16,7 @@ import { labTaskStatusVariant } from '@/components/lab/labTaskStatusDisplay';
|
||||
import { LabCaseDueDateBadge } from '@/components/lab/LabCaseDueDateBadge';
|
||||
import { LabCaseOriginBadge } from '@/components/ui/lab/LabCaseOriginBadge';
|
||||
import { ProsthesisJobLineLabel } from '@/components/ui/lab/ProsthesisJobLineLabel';
|
||||
import { prosthesisJobPathLabel } from '@/components/treatment/prosthesisJobPath';
|
||||
import { prosthesisCatalogApi } from '@/lib/api/prosthesis-catalog';
|
||||
import {
|
||||
buildCaseLinkedEdges,
|
||||
@@ -311,6 +312,7 @@ export function CaseDetailPanel({
|
||||
const tComments = useTranslations('caseComments');
|
||||
const tErrors = useTranslations('errors');
|
||||
const tCommon = useTranslations('common');
|
||||
const tProsthesis = useTranslations('prosthesis');
|
||||
const intlLocale = useLocale();
|
||||
const { settings: currencySettings } = useBillingCurrency(true);
|
||||
const { currentOrganization } = useAuth();
|
||||
@@ -494,7 +496,10 @@ export function CaseDetailPanel({
|
||||
toast.showInfo(
|
||||
t('sendToExocadSkipped', {
|
||||
lines: project.skipped
|
||||
.map((line) => `${line.tooth} ${line.prosthesisTypeCode}`)
|
||||
.map(
|
||||
(line) =>
|
||||
`${line.tooth} ${prosthesisJobPathLabel(line.prosthesisTypeCode, prosthesisCatalog, (key) => tProsthesis(key as never))}`,
|
||||
)
|
||||
.join(', '),
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user