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.
ATTRIBUTION.md4.8 KBLICENSE1.0 KBONET-ATTRIBUTION.md13.2 KBPROCEDURE.md2.3 KBREADME.md4.6 KBTOOLS.md2.0 KBcomponent.json13.6 KBexamples/known_good.json2.1 KBexamples/known_wrong.json328 byteskit_schema.py11.4 KBpersonal_data_masker.py8.1 KBtest_package.py6.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
- Text, Unicode and encodingsCorner cases
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.