feat(templates): med-mal-case project template
Phase 1 of the templates → extraction-pipeline path. Selecting a template when creating a project scaffolds the 12-folder med-mal taxonomy + nested imaging folder, and exposes a "Recommended tabular reviews" strip on the project page with one-click buttons for the 11 schemas validated against Minnesota primary sources (Plutshack/Smith, § 145.682, § 548.251, § 144.293, Popovich, Dickhoff, Flom, Reinhardt, Cornfeldt). Backend: - New table column: projects.template_id (text null) - applied directly to prod (`qkfcrsrtualqdmqqexpf`) via Supabase MCP apply_migration after branch creation returned PaymentRequiredException on the free plan. Folded into schema.sql + backend/migrations/0001_projects_template_id.sql. - backend/src/lib/templateIds.ts - shared string-literal unions for ProjectTemplateId and TabularSchemaId. - backend/src/lib/builtinProjectTemplates.ts - registry exporting the med-mal-case template with its 12 subfolders and 11 recommended schema ids. - backend/src/routes/projects.ts - POST /projects extended to parse optional template_id, validate against registry (400 on unknown), and batch-create subfolders in two passes (top-level UUIDs returned by Batch A resolve the array-index parent refs in Batch B). On any error the project row is deleted via CASCADE so the operation is atomic from the user's perspective. Frontend: - frontend/src/app/components/tabular/templateIds.ts - mirror of backend template/schema IDs. - frontend/src/app/components/tabular/builtinTabularSchemas.ts - the only place column specs for built-in schemas live (11 schemas, ~120 columns total) with prompts tuned for Mayo/Epic ebook formatting. Each schema's description names the prima facie element or filing requirement it supports. - frontend/src/app/components/projects/builtinProjectTemplates.ts - frontend mirror of the template registry (id, name, description, recommendedSchemaIds only; backend owns subfolders). - frontend/src/app/lib/mikeApi.ts - createProject signature gains optional template_id arg. - frontend/src/app/components/shared/types.ts - MikeProject gains template_id and subfolders fields. - frontend/src/app/components/projects/NewProjectModal.tsx - adds a Template dropdown between the CM number field and the attribute pills, using the same Check-icon-on-select pattern as AddNewTRModal's workflow picker. - frontend/src/app/components/projects/ProjectPage.tsx - on the reviews tab, renders a recommended-reviews strip when project.template_id is set. Each pill opens AddNewTRModal with the schema's title and full columns_config pre-populated. - frontend/src/app/components/tabular/AddNewTRModal.tsx - accepts new optional initialTitle and initialColumnsConfig props that the recommended strip uses to seed the modal. CLAUDE.md: documents the migrations workflow + flags the Supabase branching limitation on the free plan so future migrations don't reach for create_branch first.
| Repository | rmerk/mike |
|---|---|
| Author | Ryan Choi <4576425+rmerk@users.noreply.github.com> |
| Authored | |
| Parents | 3a973152 |
| Stats | 14 files changed , +1392 , -9 |
| Part of | Minnesota medical-malpractice records platform (5-phase build) |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-73faac09.md
from inside the repo you want the change in.