Skip to main content

Guardrails AI validator for African financial and data protection compliance — NDPA 2023, POPIA, KDPA, CBN AML/CFT thresholds, and cross-border transfer controls.

Project description

guardrails-african-compliance

Guardrails AI validator for African financial and data protection compliance.

Validates LLM outputs against African regulatory frameworks — detecting special-category data, AML/CFT transaction thresholds, and prohibited cross-border data transfers.

Hub License


What it checks

1. Sensitive data (sensitive_data)

Flags special-category data keywords under African data protection laws:

Framework Jurisdiction Special categories
NDPA 2023 Nigeria Health, biometric, genetic, religious, political, children's data
POPIA South Africa Above + criminal records
KDPA 2019 Kenya Above + ethnic origin, race
GH_DPA 2012 Ghana Same as NDPA base
RW_DPA 2021 Rwanda Same as NDPA base

2. CBN transaction thresholds (cbn_threshold)

Flags Nigerian Naira (NGN / ₦) amounts in LLM output:

Amount Rule
≥ ₦5,000,000 Structuring risk — compliance officer review required
≥ ₦10,000,000 Mandatory Currency Transaction Report (CBN AML/CFT/CPF 2023)

3. CBK transaction thresholds (cbk_threshold)

Flags Kenyan Shilling (KES / KSh) amounts:

Amount Rule
≥ KES 1,000,000 Suspicious transaction — enhanced due diligence
≥ KES 5,000,000 Mandatory CTR (CBK AML/CFT Guidelines)

4. Cross-border data transfers (cross_border)

Flags data transfer language directed at countries without NDPA 2023 §43 adequacy determination (China, Russia, Iran, North Korea, Belarus, Myanmar, Cuba, Syria).


Installation

guardrails hub install hub://guardrails/african_compliance

Or install directly:

pip install guardrails-african-compliance

Usage

from guardrails import Guard
from guardrails.hub import AfricanCompliance

# Run all checks
guard = Guard().use(AfricanCompliance, on_fail="exception")

# CBN threshold
guard.validate("Transfer of NGN 10,000,000 approved.")
# → raises ValidationError: [CBN] Amount ₦10,000,000 exceeds mandatory CTR threshold

# Sensitive data
guard.validate("The customer's health record was retrieved.")
# → raises ValidationError: [NDPA] Special-category data detected

# Cross-border
guard.validate("Syncing customer records to China.")
# → raises ValidationError: [NDPA] Cross-border data transfer to 'China' detected

# Run specific checks only
guard_cbn = Guard().use(
    AfricanCompliance,
    checks=["cbn_threshold"],
    on_fail="exception"
)

# Scope sensitive data to specific frameworks
guard_ndpa_popia = Guard().use(
    AfricanCompliance,
    checks=["sensitive_data"],
    jurisdictions=["NDPA", "POPIA"],
    on_fail="exception"
)

Parameters

Parameter Type Default Description
checks list[str] | None None (all) Checks to run
jurisdictions list[str] | None None (all) Frameworks for sensitive_data check
on_fail str | Callable Guardrails failure action

Available checks: sensitive_data, cbn_threshold, cbk_threshold, cross_border

Available jurisdictions: NDPA, POPIA, KDPA, GH_DPA, RW_DPA


Running tests

pip install guardrails-ai pytest
pytest tests/

Contributing

Part of a broader African compliance initiative. Issues and PRs welcome.

Built by Oluwajuwon Omotayo — also see:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guardrails_african_compliance-0.1.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guardrails_african_compliance-0.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file guardrails_african_compliance-0.1.0.tar.gz.

File metadata

File hashes

Hashes for guardrails_african_compliance-0.1.0.tar.gz
Algorithm Hash digest
SHA256 17eb03be74750d00ed8d486680503a73fd2c2b8399675c35113ddf43903fb5cb
MD5 874f50a1577b2614312ae27abdf836ed
BLAKE2b-256 59dc904b6311b3cc1ffb0fb535f3b6e16c173bec00f926feac54b893125c25a3

See more details on using hashes here.

File details

Details for the file guardrails_african_compliance-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for guardrails_african_compliance-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5408bacaf68f4850d43edf2508e96a67f0510ce46f8d76023dd6a761140f718c
MD5 e46ba6e3df8e8088a25302b59da06a24
BLAKE2b-256 f442287f5ad0e8c25090c3443e9ed943c1abc582be4d0182aa3d987c88e8937b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page