Commit graph

106 commits

Author SHA1 Message Date
3496e4acfe feat: add disclosure schemas and case response masking helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:03:58 +00:00
bb13ec80a2 feat: add DisclosureRequest model and migration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:02:52 +00:00
00bc92322f docs: add DAK-Datenschutz implementation plan (11 tasks)
Backend-enforced field masking for dak_mitarbeiter, disclosure request
workflow with 24h expiry, admin approval page, and frontend adaptations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 15:59:29 +00:00
030fab72e4 docs: add DAK-Datenschutz design for role-based data masking
Design for hiding personal data (name, birthdate) from dak_mitarbeiter
users with backend-enforced filtering and a time-limited disclosure
request mechanism for KVNR error resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 15:56:48 +00:00
480f851836 fix: dashboard weekly chart shows correct stacked breakdown
Change stacked bar chart from erstberatungen+unterlagen+gutachten
(overlapping, incorrect) to ablehnungen+keine_rm+gutachten (disjoint
categories that sum to total cases per KW, matching Excel Sheet 1).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 11:12:30 +00:00
32127c30c3 fix: filter all case queries to DAK insurance only
Add VERSICHERUNG_FILTER="DAK" to config and apply it to all case
queries: list, detail, pending-icd, pending-coding, coding queue,
dashboard KPIs, all 5 report sheets, and excel sync export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:20:33 +00:00
e0b2d1e01d docs: add Kontoverwaltung design and implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:12:13 +00:00
5f7b4c6e1d feat: add /account route, sidebar entry and header link
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:48:43 +00:00
45cadd07ce feat: add AccountPage with Profile, Security, and MFA tabs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:46:52 +00:00
832f5c0a63 feat: add profile/avatar/MFA types and service functions
Extend User and UserResponse interfaces with first_name, last_name,
display_name, avatar_url fields. Add ProfileUpdatePayload,
ChangePasswordPayload, MFASetupResponse, MFAVerifyPayload types.
Add authService functions for profile update, avatar upload/delete,
password change, and MFA setup/verify/disable. Add refreshUser to
AuthContext so components can re-fetch user data after changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:42:46 +00:00
fc609401c3 feat: add MFA disable (self-service + admin reset) endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:40:57 +00:00
661f1ce552 feat: add avatar upload/delete endpoints with static file serving
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:39:21 +00:00
1fa5d20d40 feat: add PUT /api/auth/profile endpoint for self-service profile update
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:37:17 +00:00
6bc0b3ac5a feat: add ProfileUpdate schema and extend UserResponse with profile fields
- Add first_name, last_name, display_name, avatar_url to UserResponse
- Add ProfileUpdate schema for self-service profile editing
- Add MFADisableRequest schema for password-confirmed MFA disable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:35:54 +00:00
d09fdccc75 feat: add first_name, last_name, display_name, avatar_url to User model
Add 4 new nullable profile fields to support the upcoming account
management (Kontoverwaltung) feature. Includes Alembic migration
that has been applied to production database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 09:34:33 +00:00
400520aebd fix: auto-detect CSV delimiter (comma, semicolon, tab)
German Excel/CRM exports often use semicolons instead of commas.
The parser now uses csv.Sniffer to auto-detect the delimiter,
fixing the issue where semicolon-delimited CSVs produced 0 rows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 23:09:16 +00:00
f8a8befb19 fix: add versicherung field to CaseUpdate schema
The field was editable in the frontend but missing from the backend
CaseUpdate Pydantic schema, causing changes to be silently dropped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 13:05:55 +00:00
7e9373a6d0 fix: use sentinel value for empty Radix Select option to prevent crash
Radix UI Select.Item does not allow empty string values. The Anrede
dropdown used value="" for the empty option, causing the entire React
app to crash when entering edit mode. Use '__none__' sentinel value
instead and convert to null on selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:59:32 +00:00
19db4c5def feat: make all case detail fields editable with edit-mode toggle
Replace individual field editors (KVNR, ICD) with a unified edit-mode
approach using data-driven field configuration. A single "Bearbeiten"
button toggles all fields into edit mode with dirty-tracking and
split-save (KVNR via dedicated endpoint for all users, remaining fields
via admin-only general update endpoint).

- Extend Case TypeScript interface with 17 missing backend fields
- Add declarative field config (7 sections, 30 fields) in fieldConfig.ts
- Add useInlineEdit hook with dirty-tracking and split-save logic
- Add EditableField dual-mode component (text/date/boolean/select/textarea)
- Refactor CaseDetail to render sections from config
- ICD section retains its own endpoint with separate save button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 11:23:03 +00:00
97731552c5 feat: add editable KVNR field in case detail view with dedicated API endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 11:07:49 +00:00
ab0ed453fa fix: rename Faelle to Fälle in sidebar, add KVNR column to cases table
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:50:42 +00:00
7ef1fc9335 feat: add checkbox selection and bulk delete for reports
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:40:19 +00:00
9650889d24 feat: add audit logging for login, logout, imports, and report generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:36:25 +00:00
4a3648a018 feat: serve frontend SPA from FastAPI backend
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:10:11 +00:00
1edf5835be feat: add dark mode toggle in header and login page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 10:02:41 +00:00
9d79ba35bc fix: wrap vorjahr data in "summary" key to match excel_export structure
get_vorjahr_summary returned a flat dict, but excel_export looked for
data under vj.get("summary", {}), resulting in empty Vorjahr columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:34:19 +00:00
8502c7a7fb fix: use one-decimal percentage format in Sheet 1 (0.0% instead of 0%)
Shows "0,8%" instead of "1%" for small ratios like Ablehnungen/Erstberatungen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:32:32 +00:00
4467e1b1cb fix: upsert report metadata to avoid duplicate key error on re-generation
When generating a report for the same jahr/kw, update the existing
record instead of inserting a duplicate (which caused IntegrityError).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:28:40 +00:00
db963a8e12 fix: align excel_export keys with report_service output
report_service uses 'summary'/'weekly'/'keine_rm'/'gutachten' but
excel_export expected 'totals'/'weeks'/'keine_rueckmeldung'/
'gutachten_gesamt'. Also fix nested gesamt dict access in sheet3
and icd_codes path from sheet5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:26:11 +00:00
590125073c fix: support token query param for file download endpoints
Browser-initiated downloads (window.open) cannot set Authorization
headers. Accept ?token= query parameter as fallback on the report
download and coding-template endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:20:14 +00:00
f12f664ce5 fix: prevent pie chart labels from being clipped
Move Fallgruppen names into a Legend below the chart instead of
inline labels that overflow the container. Reduce pie radius to
leave breathing room.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:13:00 +00:00
5ee1cff0d6 fix: use SQLAlchemy Integer type in .cast() calls in report_service
.cast(int) uses Python's builtin int, which lacks SQLAlchemy's
_isnull attribute. Replace all occurrences with .cast(Integer).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:06:48 +00:00
0e4d19e8bc fix: use savepoints for row-by-row error isolation in Excel import
Prevents a single duplicate fall_id from rolling back the entire
import session. Each row insert now uses db.begin_nested() so
constraint violations are isolated to the offending row.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 09:01:42 +00:00
47bd9c8a08 feat: add Passenger app.js for Plesk deployment
Node.js entry point that serves static frontend files and proxies
/api/ requests to the FastAPI backend on port 8000.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:55:47 +00:00
93884f3c8d fix: add missing cases API, import router, and case schemas
These files were created by a subagent but not included in the commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:49:55 +00:00
3f8f96097d fix: URL-encode DB password in connection string
Passwords with special characters (@, &, etc.) broke the SQLAlchemy
connection URL parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:48:28 +00:00
fc83db640e feat: add deployment configuration for Hetzner 1
Includes systemd service unit, nginx reverse proxy config, and
automated deployment script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:42:08 +00:00
006ffd5254 feat: coding queue, reports, notifications, and admin pages
- CodingPage: card-based queue with Fallgruppe filter, coding form per case
- ReportsPage: report generation (admin), download, report history table
- Notifications: real-time bell dropdown in Header with polling, mark-read
- AdminUsersPage: user list, create/edit dialogs with role & active toggle
- AdminInvitationsPage: create invitations, copy token, status badges
- AdminAuditPage: filterable log with expandable old/new values

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:39:56 +00:00
5cbef969fb feat: dashboard, cases, import, and ICD pages with full functionality
Implement the four core frontend pages for the DAK Zweitmeinungs-Portal:
- DashboardPage: KPI cards, weekly stacked bar chart, fallgruppen donut chart, year selector
- CasesPage: filterable/searchable paginated table with detail slide-out and inline ICD editing
- ImportPage: CSV upload with preview/confirm, ICD Excel upload, import history log
- IcdPage: reuses CasesPage with pending-icd-only filter

Also adds shadcn/ui components (table, select, tabs, skeleton, scroll-area) and
new TypeScript types for import log and ICD import responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:32:18 +00:00
0767e1ed18 feat: auth context, login/register pages, app layout with routing
- Task 19: TypeScript types for all API entities, axios client with JWT
  refresh interceptor, auth service, AuthContext provider, ProtectedRoute
- Task 20: Login page with MFA support, Register page with invitation
  token support, German labels, zod validation
- Task 21: Responsive sidebar with role-aware navigation, header with
  user dropdown, AppLayout with Sheet for mobile, full React Router setup
  with placeholder pages for all routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:21:00 +00:00
aea967acf8 feat: frontend setup — React, Vite, TypeScript, Tailwind CSS v4, shadcn/ui
Scaffold the DAK Zweitmeinungs-Portal frontend with:
- Vite 7.3 + React 19 + TypeScript 5.9
- Tailwind CSS v4 with @tailwindcss/vite plugin
- shadcn/ui (new-york style, neutral base color) with button, input, label, card components
- Path alias @/* -> src/* configured in tsconfig and vite
- API proxy: /api/* -> http://localhost:8000
- Core deps: react-router-dom, axios, recharts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:14:36 +00:00
1748379253 feat: Excel export in Berichtswesen format + historical import
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:07:28 +00:00
d6fb04d5a7 feat: coding queue, reports API, Excel sync
- Add coding_service.py with queue retrieval, single + batch coding updates
- Add report schemas (DashboardKPIs, WeeklyDataPoint, ReportMeta)
- Add coding API router with /queue, PUT /{case_id}, POST /batch endpoints
- Add reports API router with /dashboard, /weekly, /generate, /download, /list
- Add excel_sync.py for bidirectional Abrechnung DB<->XLSX sync
- Register coding and reports routers in main.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:03:17 +00:00
72b6f784fc feat: report service — all 5 sheet calculations + year-over-year
Implements report_service.py with:
- Sheet 1: Auswertung KW gesamt (weekly totals + year summary)
- Sheet 2: Auswertung nach Fachgebieten (per-KW per-Fallgruppe)
- Sheet 3: Auswertung Gutachten (alternative/bestaetigung per group)
- Sheet 4: Auswertung Therapieaenderungen (TA metrics per KW)
- Sheet 5: Auswertung ICD onko (ICD code frequency for onko)
- Dashboard KPIs (total_cases, pending_icd, pending_coding, etc.)
- generate_full_report() for all 5 sheets combined

Implements vorjahr_service.py with:
- Cached year-over-year comparison via yearly_summary table
- get_vorjahr_summary() for Sheet 1 comparison columns
- get_vorjahr_detail() for full previous-year breakdown
- refresh_vorjahr_cache() for cache invalidation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 08:02:53 +00:00
f4afea7f85 feat: historical Excel import (Abrechnung_DAK.xlsx)
Add service and standalone script to import all cases from the master
Excel workbook into the database. Handles 5 year-sheets (2020-2022,
2023, 2024, 2025, 2026) with dynamic column mapping, fallgruppe
normalization, boolean/date parsing, phone number formatting, and
duplicate detection. Supports dry-run mode and per-sheet import.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 07:58:04 +00:00
e793bad01f feat: notification service — in-app + SMTP email
Adds notification_service.py with:
- send_email() for SMTP SSL delivery via complexcaresolutions.de
- create_notification() for in-app + optional email notifications
- notify_all_users_with_role() for role-based bulk notifications
- Convenience functions for all 5 notification types:
  new_cases_uploaded, icd_entered, icd_uploaded,
  report_ready, coding_completed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 07:52:24 +00:00
78c2c682a4 feat: import service with duplicate detection and fall_id generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 07:49:15 +00:00
498cb7048d feat: ICD service — normalize, split, validate, coding template
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 07:49:05 +00:00
df26b51e14 feat: admin API, audit logging, notifications, create_admin script
Add audit_service for compliance logging, admin endpoints (user CRUD,
invitation management, audit log), notification endpoints (list, mark
read), and interactive create_admin script.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 07:48:41 +00:00
518de3da27 feat: auth system — login, register, refresh, MFA, domain whitelist
Add complete authentication layer:
- Pydantic v2 schemas for auth requests/responses and user representation
- Auth service with login (account locking, MFA), registration (invitation
  tokens + domain whitelist), token management, MFA setup/activation, and
  password change
- FastAPI router with 8 endpoints: login, register, refresh, logout,
  mfa/setup, mfa/verify, change-password, me
- Router registered in main.py under /api/auth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 07:46:04 +00:00