Baltor Get started

Library / Code module

Personal data masker for free text

personal_data_masker

Replace personal identifiers in free text (emails, web addresses, IP addresses, card numbers, phone numbers, dates, ID numbers, ZIP codes, listed names and custom patterns) with numbered placeholders and return an inventory without the values.

Files, names only

  • ATTRIBUTION.md 4.8 KB
  • LICENSE 1.0 KB
  • ONET-ATTRIBUTION.md 13.2 KB
  • PROCEDURE.md 2.3 KB
  • README.md 4.6 KB
  • TOOLS.md 2.0 KB
  • component.json 13.6 KB
  • examples/known_good.json 2.1 KB
  • examples/known_wrong.json 328 bytes
  • kit_schema.py 11.4 KB
  • personal_data_masker.py 8.1 KB
  • test_package.py 6.8 KB

Full files in your harness.

What it takes and gives

Runs with
Python 3.10 or later
Command
python3 personal_data_masker.py < input.json
Function
personal_data_masker.run
Required input
text

Cases it covers

  • Known wrong example: The custom pattern for record numbers has an unclosed group, so it cannot be compiled and nothing would be masked by it. Refused as invalid pattern.
  • input invalid: refused with exit code 2
  • input not json: refused with exit code 2
  • invalid pattern: refused with exit code 2
  • label invalid: refused with exit code 2

Limits and scope

Limits
Pattern masking misses names that are not listed and have no honorific, addresses written in prose, and identifiers in unusual formats. It can also mask numbers that only look like phone numbers. Treat the output as reduced risk, not as anonymized data. Dates are masked whole; keep a year separately if analysis needs it.
Work activities
Record patient medical histories; Maintain student records; Record personnel information.

Details

Kind
Code module
Licence
MIT
Declared effects
runs commands
Source
github.com/alisonjieli-png/loop-engine/tools/creative_originals/occupation_task_kits/items/personal_data_masker
Size
12 files, 70.3 KB
Identity
library.supply.creative_originals.7a09f7ac445d891a26e0ad2e.2636cba2402d8ad0
Version
2636cba2402d8ad0501db151a3cc67b65d8e10a1629774f2b8aeb202737dd372

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Where it is shown

Related components

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.