Frameworks Module¶
Compliance framework implementations for EU AI Act, SOC2, HIPAA, GDPR, NIST AI RMF, ISO 42001, and MAS FEAT.
Base Types¶
ComplianceRule¶
ComplianceRule
dataclass
¶
Definition of a single compliance rule within a framework.
Rules represent specific regulatory requirements that AI systems must satisfy. Each rule has an associated check function that evaluates audit entries for compliance.
Attributes:
| Name | Type | Description |
|---|---|---|
rule_id |
str
|
Unique identifier for this rule within the framework |
name |
str
|
Human-readable name of the rule |
description |
str
|
Detailed description of the requirement |
severity |
RiskLevel
|
Default severity level for violations of this rule |
category |
str
|
Category grouping for the rule |
check_fn |
Optional[Callable[[AuditEntry], bool]]
|
Optional custom check function for specialized validation |
remediation |
str
|
Default remediation guidance for violations |
references |
List[str]
|
External references (regulation sections, standards, etc.) |
Source code in src/rotalabs_comply/frameworks/base.py
Definition of a single compliance rule within a framework.
Attributes:
| Attribute | Type | Description |
|---|---|---|
rule_id |
str |
Unique identifier within framework |
name |
str |
Human-readable name |
description |
str |
Detailed requirement description |
severity |
RiskLevel |
Default severity for violations |
category |
str |
Category grouping |
check_fn |
Optional[Callable] |
Custom check function |
remediation |
str |
Default remediation guidance |
references |
List[str] |
External references |
Example:
from rotalabs_comply.frameworks.base import ComplianceRule, RiskLevel
rule = ComplianceRule(
rule_id="CUSTOM-001",
name="Custom Requirement",
description="Description of what's required",
severity=RiskLevel.MEDIUM,
category="custom",
remediation="How to fix violations",
references=["Internal Policy 1.2.3"],
)
ComplianceFramework Protocol¶
ComplianceFramework ¶
Protocol defining the interface for compliance frameworks.
All compliance frameworks must implement this protocol to ensure consistent behavior across different regulatory standards.
Frameworks evaluate audit entries against their rules and produce compliance check results with any violations found.
Source code in src/rotalabs_comply/frameworks/base.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
name
property
¶
Get the name of this compliance framework.
Returns:
| Type | Description |
|---|---|
str
|
Human-readable name (e.g., "EU AI Act", "SOC2 Type II") |
version
property
¶
Get the version of the framework being implemented.
Returns:
| Type | Description |
|---|---|
str
|
Version string (e.g., "2024", "2017") |
rules
property
¶
Get all rules defined in this framework.
Returns:
| Type | Description |
|---|---|
List[ComplianceRule]
|
List of all compliance rules |
check
async
¶
Check an audit entry for compliance violations.
Evaluates the entry against all applicable rules based on the provided compliance profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry
|
AuditEntry
|
The audit entry to evaluate |
required |
profile
|
ComplianceProfile
|
Configuration profile controlling evaluation |
required |
Returns:
| Type | Description |
|---|---|
ComplianceCheckResult
|
ComplianceCheckResult containing any violations found |
Source code in src/rotalabs_comply/frameworks/base.py
get_rule ¶
Get a specific rule by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule_id
|
str
|
The unique identifier of the rule |
required |
Returns:
| Type | Description |
|---|---|
Optional[ComplianceRule]
|
The ComplianceRule if found, None otherwise |
Source code in src/rotalabs_comply/frameworks/base.py
list_categories ¶
List all rule categories in this framework.
Returns:
| Type | Description |
|---|---|
List[str]
|
List of unique category names |
Protocol defining the interface for compliance frameworks.
Properties:
| Property | Type | Description |
|---|---|---|
name |
str |
Framework name |
version |
str |
Framework version |
rules |
List[ComplianceRule] |
All rules |
Methods:
| Method | Signature | Description |
|---|---|---|
check |
async (entry, profile) -> ComplianceCheckResult |
Check entry |
get_rule |
(rule_id: str) -> Optional[ComplianceRule] |
Get rule by ID |
list_categories |
() -> List[str] |
List categories |
BaseFramework¶
BaseFramework ¶
Abstract base class for compliance frameworks.
Provides common functionality for all framework implementations including rule management, category listing, and the main check loop. Subclasses must implement the _check_rule method to define framework-specific validation logic.
Attributes:
| Name | Type | Description |
|---|---|---|
_name |
Framework name |
|
_version |
Framework version |
|
_rules |
List of rules in this framework |
|
_rules_by_id |
Dict[str, ComplianceRule]
|
Dictionary mapping rule IDs to rules for fast lookup |
Source code in src/rotalabs_comply/frameworks/base.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | |
__init__ ¶
Initialize the base framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Human-readable framework name |
required |
version
|
str
|
Framework version string |
required |
rules
|
List[ComplianceRule]
|
List of compliance rules |
required |
Source code in src/rotalabs_comply/frameworks/base.py
get_rule ¶
Get a specific rule by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule_id
|
str
|
The unique identifier of the rule |
required |
Returns:
| Type | Description |
|---|---|
Optional[ComplianceRule]
|
The ComplianceRule if found, None otherwise |
Source code in src/rotalabs_comply/frameworks/base.py
list_categories ¶
List all unique rule categories in this framework.
Returns:
| Type | Description |
|---|---|
List[str]
|
Sorted list of unique category names |
Source code in src/rotalabs_comply/frameworks/base.py
check
async
¶
Check an audit entry for compliance violations.
Evaluates the entry against all applicable rules based on the provided compliance profile, respecting category filters and excluded rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entry
|
AuditEntry
|
The audit entry to evaluate |
required |
profile
|
ComplianceProfile
|
Configuration profile controlling evaluation |
required |
Returns:
| Type | Description |
|---|---|
ComplianceCheckResult
|
ComplianceCheckResult containing any violations found |
Source code in src/rotalabs_comply/frameworks/base.py
Abstract base class for compliance frameworks.
Constructor¶
Abstract Method¶
Subclasses must implement:
Example Custom Framework:
from rotalabs_comply.frameworks.base import BaseFramework, ComplianceRule, RiskLevel
class MyFramework(BaseFramework):
def __init__(self):
rules = [
ComplianceRule(
rule_id="MY-001",
name="My Rule",
description="Description",
severity=RiskLevel.MEDIUM,
category="custom",
),
]
super().__init__("My Framework", "1.0", rules)
def _check_rule(self, entry, rule):
if rule.rule_id == "MY-001":
if not entry.metadata.get("my_field"):
return self._create_violation(entry, rule, "my_field missing")
return None
AuditEntry (Frameworks)¶
AuditEntry
dataclass
¶
Represents a single audit log entry for an AI system interaction.
Audit entries capture the essential metadata about AI system operations that compliance frameworks need to evaluate against regulatory requirements.
Attributes:
| Name | Type | Description |
|---|---|---|
entry_id |
str
|
Unique identifier for this audit entry |
timestamp |
datetime
|
When the event occurred |
event_type |
str
|
Type of event (e.g., "inference", "training", "data_access") |
actor |
str
|
Identifier for the user, system, or agent that triggered the event |
action |
str
|
Description of the action taken |
resource |
str
|
The resource being accessed or modified |
metadata |
Dict[str, Any]
|
Additional context-specific information about the event |
risk_level |
RiskLevel
|
Assessed risk level of this operation |
system_id |
str
|
Identifier for the AI system involved |
data_classification |
str
|
Classification of data involved (e.g., "PII", "PHI", "public") |
user_notified |
bool
|
Whether the user was notified about AI involvement |
human_oversight |
bool
|
Whether human oversight was present |
error_handled |
bool
|
Whether errors were handled gracefully |
documentation_ref |
Optional[str]
|
Reference to related technical documentation |
Source code in src/rotalabs_comply/frameworks/base.py
Audit entry structure used by frameworks for compliance checking.
Attributes:
| Attribute | Type | Default | Description |
|---|---|---|---|
entry_id |
str |
Required | Unique identifier |
timestamp |
datetime |
Required | Event time |
event_type |
str |
Required | Type of event |
actor |
str |
Required | Who triggered event |
action |
str |
Required | Action description |
resource |
str |
"" |
Resource accessed |
metadata |
Dict[str, Any] |
{} |
Additional context |
risk_level |
RiskLevel |
LOW |
Risk classification |
system_id |
str |
"" |
AI system identifier |
data_classification |
str |
"unclassified" |
Data sensitivity |
user_notified |
bool |
False |
User knows about AI |
human_oversight |
bool |
False |
Human oversight present |
error_handled |
bool |
True |
Errors handled gracefully |
documentation_ref |
Optional[str] |
None |
Documentation reference |
ComplianceProfile (Frameworks)¶
ComplianceProfile
dataclass
¶
Configuration profile for compliance evaluation.
Profiles define which rules to apply, severity thresholds, and system-specific compliance requirements.
Attributes:
| Name | Type | Description |
|---|---|---|
profile_id |
str
|
Unique identifier for this profile |
name |
str
|
Human-readable profile name |
description |
str
|
Detailed description of the profile's purpose |
enabled_frameworks |
List[str]
|
List of framework names to evaluate against |
enabled_categories |
List[str]
|
Categories of rules to check (empty = all) |
min_severity |
RiskLevel
|
Minimum severity level to report |
system_classification |
str
|
Classification of the AI system being evaluated |
custom_rules |
List[str]
|
Additional custom rule IDs to include |
excluded_rules |
List[str]
|
Rule IDs to exclude from evaluation |
metadata |
Dict[str, Any]
|
Additional profile configuration |
Source code in src/rotalabs_comply/frameworks/base.py
Configuration profile for compliance evaluation.
Attributes:
| Attribute | Type | Default | Description |
|---|---|---|---|
profile_id |
str |
Required | Unique identifier |
name |
str |
Required | Profile name |
description |
str |
"" |
Profile description |
enabled_frameworks |
List[str] |
[] |
Frameworks to evaluate |
enabled_categories |
List[str] |
[] |
Categories to check |
min_severity |
RiskLevel |
LOW |
Minimum severity to report |
system_classification |
str |
"standard" |
System classification |
custom_rules |
List[str] |
[] |
Additional rule IDs |
excluded_rules |
List[str] |
[] |
Rules to skip |
metadata |
Dict[str, Any] |
{} |
Additional config |
ComplianceViolation (Frameworks)¶
ComplianceViolation
dataclass
¶
Represents a single compliance violation detected during evaluation.
Violations are the output of rule checks that identify non-compliance with regulatory requirements.
Attributes:
| Name | Type | Description |
|---|---|---|
rule_id |
str
|
ID of the rule that was violated |
rule_name |
str
|
Human-readable name of the violated rule |
severity |
RiskLevel
|
Severity level of the violation |
description |
str
|
Detailed description of what was violated |
evidence |
str
|
Specific evidence from the audit entry |
remediation |
str
|
Suggested steps to remediate the violation |
entry_id |
str
|
ID of the audit entry that triggered this violation |
category |
str
|
Category of the violated rule |
framework |
str
|
Name of the framework containing the rule |
Source code in src/rotalabs_comply/frameworks/base.py
A compliance violation detected during evaluation.
Attributes:
| Attribute | Type | Description |
|---|---|---|
rule_id |
str |
Violated rule ID |
rule_name |
str |
Rule name |
severity |
RiskLevel |
Violation severity |
description |
str |
Rule description |
evidence |
str |
Specific evidence |
remediation |
str |
How to fix |
entry_id |
str |
Entry that triggered |
category |
str |
Rule category |
framework |
str |
Framework name |
ComplianceCheckResult (Frameworks)¶
ComplianceCheckResult
dataclass
¶
Result of a compliance check against an audit entry.
Contains all violations found, along with summary statistics about the compliance evaluation.
Attributes:
| Name | Type | Description |
|---|---|---|
entry_id |
str
|
ID of the audit entry that was checked |
framework |
str
|
Name of the framework used for evaluation |
framework_version |
str
|
Version of the framework |
timestamp |
datetime
|
When the check was performed |
violations |
List[ComplianceViolation]
|
List of all violations found |
rules_checked |
int
|
Total number of rules evaluated |
rules_passed |
int
|
Number of rules that passed |
is_compliant |
bool
|
Whether the entry is fully compliant (no violations) |
metadata |
Dict[str, Any]
|
Additional check result metadata |
Source code in src/rotalabs_comply/frameworks/base.py
Result of a compliance check against an audit entry.
Attributes:
| Attribute | Type | Description |
|---|---|---|
entry_id |
str |
Checked entry ID |
framework |
str |
Framework name |
framework_version |
str |
Framework version |
timestamp |
datetime |
Check time |
violations |
List[ComplianceViolation] |
Violations found |
rules_checked |
int |
Total rules evaluated |
rules_passed |
int |
Rules that passed |
is_compliant |
bool |
No violations found |
metadata |
Dict[str, Any] |
Additional data |
EU AI Act Framework¶
EUAIActFramework ¶
EU AI Act compliance framework.
Implements compliance checks based on the EU AI Act (2024) requirements for high-risk AI systems. The framework evaluates audit entries against the Act's requirements for transparency, human oversight, risk management, documentation, and security.
The EU AI Act classifies AI systems into risk categories: - Unacceptable risk: Prohibited systems - High-risk: Systems subject to strict requirements (this framework's focus) - Limited risk: Systems with transparency obligations - Minimal risk: Most AI systems with few requirements
This implementation focuses on high-risk system requirements as they represent the most comprehensive compliance obligations.
Example
framework = EUAIActFramework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Source code in src/rotalabs_comply/frameworks/eu_ai_act.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
__init__ ¶
Initialize the EU AI Act framework with all defined rules.
EU AI Act (2024) compliance framework.
Categories¶
| Category | Description |
|---|---|
transparency |
User notification requirements |
oversight |
Human oversight requirements |
risk_management |
Risk assessment and handling |
documentation |
Technical documentation |
security |
Cybersecurity measures |
Rules¶
| Rule ID | Name | Severity | Category |
|---|---|---|---|
EUAI-001 |
Human Oversight Documentation | HIGH | oversight |
EUAI-002 |
AI Interaction Notification | HIGH | transparency |
EUAI-003 |
Risk Assessment | CRITICAL | risk_management |
EUAI-004 |
Technical Documentation | HIGH | documentation |
EUAI-005 |
Data Governance | HIGH | documentation |
EUAI-006 |
Error Handling | MEDIUM | risk_management |
EUAI-007 |
Accuracy Monitoring | MEDIUM | risk_management |
EUAI-008 |
Cybersecurity Measures | HIGH | security |
Usage¶
from rotalabs_comply.frameworks.eu_ai_act import EUAIActFramework
from rotalabs_comply.frameworks.base import AuditEntry, ComplianceProfile, RiskLevel
from datetime import datetime
framework = EUAIActFramework()
entry = AuditEntry(
entry_id="test-001",
timestamp=datetime.utcnow(),
event_type="inference",
actor="user@example.com",
action="AI response",
risk_level=RiskLevel.HIGH,
user_notified=True,
human_oversight=True,
metadata={"risk_assessment_documented": True},
)
profile = ComplianceProfile(
profile_id="eu-ai",
name="EU AI Compliance",
)
result = await framework.check(entry, profile)
Key Requirements¶
High-risk operations require:
- human_oversight=True
- metadata["risk_assessment_documented"]=True
User-facing interactions require:
- user_notified=True
Inference events require:
- metadata["accuracy_monitored"]=True
SOC2 Framework¶
SOC2Framework ¶
SOC2 Type II compliance framework.
Implements compliance checks based on the AICPA Trust Service Criteria for SOC2 Type II reporting. This framework evaluates audit entries against the five trust service principles: Security, Availability, Processing Integrity, Confidentiality, and Privacy.
SOC2 Type II reports assess both the design and operating effectiveness of controls over a specified period. This implementation focuses on controls relevant to AI systems and their operational characteristics.
Trust Service Categories: - CC (Common Criteria): Security-related controls - A: Availability controls - PI: Processing Integrity controls - C: Confidentiality controls - P: Privacy controls
Example
framework = SOC2Framework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Source code in src/rotalabs_comply/frameworks/soc2.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | |
__init__ ¶
Initialize the SOC2 Type II framework with all defined rules.
SOC2 Type II compliance framework.
Categories¶
| Category | TSC | Description |
|---|---|---|
security |
CC | Common Criteria - Security controls |
availability |
A | System availability |
processing_integrity |
PI | Data processing accuracy |
confidentiality |
C | Confidential information protection |
privacy |
P | Personal information protection |
Rules¶
| Rule ID | Name | Severity | Category |
|---|---|---|---|
SOC2-CC6.1 |
Logical Access Controls | HIGH | security |
SOC2-CC6.2 |
System Boundary Definition | MEDIUM | security |
SOC2-CC6.3 |
Change Management | MEDIUM | security |
SOC2-CC7.1 |
System Monitoring | HIGH | security |
SOC2-CC7.2 |
Incident Response | HIGH | security |
SOC2-CC8.1 |
Availability Monitoring | MEDIUM | availability |
SOC2-A1.1 |
Recovery Objectives | MEDIUM | availability |
SOC2-PI1.1 |
Processing Integrity | MEDIUM | processing_integrity |
SOC2-C1.1 |
Confidentiality Classification | HIGH | confidentiality |
SOC2-P1.1 |
Privacy Notice | HIGH | privacy |
Usage¶
from rotalabs_comply.frameworks.soc2 import SOC2Framework
framework = SOC2Framework()
entry = AuditEntry(
entry_id="soc2-001",
timestamp=datetime.utcnow(),
event_type="data_access",
actor="admin@company.com",
action="Query database",
data_classification="confidential",
metadata={
"access_controlled": True,
"monitored": True,
},
)
result = await framework.check(entry, profile)
Key Requirements¶
Access events require:
- Authenticated actor (not "anonymous")
- metadata["access_controlled"]=True
Change events require:
- metadata["change_approved"]=True
- documentation_ref set
Data events require:
- data_classification not "unclassified"
HIPAA Framework¶
HIPAAFramework ¶
HIPAA compliance framework.
Implements compliance checks based on HIPAA Security Rule technical safeguards and Privacy Rule requirements. This framework evaluates audit entries for AI systems that process Protected Health Information (PHI) or electronic PHI (ePHI).
HIPAA requires covered entities and business associates to: - Ensure confidentiality, integrity, and availability of ePHI - Protect against anticipated threats and hazards - Protect against unauthorized uses or disclosures - Ensure workforce compliance
This implementation focuses on technical safeguards (164.312) which are most relevant to AI system operations: - Access controls (164.312(a)) - Audit controls (164.312(b)) - Integrity controls (164.312(c)) - Authentication (164.312(d)) - Transmission security (164.312(e))
Example
framework = HIPAAFramework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Source code in src/rotalabs_comply/frameworks/hipaa.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | |
__init__ ¶
HIPAA compliance framework for PHI handling.
Categories¶
| Category | Rule Section | Description |
|---|---|---|
access_control |
164.312(a) | System and data access |
audit |
164.312(b) | Audit controls |
integrity |
164.312(c) | Data integrity |
authentication |
164.312(d) | Entity authentication |
transmission |
164.312(e) | Transmission security |
privacy |
164.502/514/530 | Privacy rule |
Rules¶
| Rule ID | Name | Severity | Category |
|---|---|---|---|
HIPAA-164.312(a) |
Access Control | CRITICAL | access_control |
HIPAA-164.312(b) |
Audit Controls | HIGH | audit |
HIPAA-164.312(c) |
Integrity Controls | HIGH | integrity |
HIPAA-164.312(d) |
Authentication | CRITICAL | authentication |
HIPAA-164.312(e) |
Transmission Security | HIGH | transmission |
HIPAA-164.502 |
Uses and Disclosures | CRITICAL | privacy |
HIPAA-164.514 |
De-identification | HIGH | privacy |
HIPAA-164.530 |
Administrative Requirements | MEDIUM | privacy |
PHI Detection¶
Rules only apply when data_classification contains:
"PHI""ePHI""protected_health_information""health_data""medical""clinical"
Usage¶
from rotalabs_comply.frameworks.hipaa import HIPAAFramework
framework = HIPAAFramework()
# PHI-related entry (rules apply)
entry = AuditEntry(
entry_id="hipaa-001",
timestamp=datetime.utcnow(),
event_type="inference",
actor="doctor@hospital.com",
action="AI diagnostic",
data_classification="PHI",
metadata={
"access_controlled": True,
"encryption_enabled": True,
"authenticated": True,
"purpose_documented": True,
"minimum_necessary_applied": True,
},
)
result = await framework.check(entry, profile)
Key Requirements¶
All PHI access requires:
- Authenticated actor
- metadata["access_controlled"]=True
- metadata["encryption_enabled"]=True
High-risk PHI operations require:
- metadata["mfa_verified"]=True
PHI use requires:
- metadata["purpose_documented"]=True
- metadata["minimum_necessary_applied"]=True
GDPR Framework¶
GDPRFramework ¶
GDPR compliance framework.
Implements compliance checks based on the General Data Protection Regulation (GDPR) requirements for processing personal data. The framework evaluates audit entries against the Regulation's requirements for data protection, consent, transparency, data subject rights, security, and accountability.
The GDPR applies to: - Organizations established in the EU processing personal data - Organizations outside the EU offering goods/services to EU residents - Organizations monitoring behavior of individuals in the EU
Key principles enforced: - Lawfulness, fairness, and transparency - Purpose limitation - Data minimization - Accuracy - Storage limitation - Integrity and confidentiality - Accountability
Example
framework = GDPRFramework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Source code in src/rotalabs_comply/frameworks/gdpr.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | |
__init__ ¶
GDPR (EU General Data Protection Regulation 2016/679) compliance framework for processing personal data.
Categories¶
| Category | Description |
|---|---|
data_protection |
Core data protection principles (Article 5) |
legal_basis |
Lawful processing requirements (Article 6) |
consent |
Valid consent conditions (Article 7) |
transparency |
Information provision and communication (Articles 12-13) |
data_subject_rights |
Individual rights (Articles 15, 17, 20, 22) |
security |
Data security measures (Articles 32-33) |
accountability |
Demonstrating compliance (Articles 25, 30, 35) |
Rules¶
| Rule ID | Name | Category | Severity |
|---|---|---|---|
GDPR-Art5 |
Data Processing Principles | data_protection | CRITICAL |
GDPR-Art6 |
Lawful Basis for Processing | legal_basis | CRITICAL |
GDPR-Art7 |
Conditions for Consent | consent | HIGH |
GDPR-Art12 |
Transparent Information and Communication | transparency | HIGH |
GDPR-Art13 |
Information at Collection | transparency | HIGH |
GDPR-Art15 |
Right of Access | data_subject_rights | HIGH |
GDPR-Art17 |
Right to Erasure (Right to be Forgotten) | data_subject_rights | HIGH |
GDPR-Art20 |
Right to Data Portability | data_subject_rights | MEDIUM |
GDPR-Art22 |
Automated Decision-Making and Profiling | data_subject_rights | CRITICAL |
GDPR-Art25 |
Data Protection by Design and Default | accountability | HIGH |
GDPR-Art30 |
Records of Processing Activities | accountability | HIGH |
GDPR-Art32 |
Security of Processing | security | CRITICAL |
GDPR-Art33 |
Personal Data Breach Notification | security | CRITICAL |
GDPR-Art35 |
Data Protection Impact Assessment | accountability | HIGH |
Usage¶
from rotalabs_comply.frameworks.gdpr import GDPRFramework
from rotalabs_comply.frameworks.base import AuditEntry, ComplianceProfile, RiskLevel
from datetime import datetime
framework = GDPRFramework()
entry = AuditEntry(
entry_id="gdpr-001",
timestamp=datetime.utcnow(),
event_type="data_processing",
actor="analyst@company.eu",
action="Process customer data",
data_classification="pii",
metadata={
"lawful_basis_documented": True,
"lawful_basis": "consent",
"purpose_documented": True,
"consent_recorded": True,
"consent_specific": True,
"consent_informed": True,
"encryption_applied": True,
"access_controlled": True,
},
)
profile = ComplianceProfile(
profile_id="gdpr-profile",
name="GDPR Compliance",
)
result = await framework.check(entry, profile)
Key Requirements¶
Personal data processing requires:
- data_classification set to "pii", "personal", "sensitive", or "special_category"
- metadata["lawful_basis_documented"]=True
- metadata["purpose_documented"]=True
- metadata["lawful_basis"] set to one of: "consent", "contract", "legal_obligation", "vital_interests", "public_interest", "legitimate_interests"
Consent-based processing requires:
- metadata["consent_recorded"]=True
- metadata["consent_specific"]=True
- metadata["consent_informed"]=True
Automated decisions with significant effects require:
- metadata["human_intervention_available"]=True
- metadata["right_to_contest_enabled"]=True
- metadata["logic_explained"]=True
NIST AI RMF Framework¶
NISTAIRMFFramework ¶
NIST AI Risk Management Framework compliance framework.
Implements compliance checks based on the NIST AI RMF 1.0 (January 2023) requirements for managing AI system risks. The framework evaluates audit entries against requirements for governance, context mapping, risk measurement, and risk management.
The NIST AI RMF is built on four core functions:
-
GOVERN: Cross-cutting function that infuses the AI risk management culture into the organization. Establishes accountability structures, policies, and processes for AI risk management.
-
MAP: Establishes the context for framing risks related to an AI system. Identifies and documents AI system characteristics, intended purposes, and potential impacts.
-
MEASURE: Employs quantitative and qualitative methods to analyze, assess, and track AI risks and their impacts. Includes identification of appropriate metrics and evaluation methods.
-
MANAGE: Allocates risk resources and implements responses to mapped and measured risks. Includes deployment decisions, post-deployment monitoring, and incident response.
The framework emphasizes trustworthy AI characteristics: - Valid and Reliable - Safe - Secure and Resilient - Accountable and Transparent - Explainable and Interpretable - Privacy-Enhanced - Fair with Harmful Bias Managed
Example
framework = NISTAIRMFFramework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Source code in src/rotalabs_comply/frameworks/nist_ai_rmf.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | |
__init__ ¶
Initialize the NIST AI RMF framework with all defined rules.
NIST AI Risk Management Framework (AI RMF 1.0, January 2023) compliance framework.
Categories¶
| Category | Function | Description |
|---|---|---|
governance |
GOVERN | Organizational AI governance structures and accountability |
context |
MAP | AI system context, intended use, and stakeholder analysis |
risk_identification |
MAP | Identification of risks from AI systems and components |
measurement |
MEASURE | Metrics, evaluation, and tracking of AI characteristics |
risk_treatment |
MANAGE | Risk prioritization, response, and post-deployment monitoring |
Rules¶
| Rule ID | Name | Category | Severity |
|---|---|---|---|
NIST-GOV-1 |
AI Risk Management Governance Structure | governance | HIGH |
NIST-GOV-2 |
Organizational AI Principles and Values | governance | MEDIUM |
NIST-GOV-3 |
Roles and Responsibilities Defined | governance | HIGH |
NIST-GOV-4 |
Third-Party AI Risk Management | governance | HIGH |
NIST-MAP-1 |
AI System Context Established | context | MEDIUM |
NIST-MAP-2 |
AI Categorization and Intended Use Documented | context | HIGH |
NIST-MAP-3 |
AI Benefits and Costs Assessed | context | MEDIUM |
NIST-MAP-4 |
Risks from Third-Party Components Mapped | risk_identification | HIGH |
NIST-MEAS-1 |
Appropriate Metrics Identified | measurement | MEDIUM |
NIST-MEAS-2 |
AI Systems Evaluated for Trustworthy Characteristics | measurement | HIGH |
NIST-MEAS-3 |
Mechanisms for Tracking Identified Risks | measurement | MEDIUM |
NIST-MAN-1 |
AI Risks Prioritized and Responded To | risk_treatment | HIGH |
NIST-MAN-2 |
AI System Deployment Decisions Documented | risk_treatment | HIGH |
NIST-MAN-3 |
Post-Deployment Monitoring in Place | risk_treatment | HIGH |
NIST-MAN-4 |
Incident Response and Recovery Procedures | risk_treatment | CRITICAL |
Usage¶
from rotalabs_comply.frameworks.nist_ai_rmf import NISTAIRMFFramework
from rotalabs_comply.frameworks.base import AuditEntry, ComplianceProfile, RiskLevel
from datetime import datetime
framework = NISTAIRMFFramework()
entry = AuditEntry(
entry_id="nist-001",
timestamp=datetime.utcnow(),
event_type="deployment",
actor="mlops@company.com",
action="Deploy production model",
risk_level=RiskLevel.HIGH,
documentation_ref="DOC-DEPLOY-001",
metadata={
"governance_documented": True,
"governance_approval": True,
"system_context_documented": True,
"ai_categorization_documented": True,
"intended_use_documented": True,
"benefit_cost_assessed": True,
"deployment_decision_documented": True,
"deployment_approved": True,
"risk_assessment_documented": True,
},
)
profile = ComplianceProfile(
profile_id="nist-profile",
name="NIST AI RMF Compliance",
)
result = await framework.check(entry, profile)
Key Requirements¶
High-risk operations require:
- metadata["governance_documented"]=True or metadata["governance_approval"]=True
- metadata["risk_assessment_documented"]=True or metadata["risk_prioritized"]=True
- metadata["risk_tracked"]=True or metadata["risk_registry_updated"]=True
Deployment operations require:
- metadata["deployment_decision_documented"]=True or metadata["deployment_approved"]=True
- documentation_ref set
Third-party AI operations require:
- metadata["third_party_assessed"]=True or metadata["vendor_agreement_documented"]=True
- metadata["third_party_risks_mapped"]=True or metadata["component_inventory_updated"]=True
Incident events require:
- metadata["incident_response_followed"]=True or metadata["recovery_plan_executed"]=True
ISO/IEC 42001 Framework¶
ISO42001Framework ¶
ISO/IEC 42001:2023 AI Management System compliance framework.
Implements compliance checks based on ISO 42001:2023 requirements for establishing, implementing, maintaining, and continually improving an AI management system. The framework evaluates audit entries against the standard's requirements across seven key areas.
ISO 42001 is structured around the Plan-Do-Check-Act (PDCA) cycle: - Plan: Establish AIMS objectives and processes (Clauses 4-6) - Do: Implement the AIMS and its processes (Clauses 7-8) - Check: Monitor and evaluate performance (Clause 9) - Act: Take actions to improve performance (Clause 10)
The standard emphasizes: - Risk-based thinking throughout the AI lifecycle - Responsible AI development and deployment - Transparency and accountability - Continual improvement
Example
framework = ISO42001Framework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Source code in src/rotalabs_comply/frameworks/iso_42001.py
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 | |
__init__ ¶
Initialize the ISO 42001 framework with all defined rules.
ISO/IEC 42001:2023 AI Management System (AIMS) compliance framework.
Categories¶
| Category | Clause | Description |
|---|---|---|
context |
4 | Organizational context and AIMS scope |
leadership |
5 | Leadership commitment, AI policy, and roles |
planning |
6 | Risk assessment, objectives, and impact assessment |
support |
7 | Resources, competence, awareness, communication, documentation |
operation |
8 | Operational planning, lifecycle, third-party, impact |
performance |
9 | Monitoring, internal audit, management review |
improvement |
10 | Corrective action and continual improvement |
Rules¶
| Rule ID | Name | Category | Severity |
|---|---|---|---|
ISO42001-4.1 |
Understanding Organization and Context | context | HIGH |
ISO42001-4.2 |
Understanding Needs of Interested Parties | context | HIGH |
ISO42001-4.3 |
Scope of AIMS Determined | context | HIGH |
ISO42001-5.1 |
Leadership Commitment Demonstrated | leadership | HIGH |
ISO42001-5.2 |
AI Policy Established | leadership | CRITICAL |
ISO42001-5.3 |
Roles and Responsibilities Assigned | leadership | HIGH |
ISO42001-6.1 |
AI Risk Assessment Conducted | planning | CRITICAL |
ISO42001-6.2 |
AI Objectives Established | planning | HIGH |
ISO42001-6.3 |
AI Impact Assessment Performed | planning | CRITICAL |
ISO42001-7.1 |
Resources Provided | support | HIGH |
ISO42001-7.2 |
Competence Ensured | support | HIGH |
ISO42001-7.3 |
Awareness Maintained | support | MEDIUM |
ISO42001-7.4 |
Communication Processes Established | support | MEDIUM |
ISO42001-7.5 |
Documented Information Controlled | support | HIGH |
ISO42001-8.1 |
Operational Planning and Control | operation | HIGH |
ISO42001-8.2 |
AI System Lifecycle Processes | operation | CRITICAL |
ISO42001-8.3 |
Third-Party Considerations | operation | HIGH |
ISO42001-8.4 |
AI System Impact Assessment | operation | CRITICAL |
ISO42001-9.1 |
Monitoring and Measurement | performance | HIGH |
ISO42001-9.2 |
Internal Audit Conducted | performance | HIGH |
ISO42001-9.3 |
Management Review | performance | HIGH |
ISO42001-10.1 |
Nonconformity and Corrective Action | improvement | HIGH |
ISO42001-10.2 |
Continual Improvement | improvement | MEDIUM |
Usage¶
from rotalabs_comply.frameworks.iso_42001 import ISO42001Framework
from rotalabs_comply.frameworks.base import AuditEntry, ComplianceProfile, RiskLevel
from datetime import datetime
framework = ISO42001Framework()
entry = AuditEntry(
entry_id="iso-001",
timestamp=datetime.utcnow(),
event_type="deployment",
actor="ai-engineer@company.com",
action="Deploy AI system",
risk_level=RiskLevel.HIGH,
metadata={
"organizational_context_documented": True,
"stakeholders_identified": True,
"aims_scope_defined": True,
"within_aims_scope": True,
"leadership_approved": True,
"ai_policy_compliant": True,
"role_defined": True,
"authorized_role": True,
"risk_assessment_documented": True,
"impact_assessment_documented": True,
"lifecycle_process_followed": True,
"operational_plan_documented": True,
"monitoring_enabled": True,
},
)
profile = ComplianceProfile(
profile_id="iso42001-profile",
name="ISO 42001 Compliance",
)
result = await framework.check(entry, profile)
Key Requirements¶
All AI operations require:
- metadata["ai_policy_compliant"]=True
System deployments require:
- metadata["organizational_context_documented"]=True
- metadata["aims_scope_defined"]=True and metadata["within_aims_scope"]=True
- metadata["leadership_approved"]=True
- metadata["lifecycle_process_followed"]=True
- metadata["operational_plan_documented"]=True
High-risk operations require:
- metadata["risk_assessment_documented"]=True
Critical operations require:
- metadata["role_defined"]=True and metadata["authorized_role"]=True
- metadata["competence_verified"]=True
MAS FEAT Framework¶
MASFramework ¶
MAS (Monetary Authority of Singapore) AI governance compliance framework.
Implements compliance checks based on MAS FEAT principles and AI governance guidelines for financial institutions operating in Singapore. The framework evaluates audit entries against requirements for fairness, ethics, accountability, transparency, model risk management, data governance, and operational resilience.
The FEAT principles establish expectations for financial institutions to: - Ensure AI-driven decisions are fair and do not result in unfair treatment - Use data and AI in an ethical manner aligned with firm values - Maintain clear accountability structures for AI decisions - Provide transparency to customers about AI use and decision-making
Additionally, the framework incorporates MAS model risk management requirements and technology risk management guidelines relevant to AI systems.
Example
framework = MASFramework() result = await framework.check(entry, profile) if not result.is_compliant: ... for violation in result.violations: ... print(f"{violation.rule_id}: {violation.description}")
Note
This framework is specifically designed for financial institutions regulated by MAS. Organizations outside MAS jurisdiction should use other appropriate frameworks.
Source code in src/rotalabs_comply/frameworks/mas.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | |
__init__ ¶
MAS (Monetary Authority of Singapore) FEAT principles and AI governance framework for financial institutions.
Categories¶
| Category | Focus | Description |
|---|---|---|
fairness |
FEAT-F | Ensuring AI decisions are fair and unbiased |
ethics |
FEAT-E | Ethical use of data and AI alignment with firm standards |
accountability |
FEAT-A | Clear accountability and human oversight |
transparency |
FEAT-T | Explainability and customer notification |
model_risk |
MRM | Model development, validation, and monitoring |
data_governance |
Data | Data quality, lineage, and privacy compliance |
operations |
Ops | System resilience and incident management |
Rules¶
| Rule ID | Name | Category | Severity |
|---|---|---|---|
MAS-FEAT-F1 |
Fair AI-Driven Decisions | fairness | HIGH |
MAS-FEAT-F2 |
Bias Detection and Mitigation | fairness | HIGH |
MAS-FEAT-E1 |
Ethical Use of Data and AI | ethics | HIGH |
MAS-FEAT-E2 |
AI Alignment with Firm's Ethical Standards | ethics | MEDIUM |
MAS-FEAT-A1 |
Clear Accountability for AI Decisions | accountability | HIGH |
MAS-FEAT-A2 |
Human Oversight for Material AI Decisions | accountability | CRITICAL |
MAS-FEAT-T1 |
Explainable AI Decisions | transparency | HIGH |
MAS-FEAT-T2 |
Customer Notification of AI Use | transparency | HIGH |
MAS-MRM-1 |
Model Development Standards | model_risk | HIGH |
MAS-MRM-2 |
Model Validation Requirements | model_risk | HIGH |
MAS-MRM-3 |
Model Monitoring and Review | model_risk | HIGH |
MAS-MRM-4 |
Model Inventory Maintained | model_risk | MEDIUM |
MAS-DATA-1 |
Data Quality Standards | data_governance | HIGH |
MAS-DATA-2 |
Data Lineage Documentation | data_governance | MEDIUM |
MAS-DATA-3 |
Data Privacy Compliance | data_governance | CRITICAL |
MAS-OPS-1 |
AI System Resilience | operations | HIGH |
MAS-OPS-2 |
Incident Management for AI Failures | operations | HIGH |
MAS-OPS-3 |
Business Continuity for AI Systems | operations | MEDIUM |
Usage¶
from rotalabs_comply.frameworks.mas import MASFramework
from rotalabs_comply.frameworks.base import AuditEntry, ComplianceProfile, RiskLevel
from datetime import datetime
framework = MASFramework()
entry = AuditEntry(
entry_id="mas-001",
timestamp=datetime.utcnow(),
event_type="credit_decision",
actor="credit-officer@bank.sg",
action="AI credit scoring",
risk_level=RiskLevel.HIGH,
data_classification="customer_data",
user_notified=True,
human_oversight=True,
error_handled=True,
metadata={
"fairness_assessed": True,
"bias_mitigation_documented": True,
"accountable_owner": "credit-risk-team",
"explanation_available": True,
"monitoring_enabled": True,
"model_inventory_id": "MODEL-CS-001",
"privacy_compliant": True,
},
)
profile = ComplianceProfile(
profile_id="mas-profile",
name="MAS FEAT Compliance",
)
result = await framework.check(entry, profile)
Key Requirements¶
Customer-facing AI decisions require:
- metadata["fairness_assessed"]=True
- metadata["explanation_available"]=True or metadata["explainability_method"] set
- user_notified=True
High-risk operations require:
- human_oversight=True
Model lifecycle events require:
- metadata["bias_mitigation_documented"]=True
- metadata["validation_completed"]=True (for deployments)
- metadata["model_inventory_id"] or metadata["model_registered"]=True
Personal data operations require:
- data_classification set to "pii", "personal", "customer_data", or "sensitive"
- metadata["privacy_compliant"]=True or metadata["consent_obtained"]=True
All operations require:
- error_handled=True (for resilience)