Skip to content

Add Cases module for PVS patient case file management - #42

Merged
panteLx merged 1 commit into
mainfrom
feature/cases-module
Aug 6, 2026
Merged

Add Cases module for PVS patient case file management#42
panteLx merged 1 commit into
mainfrom
feature/cases-module

Conversation

@panteLx

@panteLx panteLx commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a second module (Cases) alongside the finance tracker: workspaces for patient case files, reusing the owner/admin/write/read permission model from trackers, switchable via a new area switcher in the header.
  • Case files move through a status workflow — Needs processing → Medical controlling → Queued for PVS (optional) → Sent to PVS → Done — with a Returned action that resets a case back to Needs processing and tracks a return count.
  • Sending case files to PVS bundles them into a dated submission batch with per-case-type PDF exports; admins can hide/unhide a batch from the submissions list without touching its case files' status or history.
  • Editors (write permission) can edit/change status on any case file in the workspace, not just ones they created; the case detail sheet and comment form now render read-only for users without write access instead of silently failing on save.
  • README updated with a Cases feature row and a short "Cases Module" section.

Test plan

  • npx tsc --noEmit passes
  • npx eslint . passes
  • Manually walked the full status workflow in the browser (needs processing → medical controlling → queued for PVS → sent to PVS → done/returned)
  • Verified PVS submission batch hide/unhide preserves case file status and history
  • Verified read-only permission gating in the case file sheet and comment form
  • Reviewer smoke test on a fresh npm run db:migrate (adds migrations 0005–0007)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added case workspaces with customizable settings, member permissions, and workspace navigation.
    • Added a case board for creating, editing, filtering, sorting, commenting on, and processing case files.
    • Added workflow actions for advancing, queuing, submitting, completing, and returning cases.
    • Added PVS submission batches with visibility controls, case details, and downloadable PDF exports.
    • Added English and German translations and a module switcher for navigating between application areas.
  • Documentation

    • Updated the README with case workspace, workflow, submission batch, and PDF export information.

Introduces a second module alongside the finance tracker: workspaces for
patient case files with the same owner/admin/write/read permission model
as trackers. Case files move through a status workflow (needs processing
-> medical controlling -> queued for PVS -> sent to PVS -> done, with a
returned path back to needs processing), get bundled into dated PVS
submission batches with per-case-type PDF exports, and admins can
hide/unhide batches without touching case file status or history.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8197129f-55dd-4ccb-b758-51c3d2bba3f9

📥 Commits

Reviewing files that changed from the base of the PR and between 9df417b and 93b8a26.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (58)
  • README.md
  • app/api/case-workspaces/[id]/batches/[batchId]/pdf/[caseType]/route.ts
  • app/api/case-workspaces/[id]/batches/[batchId]/route.ts
  • app/api/case-workspaces/[id]/batches/route.ts
  • app/api/case-workspaces/[id]/case-files/[caseFileId]/comments/[commentId]/route.ts
  • app/api/case-workspaces/[id]/case-files/[caseFileId]/comments/route.ts
  • app/api/case-workspaces/[id]/case-files/[caseFileId]/route.ts
  • app/api/case-workspaces/[id]/case-files/mark-done/route.ts
  • app/api/case-workspaces/[id]/case-files/mark-queued-for-pvs/route.ts
  • app/api/case-workspaces/[id]/case-files/mark-returned/route.ts
  • app/api/case-workspaces/[id]/case-files/route.ts
  • app/api/case-workspaces/[id]/case-files/send-to-medizin-controlling/route.ts
  • app/api/case-workspaces/[id]/members/[memberId]/route.ts
  • app/api/case-workspaces/[id]/members/candidates/route.ts
  • app/api/case-workspaces/[id]/members/route.ts
  • app/api/case-workspaces/[id]/route.ts
  • app/api/case-workspaces/route.ts
  • app/cases/[workspaceId]/batches/page.tsx
  • app/cases/[workspaceId]/page.tsx
  • app/cases/[workspaceId]/settings/page.tsx
  • app/cases/page.tsx
  • components/cases/batches-client.tsx
  • components/cases/bulk-action-bar.tsx
  • components/cases/case-board-client.tsx
  • components/cases/case-comments.tsx
  • components/cases/case-file-sheet.tsx
  • components/cases/case-workspace-list-client.tsx
  • components/cases/case-workspace-settings-client.tsx
  • components/layout/app-header.tsx
  • components/layout/cases-header.tsx
  • components/layout/cases-page-container.tsx
  • components/layout/module-switcher.tsx
  • drizzle/0005_broken_human_fly.sql
  • drizzle/0006_woozy_mastermind.sql
  • drizzle/0007_flippant_greymalkin.sql
  • drizzle/meta/0005_snapshot.json
  • drizzle/meta/0006_snapshot.json
  • drizzle/meta/0007_snapshot.json
  • drizzle/meta/_journal.json
  • lib/auth/case-workspace-access.ts
  • lib/auth/case-workspace-guards.ts
  • lib/case-workspaces.ts
  • lib/client-fetch.ts
  • lib/db/schema.ts
  • lib/i18n/request.ts
  • lib/services/case-file-service.ts
  • lib/services/pdf/pvs-submission-document.tsx
  • lib/services/pdf/render-pvs-submission-pdf.ts
  • lib/services/pvs-submission-service.ts
  • lib/validators/case-file-bulk.ts
  • lib/validators/case-file-comment.ts
  • lib/validators/case-file.ts
  • lib/validators/pvs-batch.ts
  • messages/de-DE/cases.json
  • messages/de-DE/nav.json
  • messages/en-US/cases.json
  • messages/en-US/nav.json
  • package.json

📝 Walkthrough

Walkthrough

The PR adds a Cases module with workspaces, members, case files, comments, workflow transitions, PVS submission batches, PDF exports, access controls, localized pages, and navigation.

Changes

Cases module

Layer / File(s) Summary
Cases data model and contracts
drizzle/*, lib/db/schema.ts, lib/validators/*
Adds database tables, relations, indexes, status contracts, and strict request validation for case management.
Workspace access and management
lib/auth/*, lib/case-workspaces.ts, app/api/case-workspaces/*
Adds workspace access guards, workspace CRUD, membership management, candidate search, visibility rules, and audit-backed mutations.
Case-file workflow and collaboration
lib/services/case-file-service.ts, app/api/case-workspaces/*/case-files/*, components/cases/case-board-client.tsx, components/cases/case-file-sheet.tsx, components/cases/case-comments.tsx, components/cases/bulk-action-bar.tsx
Adds case-file listing, editing, deletion, comments, filtering, status transitions, return tracking, and bulk actions.
PVS submissions and PDF exports
lib/services/pvs-submission-service.ts, lib/services/pdf/*, app/api/case-workspaces/*/batches/*, components/cases/batches-client.tsx
Adds submission batches, hidden-batch controls, case-type counts, batch details, PDF rendering, downloads, and batch actions.
Cases navigation, pages, and localization
app/cases/*, components/layout/*, messages/*, lib/i18n/request.ts, README.md
Adds authenticated Cases pages, shared layout components, module switching, English and German messages, and Cases documentation.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CaseBoardClient
  participant CaseFileService
  participant PvsSubmissionService
  participant PdfRoute
  participant PvsSubmissionDocument
  User->>CaseBoardClient: select eligible case files
  CaseBoardClient->>CaseFileService: advance or queue case files
  CaseBoardClient->>PvsSubmissionService: submit case files to PVS
  PvsSubmissionService-->>CaseBoardClient: return batch and submitted files
  User->>PdfRoute: request case-type PDF
  PdfRoute->>PvsSubmissionDocument: render batch detail
  PvsSubmissionDocument-->>User: download PDF
Loading

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/cases-module

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@panteLx
panteLx merged commit f35b743 into main Aug 6, 2026
1 check was pending
@panteLx
panteLx deleted the feature/cases-module branch August 6, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant