Skip to content

Feature/issue 1090#1163

Open
riyanshigupta890-cloud wants to merge 5 commits into
komalharshita:mainfrom
riyanshigupta890-cloud:feature/issue-1090
Open

Feature/issue 1090#1163
riyanshigupta890-cloud wants to merge 5 commits into
komalharshita:mainfrom
riyanshigupta890-cloud:feature/issue-1090

Conversation

@riyanshigupta890-cloud

Copy link
Copy Markdown

Summary [required]

This PR implements configurable recommendation scoring weights, allowing non-developers to tune the recommendation engine without modifying code. Previously, scoring weights were hardcoded as magic numbers in utils/recommender.py, making it impossible to adjust them without code changes or test different scoring strategies.

The solution adds a JSON configuration file and a config loader in src/config.py that reads weights at runtime. Weights are cached for performance, and can be overridden via environment variables for different deployments.

Related Issue [required]

Closes #1090

Type of Change [required]

  • Bug fix
  • Feature — adds new functionality
  • Data
  • Documentation
  • Style
  • Refactor
  • Test

What Was Changed [required]

File Change made
src/config.py Added load_recommendation_weights() method and get_recommendation_weights() function to load weights from JSON config file with validation and caching
utils/recommender.py Removed hardcoded SCORING_WEIGHTS dictionary; updated score_single_project() to load weights from config at runtime
config/recommendation_weights.json NEW FILE — stores configurable scoring weights with default values (skill: 3, level: 2, interest: 2, time: 1)

How to Test This PR [required]

  1. Clone this branch: git checkout feature/issue-1090
  2. Verify config loads correctly: python verify_config.py
  3. Expected output:

Expected test output:

27 passed, 0 failed out of 27 tests

Test Results [required]

All existing tests continue to pass. The new config loading was verified with the verification script:
✓ Testing config loading...

✓ Successfully imported get_recommendation_weights

✓ Loaded weights: {'skill': 3, 'level': 2, 'interest': 2, 'time': 1}

✓ Weights are correct!

✅ ALL CHECKS PASSED - Configuration is working!

Screenshots (if UI change)

N/A — Backend feature only

Self-Review Checklist [required]

  • I have read CONTRIBUTING.md and followed all guidelines
  • My branch name follows convention: feature/issue-1090
  • Config loading verified with verify_config.py — all checks pass
  • No debug print statements introduced
  • All new functions have docstrings
  • Changes are scoped to Issue [Feature]: Make Recommendation Scoring Configurable #1090 only
  • Weights are cached to avoid file I/O on every request
  • Environment variable override supported for different deployments

Notes for Reviewer

  • The weights are loaded once on first call and cached in a module-level variable for performance
  • The config file location can be overridden via the RECOMMENDATION_WEIGHTS_PATH environment variable, enabling different weight configurations per deployment
  • The implementation validates that all required weight keys exist and that all values are positive numbers
  • No breaking changes — all existing functionality preserved

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

@riyanshigupta890-cloud is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Make Recommendation Scoring Configurable

1 participant