Skip to content
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

Auto-generate score: [Score Agent] Add BMI #43

Closed
wants to merge 1 commit into from

Conversation

nckhell
Copy link
Contributor

@nckhell nckhell commented Mar 14, 2025

PR Type

  • Enhancement
  • Tests
  • Documentation

Description

  • Add BMI score calculation logic.

  • Define BMI input and output schemas.

  • Include tests for input validation and calculation.

  • Provide documentation for BMI usage.


Changes walkthrough 📝

Relevant files
Tests
1 files
bmi.test.ts
Add tests for BMI calculation and validations.                     
+61/-0   
Enhancement
4 files
bmi.ts
Implement BMI calculation method.                                               
+14/-0   
bmi_inputs.ts
Define BMI input schema with weight and height.                   
+15/-0   
bmi_output.ts
Define BMI output schema for score.                                           
+10/-0   
index.ts
Refactor BMI module export.                                                           
+1/-2     
Other
1 files
bmi_subscales.ts
Add BMI subscales placeholder.                                                     
+1/-0     
Documentation
1 files
README.md
Add documentation for BMI score.                                                 
+18/-0   

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Precision

    The BMI calculation returns a floating point result that is directly compared to 24.22 in the test, which might lead to precision issues across different environments. Consider explicitly rounding the result or using a tolerance in the test.

    calculate: ({ data }) => {
      return {
        bmi: data.weight / ((data.height / 100) ** 2),
      }

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Use tolerant float comparison

    Replace the strict equality check with a floating-point tolerant comparison to
    handle precision discrepancies.

    src/scores/bmi/bmi.test.ts [57]

    -expect(outcome.bmi).toEqual(24.22)
    +expect(outcome.bmi).toBeCloseTo(24.22, 2)
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion improves the test's accuracy against floating-point precision issues by using a tolerant comparison. It is a relevant and correct improvement, though its impact is moderate given the context.

    Medium

    @nckhell nckhell closed this Mar 14, 2025
    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.

    1 participant