diff --git a/model_governance_pack/__init__.py b/model_governance_pack/__init__.py new file mode 100644 index 0000000..3d2f776 --- /dev/null +++ b/model_governance_pack/__init__.py @@ -0,0 +1,7 @@ +""" +Model Governance Pack + +Canonical governance models and schemas for the Lexecon protocol. +""" + +__version__ = "0.1.0" diff --git a/pyproject.toml b/pyproject.toml index c85cfe7..ef95836 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,8 @@ Issues = "https://github.com/Lexicoding-systems/Lexecon/issues" lexecon = "lexecon.cli.main:cli" [tool.setuptools.packages.find] -where = ["src"] +where = ["src", "."] +include = ["lexecon*", "model_governance_pack*"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/src/lexecon/risk/service.py b/src/lexecon/risk/service.py index 37cfeed..03bac46 100644 --- a/src/lexecon/risk/service.py +++ b/src/lexecon/risk/service.py @@ -80,13 +80,22 @@ class RiskScoringEngine: "financial": 0.10, } - # Risk level thresholds - RISK_THRESHOLDS = { - RiskLevel.CRITICAL: 80, # >= 80 - RiskLevel.HIGH: 60, # 60-79 - RiskLevel.MEDIUM: 30, # 30-59 - RiskLevel.LOW: 0, # 0-29 - } + # Risk level thresholds (defined conditionally to avoid import errors) + if GOVERNANCE_MODELS_AVAILABLE: + RISK_THRESHOLDS = { + RiskLevel.CRITICAL: 80, # >= 80 + RiskLevel.HIGH: 60, # 60-79 + RiskLevel.MEDIUM: 30, # 30-59 + RiskLevel.LOW: 0, # 0-29 + } + else: + # Fallback thresholds using string keys + RISK_THRESHOLDS = { + "critical": 80, + "high": 60, + "medium": 30, + "low": 0, + } def __init__(self, weights: Optional[Dict[str, float]] = None): """