Skip to content

Feat/why projects fits you section. - #935

Merged
komalharshita merged 14 commits into
komalharshita:mainfrom
Soumya1Kesharwani:feat/why-fits-you-only
Jul 12, 2026
Merged

Feat/why projects fits you section.#935
komalharshita merged 14 commits into
komalharshita:mainfrom
Soumya1Kesharwani:feat/why-fits-you-only

Conversation

@Soumya1Kesharwani

Copy link
Copy Markdown

Fixes #129
Hi @komalharshita Ma'am -

This PR introduces a new feature that provides users with a personalized, dynamically generated explanation of exactly why a specific project was recommended to them (e.g., "This project utilizes your skills in Python, fits your current experience level, and aligns closely with your interests"). It also includes a critical backend fix to data_loader.py.

Changes Included in this PR:

  1. Backend Recommendation Logic (utils/recommender.py)
    i. Updated score_single_project() to accurately track and return exactly which parameters matched the user's input via a new match_details dictionary.
    ii.Updated get_recommendations() to dynamically generate a natural language match_explanation sentence tailored to the user's profile.

  2. Frontend Details Page (templates/project.html)
    i. Added an empty

    for seamless client-side injection.
    ii. Refactored the way variables are passed to JavaScript by adopting a secure tag approach to prevent template rendering conflicts.

  3. JavaScript UI Rendering (static/script.js)
    i. Updated the recommendation grid generation to securely encode and pass the match_explanation via a URL parameter (?reason=...).
    ii. Implemented a new loadExplanation() function that automatically reads the URL parameter on the project detail page and renders the explanation.

  4. Data Loader Stability Fix (utils/data_loader.py)
    i. Added _cache_lock to make project loading fully thread-safe.
    ii. Added extensive try/except blocks to gracefully catch FileNotFoundError and json.JSONDecodeError to prevent application crashes when the projects.json file is malformed or missing.

Screenshot 2026-06-10 at 17 29 07

After updating--

Screenshot 2026-06-18 at 08 49 12

I tested the feature locally and the match score functionality is working fine.Please let me know if there are any edge cases I should check.

Kindly review the changes. If everything looks good, please merge this PR into main.

Thanks for your time.

Soumya Kesharwani added 4 commits June 8, 2026 16:47
- utils/recommender.py: normalize raw score to 0-10 scale and attach
  as match_score field on each returned project dict
- static/script.js: render match score badge (label + number + bar)
  inside buildProjectCard() between title and description
- static/style.css: add styles for .project-match-score, .score-label,
  .score-value, .score-bar, .score-bar-fill

Resolves issue: show score/10 on recommended projects for clarity


# Conflicts:
#	static/style.css
#	utils/recommender.py
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

Someone 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.

@Soumya1Kesharwani

Copy link
Copy Markdown
Author

Hi maintainers,
Just following up on this PR. I wanted to check if any changes or improvements are needed from my side. Thanks for your time!

@komalharshita

Copy link
Copy Markdown
Owner

@Soumya1Kesharwani kindly resolve the merge conflicts

@komalharshita komalharshita reopened this Jul 5, 2026
@komalharshita komalharshita added the need review Further information is requested label Jul 5, 2026
@Soumya1Kesharwani

Copy link
Copy Markdown
Author

Ma'am please review the changes and if everything looks good kindly merge it to main.

@Soumya1Kesharwani

Soumya1Kesharwani commented Jul 7, 2026 via email

Copy link
Copy Markdown
Author

@Soumya1Kesharwani

Soumya1Kesharwani commented Jul 11, 2026 via email

Copy link
Copy Markdown
Author

@komalharshita

Copy link
Copy Markdown
Owner

Ok, approved for merge!

@komalharshita
komalharshita merged commit dd6bc21 into komalharshita:main Jul 12, 2026
4 of 5 checks passed
@Soumya1Kesharwani

Soumya1Kesharwani commented Jul 12, 2026 via email

Copy link
Copy Markdown
Author

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]: Add "Why this project matches you Explanation to increase trust in recommendation engine"

2 participants