Skip to content

feat: reliability refactor — core/services layout, conformal UQ, MCDM…#1

Merged
Rafalexandre-code merged 1 commit into
masterfrom
claude/elegant-tereshkova-93f1dc
Apr 24, 2026
Merged

feat: reliability refactor — core/services layout, conformal UQ, MCDM…#1
Rafalexandre-code merged 1 commit into
masterfrom
claude/elegant-tereshkova-93f1dc

Conversation

@Rafalexandre-code

Copy link
Copy Markdown
Owner

…, safe serialization, manifest, CI

Reorganizes the project around reusable modules and adds the reliability, traceability, and security infrastructure referenced by the new help tab:

Core (CSTRChemIA/core/)

  • safe_serialization: JSON + SHA-256 persistence for scalers, removes pickle from the happy path (mitigates CWE-502)
  • data_validation: ValidationReport dataclass, clean_dataset, explicit bounds/flag checks; replaces silent median imputation with reporting
  • model_manifest: ModelManifest dataclass + build/read/write + verify_integrity for end-to-end artifact auditability (models.json)
  • uncertainty: SplitConformalCalibrator (Vovk 2005), MC Dropout (Gal & Ghahramani 2016), deep ensemble (Lakshminarayanan 2017), predict_with_interval helper
  • feature_engineering: 11 derived features with safe_div / log_clip
  • constants, exceptions, i18n, logging, settings, types, units, utils

Optimization

  • decision_methods: TOPSIS, VIKOR, PROMETHEE II, knee-point (L1-ASF), consensus_ranking
  • problem_v2: NSGA-II / NSGA-III problem with n_ieq_constr=5 native constraint handling

Training

  • train_xgboost_baseline: per-target XGBoost baseline on engineered features
  • train_surrogate: ReduceLROnPlateau + ModelCheckpoint + --seed CLI, writes manifest entries on completion

Services (CSTRChemIA/services/)

  • model_registry (models.json precedence, verify_integrity)
  • simulation_service, optimization_service, training_service, data_file_service

API skeleton (CSTRChemIA/api/): FastAPI app + pydantic schemas for a future headless deployment mode.

Tests

  • CSTRChemIA/tests/: 46 pytest cases over the new core modules
  • tests/: service and integration tests (mypy-typed, no TF required)

Tooling & deploy

  • pyproject.toml (ruff, mypy, pytest config)
  • .github/workflows/ci.yml (lint, typecheck, matrix tests, docker build)
  • .pre-commit-config.yaml, .editorconfig, .dockerignore
  • Dockerfile + Dockerfile.api + docker-compose.yml
  • docs/ARCHITECTURE.md, docs/CONTRIBUTING.md, docs/DEPLOYMENT.md
  • Makefile, README.md at repo root

UI

  • assets/html_help/index.html rewritten: 20 sections, ~2000 lines, full coverage of the modules above (sidebar, CSS tokens, callouts)
  • layout_TAB.py: dashboard upgrade (Analytics tab, K-means, Hypervolume)
  • custom.css: purple-theme refinements

Other

  • requirements.txt: add keras-tuner>=1.4.0
  • .gitignore: exclude .claude/ working directory

…, safe serialization, manifest, CI

Reorganizes the project around reusable modules and adds the reliability,
traceability, and security infrastructure referenced by the new help tab:

Core (CSTRChemIA/core/)
  - safe_serialization: JSON + SHA-256 persistence for scalers, removes
    pickle from the happy path (mitigates CWE-502)
  - data_validation: ValidationReport dataclass, clean_dataset, explicit
    bounds/flag checks; replaces silent median imputation with reporting
  - model_manifest: ModelManifest dataclass + build/read/write +
    verify_integrity for end-to-end artifact auditability (models.json)
  - uncertainty: SplitConformalCalibrator (Vovk 2005), MC Dropout
    (Gal & Ghahramani 2016), deep ensemble (Lakshminarayanan 2017),
    predict_with_interval helper
  - feature_engineering: 11 derived features with safe_div / log_clip
  - constants, exceptions, i18n, logging, settings, types, units, utils

Optimization
  - decision_methods: TOPSIS, VIKOR, PROMETHEE II, knee-point (L1-ASF),
    consensus_ranking
  - problem_v2: NSGA-II / NSGA-III problem with n_ieq_constr=5 native
    constraint handling

Training
  - train_xgboost_baseline: per-target XGBoost baseline on engineered features
  - train_surrogate: ReduceLROnPlateau + ModelCheckpoint + --seed CLI,
    writes manifest entries on completion

Services (CSTRChemIA/services/)
  - model_registry (models.json precedence, verify_integrity)
  - simulation_service, optimization_service, training_service,
    data_file_service

API skeleton (CSTRChemIA/api/): FastAPI app + pydantic schemas for a
future headless deployment mode.

Tests
  - CSTRChemIA/tests/: 46 pytest cases over the new core modules
  - tests/: service and integration tests (mypy-typed, no TF required)

Tooling & deploy
  - pyproject.toml (ruff, mypy, pytest config)
  - .github/workflows/ci.yml (lint, typecheck, matrix tests, docker build)
  - .pre-commit-config.yaml, .editorconfig, .dockerignore
  - Dockerfile + Dockerfile.api + docker-compose.yml
  - docs/ARCHITECTURE.md, docs/CONTRIBUTING.md, docs/DEPLOYMENT.md
  - Makefile, README.md at repo root

UI
  - assets/html_help/index.html rewritten: 20 sections, ~2000 lines,
    full coverage of the modules above (sidebar, CSS tokens, callouts)
  - layout_TAB.py: dashboard upgrade (Analytics tab, K-means, Hypervolume)
  - custom.css: purple-theme refinements

Other
  - requirements.txt: add keras-tuner>=1.4.0
  - .gitignore: exclude .claude/ working directory

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Rafalexandre-code Rafalexandre-code merged commit ee7eccd into master Apr 24, 2026
0 of 2 checks passed
@Rafalexandre-code Rafalexandre-code deleted the claude/elegant-tereshkova-93f1dc branch April 24, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant