⚖️ AI Regulation & Ethics

Automated Decision-Making

Automated Decision-Making

Decisions made automatically by AI without human intervention. A key concept regulated by GDPR Article 22 and the EU AI Act.

Detailed Explanation

Automated Decision-Making (ADM) refers to making decisions about individuals by technological means alone, without human involvement. Article 22(1) of the GDPR provides that the data subject has the "right not to be subject to a decision based solely on automated processing, including profiling, which produces legal effects concerning him or her or similarly significantly affects him or her." This is a key provision protecting individual rights in the age of AI.

For Article 22 to apply, three conditions must be met. First, the decision must be based solely on automated processing (solely automated). It does not apply if a human is substantively involved. Second, it may include profiling. Third, it must have legal effects or similarly significant effects (significantly affects). Examples include loan denial, rejection of a job application, and an increase in insurance premiums.

There are three exceptions to Article 22: (a) where it is necessary for entering into or performing a contract, (b) where it is authorized by Union or Member State law, and (c) where the data subject has given explicit consent. However, even where an exception applies, the controller must guarantee at least (1) the right to request human intervention, (2) the right to express one's point of view, and (3) the right to contest the decision. Stricter conditions apply to automated decisions based on special category data (race, health, etc.).

The EU AI Act complements the GDPR's ADM rules. High-risk AI (recruitment, credit scoring, judiciary, etc.) is subject to additional requirements for transparency, human oversight, and risk management. Article 37-2 of the Korean Personal Information Protection Act also provides the right to refuse automated decisions and the right to request an explanation. In case of violation, administrative fines of up to EUR 20 million or 4% of total worldwide annual turnover, under the GDPR, may be imposed. In practice, the key is to demonstrate 'meaningful human involvement.'

Code Example

This is an example implementation of an automated decision-making system that complies with GDPR Article 22.

"""
자동화된 의사결정(ADM) 시스템
GDPR 제22조 및 개인정보보호법 제37조의2 준수
"""
from dataclasses import dataclass, field
from datetime import datetime
from enum import Enum
from typing import Dict, List, Optional, Any
import logging


class DecisionType(Enum):
    """결정 유형"""
    FULLY_AUTOMATED = "fully_automated"      # 완전 자동화 (제22조 적용)
    HUMAN_ASSISTED = "human_assisted"         # 인간 보조 결정
    HUMAN_DECIDED = "human_decided"           # 인간 결정


class LegalBasis(Enum):
    """제22조 예외 법적 근거"""
    CONTRACT_NECESSITY = "contract"           # 계약 체결/이행에 필요
    LEGAL_AUTHORIZATION = "legal"             # 법률에 의해 허용
    EXPLICIT_CONSENT = "consent"              # 명시적 동의
    NOT_APPLICABLE = "n/a"                    # 예외 없음


class ImpactLevel(Enum):
    """결정의 영향 수준"""
    LOW = "low"                               # 낮은 영향
    MODERATE = "moderate"                      # 중간 영향
    SIGNIFICANT = "significant"                # 중대한 영향 (제22조 적용)
    LEGAL_EFFECT = "legal_effect"             # 법적 효력


@dataclass
class AutomatedDecision:
    """자동화된 결정 기록"""
    decision_id: str
    subject_id: str
    decision_type: DecisionType
    model_name: str
    input_data: Dict
    output: Any
    confidence: float
    explanation: str
    impact_level: ImpactLevel
    legal_basis: Optional[LegalBasis] = None
    human_reviewer: Optional[str] = None
    human_review_notes: Optional[str] = None
    created_at: datetime = field(default_factory=datetime.now)
    objection_requested: bool = False
    objection_reason: Optional[str] = None


class GDPRArticle22Handler:
    """
    GDPR 제22조 준수 핸들러

    주요 기능:
    - 자동화된 결정 적법성 검증
    - 인간 개입 요청 처리
    - 의견 표명 및 이의 제기 처리
    - 결정 설명 제공
    """

    # 중대한 영향 분야
    SIGNIFICANT_DOMAINS = [
        "credit_scoring",      # 신용 평가
        "employment",          # 채용/고용
        "insurance",           # 보험
        "social_benefits",     # 사회 급여
        "education",           # 교육 입학
        "health",              # 의료
        "legal"                # 법적 결정
    ]

    def __init__(self, audit_logger):
        self.audit_logger = audit_logger
        self.decisions: Dict[str, AutomatedDecision] = {}
        self.logger = logging.getLogger("gdpr_article22")

    def register_decision(
        self,
        decision: AutomatedDecision,
        domain: str
    ) -> Dict:
        """
        자동화된 결정 등록 및 제22조 적용 여부 확인

        Returns:
            제22조 적용 여부 및 필요 조치
        """
        # 제22조 적용 여부 판단
        article22_applies = self._check_article22_applicability(
            decision, domain
        )

        self.decisions[decision.decision_id] = decision

        result = {
            "decision_id": decision.decision_id,
            "article_22_applies": article22_applies,
            "decision_type": decision.decision_type.value,
            "impact_level": decision.impact_level.value
        }

        if article22_applies:
            # 법적 근거 검증
            legal_basis_valid = self._validate_legal_basis(decision)

            result.update({
                "legal_basis": decision.legal_basis.value if decision.legal_basis else None,
                "legal_basis_valid": legal_basis_valid,
                "required_safeguards": self._get_required_safeguards(),
                "warning": None if legal_basis_valid else
                    "GDPR 제22조 위반 가능성: 유효한 법적 근거 없이 완전 자동화된 중대 결정"
            })

        self.audit_logger.log_event(
            event_type="ADM_DECISION_REGISTERED",
            decision_id=decision.decision_id,
            article_22_applies=article22_applies,
            impact_level=decision.impact_level.value
        )

        return result

    def _check_article22_applicability(
        self,
        decision: AutomatedDecision,
        domain: str
    ) -> bool:
        """
        GDPR 제22조 적용 여부 확인

        적용 조건:
        1. 완전 자동화된 결정 (solely automated)
        2. 중대한 영향 또는 법적 효력
        """
        # 완전 자동화가 아니면 미적용
        if decision.decision_type != DecisionType.FULLY_AUTOMATED:
            return False

        # 중대한 영향 또는 법적 효력 확인
        significant_impact = (
            decision.impact_level in [ImpactLevel.SIGNIFICANT, ImpactLevel.LEGAL_EFFECT] or
            domain in self.SIGNIFICANT_DOMAINS
        )

        return significant_impact

    def _validate_legal_basis(self, decision: AutomatedDecision) -> bool:
        """법적 근거 유효성 검증"""
        if not decision.legal_basis:
            return False

        if decision.legal_basis == LegalBasis.NOT_APPLICABLE:
            return False

        # 각 법적 근거에 대한 추가 검증 필요
        # (실제 구현에서는 동의 기록, 계약 문서 등 확인)
        return True

    def _get_required_safeguards(self) -> List[str]:
        """제22조 제3항: 필수 보호조치"""
        return [
            "정보주체의 인간 개입 요청권 보장",
            "정보주체의 의견 표명권 보장",
            "결정에 대한 이의 제기권 보장"
        ]

    def request_human_intervention(
        self,
        decision_id: str,
        subject_id: str,
        reason: str
    ) -> Dict:
        """
        인간 개입 요청 (제22조 제3항)

        정보주체는 자동화된 결정에 대해
        인간 개입을 요청할 권리가 있음
        """
        decision = self.decisions.get(decision_id)

        if not decision:
            raise ValueError(f"Decision not found: {decision_id}")

        if decision.subject_id != subject_id:
            raise PermissionError("Unauthorized: subject_id mismatch")

        # 결정 유형을 인간 검토 필요로 변경
        decision.decision_type = DecisionType.HUMAN_ASSISTED
        decision.objection_requested = True
        decision.objection_reason = reason

        self.audit_logger.log_event(
            event_type="HUMAN_INTERVENTION_REQUESTED",
            decision_id=decision_id,
            reason=reason
        )

        return {
            "status": "intervention_requested",
            "decision_id": decision_id,
            "message": "인간 검토자가 귀하의 결정을 재검토할 예정입니다.",
            "expected_timeline": "영업일 기준 5일 이내"
        }

    def express_view(
        self,
        decision_id: str,
        subject_id: str,
        view: str,
        supporting_documents: List[str] = None
    ) -> Dict:
        """
        의견 표명 (제22조 제3항)

        정보주체는 자동화된 결정에 대해
        자신의 의견을 표명할 권리가 있음
        """
        decision = self.decisions.get(decision_id)

        if not decision or decision.subject_id != subject_id:
            raise ValueError("Invalid decision or subject")

        self.audit_logger.log_event(
            event_type="VIEW_EXPRESSED",
            decision_id=decision_id,
            view_summary=view[:100] + "..." if len(view) > 100 else view,
            has_documents=bool(supporting_documents)
        )

        return {
            "status": "view_recorded",
            "decision_id": decision_id,
            "message": "귀하의 의견이 기록되었습니다. 검토 후 연락드리겠습니다."
        }

    def contest_decision(
        self,
        decision_id: str,
        subject_id: str,
        grounds: str
    ) -> Dict:
        """
        결정 이의 제기 (제22조 제3항)

        정보주체는 자동화된 결정에
        이의를 제기할 권리가 있음
        """
        decision = self.decisions.get(decision_id)

        if not decision or decision.subject_id != subject_id:
            raise ValueError("Invalid decision or subject")

        decision.objection_requested = True
        decision.objection_reason = grounds

        self.audit_logger.log_event(
            event_type="DECISION_CONTESTED",
            decision_id=decision_id,
            grounds_summary=grounds[:100]
        )

        return {
            "status": "contest_received",
            "decision_id": decision_id,
            "case_number": f"CONTEST-{decision_id[:8]}",
            "message": "이의 제기가 접수되었습니다. 재심사를 진행합니다.",
            "expected_response": "30일 이내"
        }

    def get_decision_explanation(
        self,
        decision_id: str,
        subject_id: str
    ) -> Dict:
        """
        결정 설명 제공 (제13-15조, Recital 71)

        정보주체는 자동화된 결정의 로직,
        중요성, 예상 결과에 대한 설명을 받을 권리가 있음
        """
        decision = self.decisions.get(decision_id)

        if not decision or decision.subject_id != subject_id:
            raise ValueError("Invalid decision or subject")

        return {
            "decision_id": decision_id,
            "decision_date": decision.created_at.isoformat(),
            "decision_outcome": str(decision.output),
            "confidence_level": f"{decision.confidence:.0%}",
            "explanation": {
                "logic_summary": decision.explanation,
                "key_factors": self._extract_key_factors(decision.input_data),
                "significance": self._get_impact_description(decision.impact_level),
                "possible_consequences": self._get_consequences(decision.output)
            },
            "your_rights": [
                "인간 검토 요청 (제22조 제3항)",
                "의견 표명 (제22조 제3항)",
                "결정 이의 제기 (제22조 제3항)"
            ]
        }

    def _extract_key_factors(self, input_data: Dict) -> List[str]:
        """결정에 영향을 미친 주요 요소 추출"""
        return [f"{k}: {v}" for k, v in list(input_data.items())[:5]]

    def _get_impact_description(self, level: ImpactLevel) -> str:
        descriptions = {
            ImpactLevel.LOW: "이 결정은 귀하에게 경미한 영향을 미칩니다.",
            ImpactLevel.MODERATE: "이 결정은 귀하에게 중간 수준의 영향을 미칩니다.",
            ImpactLevel.SIGNIFICANT: "이 결정은 귀하에게 중대한 영향을 미칩니다.",
            ImpactLevel.LEGAL_EFFECT: "이 결정은 귀하에게 법적 효력이 있습니다."
        }
        return descriptions.get(level, "영향 수준을 평가할 수 없습니다.")

    def _get_consequences(self, output: Any) -> List[str]:
        """결정의 예상 결과"""
        return [
            "이 결정에 따라 서비스/혜택이 결정됩니다.",
            "이의 제기 시 재검토가 가능합니다."
        ]


# 사용 예시
if __name__ == "__main__":
    import uuid

    logging.basicConfig(level=logging.INFO)

    class MockAuditLogger:
        def log_event(self, **kwargs):
            print(f"AUDIT: {kwargs}")

    handler = GDPRArticle22Handler(MockAuditLogger())

    # 자동화된 신용 결정 등록
    decision = AutomatedDecision(
        decision_id=str(uuid.uuid4())[:8],
        subject_id="user_12345",
        decision_type=DecisionType.FULLY_AUTOMATED,
        model_name="credit_model_v3",
        input_data={
            "income": 50000,
            "debt_ratio": 0.3,
            "credit_history_years": 5
        },
        output="DENIED",
        confidence=0.85,
        explanation="부채 비율이 기준(0.25)을 초과함",
        impact_level=ImpactLevel.SIGNIFICANT,
        legal_basis=LegalBasis.CONTRACT_NECESSITY
    )

    # 결정 등록 및 제22조 적용 확인
    result = handler.register_decision(decision, "credit_scoring")
    print(f"Article 22 applies: {result['article_22_applies']}")

    # 결정 설명 요청
    explanation = handler.get_decision_explanation(
        decision.decision_id,
        "user_12345"
    )
    print(f"Explanation: {explanation['explanation']['logic_summary']}")

    # 인간 개입 요청
    intervention = handler.request_human_intervention(
        decision.decision_id,
        "user_12345",
        "추가 소득 자료가 있어 재검토 요청"
    )
    print(f"Intervention status: {intervention['status']}")

Practical Conversation

PM: Our loan screening AI is fully automated. Is there an issue with GDPR Article 22?
Developer: Yes, a loan denial falls under 'significant effects,' so Article 22 applies. Fully automated decisions are prohibited in principle, but exceptions apply if there is contractual necessity or explicit consent.
PM: But we obtain consent through our terms and conditions, don't we?
Developer: 'Explicit consent' is different from agreeing to general terms and conditions. You need to obtain separate consent for automated decisions. And even with consent, you must guarantee the right to request human intervention, the right to express one's views, and the right to contest the decision. It's safest to have at least one person review the AI's decisions.
Interviewer: Please explain 'solely automated' and 'significantly affects' under GDPR Article 22.
Candidate: 'Solely automated' means that a decision is made by technology alone, without substantive human involvement. Rubber-stamping, where a person merely gives formal approval, is not recognized as human involvement. 'Significantly affects' refers to effects that are not legal effects but are comparable to them, and includes loan denial, rejection of a job application, and an increase in insurance premiums.
Interviewer: Even when an Article 22 exception applies, what safeguards are required?
Candidate: Under Article 22(3), three rights must be guaranteed. First, the right to request human intervention. Second, the right to express one's own views. Third, the right to contest the decision. These three must be guaranteed even when an exception applies.

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

Reviewer: This hiring AI system has automatic rejection logic. That is a violation of Article 22.
Author: But the HR team gives final approval, doesn't it?
Reviewer: HR doesn't even review the candidates the AI rejects. That is 'solely automated.' HR accepting the AI's recommendations uncritically is also not substantive human involvement. You must add human review to every rejection decision, or provide candidates with a way to request human review.
Author: Understood. I'll add a human review step to rejection decisions and also add an objection feature to the applicant portal.

Cautions

Substantive Human Involvement Required

To avoid 'solely automated' status, human involvement must be substantive. 'Rubber-stamping,' which merely approves AI decisions, is not recognized. The human reviewer must (1) understand the AI decision, (2) review the relevant data, and (3) have the authority and ability to change the decision when necessary. You must demonstrate that the review is not merely formal by monitoring review time, change rates, and so on.

Requirements for Explicit Consent

'Explicit consent' as an exception under Article 22 is different from agreeing to general terms and conditions. It must meet the requirements of Article 4(11) of the GDPR: (1) freely given consent, (2) specific and informed consent, (3) an unambiguous indication of consent. A separate consent procedure is required for automated decisions, and the service must still be provided even if consent is withdrawn.

Restrictions on Special Category Data

Automated decisions based on special category data (Article 9), such as race, ethnicity, political opinions, religion, health, and sexual orientation, are subject to stricter rules. Even with explicit consent or substantial public interest, appropriate safeguards are essential. In many cases, it is advisable to avoid using such data in AI decision-making altogether.

Learn More