aboutsummaryrefslogtreecommitdiffstats
path: root/gdpr_obfuscator/obfuscate.py
blob: 0a1d74b90e98fd1b6a86e968e1ce4c3206d22007 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from typing import List, Dict


def obfuscate_data(
    data: List[Dict[str, str]], pii_fields: List[str]
) -> List[Dict[str, str]]:
    """
    A function to obfuscate PII fields in a list of dictionaries, replacing
    sensitive values with a string of asterisks.
    """

    return [
        {k: ("***" if k in pii_fields else v) for k, v in record.items()}
        for record in data
    ]
git.ajschof.me — hosted by ajschofield — powered by cgit