Skip to content

Conversation

@iamkaroko
Copy link
Collaborator

SUMMARY

Problem

This PR addresses two main needs:

  1. Data Export Capability: The research team needed a way to export answer data collected from participants in CSV format for analysis and reporting purposes.
  2. BMI Display Enhancement: Case details were showing raw BMI numeric values instead of human-readable categories (Underweight, Normal, Overweight, Obese).

Solution

Answer Export Scripts

  • Created two export scripts (export_answers_to_csv.py and export_answers_to_csv_new_format.py) to extract answer data from the database and format it for analysis
  • Added comprehensive README documentation for the export functionality
  • Included sample exported data for reference

BMI Categorization

  • Modified case_service.py to detect BMI measurements (concept_id 40490382) and convert numeric values to categories:
    • 18 → Underweight
    • 22 → Normal
    • 27 → Overweight
    • 30 → Obese
    • Other values → Display numeric value as string

Round 3 Configuration

  • Added utilities for Round 3 test configuration management
  • Created generate_round3_test_config.sh script
  • Added remove_all_case_assignments.py utility
  • Included round3_test_config.csv with test data

Cleanup

  • Removed outdated config.csv file (25K+ lines)
  • Updated dependencies in Pipfile

TEST PLAN

Manual Testing

  1. BMI Display

    • Navigate to a case with BMI measurements
    • Verify BMI values display as categories instead of numbers
    • Confirm other measurements still display correctly
  2. Answer Export

    • Run python script/answer_export/export_answers_to_csv.py
    • Verify CSV file is generated with correct format
    • Check that all answer data is properly formatted
  3. Round 3 Configuration

    • Run ./script/assign_cases/generate_round3_test_config.sh
    • Verify configuration file is generated
    • Test case assignment removal script

Automated Testing

  • Added 5 new unit tests for BMI categorization covering:
    • ✅ Underweight category (BMI 18)
    • ✅ Normal category (BMI 22)
    • ✅ Overweight category (BMI 27)
    • ✅ Obese category (BMI 30)
    • ✅ Unknown/other BMI values (fallback to numeric string)
  • All 175 tests passing (170 existing + 5 new)
  • Test coverage maintained at 96.42% (above 96.4% threshold)

CI/CD

  • ✅ All tests pass
  • ✅ Code coverage meets requirements
  • ✅ Linting checks pass
  • ✅ Security scans complete

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving.
    • How this problem was solved.
    • How reviewers can test my changes.
  • I've included tests I've run to ensure my changes work.
  • I've added unit tests for any new code, if applicable.
  • I've documented any added code.

@iamkaroko iamkaroko merged commit d05dc04 into main Nov 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants