File size: 1,769 Bytes
7602502
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
"""Centralized configuration for the tools module."""

from __future__ import annotations

from pathlib import Path

from pydantic_settings import BaseSettings, SettingsConfigDict


class ToolsSettings(BaseSettings):
    """Configuration settings for the tools module."""

    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        case_sensitive=False,
    )

    # API Configuration
    csp_api_key: str = ""
    csp_base_url: str = "https://api.commonstandardsproject.com/api/v1"
    max_requests_per_minute: int = 60

    # Path Configuration
    # These are computed properties based on project root
    @property
    def project_root(self) -> Path:
        """Get the project root directory."""
        return Path(__file__).parent.parent

    @property
    def raw_data_dir(self) -> Path:
        """Get the raw data directory."""
        return self.project_root / "data" / "raw"

    @property
    def standard_sets_dir(self) -> Path:
        """Get the standard sets directory."""
        return self.raw_data_dir / "standardSets"

    @property
    def processed_data_dir(self) -> Path:
        """Get the processed data directory."""
        return self.project_root / "data" / "processed"

    # Logging Configuration
    log_file: str = "data/cli.log"
    log_rotation: str = "10 MB"
    log_retention: str = "7 days"

    # Pinecone Configuration
    pinecone_api_key: str = ""
    pinecone_index_name: str = "common-core-standards"
    pinecone_namespace: str = "standards"


_settings: ToolsSettings | None = None


def get_settings() -> ToolsSettings:
    """Get the singleton settings instance."""
    global _settings
    if _settings is None:
        _settings = ToolsSettings()
    return _settings