refactor(bot-detector): extract monolith into modular package
Split bot_detector.py (~1982 lines) into 10 focused modules: - config.py: all configuration constants and optional imports - log.py: logging utilities (log_info, log_decision, append_training_history) - infra.py: ClickHouse client, health check HTTP server, shutdown - browser.py: multifactorial browser identification (5 axes) - scoring.py: drift detection, feature validation, SHAP, clustering - models.py: EIF, Autoencoder, XGBoost model management - preprocessing.py: data preprocessing and feature list definitions - pipeline.py: core semi-supervised scoring loop - cycle.py: main analysis cycle orchestration - __main__.py: entry point with startup banner Update Dockerfile to copy package directory and use python -m bot_detector. All 36 existing tests pass unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@ -13,6 +13,6 @@ RUN pip install --no-cache-dir /app/shared/ja4_common/
|
||||
COPY services/bot-detector/bot_detector/requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY services/bot-detector/bot_detector/bot_detector.py .
|
||||
COPY services/bot-detector/bot_detector/ ./bot_detector/
|
||||
|
||||
CMD ["python", "bot_detector.py"]
|
||||
CMD ["python", "-m", "bot_detector"]
|
||||
|
||||
Reference in New Issue
Block a user