mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 20:43:41 +00:00
feat: add disclosure schemas and case response masking helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bb13ec80a2
commit
3496e4acfe
2 changed files with 55 additions and 0 deletions
|
|
@ -57,6 +57,8 @@ class CaseResponse(BaseModel):
|
||||||
import_source: Optional[str] = None
|
import_source: Optional[str] = None
|
||||||
imported_at: datetime
|
imported_at: datetime
|
||||||
updated_at: datetime
|
updated_at: datetime
|
||||||
|
disclosure_granted: bool = False
|
||||||
|
disclosure_expires_at: Optional[datetime] = None
|
||||||
|
|
||||||
model_config = {"from_attributes": True}
|
model_config = {"from_attributes": True}
|
||||||
|
|
||||||
|
|
@ -124,3 +126,18 @@ class CodingUpdate(BaseModel):
|
||||||
ta_diagnosekorrektur: bool = False
|
ta_diagnosekorrektur: bool = False
|
||||||
ta_unterversorgung: bool = False
|
ta_unterversorgung: bool = False
|
||||||
ta_uebertherapie: bool = False
|
ta_uebertherapie: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
SENSITIVE_FIELDS = ("nachname", "vorname", "geburtsdatum", "anrede")
|
||||||
|
|
||||||
|
|
||||||
|
def mask_case_for_mitarbeiter(case_dict: dict, disclosure_granted: bool = False) -> dict:
|
||||||
|
"""Remove sensitive personal data fields for dak_mitarbeiter users.
|
||||||
|
|
||||||
|
If disclosure_granted is True, the fields remain visible.
|
||||||
|
"""
|
||||||
|
if not disclosure_granted:
|
||||||
|
for field in SENSITIVE_FIELDS:
|
||||||
|
case_dict[field] = None
|
||||||
|
case_dict["disclosure_granted"] = disclosure_granted
|
||||||
|
return case_dict
|
||||||
|
|
|
||||||
38
backend/app/schemas/disclosure.py
Normal file
38
backend/app/schemas/disclosure.py
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
"""Pydantic schemas for disclosure request endpoints."""
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class DisclosureRequestCreate(BaseModel):
|
||||||
|
"""Payload for creating a disclosure request."""
|
||||||
|
reason: str
|
||||||
|
|
||||||
|
|
||||||
|
class DisclosureRequestResponse(BaseModel):
|
||||||
|
"""Response for a single disclosure request."""
|
||||||
|
id: int
|
||||||
|
case_id: int
|
||||||
|
requester_id: int
|
||||||
|
requester_username: Optional[str] = None
|
||||||
|
fall_id: Optional[str] = None
|
||||||
|
reason: str
|
||||||
|
status: str
|
||||||
|
reviewed_by: Optional[int] = None
|
||||||
|
reviewed_at: Optional[datetime] = None
|
||||||
|
expires_at: Optional[datetime] = None
|
||||||
|
created_at: datetime
|
||||||
|
|
||||||
|
model_config = {"from_attributes": True}
|
||||||
|
|
||||||
|
|
||||||
|
class DisclosureRequestUpdate(BaseModel):
|
||||||
|
"""Payload for approving/rejecting a disclosure request."""
|
||||||
|
status: str # "approved" or "rejected"
|
||||||
|
|
||||||
|
|
||||||
|
class DisclosureCountResponse(BaseModel):
|
||||||
|
"""Count of pending disclosure requests."""
|
||||||
|
pending_count: int
|
||||||
Loading…
Reference in a new issue