Skip to content

Major UX improvements for credit-scorer: simplified workflows, unified visualizations, and user-friendly defaults #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 18, 2025

Conversation

strickvl
Copy link
Contributor

@strickvl strickvl commented Jun 18, 2025

This PR introduces significant user experience improvements to the EU AI Act compliance credit scoring project, making it much easier to get started while preserving all compliance features. The changes span workflow simplification, visual consistency improvements, and architectural enhancements.

🎯 Key Improvements

1. Simplified Deployment Workflow with User-Friendly Defaults

  • Auto-approve is now default: No more --auto-approve flag needed for testing
  • Slack disabled by default: No Modal secrets required for basic testing
  • Clean primary workflow: Just python run.py --all works out of the box
  • Full compliance available: Use --enable-slack flag when you need complete EU AI Act features

Before: python run.py --all --auto-approve --no-slack (verbose, confusing)
After: python run.py --all (clean, simple)

2. Unified HTMLString Visualization System

  • Created centralized CSS architecture for all compliance reports
  • Migrated 5 different HTMLString artifacts to shared styling system
  • Massive code reduction: Eliminated 500+ lines of duplicate inline CSS
  • Visual consistency: All EU AI Act reports now have unified professional styling
  • Better maintainability: Single shared_styles.css file for all visualizations

3. Enhanced Risk Assessment Visualization

  • Added comprehensive HTML risk assessment report as second artifact from risk_assessment step
  • Color-coded risk levels (LOW/MEDIUM/HIGH) with professional styling
  • Detailed hazard breakdown with severity badges and mitigation guidance
  • Responsive design with gradient headers and card layouts

4. Fixed Pipeline Execution Issues

  • Fixed --all flag: Now properly executes complete feature → training → deployment workflow
  • Resolved artifact chaining: Removed Pydantic validation errors between pipeline steps
  • Improved Modal deployment: Better error handling and conditional secret management
  • Enhanced auto-approve: Properly connects CLI flags to deployment approval logic

📊 Detailed Changes

Pipeline Execution Fixes

  • Fixed --all flag handling: Moved logic to beginning of main() function to properly enable all pipelines
  • Artifact store integration: Let ZenML automatically fetch latest artifacts instead of direct passing
  • Modal directory creation: Fixed FileNotFoundError when saving models
  • Auto-approve integration: Connected CLI flags to environment variables for deployment approval

Visualization Architecture

  • Created shared CSS system: src/utils/visualizations/shared_styles.css with comprehensive component library
  • Python utilities: shared_styles.py with CSS loading and HTML template generation functions
  • Migrated all HTMLString artifacts:
    • eval.py - Model evaluation dashboard
    • generate_sbom.py - Software Bill of Materials visualization
    • post_run_annex.py - Annex IV technical documentation
    • dashboard.py - Compliance dashboard
    • risk_assessment.py - Risk assessment reports

Enhanced Features

  • Risk visualization: Added HTML report as second artifact from risk_assessment step
  • SBOM HTML generation: Created professional HTML version of Software Bill of Materials
  • Annex IV HTML: Enhanced technical documentation with structured HTML output
  • Pipeline naming: Made pipeline names more specific (credit_scoring_* prefix)

Documentation & UX

  • README overhaul: Completely restructured to highlight simplified --all workflow
  • Modal secrets guidance: Clear instructions for optional vs required setup
  • Usage examples: Updated all examples to reflect new simplified commands
  • Setup instructions: Clarified what's required vs optional for getting started

🧪 Testing

All changes maintain backward compatibility while improving the user experience:

  • python run.py --all works without any setup (new default behavior)
  • python run.py --all --enable-slack enables full compliance features
  • python run.py --all --manual-approve prompts for human approval
  • ✅ Individual pipeline commands work with new defaults
  • ✅ All HTMLString artifacts render with consistent styling
  • ✅ Complete EU AI Act compliance workflow functions correctly

🎨 Visual Improvements

The unified CSS system provides:

  • Professional styling: Modern, clean design with proper typography
  • Responsive design: Works well on different screen sizes
  • Component consistency: Cards, tables, badges, alerts use shared styling
  • EU AI Act branding: Consistent color scheme and layout across all reports
  • Accessibility: Proper contrast ratios and semantic markup

🚀 Migration Impact

This PR significantly improves the onboarding experience:

  • Reduced setup friction: New users can test immediately with python run.py --all
  • Clearer documentation: README now emphasizes the simple workflow
  • Optional complexity: Advanced features available when explicitly requested
  • Better error handling: More graceful degradation when optional components unavailable

The changes make the project much more approachable for new contributors and users while maintaining full EU AI Act compliance capabilities.

🤖 Generated with Claude Code

strickvl and others added 12 commits June 17, 2025 15:38
Create models directory before saving model to prevent FileNotFoundError when running training pipeline.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Connect the --auto-approve flag to the actual approval logic by checking DEPLOY_APPROVAL, APPROVER, and APPROVAL_RATIONALE environment variables in the approve_deployment step.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Document the required credit-scoring-secrets Modal secret for deployment pipeline, including Slack credentials needed for EU AI Act compliance incident reporting.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Enable the --all flag to run feature engineering, training, and deployment pipelines sequentially with proper output chaining between steps.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Extract real deployment URLs from deployment_info parameter structure
- Handle dictionary return from load_risk_register() by extracting 'Risks' sheet
- Fix indentation and structure in risk management section
- Resolve "Risk level information not found" issue by properly accessing risk data

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Move --all flag handling to beginning of main() function
- Remove direct artifact passing between pipelines to avoid Pydantic validation errors
- Let ZenML automatically fetch latest artifacts from artifact store
- Enables successful execution of complete workflow: feature → training → deployment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add --all flag as the primary recommended command for running complete workflow
- Show --all with --auto-approve for seamless execution
- Reorganize commands to emphasize complete workflow over individual pipelines
- Add --all --no-cache example for additional pipeline options

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add generate_risk_visualization() function to create styled HTML report
- Update risk_assessment step to return tuple: (risk_scores_dict, risk_visualization_html)
- Add RISK_VISUALIZATION constant to annotations
- Update training pipeline and run.py to handle new return signature
- Visualization includes overall risk score, component risks, and detailed hazard breakdown
- Color-coded risk levels (LOW/MEDIUM/HIGH) with severity badges for hazards
- Professional styling with gradient header and responsive card layout

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Migrate all HTMLString artifacts to use centralized CSS styling for improved maintainability and visual consistency across EU AI Act compliance reports.

Key changes:
- Updated eval.py to use shared CSS classes for model evaluation dashboard
- Migrated generate_sbom.py SBOM visualization to shared styling
- Converted post_run_annex.py Annex IV documentation to use shared CSS
- Updated dashboard.py compliance dashboard with unified styling
- Enhanced risk_assessment.py with shared CSS components

Benefits:
- Consistent styling across all compliance visualizations
- Reduced CSS duplication from ~500+ lines of inline styles
- Improved maintainability with centralized style management
- Enhanced visual consistency for EU AI Act reporting

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Auto-approve is now the default behavior (use --manual-approve to disable)
- Slack notifications are disabled by default (use --enable-slack to enable)
- Modal secrets are now optional, only required when --enable-slack is used
- Primary workflow is now just `python run.py --all` with no flags needed
- Full EU AI Act compliance available via `python run.py --all --enable-slack`

This makes the project much easier to test and get started with while keeping
all compliance features available when explicitly requested.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@strickvl strickvl added enhancement New feature or request internal labels Jun 18, 2025
@strickvl strickvl requested a review from safoinme June 18, 2025 12:55
Copy link

dagshub bot commented Jun 18, 2025

@strickvl strickvl changed the title Major UX improvements: Simplified workflows, unified visualizations, and user-friendly defaults Major UX improvements for credit-scorer: simplified workflows, unified visualizations, and user-friendly defaults Jun 18, 2025
@strickvl strickvl requested a review from Copilot June 18, 2025 12:56
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces major UX improvements to the credit scorer project by simplifying deployment workflows, unifying HTML visualizations with shared CSS, and enhancing risk assessment and SBOM generation. Key changes include removing verbose CLI flags (auto‐approve now defaults), refactoring inline styles into shared templates, and updating return types to support new visualizations.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/visualizations/eval.py Refactored inline HTML styles and tables to use shared CSS template
src/utils/visualizations/dashboard.py Improved risk management sections and added new API documentation elements
src/steps/training/train.py Added directory creation before saving model artifacts
src/steps/training/risk_assessment.py Updated risk assessment to return a tuple with visualization HTML
src/steps/deployment/generate_sbom.py Added HTML generation for SBOM and updated return type
src/steps/deployment/approve.py Enhanced auto-approval logic with environment variable support
src/pipelines/training.py, deployment.py Adjusted unpacking to match updated return types and naming conventions
src/constants/annotations.py Renamed pipeline identifiers for clarity
run.py Modified CLI flags and environment setup for auto/manual approval and Slack notifications
modal_app/modal_deployment.py Conditional inclusion of secrets for Slack notifications with enhanced logging
README.md Updated instructions to reflect new workflow commands and configuration steps
Comments suppressed due to low confidence (2)

credit-scorer/src/steps/training/risk_assessment.py:386

  • The risk_assessment function now returns a tuple (risk_scores, risk_visualization) instead of a single dict. Ensure that all downstream callers and documentation are updated accordingly to handle the new return type.
    return result, risk_visualization

credit-scorer/run.py:126

  • The auto-approval behavior now relies on the manual_approve flag with auto-approve as default; consider updating inline comments or documentation to clearly explain this inversion and how environment variables are set.
    auto_approve = not manual_approve

- Add strict validation to only accept "true" or "false" values for ENABLE_SLACK
- In Modal app creation: raise ValueError and abort deployment for invalid values
- In incident reporting: log error but gracefully continue with disabled Slack
- Prevents silent failures from typos like "True", "1", "yes", or "tru"
- Provides clear error messages showing expected vs actual values

This improves user experience by catching configuration errors early rather
than silently defaulting to disabled Slack notifications.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@strickvl strickvl merged commit 3123445 into main Jun 18, 2025
5 checks passed
@strickvl strickvl deleted the feature/fix-credit-scoring branch June 18, 2025 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants