Health-DeID
Health-DeID is local research software for auditable, resumable de-identification of clinical text and selected structured fields. Its desktop web UI, CLI, and Python API all use the same SQLite run database.
⚠️ Important: Health-DeID has not been validated or approved for diagnosis, treatment, clinical decisions, or as a guarantee of legal or regulatory compliance. Validate it for your data and use case before sharing output.
Features
- Imports JSONL or Parquet while preserving input order and selected metadata.
- Detects PHI with AWS Comprehend Medical, Claude Sonnet 4.6 on Amazon Bedrock, local rules, or a combination.
- Retains, redacts, generalizes, date-shifts, or replaces each PHI category.
- Generates replacements with Faker or a custom list, consistently by entity, record, or occurrence.
- Applies the same replacement policy to unstructured text and mapped structured fields.
- Optionally validates de-identified text with GPT-OSS Safeguard 120B and includes a human review user interface.
- Recovers interrupted work and retains completed backend requests.
- Creates revised runs that reuse detector results when the input and detector setup are identical, while rerunning rules and downstream de-identification.
- Exports explicitly selected columns to JSONL or Parquet.
Requirements
- Python 3.12 through 3.14
- AWS credentials and access to the configured services for AWS-backed runs
Installation
pip install health-deid
health-deid --version
AWS services use boto3's standard credential and region resolution; credentials are not entered or stored in the UI.
Start with the UI
health-deid ui --reviewer "Reviewer Name" --runs-dir runs
Open one run directly:
health-deid ui runs/RUN_ID --reviewer "Reviewer Name"
CLI
The CLI intentionally has eight commands:
health-deid check config.yaml
health-deid run config.yaml
health-deid status runs/RUN_ID
health-deid resume runs/RUN_ID
health-deid retry runs/RUN_ID --failed
health-deid revise runs/RUN_ID revised.yaml --reason "change date handling"
health-deid export runs/RUN_ID final.parquet \
--mode ready_only --column record_id --column final_text
health-deid ui --reviewer "Reviewer Name"
check is a precheck: it validates setup and shows an estimated AWS cost without
making paid model calls. After processing starts, status and UI usage cards show actual costs.
Run data
Normal operation creates:
runs/<run-id>/
├── run.sqlite
└── exports/
The database contains source clinical text, identifiers, backend responses, findings, transformations, review decisions, usage, errors, and export history. Treat the complete run directory as PHI even after creating a de-identified export.
The processing sequence is:
input → detection and rules → draft de-identification → validation → review → final de-identification
Configuration
A minimal Comprehend configuration is:
config_version: 1
run:
name: example
output_dir: runs
input:
path: notes.jsonl
format: jsonl
record_id_column: note_id
entity_id:
source: column
column: patient_id
text_column: note_text
detection:
enabled: true
detectors:
- backend: aws_comprehend_medical
region_name: us-east-1
cost_per_100_characters_usd: 0.0014
execution:
workers: 2
The supported Bedrock detector and validator models are fixed:
us.anthropic.claude-sonnet-4-6openai.gpt-oss-safeguard-120b
AWS calls use botocore's standard retry mode. Detection and validation each expose only
the useful local concurrency setting, workers, which defaults to 2. Validator responses
that are explicitly truncated are retried with the next fixed output-token budget.
Non-date synthetic replacements use one of two direct methods:
faker: realistic values generated by Faker.custom_list: values supplied in configuration or the UI.
Both support entity, record, and occurrence consistency. Date replacement uses
date_shift, with one whole-week offset per entity. Dates can also be generalized to the
year, and ages can be generalized to 90+.
Python API
from health_deid import create_run, open_run
run = create_run("config.yaml").execute()
print(run.status())
reopened = open_run(run.run_dir).resume()
revised = reopened.revise(
"revised.yaml",
reason="change replacement policy",
)
revised.export(
output_path=revised.context.exports_dir / "final.jsonl",
format="jsonl",
mode="ready_only",
selected_columns=["record_id", "final_text"],
)
A revised run reuses paid detection only when the imported input and detector definitions
match. Use rerun_detection=True (or CLI --rerun-detection) to authorize a new detector
pass when they do not.
Examples
See the examples for thirteen configurations using fictional records.
Documentation
See the documentation for the full user guide, API, and module reference (generated with Sphinx).
Acknowledgements
- Developed by: Omid Jafari
- Research affiliation and acknowledgement: Ang Li Lab
License
Health-DeID is licensed under the GNU Affero General Public License v3.0 or later.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file health_deid-1.0.0.tar.gz.
File metadata
- Download URL: health_deid-1.0.0.tar.gz
- Upload date:
- Size: 205.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25a1ff47f26f7faa3d13121aa27d22ab3eecfe379ed6295779dfeca817876fe8
|
|
| MD5 |
fb0aa2500acbbdd69c783e9db05a8d4b
|
|
| BLAKE2b-256 |
495a98d468ad62ed22abab5c3404a68755188903f13a476bfa3cfd39835cb71d
|
Provenance
The following attestation bundles were made for health_deid-1.0.0.tar.gz:
Publisher:
publish-pypi.yml on omid-jf/Health-DeID
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
health_deid-1.0.0.tar.gz -
Subject digest:
25a1ff47f26f7faa3d13121aa27d22ab3eecfe379ed6295779dfeca817876fe8 - Sigstore transparency entry: 2500379723
- Sigstore integration time:
-
Permalink:
omid-jf/Health-DeID@b199775d00f3a67cee84a24396f1dea72f640817 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/omid-jf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@b199775d00f3a67cee84a24396f1dea72f640817 -
Trigger Event:
release
-
Statement type:
File details
Details for the file health_deid-1.0.0-py3-none-any.whl.
File metadata
- Download URL: health_deid-1.0.0-py3-none-any.whl
- Upload date:
- Size: 248.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ac6f28f6149c2ba7d474be2a2c054af3633e154ec7e976ceafec7847775a28b
|
|
| MD5 |
a15d081b1f8bf40468900a098b5ab36a
|
|
| BLAKE2b-256 |
226e4ac8436f582b200669918e9b863cf4648689f058129de4d8d05ff1ed5162
|
Provenance
The following attestation bundles were made for health_deid-1.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on omid-jf/Health-DeID
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
health_deid-1.0.0-py3-none-any.whl -
Subject digest:
6ac6f28f6149c2ba7d474be2a2c054af3633e154ec7e976ceafec7847775a28b - Sigstore transparency entry: 2500379746
- Sigstore integration time:
-
Permalink:
omid-jf/Health-DeID@b199775d00f3a67cee84a24396f1dea72f640817 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/omid-jf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@b199775d00f3a67cee84a24396f1dea72f640817 -
Trigger Event:
release
-
Statement type: