File size: 1,759 Bytes
6b1e754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
language: en
license: apache-2.0
tags:
  - token-classification
  - ner
  - hipaa
  - phi
  - healthcare
  - privacy
  - distilbert
datasets:
  - custom
pipeline_tag: token-classification
---

# HIPAA PHI Detector (DistilBERT)

A fine-tuned DistilBERT model for detecting Protected Health Information (PHI) in text, covering all 18 HIPAA Safe Harbor categories.

## Model Details

- **Architecture**: DistilBERT (66M params) with token classification head
- **Training**: Fine-tuned on 5,000+ synthetic HIPAA examples
- **Labels**: 37 BIO labels (18 entity types x 2 + O)
- **Framework**: PyTorch / HuggingFace Transformers

## Supported Entity Types

| Label | HIPAA Category |
|-------|---------------|
| NAME | Names |
| LOCATION | Geographic subdivisions |
| DATE | Dates |
| PHONE | Phone numbers |
| FAX | Fax numbers |
| EMAIL | Email addresses |
| SSN | Social Security numbers |
| MRN | Medical record numbers |
| HEALTH_PLAN | Health plan beneficiary numbers |
| ACCOUNT | Account numbers |
| LICENSE | Certificate/license numbers |
| VEHICLE | Vehicle identifiers |
| DEVICE | Device identifiers |
| URL | Web URLs |
| IP | IP addresses |
| BIOMETRIC | Biometric identifiers |
| PHOTO | Photographic images |
| OTHER | Any other unique identifying number |

## Usage

```python
from transformers import pipeline

pipe = pipeline("token-classification", model="mkocher/hipaa-phi-detector", aggregation_strategy="simple")
results = pipe("Patient John Smith, SSN 123-45-6789")
```

Or with the `aare-core` package:

```python
from aare import HIPAAGuardrail

guardrail = HIPAAGuardrail()
result = guardrail.check("Patient John Smith, SSN 123-45-6789")
if result.blocked:
    print(f"PHI detected: {result.violations}")
```

## License

Apache 2.0