RRC / src /racing_reports /config.py
pablogrois's picture
Deploy MVP: API JSON + SPA + bundle/cache de artifacts CORE
e58615a
Raw
History Blame Contribute Delete
1.68 kB
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
def _expand_path(value: str) -> Path:
return Path(value).expanduser().resolve()
@dataclass(frozen=True)
class Settings:
azure_storage_account: str = os.getenv("AZURE_STORAGE_ACCOUNT", "stdlprodfrancecentral001")
azure_filesystem: str = os.getenv("AZURE_FILESYSTEM", "fs-dl-prod-francecentral-001")
azure_preprocessed_root: str = os.getenv("AZURE_PREPROCESSED_ROOT", "raw/eventing/processed")
azure_report_artifacts_root: str = os.getenv("AZURE_REPORT_ARTIFACTS_ROOT", "raw/eventing/report_artifacts")
cache_dir: Path = _expand_path(os.getenv("RACING_REPORTS_CACHE_DIR", "~/.cache/racing-reports"))
output_dir: Path = _expand_path(os.getenv("RACING_REPORTS_OUTPUT_DIR", "outputs"))
preprocessed_name: str = os.getenv("RACING_PREPROCESSED_NAME", "preprocessed_SSD_25-26.csv")
labeled_preprocessed_name: str = os.getenv(
"RACING_LABELED_PREPROCESSED_NAME", "preprocessed_SSD_25-26_etiquetado_modelo.csv"
)
access_password: str = os.getenv("ACCESS_PASSWORD", "")
local_data_dir: str = os.getenv("RACING_LOCAL_DATA_DIR", "")
enable_nn_predictions: bool = os.getenv("RR_ENABLE_NN_PREDICTIONS", "0") == "1"
@property
def preprocessed_cache_dir(self) -> Path:
return self.cache_dir / "preprocessed"
@property
def artifacts_cache_dir(self) -> Path:
return self.cache_dir / "artifacts"
@property
def account_url(self) -> str:
return f"https://{self.azure_storage_account}.dfs.core.windows.net"
DEFAULT_SETTINGS = Settings()