Explain why a report cannot guarantee privacy

A short report is not a privacy guarantee

The dictionary deliberately contains Path.name and a calculated line count. It omits temporary parent paths and the source text itself, which makes the exact report schema visible in the assertion. That is a minimization choice, not a privacy classification.

A filename may reveal context and a count may reveal information about the source. The code counts text lines, not bytes or document structure, and provides no redaction rule. Whether the two fields are acceptable depends on the recipient and data policy.

Example

from pathlib import Path
from tempfile import TemporaryDirectory
with TemporaryDirectory() as d:
    p = Path(d) / 'customer-notes.txt'
    p.write_text('one\ntwo\n')
    report = {'path': p.name, 'line_count': len(p.read_text().splitlines())}
    assert report['line_count'] == 2
    result = 'fields=path,line_count'
    print(result)

Expected stdout:

fields=path,line_count

Sources

- pathlib.PurePath.name

- pathlib.Path.read_text

Prepared with AI assistance. The example uses synthetic data; its stated limits apply.

Comments

Popular posts from this blog

Compare Two Text Files in Python Without Modifying Them

Seven CSV Quality Checks to Run Before Importing Data

Explain why SQLite transactions cannot make an HTTP call atomic