Add analyze_fit_return_risk — Robert Engine return probability (api/fit_engine.py)#113
Draft
Add analyze_fit_return_risk — Robert Engine return probability (api/fit_engine.py)#113
analyze_fit_return_risk — Robert Engine return probability (api/fit_engine.py)#113Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Agent-Logs-Url: https://github.com/Tryonme-com/tryonyou-app/sessions/f7cbd16f-e3bb-41c5-96e9-02fb2aa29d59 Co-authored-by: LVT-ENG <214667862+LVT-ENG@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add return risk analysis function for garments
Add Apr 7, 2026
analyze_fit_return_risk — Robert Engine return probability (api/fit_engine.py)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the Robert Engine physics formula that estimates return risk from fabric elasticity/recovery and the user's shoulder width, returning a risk percentage and size recommendation.
Changes
api/fit_engine.py(new)UserAnchorsdataclass — biometric anchor point (shoulder width in cm)_SHOULDER_MULTIPLIER,_TENSION_WEIGHT,_MAX_RETURN_RISK,_RISK_THRESHOLD,_PERCENTAGE_DIVISOR)analyze_fit_return_risk(fabric, user_anchors, garment_id)— raisesValueErroronelasticityPct ≤ 0to prevent division-by-zero; caps risk at 95 %tests/test_fit_engine.py(new) — 10 unittest cases covering low/high risk paths, 95 % cap, exact 30 % boundary, response structure, rounding, and invalid-input guardsUsage