Guardrails AI validator for African-specific PII — BVN, NIN, Ghana Card, KRA PIN, SA ID and phone formats across NG, KE, ZA, GH, RW, EG
# guardrails-african-pii
**Guardrails AI validator for African-specific PII detection.**
Generic PII validators (Presidio, spaCy NER) have no awareness of African identity formats. This validator fills that gap with pattern-based detection aligned to each country's official format specifications.
---
## Covered entities
| Entity | Jurisdiction | Format |
|---|---|---|
| BVN (Bank Verification Number) | Nigeria (NG) | Labelled 11-digit number |
| NIN (National Identity Number) | Nigeria (NG) | Labelled 11-digit number |
| CAC_RC_NUMBER (Corporate Registration) | Nigeria (NG) | `RC` + 4–7 digits |
| PHONE_NG | Nigeria (NG) | `+234` / `0[789]` prefix |
| KRA_PIN | Kenya (KE) | Letter + 9 digits + letter |
| NATIONAL_ID_KE | Kenya (KE) | Labelled 7–8 digit ID |
| PHONE_KE | Kenya (KE) | `+254` / `0[71]` prefix |
| NATIONAL_ID_ZA | South Africa (ZA) | Labelled 13-digit SA ID |
| SARS_TAX_REF | South Africa (ZA) | Labelled 10-digit tax ref |
| PHONE_ZA | South Africa (ZA) | `+27` / `0` prefix |
| GHANA_CARD | Ghana (GH) | `GHA-XXXXXXXXX-X` |
| PHONE_GH | Ghana (GH) | `+233` / `0[25]` prefix |
| NATIONAL_ID_RW | Rwanda (RW) | Labelled 16-digit NID |
| PHONE_RW | Rwanda (RW) | `+250` / `07` prefix |
| NATIONAL_ID_EG | Egypt (EG) | Labelled 14-digit national ID |
| PHONE_EG | Egypt (EG) | `+20` / `01[0-5]` prefix |
---
## Regulatory alignment
- **NDPA 2023** (Nigeria Data Protection Act) — §30 sensitive personal data
- **KDPA 2019** (Kenya Data Protection Act) — §43 sensitive data
- **POPIA** (South Africa Protection of Personal Information Act) — §26
- **Ghana Data Protection Act 2012**
- **Rwanda Law No. 058/2021** on personal data protection
- **Egypt Data Protection Law No. 151/2020**
---
## Installation
```bash
guardrails hub install hub://guardrails/african_pii
```
Or install directly:
```bash
pip install guardrails-african-pii
```
---
## Usage
```python
from guardrails import Guard
from guardrails.hub import AfricanPii
# Detect all African PII
guar …