PII-discovery 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pii_discovery-0.1.0/LICENSE +21 -0
- pii_discovery-0.1.0/MANIFEST.in +11 -0
- pii_discovery-0.1.0/PII_discovery.egg-info/PKG-INFO +173 -0
- pii_discovery-0.1.0/PII_discovery.egg-info/SOURCES.txt +12 -0
- pii_discovery-0.1.0/PII_discovery.egg-info/dependency_links.txt +1 -0
- pii_discovery-0.1.0/PII_discovery.egg-info/entry_points.txt +2 -0
- pii_discovery-0.1.0/PII_discovery.egg-info/requires.txt +20 -0
- pii_discovery-0.1.0/PII_discovery.egg-info/top_level.txt +1 -0
- pii_discovery-0.1.0/PKG-INFO +173 -0
- pii_discovery-0.1.0/PUBLISHING.md +71 -0
- pii_discovery-0.1.0/README.md +138 -0
- pii_discovery-0.1.0/pii_discovery.py +2907 -0
- pii_discovery-0.1.0/pyproject.toml +46 -0
- pii_discovery-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pratik P. Lahudkar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include PUBLISHING.md
|
|
3
|
+
include README.md
|
|
4
|
+
include pii_discovery.py
|
|
5
|
+
exclude PII_Discovery_and_Detection_Methodology.docx
|
|
6
|
+
exclude EDGE_CASE_CATALOG.md
|
|
7
|
+
exclude SAMPLES_README.md
|
|
8
|
+
recursive-exclude samples *
|
|
9
|
+
recursive-exclude sample_report_value_only *
|
|
10
|
+
recursive-exclude __pycache__ *
|
|
11
|
+
global-exclude *.py[cod] *.csv *.xlsx *.xlsm *.pdf *.docx
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PII-discovery
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first discovery of candidate PII, PHI, and financial data in common file formats
|
|
5
|
+
Author: Pratik P. Lahudkar
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: pii,phi,privacy,data-discovery,sensitive-data,structured-data,unstructured-data,forensics
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Information Technology
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Topic :: Security
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: tqdm<5,>=4.66
|
|
19
|
+
Provides-Extra: formats
|
|
20
|
+
Requires-Dist: openpyxl<4,>=3.1; extra == "formats"
|
|
21
|
+
Requires-Dist: pypdf<7,>=5; extra == "formats"
|
|
22
|
+
Requires-Dist: python-docx<2,>=1.1; extra == "formats"
|
|
23
|
+
Provides-Extra: ner
|
|
24
|
+
Requires-Dist: spacy<4,>=3.7; extra == "ner"
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: openpyxl<4,>=3.1; extra == "all"
|
|
27
|
+
Requires-Dist: pypdf<7,>=5; extra == "all"
|
|
28
|
+
Requires-Dist: python-docx<2,>=1.1; extra == "all"
|
|
29
|
+
Requires-Dist: spacy<4,>=3.7; extra == "all"
|
|
30
|
+
Requires-Dist: tqdm<5,>=4.66; extra == "all"
|
|
31
|
+
Provides-Extra: maintainer
|
|
32
|
+
Requires-Dist: build<2,>=1.2; extra == "maintainer"
|
|
33
|
+
Requires-Dist: twine<7,>=5; extra == "maintainer"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# PII-discovery
|
|
37
|
+
|
|
38
|
+
**Local-first discovery of candidate PII, PHI, and financial data across structured, semi-structured, and text-based files.**
|
|
39
|
+
|
|
40
|
+
PII-discovery is a Python library and command-line scanner for locating potentially sensitive values in supported local files. It combines structured-field and key-name matching with value patterns, explicit labels, selected validation rules, nearby text context, and optional spaCy named-entity recognition.
|
|
41
|
+
|
|
42
|
+
The scanner reads source files locally and writes reports to a directory you choose. It does not redact values or modify source files. Findings include exact candidate values and unredacted context so an analyst can locate and review each match.
|
|
43
|
+
|
|
44
|
+
PII-discovery is a discovery aid. It does not certify that a dataset is free of sensitive information, guarantee zero false positives, verify a person's identity, or establish regulatory compliance.
|
|
45
|
+
|
|
46
|
+
## Capabilities
|
|
47
|
+
|
|
48
|
+
- Scans structured, semi-structured, and unstructured text in supported local files.
|
|
49
|
+
- Uses embedded header and key aliases, regular expressions, explicit label capture, selected format and checksum validation, and source context.
|
|
50
|
+
- Optionally identifies PERSON and ORG candidates with spaCy NER.
|
|
51
|
+
- Reports exact values, source locations, detection evidence, confidence/severity scores, and prefix/suffix context.
|
|
52
|
+
- Keeps structured header findings separate from value-level findings.
|
|
53
|
+
- Includes a progress bar through tqdm.
|
|
54
|
+
- Embeds a reference taxonomy of 651 data-type entries across 27 categories. The taxonomy supports classification and matching; it does not mean every entry has a dedicated value detector.
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Install the base package from PyPI:
|
|
59
|
+
|
|
60
|
+
~~~~powershell
|
|
61
|
+
python -m pip install pii-discovery
|
|
62
|
+
~~~~
|
|
63
|
+
|
|
64
|
+
The base installation includes the command-line scanner and progress display. Optional readers for Excel, PDF, and Word documents can be installed with:
|
|
65
|
+
|
|
66
|
+
~~~~powershell
|
|
67
|
+
python -m pip install "pii-discovery[formats]"
|
|
68
|
+
~~~~
|
|
69
|
+
|
|
70
|
+
To enable spaCy named-entity recognition, install the NER extra and its language model:
|
|
71
|
+
|
|
72
|
+
~~~~powershell
|
|
73
|
+
python -m pip install "pii-discovery[ner]"
|
|
74
|
+
python -m spacy download en_core_web_sm
|
|
75
|
+
~~~~
|
|
76
|
+
|
|
77
|
+
Install all optional integrations with `python -m pip install "pii-discovery[all]"`. The spaCy language model is installed separately. If spaCy or the requested model is unavailable, the scanner warns and continues without NER.
|
|
78
|
+
|
|
79
|
+
## Supported input formats
|
|
80
|
+
|
|
81
|
+
The current readers support:
|
|
82
|
+
|
|
83
|
+
- Delimited text, including CSV and TSV
|
|
84
|
+
- JSON and JSON Lines
|
|
85
|
+
- XML and HTML
|
|
86
|
+
- Plain text, logs, and Markdown
|
|
87
|
+
- SQLite databases, read through a read-only connection
|
|
88
|
+
- EML email messages, ICS calendars, and VCF files
|
|
89
|
+
- XLSX and XLSM workbooks
|
|
90
|
+
- PDF files with extractable embedded text
|
|
91
|
+
- DOCX paragraphs and tables
|
|
92
|
+
|
|
93
|
+
Some formats require the `formats` extra. XLSX scanning reads cached cell values and does not calculate formulas. PDF scanning extracts embedded text and does not OCR scanned pages. Images, audio, video, external databases, hidden document metadata, and password-protected content are outside the current scanner's coverage.
|
|
94
|
+
|
|
95
|
+
## Quick start
|
|
96
|
+
|
|
97
|
+
Scan a directory recursively and write reports to a separate output directory:
|
|
98
|
+
|
|
99
|
+
~~~~powershell
|
|
100
|
+
pii-discovery ./source_data --output ./pii_report
|
|
101
|
+
~~~~
|
|
102
|
+
|
|
103
|
+
Scan individual files and set a higher minimum candidate score:
|
|
104
|
+
|
|
105
|
+
~~~~powershell
|
|
106
|
+
pii-discovery ./customers.csv ./case_notes.txt --output ./case_report --min-confidence 0.70
|
|
107
|
+
~~~~
|
|
108
|
+
|
|
109
|
+
Use the command's help option to see every setting. Key controls include:
|
|
110
|
+
|
|
111
|
+
| Option | Default | Purpose |
|
|
112
|
+
| --- | ---: | --- |
|
|
113
|
+
| `--output` | `pii_discovery_report` | Report destination |
|
|
114
|
+
| `--no-recursive` | Off | Scan only files immediately inside each input directory |
|
|
115
|
+
| `--min-confidence` | `0.55` | Minimum candidate score to report |
|
|
116
|
+
| `--context-chars` | `70` | Maximum prefix and suffix context length in findings |
|
|
117
|
+
| `--max-file-mb` | `100` | Per-file size limit |
|
|
118
|
+
| `--spacy-model` | `en_core_web_sm` | spaCy model used for optional PERSON/ORG NER |
|
|
119
|
+
| `--no-spacy` | Off | Disable spaCy NER |
|
|
120
|
+
|
|
121
|
+
Confidence and severity values are evidence scores assigned by the implementation. They are not calibrated probabilities that a match is true.
|
|
122
|
+
|
|
123
|
+
## Python API
|
|
124
|
+
|
|
125
|
+
The primary programmatic entry point is `build_report`:
|
|
126
|
+
|
|
127
|
+
~~~~python
|
|
128
|
+
from pathlib import Path
|
|
129
|
+
|
|
130
|
+
from pii_discovery import build_report
|
|
131
|
+
|
|
132
|
+
summary = build_report(
|
|
133
|
+
inputs=[Path("source_data")],
|
|
134
|
+
output_dir=Path("pii_report"),
|
|
135
|
+
recursive=True,
|
|
136
|
+
min_confidence=0.55,
|
|
137
|
+
context_chars=70,
|
|
138
|
+
max_file_mb=100,
|
|
139
|
+
spacy_model="en_core_web_sm",
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
print(summary)
|
|
143
|
+
~~~~
|
|
144
|
+
|
|
145
|
+
Pass `spacy_model=None` to disable NER. The function returns a summary dictionary and writes the reports to `output_dir`.
|
|
146
|
+
|
|
147
|
+
## Reports
|
|
148
|
+
|
|
149
|
+
The report directory contains:
|
|
150
|
+
|
|
151
|
+
- `findings.csv` — value-level candidate findings, including exact unredacted values in `value_preview`, source locations, detection evidence, and unredacted prefix/suffix context.
|
|
152
|
+
- `structured_fields.csv` — sensitive column and key names detected from structured sources, kept separate from value-level findings.
|
|
153
|
+
- `summary_by_category.csv`, `summary_by_file.csv`, and `summary_by_pii_type.csv` — finding counts by category, source file, and mapped catalog type.
|
|
154
|
+
- `file_inventory.csv` — discovered files, scan status, values scanned, finding count, and parser errors.
|
|
155
|
+
- `document_indicators.csv` — document-level terms reported separately from value findings.
|
|
156
|
+
- `pii_type_catalog.csv`, `classification_legend.csv`, and `regulatory_terminology.csv` — embedded reference material used in classification and reporting.
|
|
157
|
+
- `report.md` — scan totals, summaries, interpretation notes, and known limitations.
|
|
158
|
+
|
|
159
|
+
The scanner does not redact values. Findings and reports may contain personal, health, financial, identity, or investigative information. Store and share them only under appropriate access controls and evidence-handling procedures.
|
|
160
|
+
|
|
161
|
+
## Detection scope and limitations
|
|
162
|
+
|
|
163
|
+
Detection combines header/key aliases, embedded taxonomy terms, regular expressions, explicit label capture, selected format or checksum checks, nearby context, and optional spaCy PERSON/ORG NER. Document-level keywords are reported separately and are not treated as proof that a value was found.
|
|
164
|
+
|
|
165
|
+
Not every catalog item has a dedicated value detector. Names, addresses, health content, dates, and jurisdiction-specific identifiers can depend heavily on labels, language, context, and source quality. NER candidates are statistical signals, not proof of identity or personal-data status. The scanner does not query government, financial, carrier, or other issuing registries to authenticate values.
|
|
166
|
+
|
|
167
|
+
No automated detector can guarantee complete recall or zero false positives across all languages, jurisdictions, source layouts, and data conditions. Validate results against an approved, representative, adjudicated dataset and have a qualified analyst review findings before relying on them in an investigation. Do not use this package as the sole basis for a legal, employment, financial, or other high-impact decision.
|
|
168
|
+
|
|
169
|
+
The scanner processes files locally and does not upload source contents to a remote detection service. It is not a forensic acquisition tool and does not create a chain-of-custody record.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT. See the included `LICENSE` file.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
PUBLISHING.md
|
|
4
|
+
README.md
|
|
5
|
+
pii_discovery.py
|
|
6
|
+
pyproject.toml
|
|
7
|
+
PII_discovery.egg-info/PKG-INFO
|
|
8
|
+
PII_discovery.egg-info/SOURCES.txt
|
|
9
|
+
PII_discovery.egg-info/dependency_links.txt
|
|
10
|
+
PII_discovery.egg-info/entry_points.txt
|
|
11
|
+
PII_discovery.egg-info/requires.txt
|
|
12
|
+
PII_discovery.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
tqdm<5,>=4.66
|
|
2
|
+
|
|
3
|
+
[all]
|
|
4
|
+
openpyxl<4,>=3.1
|
|
5
|
+
pypdf<7,>=5
|
|
6
|
+
python-docx<2,>=1.1
|
|
7
|
+
spacy<4,>=3.7
|
|
8
|
+
tqdm<5,>=4.66
|
|
9
|
+
|
|
10
|
+
[formats]
|
|
11
|
+
openpyxl<4,>=3.1
|
|
12
|
+
pypdf<7,>=5
|
|
13
|
+
python-docx<2,>=1.1
|
|
14
|
+
|
|
15
|
+
[maintainer]
|
|
16
|
+
build<2,>=1.2
|
|
17
|
+
twine<7,>=5
|
|
18
|
+
|
|
19
|
+
[ner]
|
|
20
|
+
spacy<4,>=3.7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pii_discovery
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PII-discovery
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local-first discovery of candidate PII, PHI, and financial data in common file formats
|
|
5
|
+
Author: Pratik P. Lahudkar
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: pii,phi,privacy,data-discovery,sensitive-data,structured-data,unstructured-data,forensics
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Information Technology
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Topic :: Security
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: tqdm<5,>=4.66
|
|
19
|
+
Provides-Extra: formats
|
|
20
|
+
Requires-Dist: openpyxl<4,>=3.1; extra == "formats"
|
|
21
|
+
Requires-Dist: pypdf<7,>=5; extra == "formats"
|
|
22
|
+
Requires-Dist: python-docx<2,>=1.1; extra == "formats"
|
|
23
|
+
Provides-Extra: ner
|
|
24
|
+
Requires-Dist: spacy<4,>=3.7; extra == "ner"
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: openpyxl<4,>=3.1; extra == "all"
|
|
27
|
+
Requires-Dist: pypdf<7,>=5; extra == "all"
|
|
28
|
+
Requires-Dist: python-docx<2,>=1.1; extra == "all"
|
|
29
|
+
Requires-Dist: spacy<4,>=3.7; extra == "all"
|
|
30
|
+
Requires-Dist: tqdm<5,>=4.66; extra == "all"
|
|
31
|
+
Provides-Extra: maintainer
|
|
32
|
+
Requires-Dist: build<2,>=1.2; extra == "maintainer"
|
|
33
|
+
Requires-Dist: twine<7,>=5; extra == "maintainer"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# PII-discovery
|
|
37
|
+
|
|
38
|
+
**Local-first discovery of candidate PII, PHI, and financial data across structured, semi-structured, and text-based files.**
|
|
39
|
+
|
|
40
|
+
PII-discovery is a Python library and command-line scanner for locating potentially sensitive values in supported local files. It combines structured-field and key-name matching with value patterns, explicit labels, selected validation rules, nearby text context, and optional spaCy named-entity recognition.
|
|
41
|
+
|
|
42
|
+
The scanner reads source files locally and writes reports to a directory you choose. It does not redact values or modify source files. Findings include exact candidate values and unredacted context so an analyst can locate and review each match.
|
|
43
|
+
|
|
44
|
+
PII-discovery is a discovery aid. It does not certify that a dataset is free of sensitive information, guarantee zero false positives, verify a person's identity, or establish regulatory compliance.
|
|
45
|
+
|
|
46
|
+
## Capabilities
|
|
47
|
+
|
|
48
|
+
- Scans structured, semi-structured, and unstructured text in supported local files.
|
|
49
|
+
- Uses embedded header and key aliases, regular expressions, explicit label capture, selected format and checksum validation, and source context.
|
|
50
|
+
- Optionally identifies PERSON and ORG candidates with spaCy NER.
|
|
51
|
+
- Reports exact values, source locations, detection evidence, confidence/severity scores, and prefix/suffix context.
|
|
52
|
+
- Keeps structured header findings separate from value-level findings.
|
|
53
|
+
- Includes a progress bar through tqdm.
|
|
54
|
+
- Embeds a reference taxonomy of 651 data-type entries across 27 categories. The taxonomy supports classification and matching; it does not mean every entry has a dedicated value detector.
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Install the base package from PyPI:
|
|
59
|
+
|
|
60
|
+
~~~~powershell
|
|
61
|
+
python -m pip install pii-discovery
|
|
62
|
+
~~~~
|
|
63
|
+
|
|
64
|
+
The base installation includes the command-line scanner and progress display. Optional readers for Excel, PDF, and Word documents can be installed with:
|
|
65
|
+
|
|
66
|
+
~~~~powershell
|
|
67
|
+
python -m pip install "pii-discovery[formats]"
|
|
68
|
+
~~~~
|
|
69
|
+
|
|
70
|
+
To enable spaCy named-entity recognition, install the NER extra and its language model:
|
|
71
|
+
|
|
72
|
+
~~~~powershell
|
|
73
|
+
python -m pip install "pii-discovery[ner]"
|
|
74
|
+
python -m spacy download en_core_web_sm
|
|
75
|
+
~~~~
|
|
76
|
+
|
|
77
|
+
Install all optional integrations with `python -m pip install "pii-discovery[all]"`. The spaCy language model is installed separately. If spaCy or the requested model is unavailable, the scanner warns and continues without NER.
|
|
78
|
+
|
|
79
|
+
## Supported input formats
|
|
80
|
+
|
|
81
|
+
The current readers support:
|
|
82
|
+
|
|
83
|
+
- Delimited text, including CSV and TSV
|
|
84
|
+
- JSON and JSON Lines
|
|
85
|
+
- XML and HTML
|
|
86
|
+
- Plain text, logs, and Markdown
|
|
87
|
+
- SQLite databases, read through a read-only connection
|
|
88
|
+
- EML email messages, ICS calendars, and VCF files
|
|
89
|
+
- XLSX and XLSM workbooks
|
|
90
|
+
- PDF files with extractable embedded text
|
|
91
|
+
- DOCX paragraphs and tables
|
|
92
|
+
|
|
93
|
+
Some formats require the `formats` extra. XLSX scanning reads cached cell values and does not calculate formulas. PDF scanning extracts embedded text and does not OCR scanned pages. Images, audio, video, external databases, hidden document metadata, and password-protected content are outside the current scanner's coverage.
|
|
94
|
+
|
|
95
|
+
## Quick start
|
|
96
|
+
|
|
97
|
+
Scan a directory recursively and write reports to a separate output directory:
|
|
98
|
+
|
|
99
|
+
~~~~powershell
|
|
100
|
+
pii-discovery ./source_data --output ./pii_report
|
|
101
|
+
~~~~
|
|
102
|
+
|
|
103
|
+
Scan individual files and set a higher minimum candidate score:
|
|
104
|
+
|
|
105
|
+
~~~~powershell
|
|
106
|
+
pii-discovery ./customers.csv ./case_notes.txt --output ./case_report --min-confidence 0.70
|
|
107
|
+
~~~~
|
|
108
|
+
|
|
109
|
+
Use the command's help option to see every setting. Key controls include:
|
|
110
|
+
|
|
111
|
+
| Option | Default | Purpose |
|
|
112
|
+
| --- | ---: | --- |
|
|
113
|
+
| `--output` | `pii_discovery_report` | Report destination |
|
|
114
|
+
| `--no-recursive` | Off | Scan only files immediately inside each input directory |
|
|
115
|
+
| `--min-confidence` | `0.55` | Minimum candidate score to report |
|
|
116
|
+
| `--context-chars` | `70` | Maximum prefix and suffix context length in findings |
|
|
117
|
+
| `--max-file-mb` | `100` | Per-file size limit |
|
|
118
|
+
| `--spacy-model` | `en_core_web_sm` | spaCy model used for optional PERSON/ORG NER |
|
|
119
|
+
| `--no-spacy` | Off | Disable spaCy NER |
|
|
120
|
+
|
|
121
|
+
Confidence and severity values are evidence scores assigned by the implementation. They are not calibrated probabilities that a match is true.
|
|
122
|
+
|
|
123
|
+
## Python API
|
|
124
|
+
|
|
125
|
+
The primary programmatic entry point is `build_report`:
|
|
126
|
+
|
|
127
|
+
~~~~python
|
|
128
|
+
from pathlib import Path
|
|
129
|
+
|
|
130
|
+
from pii_discovery import build_report
|
|
131
|
+
|
|
132
|
+
summary = build_report(
|
|
133
|
+
inputs=[Path("source_data")],
|
|
134
|
+
output_dir=Path("pii_report"),
|
|
135
|
+
recursive=True,
|
|
136
|
+
min_confidence=0.55,
|
|
137
|
+
context_chars=70,
|
|
138
|
+
max_file_mb=100,
|
|
139
|
+
spacy_model="en_core_web_sm",
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
print(summary)
|
|
143
|
+
~~~~
|
|
144
|
+
|
|
145
|
+
Pass `spacy_model=None` to disable NER. The function returns a summary dictionary and writes the reports to `output_dir`.
|
|
146
|
+
|
|
147
|
+
## Reports
|
|
148
|
+
|
|
149
|
+
The report directory contains:
|
|
150
|
+
|
|
151
|
+
- `findings.csv` — value-level candidate findings, including exact unredacted values in `value_preview`, source locations, detection evidence, and unredacted prefix/suffix context.
|
|
152
|
+
- `structured_fields.csv` — sensitive column and key names detected from structured sources, kept separate from value-level findings.
|
|
153
|
+
- `summary_by_category.csv`, `summary_by_file.csv`, and `summary_by_pii_type.csv` — finding counts by category, source file, and mapped catalog type.
|
|
154
|
+
- `file_inventory.csv` — discovered files, scan status, values scanned, finding count, and parser errors.
|
|
155
|
+
- `document_indicators.csv` — document-level terms reported separately from value findings.
|
|
156
|
+
- `pii_type_catalog.csv`, `classification_legend.csv`, and `regulatory_terminology.csv` — embedded reference material used in classification and reporting.
|
|
157
|
+
- `report.md` — scan totals, summaries, interpretation notes, and known limitations.
|
|
158
|
+
|
|
159
|
+
The scanner does not redact values. Findings and reports may contain personal, health, financial, identity, or investigative information. Store and share them only under appropriate access controls and evidence-handling procedures.
|
|
160
|
+
|
|
161
|
+
## Detection scope and limitations
|
|
162
|
+
|
|
163
|
+
Detection combines header/key aliases, embedded taxonomy terms, regular expressions, explicit label capture, selected format or checksum checks, nearby context, and optional spaCy PERSON/ORG NER. Document-level keywords are reported separately and are not treated as proof that a value was found.
|
|
164
|
+
|
|
165
|
+
Not every catalog item has a dedicated value detector. Names, addresses, health content, dates, and jurisdiction-specific identifiers can depend heavily on labels, language, context, and source quality. NER candidates are statistical signals, not proof of identity or personal-data status. The scanner does not query government, financial, carrier, or other issuing registries to authenticate values.
|
|
166
|
+
|
|
167
|
+
No automated detector can guarantee complete recall or zero false positives across all languages, jurisdictions, source layouts, and data conditions. Validate results against an approved, representative, adjudicated dataset and have a qualified analyst review findings before relying on them in an investigation. Do not use this package as the sole basis for a legal, employment, financial, or other high-impact decision.
|
|
168
|
+
|
|
169
|
+
The scanner processes files locally and does not upload source contents to a remote detection service. It is not a forensic acquisition tool and does not create a chain-of-custody record.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT. See the included `LICENSE` file.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Publish PII-discovery on PyPI
|
|
2
|
+
|
|
3
|
+
This guide publishes release 0.1.0 from this project directory. The distribution name is PII-discovery; PyPI normalizes it to pii-discovery. A read-only lookup returned Not Found for this name on 12 November 2026. A lookup does not reserve a name, so PyPI confirms availability during the first upload.
|
|
4
|
+
|
|
5
|
+
## 1. Prepare your PyPI account
|
|
6
|
+
|
|
7
|
+
1. Create an account at https://pypi.org/account/register/ or sign in to your existing account.
|
|
8
|
+
2. Verify your email address and configure two-factor authentication. PyPI requires two-factor authentication for accounts.
|
|
9
|
+
3. Review the author name in pyproject.toml, the MIT notice in LICENSE, the version, and the rendered README.
|
|
10
|
+
|
|
11
|
+
## 2. Build the release files
|
|
12
|
+
|
|
13
|
+
Open PowerShell in the project directory and install the release tools from the local project:
|
|
14
|
+
|
|
15
|
+
~~~~powershell
|
|
16
|
+
python -m pip install --upgrade pip
|
|
17
|
+
python -m pip install ".[maintainer]"
|
|
18
|
+
python -m build
|
|
19
|
+
~~~~
|
|
20
|
+
|
|
21
|
+
The dist directory should contain:
|
|
22
|
+
|
|
23
|
+
~~~~text
|
|
24
|
+
dist/pii_discovery-0.1.0-py3-none-any.whl
|
|
25
|
+
dist/pii_discovery-0.1.0.tar.gz
|
|
26
|
+
~~~~
|
|
27
|
+
|
|
28
|
+
Check the archives' metadata and rendered project description:
|
|
29
|
+
|
|
30
|
+
~~~~powershell
|
|
31
|
+
python -m twine check ./dist/pii_discovery-0.1.0-py3-none-any.whl ./dist/pii_discovery-0.1.0.tar.gz
|
|
32
|
+
~~~~
|
|
33
|
+
|
|
34
|
+
Inspect both archives before upload. Confirm they contain only the intended scanner source, package metadata, README, and license. The packaging configuration excludes sample inputs and generated reports. Never upload evidence, findings, API tokens, or local configuration files.
|
|
35
|
+
|
|
36
|
+
## 3. Create upload credentials
|
|
37
|
+
|
|
38
|
+
For a manual first upload:
|
|
39
|
+
|
|
40
|
+
1. In PyPI account settings, open API tokens and create a token.
|
|
41
|
+
2. Because the project does not exist on PyPI until its first successful upload, select an account-scoped token for this first release.
|
|
42
|
+
3. Keep the token private and outside the project files. At the Twine prompt, enter __token__ as the username and the complete API token, including its pypi- prefix, as the password.
|
|
43
|
+
|
|
44
|
+
PyPI Trusted Publishing is recommended for automated publishing from a supported CI provider. It avoids storing a long-lived upload token, but requires a hosted source repository and a configured, trusted release workflow. This local project does not currently have that setup.
|
|
45
|
+
|
|
46
|
+
## 4. Upload the first release
|
|
47
|
+
|
|
48
|
+
Run this from the project directory:
|
|
49
|
+
|
|
50
|
+
~~~~powershell
|
|
51
|
+
python -m twine upload ./dist/pii_discovery-0.1.0-py3-none-any.whl ./dist/pii_discovery-0.1.0.tar.gz
|
|
52
|
+
~~~~
|
|
53
|
+
|
|
54
|
+
Enter the API token only in the credential prompt. A successful upload creates the project page and publishes version 0.1.0. A released version cannot be reused for changed files; increment the version for each subsequent release.
|
|
55
|
+
|
|
56
|
+
## 5. Verify the published package
|
|
57
|
+
|
|
58
|
+
1. Open https://pypi.org/project/pii-discovery/ and confirm the title, summary, author, license, and rendered README.
|
|
59
|
+
2. In a clean Python environment, install the uploaded package:
|
|
60
|
+
|
|
61
|
+
~~~~powershell
|
|
62
|
+
python -m pip install --upgrade pii-discovery
|
|
63
|
+
~~~~
|
|
64
|
+
|
|
65
|
+
3. Confirm the command-line entry point is installed:
|
|
66
|
+
|
|
67
|
+
~~~~powershell
|
|
68
|
+
pii-discovery --help
|
|
69
|
+
~~~~
|
|
70
|
+
|
|
71
|
+
For later releases, update the version in pyproject.toml, build fresh archives, run Twine's metadata check, and upload the new files. After the first release, create a project-scoped token for routine manual uploads and revoke the initial account-scoped token if it is no longer needed.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# PII-discovery
|
|
2
|
+
|
|
3
|
+
**Local-first discovery of candidate PII, PHI, and financial data across structured, semi-structured, and text-based files.**
|
|
4
|
+
|
|
5
|
+
PII-discovery is a Python library and command-line scanner for locating potentially sensitive values in supported local files. It combines structured-field and key-name matching with value patterns, explicit labels, selected validation rules, nearby text context, and optional spaCy named-entity recognition.
|
|
6
|
+
|
|
7
|
+
The scanner reads source files locally and writes reports to a directory you choose. It does not redact values or modify source files. Findings include exact candidate values and unredacted context so an analyst can locate and review each match.
|
|
8
|
+
|
|
9
|
+
PII-discovery is a discovery aid. It does not certify that a dataset is free of sensitive information, guarantee zero false positives, verify a person's identity, or establish regulatory compliance.
|
|
10
|
+
|
|
11
|
+
## Capabilities
|
|
12
|
+
|
|
13
|
+
- Scans structured, semi-structured, and unstructured text in supported local files.
|
|
14
|
+
- Uses embedded header and key aliases, regular expressions, explicit label capture, selected format and checksum validation, and source context.
|
|
15
|
+
- Optionally identifies PERSON and ORG candidates with spaCy NER.
|
|
16
|
+
- Reports exact values, source locations, detection evidence, confidence/severity scores, and prefix/suffix context.
|
|
17
|
+
- Keeps structured header findings separate from value-level findings.
|
|
18
|
+
- Includes a progress bar through tqdm.
|
|
19
|
+
- Embeds a reference taxonomy of 651 data-type entries across 27 categories. The taxonomy supports classification and matching; it does not mean every entry has a dedicated value detector.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Install the base package from PyPI:
|
|
24
|
+
|
|
25
|
+
~~~~powershell
|
|
26
|
+
python -m pip install pii-discovery
|
|
27
|
+
~~~~
|
|
28
|
+
|
|
29
|
+
The base installation includes the command-line scanner and progress display. Optional readers for Excel, PDF, and Word documents can be installed with:
|
|
30
|
+
|
|
31
|
+
~~~~powershell
|
|
32
|
+
python -m pip install "pii-discovery[formats]"
|
|
33
|
+
~~~~
|
|
34
|
+
|
|
35
|
+
To enable spaCy named-entity recognition, install the NER extra and its language model:
|
|
36
|
+
|
|
37
|
+
~~~~powershell
|
|
38
|
+
python -m pip install "pii-discovery[ner]"
|
|
39
|
+
python -m spacy download en_core_web_sm
|
|
40
|
+
~~~~
|
|
41
|
+
|
|
42
|
+
Install all optional integrations with `python -m pip install "pii-discovery[all]"`. The spaCy language model is installed separately. If spaCy or the requested model is unavailable, the scanner warns and continues without NER.
|
|
43
|
+
|
|
44
|
+
## Supported input formats
|
|
45
|
+
|
|
46
|
+
The current readers support:
|
|
47
|
+
|
|
48
|
+
- Delimited text, including CSV and TSV
|
|
49
|
+
- JSON and JSON Lines
|
|
50
|
+
- XML and HTML
|
|
51
|
+
- Plain text, logs, and Markdown
|
|
52
|
+
- SQLite databases, read through a read-only connection
|
|
53
|
+
- EML email messages, ICS calendars, and VCF files
|
|
54
|
+
- XLSX and XLSM workbooks
|
|
55
|
+
- PDF files with extractable embedded text
|
|
56
|
+
- DOCX paragraphs and tables
|
|
57
|
+
|
|
58
|
+
Some formats require the `formats` extra. XLSX scanning reads cached cell values and does not calculate formulas. PDF scanning extracts embedded text and does not OCR scanned pages. Images, audio, video, external databases, hidden document metadata, and password-protected content are outside the current scanner's coverage.
|
|
59
|
+
|
|
60
|
+
## Quick start
|
|
61
|
+
|
|
62
|
+
Scan a directory recursively and write reports to a separate output directory:
|
|
63
|
+
|
|
64
|
+
~~~~powershell
|
|
65
|
+
pii-discovery ./source_data --output ./pii_report
|
|
66
|
+
~~~~
|
|
67
|
+
|
|
68
|
+
Scan individual files and set a higher minimum candidate score:
|
|
69
|
+
|
|
70
|
+
~~~~powershell
|
|
71
|
+
pii-discovery ./customers.csv ./case_notes.txt --output ./case_report --min-confidence 0.70
|
|
72
|
+
~~~~
|
|
73
|
+
|
|
74
|
+
Use the command's help option to see every setting. Key controls include:
|
|
75
|
+
|
|
76
|
+
| Option | Default | Purpose |
|
|
77
|
+
| --- | ---: | --- |
|
|
78
|
+
| `--output` | `pii_discovery_report` | Report destination |
|
|
79
|
+
| `--no-recursive` | Off | Scan only files immediately inside each input directory |
|
|
80
|
+
| `--min-confidence` | `0.55` | Minimum candidate score to report |
|
|
81
|
+
| `--context-chars` | `70` | Maximum prefix and suffix context length in findings |
|
|
82
|
+
| `--max-file-mb` | `100` | Per-file size limit |
|
|
83
|
+
| `--spacy-model` | `en_core_web_sm` | spaCy model used for optional PERSON/ORG NER |
|
|
84
|
+
| `--no-spacy` | Off | Disable spaCy NER |
|
|
85
|
+
|
|
86
|
+
Confidence and severity values are evidence scores assigned by the implementation. They are not calibrated probabilities that a match is true.
|
|
87
|
+
|
|
88
|
+
## Python API
|
|
89
|
+
|
|
90
|
+
The primary programmatic entry point is `build_report`:
|
|
91
|
+
|
|
92
|
+
~~~~python
|
|
93
|
+
from pathlib import Path
|
|
94
|
+
|
|
95
|
+
from pii_discovery import build_report
|
|
96
|
+
|
|
97
|
+
summary = build_report(
|
|
98
|
+
inputs=[Path("source_data")],
|
|
99
|
+
output_dir=Path("pii_report"),
|
|
100
|
+
recursive=True,
|
|
101
|
+
min_confidence=0.55,
|
|
102
|
+
context_chars=70,
|
|
103
|
+
max_file_mb=100,
|
|
104
|
+
spacy_model="en_core_web_sm",
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
print(summary)
|
|
108
|
+
~~~~
|
|
109
|
+
|
|
110
|
+
Pass `spacy_model=None` to disable NER. The function returns a summary dictionary and writes the reports to `output_dir`.
|
|
111
|
+
|
|
112
|
+
## Reports
|
|
113
|
+
|
|
114
|
+
The report directory contains:
|
|
115
|
+
|
|
116
|
+
- `findings.csv` — value-level candidate findings, including exact unredacted values in `value_preview`, source locations, detection evidence, and unredacted prefix/suffix context.
|
|
117
|
+
- `structured_fields.csv` — sensitive column and key names detected from structured sources, kept separate from value-level findings.
|
|
118
|
+
- `summary_by_category.csv`, `summary_by_file.csv`, and `summary_by_pii_type.csv` — finding counts by category, source file, and mapped catalog type.
|
|
119
|
+
- `file_inventory.csv` — discovered files, scan status, values scanned, finding count, and parser errors.
|
|
120
|
+
- `document_indicators.csv` — document-level terms reported separately from value findings.
|
|
121
|
+
- `pii_type_catalog.csv`, `classification_legend.csv`, and `regulatory_terminology.csv` — embedded reference material used in classification and reporting.
|
|
122
|
+
- `report.md` — scan totals, summaries, interpretation notes, and known limitations.
|
|
123
|
+
|
|
124
|
+
The scanner does not redact values. Findings and reports may contain personal, health, financial, identity, or investigative information. Store and share them only under appropriate access controls and evidence-handling procedures.
|
|
125
|
+
|
|
126
|
+
## Detection scope and limitations
|
|
127
|
+
|
|
128
|
+
Detection combines header/key aliases, embedded taxonomy terms, regular expressions, explicit label capture, selected format or checksum checks, nearby context, and optional spaCy PERSON/ORG NER. Document-level keywords are reported separately and are not treated as proof that a value was found.
|
|
129
|
+
|
|
130
|
+
Not every catalog item has a dedicated value detector. Names, addresses, health content, dates, and jurisdiction-specific identifiers can depend heavily on labels, language, context, and source quality. NER candidates are statistical signals, not proof of identity or personal-data status. The scanner does not query government, financial, carrier, or other issuing registries to authenticate values.
|
|
131
|
+
|
|
132
|
+
No automated detector can guarantee complete recall or zero false positives across all languages, jurisdictions, source layouts, and data conditions. Validate results against an approved, representative, adjudicated dataset and have a qualified analyst review findings before relying on them in an investigation. Do not use this package as the sole basis for a legal, employment, financial, or other high-impact decision.
|
|
133
|
+
|
|
134
|
+
The scanner processes files locally and does not upload source contents to a remote detection service. It is not a forensic acquisition tool and does not create a chain-of-custody record.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT. See the included `LICENSE` file.
|