tacit-deid 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.
Files changed (61) hide show
  1. tacit_deid-0.1.0/.gitignore +12 -0
  2. tacit_deid-0.1.0/DATA_LICENSES.md +69 -0
  3. tacit_deid-0.1.0/LICENSE +201 -0
  4. tacit_deid-0.1.0/NOTICE +25 -0
  5. tacit_deid-0.1.0/PKG-INFO +112 -0
  6. tacit_deid-0.1.0/README.md +68 -0
  7. tacit_deid-0.1.0/pyproject.toml +146 -0
  8. tacit_deid-0.1.0/schema/boundary-artifact.schema.json +386 -0
  9. tacit_deid-0.1.0/src/tacit_deid/__init__.py +115 -0
  10. tacit_deid-0.1.0/src/tacit_deid/base_rates/__init__.py +5 -0
  11. tacit_deid-0.1.0/src/tacit_deid/base_rates/data/national-prevalence.json +211 -0
  12. tacit_deid-0.1.0/src/tacit_deid/base_rates/data/populations.json +12 -0
  13. tacit_deid-0.1.0/src/tacit_deid/base_rates/data/pums-us-joints.json +2651 -0
  14. tacit_deid-0.1.0/src/tacit_deid/base_rates/data/qof-gb.json +188 -0
  15. tacit_deid-0.1.0/src/tacit_deid/base_rates/provider.py +207 -0
  16. tacit_deid-0.1.0/src/tacit_deid/batch.py +108 -0
  17. tacit_deid-0.1.0/src/tacit_deid/calibrate.py +67 -0
  18. tacit_deid-0.1.0/src/tacit_deid/canary.py +99 -0
  19. tacit_deid-0.1.0/src/tacit_deid/canonical.py +74 -0
  20. tacit_deid-0.1.0/src/tacit_deid/clean_loop.py +163 -0
  21. tacit_deid-0.1.0/src/tacit_deid/cli.py +799 -0
  22. tacit_deid-0.1.0/src/tacit_deid/clinical_rarity.py +85 -0
  23. tacit_deid-0.1.0/src/tacit_deid/composite.py +59 -0
  24. tacit_deid-0.1.0/src/tacit_deid/config.py +93 -0
  25. tacit_deid-0.1.0/src/tacit_deid/contracts.py +216 -0
  26. tacit_deid-0.1.0/src/tacit_deid/coverage.py +158 -0
  27. tacit_deid-0.1.0/src/tacit_deid/dates.py +115 -0
  28. tacit_deid-0.1.0/src/tacit_deid/defensibility.py +66 -0
  29. tacit_deid-0.1.0/src/tacit_deid/detectors.py +82 -0
  30. tacit_deid-0.1.0/src/tacit_deid/engine.py +343 -0
  31. tacit_deid-0.1.0/src/tacit_deid/eval_set.py +114 -0
  32. tacit_deid-0.1.0/src/tacit_deid/files.py +27 -0
  33. tacit_deid-0.1.0/src/tacit_deid/gate.py +21 -0
  34. tacit_deid-0.1.0/src/tacit_deid/gliner_detector.py +233 -0
  35. tacit_deid-0.1.0/src/tacit_deid/hosts.py +35 -0
  36. tacit_deid-0.1.0/src/tacit_deid/id_checksums.py +106 -0
  37. tacit_deid-0.1.0/src/tacit_deid/identifier_types.py +86 -0
  38. tacit_deid-0.1.0/src/tacit_deid/ingest.py +349 -0
  39. tacit_deid-0.1.0/src/tacit_deid/json_shapes.py +430 -0
  40. tacit_deid-0.1.0/src/tacit_deid/keep.py +69 -0
  41. tacit_deid-0.1.0/src/tacit_deid/l_diversity.py +47 -0
  42. tacit_deid-0.1.0/src/tacit_deid/ledger.py +86 -0
  43. tacit_deid-0.1.0/src/tacit_deid/llm.py +234 -0
  44. tacit_deid-0.1.0/src/tacit_deid/metrics.py +146 -0
  45. tacit_deid-0.1.0/src/tacit_deid/office.py +63 -0
  46. tacit_deid-0.1.0/src/tacit_deid/oracle.py +111 -0
  47. tacit_deid-0.1.0/src/tacit_deid/preflight.py +231 -0
  48. tacit_deid-0.1.0/src/tacit_deid/qualify.py +92 -0
  49. tacit_deid-0.1.0/src/tacit_deid/records.py +55 -0
  50. tacit_deid-0.1.0/src/tacit_deid/redetect.py +32 -0
  51. tacit_deid-0.1.0/src/tacit_deid/roundtrip.py +261 -0
  52. tacit_deid-0.1.0/src/tacit_deid/schema/__init__.py +11 -0
  53. tacit_deid-0.1.0/src/tacit_deid/schema/boundary-artifact.schema.json +386 -0
  54. tacit_deid-0.1.0/src/tacit_deid/singling_out.py +252 -0
  55. tacit_deid-0.1.0/src/tacit_deid/sources.py +97 -0
  56. tacit_deid-0.1.0/src/tacit_deid/stage0_prepass.py +314 -0
  57. tacit_deid-0.1.0/src/tacit_deid/stage1_timeline.py +84 -0
  58. tacit_deid-0.1.0/src/tacit_deid/structured_id_recognizers.py +133 -0
  59. tacit_deid-0.1.0/src/tacit_deid/tokenize.py +201 -0
  60. tacit_deid-0.1.0/src/tacit_deid/tracing.py +30 -0
  61. tacit_deid-0.1.0/src/tacit_deid/transport.py +339 -0
@@ -0,0 +1,12 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .mypy_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ *.egg-info/
9
+ .env.local
10
+ # Per-run transformation trace folders (the CLI writes these by default). The local ledger holds
11
+ # real identifiers, so these must never be committed.
12
+ runs/
@@ -0,0 +1,69 @@
1
+ # Bundled data licenses (DD16)
2
+
3
+ The Apache-2.0 LICENSE covers the **code**. It does NOT cover the **base-rate data** bundled under
4
+ `src/tacit_deid/base_rates/data/`, which was ingested from public sources that each carry their own
5
+ terms. This file records those sources and their redistribution status.
6
+
7
+ **Release gate:** before any public open-source release, each source below must be confirmed to
8
+ permit redistribution and attributed here. Where a source restricts redistribution, switch that
9
+ table to **fetch-at-build** (download at the client's site) rather than bundling. Until each row is
10
+ marked CONFIRMED, treat this as an internal build only.
11
+
12
+ | File | Source | Stated license / terms | Redistribution | Status |
13
+ |------|--------|------------------------|----------------|--------|
14
+ | `populations.json` | World Bank, `SP.POP.TOTL` | CC BY 4.0 (World Bank Data Catalog public licenses page, read 2026-09-17) | permitted with attribution | CONFIRMED |
15
+ | `pums-us-joints.json` | US Census Bureau, ACS PUMS (derived joint proportions) | Work of the US federal government, not subject to copyright (17 U.S.C. section 105) | permitted | CONFIRMED |
16
+ | `qof-gb.json` | NHS QOF (via the House of Commons Library mirror of the NHS Digital extract) | Open Government Licence v3.0 ("worldwide, royalty-free, perpetual, non-exclusive licence", commercial and non-commercial use; text read 2026-09-17) | permitted with attribution | CONFIRMED |
17
+ | `national-prevalence.json` | National statistics, one source page per row (recorded in the file as `source` and `sourceUrl`): US National Center for Health Statistics and CDC; Australian Bureau of Statistics; New Zealand Ministry of Health and Health New Zealand; UK Office for National Statistics and UK Health Security Agency | US: not subject to copyright (17 U.S.C. section 105; CDC agency materials page: "in the public domain, and may be freely used or reproduced"). AU: CC BY 4.0 (ABS copyright page). NZ: CC BY 4.0 (survey explorer footer; Health New Zealand copyright page). UK: Open Government Licence v3.0 (stated on each page). All read 2026-09-20 | permitted with attribution | CONFIRMED |
18
+
19
+ Provenance detail (URLs, years, subset/proxy caveats) is in the reference engine's base-rates
20
+ `SOURCES.md`, kept with the engine in the source repository. Each table is a derived aggregate
21
+ (proportions / counts), not raw microdata.
22
+
23
+ ## Attribution (to include in NOTICE on release)
24
+
25
+ - Contains information from the World Bank, licensed under CC BY 4.0.
26
+ - Contains US Census Bureau ACS PUMS data (US Government work).
27
+ - Contains public sector information licensed under the Open Government Licence v3.0 (NHS QOF;
28
+ Office for National Statistics; UK Health Security Agency).
29
+ - Source: CDC. Contains statistics from the US National Center for Health Statistics and the US
30
+ Centers for Disease Control and Prevention (works of the US federal government). Use of these
31
+ materials does not imply endorsement by CDC, ATSDR, HHS, or the United States Government.
32
+ - Contains Australian Bureau of Statistics data (National Health Survey 2022), licensed under
33
+ CC BY 4.0.
34
+ - Contains New Zealand Ministry of Health data (New Zealand Health Survey 2024/25) and Health New
35
+ Zealand content (Immunisation Handbook), licensed under CC BY 4.0.
36
+ - Contains data from the WHO Global Health Observatory, used under its terms of use.
37
+
38
+ The prevalence table replaced an extract of the WHO Global Health Observatory on 2026-09-20. The
39
+ WHO data policy permits "non-commercial, not-for-profit use of the Data for public health
40
+ purposes", which does not cover bundling in a commercially licensed package, so no WHO figure
41
+ remains. Each replacement figure was read from the page named on its row, and each row records the
42
+ licence of that page; `tests/test_prevalence_sources.py` admits only licences that allow
43
+ commercial redistribution and recomputes every proportion from the published value. Rows are
44
+ absent where no openly licensed page stated the figure (HIV for Australia, Great Britain, and New
45
+ Zealand; tuberculosis for Australia): Australia's tuberculosis report is CC BY-NC-ND, the
46
+ Australian health department's site forbids commercial use, and New Zealand's Ministry of Health
47
+ states that it does not know the number of people living with HIV. The release workflow still
48
+ refuses to publish while any row of the table above is unresolved (plan tacit-deid-pypi-release,
49
+ DD9).
50
+
51
+ ## Detector models (downloaded on demand, never bundled)
52
+
53
+ | Member | Model | Terms |
54
+ |--------|-------|-------|
55
+ | `gliner` | `urchade/gliner_multi_pii-v1` | Apache-2.0 |
56
+ | `gliner-pii` | `nvidia/gliner-pii` | NVIDIA Open Model License; the operator clears it before use |
57
+
58
+ Both load from Hugging Face on first use, or from a local directory named by
59
+ `TACIT_DEID_GLINER_MODEL` / `TACIT_DEID_GLINER_PII_MODEL`. The audit names the model, never the path.
60
+
61
+ ## Evaluation datasets (kept with the source repository, never inside the package)
62
+
63
+ | Dataset | Used for | Terms |
64
+ |---------|----------|-------|
65
+ | NVIDIA Nemotron-PII (2,000-record test sample) | detector span recall | CC BY 4.0 |
66
+ | NVIDIA Privasis-Zero and Privasis-USA | health-record recall, sanitization scoring, the simulation's second corpus | research and evaluation only; not for a commercial product |
67
+ | PriMock57 (planted) | the simulation's first corpus | CC BY 4.0 |
68
+
69
+ The Privasis-Cleaner model is non-commercial and was used for research comparison only.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Tacit Intelligence
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,25 @@
1
+ tacit-deid
2
+ Copyright 2026 Tacit Intelligence Co.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software
5
+ except in compliance with the License. You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ The base-rate tables under tacit_deid/base_rates/data/ are derived aggregates ingested from public
10
+ sources under their own terms (see DATA_LICENSES.md):
11
+
12
+ - Contains information from the World Bank, licensed under CC BY 4.0.
13
+ - Contains US Census Bureau ACS PUMS data (a work of the US federal government).
14
+ - Contains public sector information licensed under the Open Government Licence v3.0 (NHS QOF;
15
+ Office for National Statistics; UK Health Security Agency).
16
+ - Source: CDC. Contains statistics from the US National Center for Health Statistics and the US
17
+ Centers for Disease Control and Prevention (works of the US federal government). Use of these
18
+ materials does not imply endorsement by CDC, ATSDR, HHS, or the United States Government.
19
+ - Contains Australian Bureau of Statistics data (National Health Survey 2022), licensed under
20
+ CC BY 4.0.
21
+ - Contains New Zealand Ministry of Health data (New Zealand Health Survey 2024/25) and Health New
22
+ Zealand content (Immunisation Handbook), licensed under CC BY 4.0.
23
+
24
+ Detector models are downloaded on demand and never bundled; their terms are listed in
25
+ DATA_LICENSES.md.
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.5
2
+ Name: tacit-deid
3
+ Version: 0.1.0
4
+ Summary: Client-side clinical de-identification SDK: turns a real consultation transcript into a de-identified boundary artifact that can safely leave your infrastructure.
5
+ Project-URL: Homepage, https://tacitintelligence.co
6
+ Project-URL: Documentation, https://docs.tacitintelligence.co/deid
7
+ Project-URL: Changelog, https://docs.tacitintelligence.co/deid/changelog
8
+ Author-email: "Tacit Intelligence Co." <support@tacitintelligence.co>
9
+ License-Expression: Apache-2.0
10
+ License-File: DATA_LICENSES.md
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: clinical,de-identification,healthcare,phi,privacy,transcripts
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Healthcare Industry
17
+ Classifier: License :: OSI Approved :: Apache Software License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
21
+ Classifier: Topic :: Security
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.13
24
+ Requires-Dist: pydantic>=2.9
25
+ Requires-Dist: pyyaml>=6
26
+ Provides-Extra: bedrock
27
+ Requires-Dist: boto3>=1.35; extra == 'bedrock'
28
+ Provides-Extra: detector
29
+ Requires-Dist: click>=8.1; extra == 'detector'
30
+ Requires-Dist: faker>=30; extra == 'detector'
31
+ Requires-Dist: presidio-analyzer>=2.2; extra == 'detector'
32
+ Requires-Dist: presidio-anonymizer>=2.2; extra == 'detector'
33
+ Requires-Dist: spacy>=3.8; extra == 'detector'
34
+ Provides-Extra: gliner
35
+ Requires-Dist: gliner>=0.2; extra == 'gliner'
36
+ Provides-Extra: llm
37
+ Requires-Dist: instructor>=1.5; extra == 'llm'
38
+ Requires-Dist: litellm>=1.50; extra == 'llm'
39
+ Provides-Extra: pdf
40
+ Requires-Dist: pypdf>=5; extra == 'pdf'
41
+ Provides-Extra: transport
42
+ Requires-Dist: httpx>=0.27; extra == 'transport'
43
+ Description-Content-Type: text/markdown
44
+
45
+ # tacit-deid
46
+
47
+ Client-side clinical de-identification. Runs inside your own infrastructure, turns a real
48
+ consultation transcript into a de-identified **boundary artifact** (a demographic shell, a
49
+ timeline of clinical beats, aggregate lexical statistics, and an audit log), and hands only that
50
+ artifact to Tacit. The transcript, the audio, and the local ledger never leave your boundary.
51
+
52
+ - Every model call goes to an endpoint you allow by name; anything else fails closed.
53
+ - The artifact carries an opaque token, never your record identifier, and is sealed with a
54
+ digest so a change after sealing is detectable on either side.
55
+ - An identifier the detectors miss is caught by a judge loop that runs to a fixpoint, and a
56
+ record it cannot clean is refused: nothing crosses.
57
+
58
+ Apache-2.0. The bundled base-rate tables carry their own terms; see `DATA_LICENSES.md`.
59
+
60
+ ## Install
61
+
62
+ ```bash
63
+ pip install "tacit-deid[detector,llm,transport]"
64
+ python -m spacy download en_core_web_lg # one-time, for the Stage-0 detector
65
+ ```
66
+
67
+ Extras: `detector` (Presidio and spaCy), `llm` (LiteLLM and instructor for the extractor and the
68
+ judge), `transport` (sending to Tacit), `bedrock` (AWS credentials via boto3), `gliner` (an
69
+ optional on-demand model detector), `pdf` (reading `.pdf` inputs). Python 3.13 or newer.
70
+
71
+ ## Run
72
+
73
+ `tacit_deid.yaml` names your in-boundary model and the hosts it may call. Credentials are read
74
+ from disk by your provider's SDK, never stored here.
75
+
76
+ ```yaml
77
+ model: bedrock/us.anthropic.claude-sonnet-4-6
78
+ allowed_endpoint_hosts:
79
+ - amazonaws.com
80
+ region: us-east-1
81
+ boundary_k: 11
82
+ ```
83
+
84
+ ```bash
85
+ tacit-deid inspect consult.json # what a run would do; no model call
86
+ tacit-deid run consult.json --config tacit_deid.yaml --out artifact.json
87
+ tacit-deid run consults/ --config tacit_deid.yaml --out-dir artifacts/ # a whole batch, one manifest
88
+ tacit-deid send artifact.json --key-file .env.local # TACIT_API_URL and TACIT_API_KEY
89
+ ```
90
+
91
+ Inputs: plain text, JSON in the common speech-to-text shapes, JSON Lines, WebVTT and SubRip,
92
+ CSV and TSV, Word, PDF, a directory, or a zip. `inspect` reports what it resolved before any
93
+ model is built.
94
+
95
+ As a library: `from tacit_deid import deidentify, load_config, run_canary` and the rest of
96
+ `tacit_deid.__all__`.
97
+
98
+ ## When it refuses
99
+
100
+ `deidentify` returns `DeidResult(crossed=False, refusal_reason=...)` when the judge loop cannot
101
+ clean the transcript within its round cap or the demographic shell fails singling-out. Nothing
102
+ crossed and nothing was sent. Do not retry with a weaker configuration; re-run only after a
103
+ change that removes the cause (a fixed transcript, a better model, or a `keep` entry for a
104
+ value wrongly treated as an identifier). The local ledger under `runs/` names every judge round
105
+ and holds real identifiers; it must not leave your boundary.
106
+
107
+ ## Documentation and security
108
+
109
+ The full guide (inputs, configuration, the artifact contract, what Tacit does with an artifact,
110
+ ceilings, and the security model) is on the documentation site named in this package's
111
+ metadata. Security reports: see `SECURITY.md` in the source repository, or the contact on the
112
+ documentation site.
@@ -0,0 +1,68 @@
1
+ # tacit-deid
2
+
3
+ Client-side clinical de-identification. Runs inside your own infrastructure, turns a real
4
+ consultation transcript into a de-identified **boundary artifact** (a demographic shell, a
5
+ timeline of clinical beats, aggregate lexical statistics, and an audit log), and hands only that
6
+ artifact to Tacit. The transcript, the audio, and the local ledger never leave your boundary.
7
+
8
+ - Every model call goes to an endpoint you allow by name; anything else fails closed.
9
+ - The artifact carries an opaque token, never your record identifier, and is sealed with a
10
+ digest so a change after sealing is detectable on either side.
11
+ - An identifier the detectors miss is caught by a judge loop that runs to a fixpoint, and a
12
+ record it cannot clean is refused: nothing crosses.
13
+
14
+ Apache-2.0. The bundled base-rate tables carry their own terms; see `DATA_LICENSES.md`.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install "tacit-deid[detector,llm,transport]"
20
+ python -m spacy download en_core_web_lg # one-time, for the Stage-0 detector
21
+ ```
22
+
23
+ Extras: `detector` (Presidio and spaCy), `llm` (LiteLLM and instructor for the extractor and the
24
+ judge), `transport` (sending to Tacit), `bedrock` (AWS credentials via boto3), `gliner` (an
25
+ optional on-demand model detector), `pdf` (reading `.pdf` inputs). Python 3.13 or newer.
26
+
27
+ ## Run
28
+
29
+ `tacit_deid.yaml` names your in-boundary model and the hosts it may call. Credentials are read
30
+ from disk by your provider's SDK, never stored here.
31
+
32
+ ```yaml
33
+ model: bedrock/us.anthropic.claude-sonnet-4-6
34
+ allowed_endpoint_hosts:
35
+ - amazonaws.com
36
+ region: us-east-1
37
+ boundary_k: 11
38
+ ```
39
+
40
+ ```bash
41
+ tacit-deid inspect consult.json # what a run would do; no model call
42
+ tacit-deid run consult.json --config tacit_deid.yaml --out artifact.json
43
+ tacit-deid run consults/ --config tacit_deid.yaml --out-dir artifacts/ # a whole batch, one manifest
44
+ tacit-deid send artifact.json --key-file .env.local # TACIT_API_URL and TACIT_API_KEY
45
+ ```
46
+
47
+ Inputs: plain text, JSON in the common speech-to-text shapes, JSON Lines, WebVTT and SubRip,
48
+ CSV and TSV, Word, PDF, a directory, or a zip. `inspect` reports what it resolved before any
49
+ model is built.
50
+
51
+ As a library: `from tacit_deid import deidentify, load_config, run_canary` and the rest of
52
+ `tacit_deid.__all__`.
53
+
54
+ ## When it refuses
55
+
56
+ `deidentify` returns `DeidResult(crossed=False, refusal_reason=...)` when the judge loop cannot
57
+ clean the transcript within its round cap or the demographic shell fails singling-out. Nothing
58
+ crossed and nothing was sent. Do not retry with a weaker configuration; re-run only after a
59
+ change that removes the cause (a fixed transcript, a better model, or a `keep` entry for a
60
+ value wrongly treated as an identifier). The local ledger under `runs/` names every judge round
61
+ and holds real identifiers; it must not leave your boundary.
62
+
63
+ ## Documentation and security
64
+
65
+ The full guide (inputs, configuration, the artifact contract, what Tacit does with an artifact,
66
+ ceilings, and the security model) is on the documentation site named in this package's
67
+ metadata. Security reports: see `SECURITY.md` in the source repository, or the contact on the
68
+ documentation site.
@@ -0,0 +1,146 @@
1
+ [project]
2
+ name = "tacit-deid"
3
+ dynamic = ["version"]
4
+ description = "Client-side clinical de-identification SDK: turns a real consultation transcript into a de-identified boundary artifact that can safely leave your infrastructure."
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ authors = [{ name = "Tacit Intelligence Co.", email = "support@tacitintelligence.co" }]
8
+ license = "Apache-2.0"
9
+ license-files = ["LICENSE", "NOTICE", "DATA_LICENSES.md"]
10
+ keywords = ["de-identification", "phi", "clinical", "healthcare", "privacy", "transcripts"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Healthcare Industry",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: Apache Software License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Topic :: Security",
19
+ "Topic :: Scientific/Engineering :: Medical Science Apps.",
20
+ "Typing :: Typed",
21
+ ]
22
+ dependencies = [
23
+ "pydantic>=2.9",
24
+ "pyyaml>=6",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://tacitintelligence.co"
29
+ Documentation = "https://docs.tacitintelligence.co/deid"
30
+ Changelog = "https://docs.tacitintelligence.co/deid/changelog"
31
+
32
+ [project.scripts]
33
+ tacit-deid = "tacit_deid.cli:main"
34
+
35
+ # Heavy stages are optional extras so the dependency-free pure ports (metrics, singling-out,
36
+ # oracle, base-rates) install and test in seconds without pulling spaCy / litellm.
37
+ [project.optional-dependencies]
38
+ detector = [
39
+ "presidio-analyzer>=2.2",
40
+ "presidio-anonymizer>=2.2",
41
+ "spacy>=3.8",
42
+ "faker>=30",
43
+ # spaCy's `download` CLI imports `click` directly; without it the model download fails when
44
+ # typer-slim is resolved instead of full typer (seen in the reference build too).
45
+ "click>=8.1",
46
+ # The spaCy model itself is not on PyPI: install it with
47
+ # python -m spacy download en_core_web_lg
48
+ # after this extra. Naming it here would make the extra unresolvable from PyPI (DD5).
49
+ ]
50
+ llm = [
51
+ "litellm>=1.50",
52
+ "instructor>=1.5",
53
+ ]
54
+ bedrock = [
55
+ "boto3>=1.35",
56
+ ]
57
+ # Optional on-demand model detector for the Stage-0 ensemble. NOT bundled: the operator installs it
58
+ # and the (Apache-2.0, clean-lineage) gliner_multi_pii weights download on demand from Hugging Face.
59
+ gliner = [
60
+ "gliner>=0.2",
61
+ ]
62
+ # PDF text extraction for `.pdf` inputs (plan tacit-deid-input-freedom, DD7); pure Python, BSD.
63
+ pdf = [
64
+ "pypdf>=5",
65
+ ]
66
+ # Client -> Tacit transport (send the artifact, pull the regenerated consultation).
67
+ transport = [
68
+ "httpx>=0.27",
69
+ ]
70
+
71
+ # Development only, never published metadata: the spaCy model (a direct URL, see
72
+ # [tool.uv.sources]), the simulated client's egress observer (mitmproxy), and the release tools.
73
+ [dependency-groups]
74
+ dev = [
75
+ "pytest>=8",
76
+ "ruff>=0.9",
77
+ "mypy>=1.11",
78
+ "types-pyyaml>=6",
79
+ "en-core-web-lg",
80
+ "mitmproxy>=11",
81
+ "twine>=6",
82
+ ]
83
+
84
+ [build-system]
85
+ requires = ["hatchling"]
86
+ build-backend = "hatchling.build"
87
+
88
+ [tool.hatch.version]
89
+ path = "src/tacit_deid/__init__.py"
90
+
91
+ # What ships (plan tacit-deid-pypi-release, DD1): an allowlist, so nothing outside it (the
92
+ # simulated client, the development scripts, the tests, the run folders) can enter the archive
93
+ # whatever the working tree holds. The distribution gate test builds both archives and refuses
94
+ # any member outside this list.
95
+ [tool.hatch.build.targets.sdist]
96
+ only-include = [
97
+ "src/tacit_deid",
98
+ "schema/boundary-artifact.schema.json",
99
+ "README.md",
100
+ "LICENSE",
101
+ "NOTICE",
102
+ "DATA_LICENSES.md",
103
+ "pyproject.toml",
104
+ ]
105
+
106
+ [tool.hatch.build.targets.wheel]
107
+ packages = ["src/tacit_deid"]
108
+
109
+ [tool.ruff]
110
+ line-length = 100
111
+ target-version = "py313"
112
+
113
+ [tool.ruff.lint]
114
+ select = ["E", "W", "F", "I", "B", "C4", "UP"]
115
+ ignore = ["W191", "E101"]
116
+
117
+ [tool.ruff.format]
118
+ quote-style = "double"
119
+ indent-style = "tab"
120
+
121
+ [tool.pytest.ini_options]
122
+ testpaths = ["tests"]
123
+ # The simulated client's harness is importable in tests but is not in the package.
124
+ pythonpath = ["sim"]
125
+
126
+ [tool.mypy]
127
+ python_version = "3.13"
128
+
129
+ # Presidio / spaCy / Faker ship without (complete) type stubs; the detector module is a faithful
130
+ # port and not where we want mypy noise. Ignore their missing stubs.
131
+ [[tool.mypy.overrides]]
132
+ module = [
133
+ "presidio_analyzer.*",
134
+ "presidio_anonymizer.*",
135
+ "faker.*",
136
+ "spacy.*",
137
+ "litellm.*",
138
+ "instructor.*",
139
+ "gliner.*",
140
+ "mitmproxy.*",
141
+ "boto3.*",
142
+ ]
143
+ ignore_missing_imports = true
144
+
145
+ [tool.uv.sources]
146
+ en-core-web-lg = { url = "https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0-py3-none-any.whl" }