|
"""Loader for compliance rules from all regulatory bodies""" |
|
|
|
from .sec_rules import SEC_RULES |
|
from .fca_rules import FCA_RULES |
|
from .eu_rules import EU_RULES |
|
|
|
class ComplianceRules: |
|
def __init__(self): |
|
self.rules = { |
|
"US_SEC": SEC_RULES, |
|
"UK_FCA": FCA_RULES, |
|
"EU": EU_RULES |
|
} |
|
|
|
def get_all_rules(self): |
|
"""Return all compliance rules""" |
|
return self.rules |
|
|
|
def get_rules_by_region(self, region): |
|
"""Get rules for a specific region""" |
|
return self.rules.get(region, {}) |
|
|
|
def get_combined_prohibited_terms(self): |
|
"""Get all prohibited terms across regions""" |
|
prohibited_terms = set() |
|
for region_rules in self.rules.values(): |
|
for term_dict in region_rules["prohibited_terms"]: |
|
prohibited_terms.add(term_dict["term"]) |
|
prohibited_terms.update(term_dict["variations"]) |
|
return list(prohibited_terms) |
|
|
|
def get_channel_requirements(self, channel): |
|
"""Get requirements for a specific channel across all regions""" |
|
requirements = {} |
|
for region, rules in self.rules.items(): |
|
if "channel_specific_rules" in rules and channel in rules["channel_specific_rules"]: |
|
requirements[region] = rules["channel_specific_rules"][channel] |
|
return requirements |
|
|
|
def calculate_risk_score(self, violations, warnings, region): |
|
"""Calculate risk score based on violations and warnings""" |
|
if region not in self.rules: |
|
return 0 |
|
|
|
risk_scoring = self.rules[region]["risk_scoring"] |
|
score = 0 |
|
|
|
for violation in violations: |
|
if "disclaimer" in violation.lower(): |
|
score += risk_scoring["missing_disclaimer"] |
|
elif "prohibited" in violation.lower(): |
|
score += risk_scoring["prohibited_term"] |
|
else: |
|
score += risk_scoring["misleading_statement"] |
|
|
|
return score |