Skip to main content

cDeid

A framework for training de-identification models to automatically remove protected health information (PHI) from the free text.

cDeid is a customized de-identification method. The users can easily train their own de-identification Models on the data sets which are extracted from their own free text corpus. cDeid is based on 3 popular NLP toolkits: spaCy, Stanza and FLAIR.

Installation

This project is based on Python 3.7+. Please install it if you do not have. PyTorch is used by FLAIR and Stanza toolkits. It needs to be installed from here before you install this project.

pip install cdeid

Usage example

We are using the pre-trained word2vec embeddings released from the CoNLL 2017 Shared Task. It is important to specify the customized PHI types in the corpus otherwise it will cause runtime error during training the models.

Using the Python API

Train the models

from cdeid.models.trainer import Trainer

phi_types = ['PHONE', 'PERSON', 'ADDRESS', 'IDN', 'DOB']
nlp = Trainer("C:/data", "C:/workspace", phi_types, "C:/wordvec/English/en.vectors.xz")
nlp.train()

De-identify a sample document

from cdeid.deidentifier.phi_deid import PHIDeid

deider = PHIDeid("C:/workspace", "C:/output")
doc = deider("C:/raw/example.txt")
deider.output(doc)

Using the command line

Train the models

python -m cdeid --command train --workspace C:/workspace --data_dir C:/data --phi_types PHONE PERSON ADDRESS IDN DOB --wordvec_file C:/wordvec/English/en.vectors.xz

De-identify a sample document

python -m cdeid --command deid --workspace C:/workspace --deid_output_dir C:/output --deid_file C:/raw/example.txt

Release History

  • 0.1.1
    • The first release
  • 0.1.2
    • Modify Readme and Setup
  • 0.1.3
    • Update model trainers

Contributors

Leibo Liu - initial work - leiboliu

License

Apache License, Version 2.0

Release files for cdeid 0.1.3

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

Source distribution (sdist)

Source distribution for cdeid 0.1.3
File Size Uploaded
cdeid-0.1.3.tar.gz 19.5 kB Details

Built distribution (wheel)

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

Total release size: 44.3 kB

Release files / cdeid-0.1.3.tar.gz

Download URL cdeid-0.1.3.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
77b554b30feff30f18a9c419b6b6b93a90a542164f473c3493ddb3fcdf11c42e
BLAKE2b-256 checksum
How to use checksums
dbbe5f81f23247aa4a0b92232da31b8948600156541b32f938d6b2ab2a4d4c2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

Release files / cdeid-0.1.3-py3-none-any.whl

Download URL cdeid-0.1.3-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29d7bfd820fc94620b7e27db48edd8007cc3e9c6b8199035694a967aead8d538
BLAKE2b-256 checksum
How to use checksums
0ab80c4b09c463e9659c7a30fe63b55b870e01692aa49634e6cb90816f2f08d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

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