PII-discovery 0.1.0__py3-none-any.whl

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.
@@ -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,7 @@
1
+ pii_discovery.py,sha256=nojDOUoLIKuGoCrhvrkzZNlqw-rNzu4uajIoTIlMN2Q,274460
2
+ pii_discovery-0.1.0.dist-info/licenses/LICENSE,sha256=h1apmRfDXrqh9ci-m4AS-jtF1u4op7Q9KwZFTCHY438,1075
3
+ pii_discovery-0.1.0.dist-info/METADATA,sha256=0GM9gHSKVD9KkxTLI2G84ORiP4KoYz9NCQdRqjtjUTI,8880
4
+ pii_discovery-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
5
+ pii_discovery-0.1.0.dist-info/entry_points.txt,sha256=Qb6gUv7nYRQL4mTG_JycL25Njtvd2NkJNvM5DDphGrE,53
6
+ pii_discovery-0.1.0.dist-info/top_level.txt,sha256=sx_4AE5f5hfTKOyIeOB5s9QoP8kG6JvFxgo2XdHmy08,14
7
+ pii_discovery-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pii-discovery = pii_discovery:main
@@ -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 @@
1
+ pii_discovery