Skip to main content

docdeid

tests build Documentation Status pypy version python versions license black

Installation - Getting started - Features - Documentation - Development and contributiong - Authors - License

Create your own document de-identifier using docdeid, a simple framework independent of language or domain.

Note that docdeid is still on version 0.x.x, and breaking changes might occur. If you plan to do extensive work involving docdeid, feel free to get in touch to coordinate.

Installation

Grab the latest version from PyPi:

pip install docdeid

Getting started

from docdeid import DocDeid
from docdeid.tokenize import WordBoundaryTokenizer
from docdeid.process SingleTokenLookupAnnotator, RegexpAnnotator, SimpleRedactor

deidentifier = DocDeid()

deidentifier.tokenizers["default"] = WordBoundaryTokenizer()

deidentifier.processors.add_processor(
    "name_lookup",
    SingleTokenLookupAnnotator(lookup_values=["John", "Mary"], tag="name"),
)

deidentifier.processors.add_processor(
    "name_regexp",
    RegexpAnnotator(regexp_pattern=re.compile(r"[A-Z]\w+"), tag="name"),
)

deidentifier.processors.add_processor(
    "redactor", 
    SimpleRedactor()
)

text = "John loves Mary, but Mary loves William."
doc = deidentifier.deidentify(text)

Find the relevant info in the Document object:

print(doc.annotations)

AnnotationSet({
    Annotation(text='John', start_char=0, end_char=4, tag='name', length=4),
    Annotation(text='Mary', start_char=11, end_char=15, tag='name', length=4),
    Annotation(text='Mary', start_char=21, end_char=25, tag='name', length=4), 
    Annotation(text='William', start_char=32, end_char=39, tag='name', length=7)
})
print(doc.deidentified_text)

'[NAME-1] loves [NAME-2], but [NAME-2] loves [NAME-3].'

Features

Additionally, docdeid features:

  • Ability to create your own Annotator, AnnotationProcessor, Redactor and Tokenizer components
  • Some basic re-usable components included (e.g. regexp, token lookup, token patterns)
  • Callable from one interface (DocDeid.deidenitfy())
  • String processing and filtering
  • Fast lookup based on sets or tries
  • Anything you add! PRs welcome.

For a more in-depth tutorial, see: docs/tutorial

Documentation

For full documentation and API, see: https://docdeid.readthedocs.io/en/latest/

Development and contributing

For setting up dev environment, see: docs/environment

For contributing, see: docs/contributing

Authors

Vincent Menger - Author, maintainer

License

This project is licensed under the MIT license - see the LICENSE.md file for details.

Metadata

Release files for docdeid 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docdeid 1.0.1
File Size Uploaded Provenance Actions
docdeid-1.0.1.tar.gz 20.5 kB Without provenance Details for docdeid-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docdeid 1.0.1
File Interpreter ABI Platform Actions
docdeid-1.0.1-py3-none-any.whl Python 3 none any Details for docdeid-1.0.1-py3-none-any.whl

Total release size: 46.7 kB

Release files / docdeid-1.0.1.tar.gz

Download URL docdeid-1.0.1.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aeff79b91a1b26dc026687c91a96298bcd9cb390ef325428c99eb59628a6c4de
BLAKE2b-256 checksum
How to use checksums
e07db72936179fde77d501bb770d734493ee44872fc26a2604c4674bf233efc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1012-azure

Release files / docdeid-1.0.1-py3-none-any.whl

Download URL docdeid-1.0.1-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
884467dac254ed6dacfb8e8e0386f40553b70ed441ef3b4e2775159b5ffd97dc
BLAKE2b-256 checksum
How to use checksums
b675082005d24241beb83019227f0edebe92721cdd0c1c59d6e1459100fa795a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1012-azure

Security for docdeid 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page