feat(regulatory): add African regulatory compliance metadata for NDPA, POPIA, KDPA, Ghana DPA, and NFIU AML - #95
Open
kingztech2019 wants to merge 2 commits into
Conversation
Adds first-class support for African data protection and financial regulation compliance metadata in generated AIBOMs. **Field registry (7 new fields in metadata category):** - `africanDeploymentJurisdictions` (important) — ISO 3166-1 alpha-2 list of African jurisdictions where the model is deployed or processes personal data. Required for Advanced completeness profile. - `ndpaCompliance` (supplementary) — Nigeria Data Protection Act 2023: NITDA registration, lawful basis under NDPA §25, DPIA status - `nfiuAmlCompliance` (supplementary) — Nigeria NFIU AML/CFT obligations for AI deployed in CBN-licensed financial institutions - `popiaCompliance` (supplementary) — South Africa POPIA 2013: Information Regulator registration, grounds under POPIA §11 - `kdpaCompliance` (supplementary) — Kenya Data Protection Act 2019: ODPC registration, DPIA status - `gdpaCompliance` (supplementary) — Ghana Data Protection Act 2012: Data Protection Commission registration - `regulatoryContactPoint` (supplementary) — DPO or compliance officer contact for cross-border regulatory queries (required under NDPA §31, POPIA §55, KDPA §24 for large-scale processing) **Service layer:** - `AIBOMService.generate_aibom()` accepts `regulatory_metadata` dict - `_build_regulatory_properties()` maps snake_case input keys to `owasp:aibom:regulatory:*` CycloneDX properties - Properties are injected at `$.metadata.properties` (not modelCard), reflecting that compliance context is a BOM-level assertion **Schema:** - `GenerateRequest.regulatory_metadata: Optional[Dict[str, Any]]` **Tests:** 19 new tests covering property construction, namespace correctness, field registry scoring and recommendations, end-to-end injection, and schema validation. 95 existing tests all pass.
Closes the gap between the PR description and implementation: the background section cited six African data protection laws in force; this commit adds the remaining two. - `rwandaDpaCompliance` — Law No. 058/2021, NCSA registration, Article 12 lawful basis - `egyptPdplCompliance` — Law No. 151/2020, PDPA registration, Article 4 lawful basis, Article 23 automated decisions Field map in `_build_regulatory_properties` grows from 7 → 9 entries. Tests updated: all-fields fixture, per-field assertions, checklist and missing-fields coverage for both new jurisdictions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds first-class support for African data protection and financial regulatory compliance metadata in generated AIBOMs. This is the first jurisdiction-specific regulatory extension for the project, establishing the `owasp:aibom:regulatory:` namespace and a pattern that future regional compliance modules (EU AI Act, APAC, LATAM) can follow.
Background
Africa is the fastest-growing AI deployment region in the world but is largely absent from AI transparency tooling. Six African data protection laws are now in force — Nigeria NDPA 2023, South Africa POPIA, Kenya KDPA 2019, Ghana DPA 2012, Rwanda DPA 2021, and Egypt PDPL 2020 — with more following the African Union Data Policy Framework. Teams deploying AI across these jurisdictions currently have no structured way to assert compliance in their AIBOMs. This PR adds support for all six.
Changes
`src/models/field_registry.json` — 9 new fields
`africanDeploymentJurisdictions` is tier `important` and added to the Advanced completeness profile, so any Advanced-scored AIBOM for an African-deployed model will surface it as missing. All eight jurisdiction fields include statutory citations in their `recommendation` text.
`src/models/service.py`
`src/models/schemas.py`
`tests/test_regulatory_compliance.py` — 21 new tests
All 95 existing tests continue to pass.
Usage Example
```python
aibom = service.generate_aibom(
"org/fraud-detection-model",
regulatory_metadata={
"african_deployment_jurisdictions": ["NG", "ZA", "KE"],
"ndpa_compliance": "registered; nitda_reg=NITDA/REG/2025/001; lawful_basis=legitimate_interests_ndpa_s25; dpia=completed",
"nfiu_aml_compliance": "cbn_licensed; aml_assessed=true; explainability_review=completed",
"popia_compliance": "registered; information_officer=appointed",
"kdpa_compliance": "registered; odpc_registration=active",
"regulatory_contact_point": "dpo@example.com",
},
)
Properties appear at: aibom["metadata"]["properties"]
with names: owasp:aibom:regulatory:africanDeploymentJurisdictions, etc.
```
Type of Change
Packages / Files Affected
References
AI Assistance
This contribution was developed with Claude (Anthropic) as a coding assistant. All code has been reviewed, tested, and is submitted under the Apache 2.0 license.