Commit graph

112 commits

Author SHA1 Message Date
1bedbcf243 fix: resolve TypeError in disclosure revoke due to naive/aware datetime comparison
PyMySQL returns naive datetimes from MySQL DATETIME columns, but
revoke_disclosure() compared them with timezone-aware datetime.now(timezone.utc),
causing an unhandled TypeError (not caught by except ValueError) and a 500 error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 07:57:59 +00:00
95e84a6978 fix: filter report data by max KW when generating reports
Previously, generate_full_report() ignored the kw parameter for data
filtering — it was only stored as metadata. This caused all reports to
contain data up to the latest available KW, making historical reports
(e.g., for KW 8) identical to the current one.

Now all 5 sheet calculation functions accept an optional max_kw parameter.
When generating a report for a specific KW, only cases with kw <= max_kw
are included. Dashboard and vorjahr callers are unaffected (max_kw=None).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 23:16:20 +00:00
4cd52dd0b2 fix: correct double /api/ prefix in report download URL
The download function used `/api/reports/download/{id}` as the URL for
the axios instance which already has `baseURL: '/api'`. This resulted in
requests to `/api/api/reports/download/{id}`, causing nginx to serve
the SPA index.html (status 200, text/html) instead of proxying to the
backend. The HTML was then saved as .xlsx, making Excel unable to open it.

Fix: Use `/reports/download/{id}` for axios (which prepends baseURL)
and keep the full `/api/reports/download/{id}` for the window.open fallback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 23:10:12 +00:00
dbb5afaeb9 feat: add inline report viewer with 5-tab sheet display
- Backend: GET /reports/{id}/data endpoint returns stored report JSON
- Frontend: ReportViewer component renders all 5 Excel sheets as tabs
  (KW gesamt, Fachgebiete, Gutachten, Therapieänderungen, ICD onko)
- ReportsPage: clickable rows with inline expansion to view reports
- Empty KW rows filtered, summary row at bottom, German labels
- Download button still available alongside inline view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 22:57:35 +00:00
32cee4d30d feat: add KPI links, My Disclosures page, and extend Admin Disclosures
- Dashboard KPI cards are now clickable with role-based links
- New GutachtenStatistikPage placeholder at /gutachten-statistik
- New "Meine Freigaben" page for DAK-Mitarbeiter to view/revoke own disclosures
- Backend: GET /cases/my-disclosure-requests, PUT /cases/disclosure-requests/{id}/revoke
- Admin Disclosures page: full history with status tabs and revoke capability
- Backend: PUT /admin/disclosure-requests/{id}/revoke, default shows all statuses
- Sidebar: "Meine Freigaben" entry for dak_mitarbeiter role

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 22:19:46 +00:00
4504d4300f fix: remove registration link from login page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:58:01 +00:00
837dc56d84 fix: remove unused imports in test files (build fix)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:47:26 +00:00
77805191cf test: add Playwright E2E tests (auth, dashboard, cases, admin)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:44:25 +00:00
edf30c02ec test: add ProtectedRoute tests and remaining page tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:40:25 +00:00
10524a471d test: add CasesPage integration tests (list, filter, detail)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:36:12 +00:00
ba3f930e4d test: add page tests for AdminUsers, Reports, Login
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:32:30 +00:00
e7f7817ebb test: add page tests for Dashboard, Disclosures, AdminAudit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:27:05 +00:00
36ffe43f18 test: add hook tests for useNotifications and useReports
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:23:15 +00:00
e67fe73da7 test: add hook tests for useDisclosures, useAuditLog, useUsers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:21:27 +00:00
6ede0d93ed test: add hook tests for useDashboard and useCases
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:19:20 +00:00
159ac0a26c test: add service tests (api, authService, disclosureService)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:15:37 +00:00
f14fa0d5f2 feat: add test utilities (renderWithProviders, renderHookWithProviders)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:10:29 +00:00
0416035ce9 feat: add MSW mock server, handlers, and test data
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:08:55 +00:00
8b30be0dcb feat: add Vitest testing infrastructure
Install vitest, @vitest/coverage-v8, jsdom, @testing-library/react,
@testing-library/jest-dom, @testing-library/user-event, and msw.
Create vitest.config.ts with jsdom environment, path aliases, and
coverage configuration. Add test scripts to package.json and
vitest/globals types to tsconfig.app.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:05:50 +00:00
75ddadc1f5 docs: add frontend testing implementation plan (13 tasks, ~155 tests)
Detailed task-by-task plan for Vitest + MSW + Playwright test infrastructure
covering hooks, services, page integration tests and E2E browser tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:02:34 +00:00
5d65cb3bcd docs: add frontend testing design (Vitest + MSW + Playwright)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:56:41 +00:00
a2b8d476b2 fix: hide Fallgruppen with 0 entries from pie chart
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:42:03 +00:00
8038c6e50d feat: make DAK logo clickable, links to dashboard
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 19:08:24 +00:00
061811ce17 fix: increase DAK logo to h-18 in sidebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:56:40 +00:00
ddeddeb083 fix: enlarge logo in sidebar, move DAK Portal title to header
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:55:02 +00:00
31c1d63ed7 fix: increase DAK logo size in sidebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:50:27 +00:00
617e5c2ae7 fix: move DAK logo from header to sidebar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:47:34 +00:00
2c1b064373 feat: add DAK logo to header
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:40:07 +00:00
657a1abcaf refactor: migrate CasesPage and useInlineEdit to TanStack Query
Replace manual useEffect data fetching with useCases/usePendingIcdCases
query hooks. Replace direct API calls in useInlineEdit with useCaseUpdate
and useKvnrUpdate mutations. Use useIcdUpdate for ICD saving. Remove
onCaseSaved callback prop drilling — mutations auto-invalidate the cache.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:36:08 +00:00
150be9183c refactor: migrate ReportsPage to TanStack Query
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:31:59 +00:00
29b54e58a2 refactor: migrate useNotifications to TanStack Query
Replace manual useState/useEffect/setInterval polling with useQuery
(refetchInterval: 60s) and useMutation for markAsRead/markAllAsRead.
Public API remains identical so consumers need no changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:30:01 +00:00
5920986c02 refactor: migrate AdminUsersPage to TanStack Query
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:27:17 +00:00
1b4aebfb8d refactor: migrate AdminAuditPage to TanStack Query
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:25:32 +00:00
1de2f7274d refactor: migrate DisclosuresPage to TanStack Query
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:23:46 +00:00
4b4af6b42d refactor: migrate DashboardPage to TanStack Query
Replace manual useState/useEffect data fetching with useDashboard hook
that uses TanStack Query for automatic caching, refetching, and loading
state management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:21:33 +00:00
28ad5c09ad feat: add TanStack Query with QueryClientProvider
Install @tanstack/react-query v5 and wrap the app with
QueryClientProvider as foundation for server-state management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:18:37 +00:00
62ee46fa3e docs: add state management implementation plan (9 tasks, TanStack Query)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:16:20 +00:00
d4420500e5 docs: add state management refactoring design (TanStack Query)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 18:11:55 +00:00
99767fe6fe fix: replace favicon with updated version
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:56:23 +00:00
773d5c6e7a feat: add custom favicon for DAK Zweitmeinungs-Portal
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:52:19 +00:00
56c0c6e662 fix: remove patient names from coding template and restrict to admin
- Remove Nachname/Vorname columns from ICD coding template (DSGVO)
- Restrict /cases/coding-template endpoint to admin-only
- ICD import reads last column for backwards compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:20:28 +00:00
90c121d58d fix: correct down_revision in 006 migration to match 005_disclosure
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:13:22 +00:00
c302a91411 feat: auto-update fall_id when KVNR is entered on a case
When a KVNR is entered on a case that has a random-suffix or legacy
Nachname-based fall_id, the fall_id is automatically rebuilt using
the new KVNR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:09:50 +00:00
7bbe501bfa feat: add migration to anonymize existing fall_ids
Replaces Nachname-based fall_ids with KVNR or random 6-char suffix
for all existing cases in the database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:07:58 +00:00
04a2e8fe93 test: verify duplicate detection works with new fall_id format
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:06:58 +00:00
a436580b03 feat: use KVNR instead of Nachname in fall_id generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:04:48 +00:00
d33fc7d242 docs: add implementation plan for fall-id anonymization
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 17:01:09 +00:00
50e93b811d docs: add Fall-ID anonymization design
Replace patient last name in fall_id with KVNR (or random fallback).
Retroactive migration of all existing ~2900 fall_ids.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:57:23 +00:00
1612d449c0 fix: make nachname nullable in CaseResponse to support data masking
CaseResponse.nachname was required (str) but the masking function sets
it to None for dak_mitarbeiter. This caused Pydantic validation errors
(500) making the case list empty for non-admin users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:24:56 +00:00
31a2d5a355 feat: add disclosure admin route and sidebar entry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:14:14 +00:00