Skip to content

Add number symbol#2319

Merged
jo-elimu merged 2 commits intomainfrom
add-number-symbol
Jul 29, 2025
Merged

Add number symbol#2319
jo-elimu merged 2 commits intomainfrom
add-number-symbol

Conversation

@jo-elimu
Copy link
Copy Markdown
Member

@jo-elimu jo-elimu commented Jul 29, 2025

https://github.com/elimu-ai/analytics/releases/tag/4.1.5

Issue Number

  • Resolves #

Purpose

Technical Details

Testing Instructions

Screenshots


Format Checks

Note

Files in PRs are automatically checked for format violations with mvn spotless:check.

If this PR contains files with format violations, run mvn spotless:apply to fix them.

@jo-elimu jo-elimu self-assigned this Jul 29, 2025
@jo-elimu jo-elimu requested a review from a team as a code owner July 29, 2025 12:02
@jo-elimu jo-elimu requested review from shiv810, vrudas and vuriaval and removed request for a team July 29, 2025 12:02
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 29, 2025

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.13%. Comparing base (97ebc15) to head (7b5d45d).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...i/elimu/util/csv/CsvAnalyticsExtractionHelper.java 0.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2319      +/-   ##
============================================
- Coverage     17.14%   17.13%   -0.01%     
  Complexity      461      461              
============================================
  Files           260      260              
  Lines          7730     7734       +4     
  Branches        898      900       +2     
============================================
  Hits           1325     1325              
- Misses         6323     6326       +3     
- Partials         82       83       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 29, 2025

Walkthrough

The changes update the dependency version of the ai.elimu:webapp artifact and its ai.elimu:model dependency. The Javadoc comment for a field in NumberAssessmentEvent is clarified. In CsvAnalyticsExtractionHelper, logic is added to conditionally set the numberSymbol field based on the CSV version and field content.

Changes

Cohort / File(s) Change Summary
Dependency Version Update
pom-dependency-tree.txt
Updated ai.elimu:webapp to 2.6.113-SNAPSHOT and ai.elimu:model to 2.0.119.
Javadoc Clarification
src/main/java/ai/elimu/entity/analytics/NumberAssessmentEvent.java
Improved Javadoc for numberSymbol field, clarifying the example and context.
Conditional Field Extraction
src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java
Added version and blank-check condition before setting numberSymbol during CSV extraction in extractNumberAssessmentEvents.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-number-symbol

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14cc508 and 7b5d45d.

⛔ Files ignored due to path filters (1)
  • pom.xml is excluded by !**/*.xml
📒 Files selected for processing (3)
  • pom-dependency-tree.txt (1 hunks)
  • src/main/java/ai/elimu/entity/analytics/NumberAssessmentEvent.java (1 hunks)
  • src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.
Learnt from: jo-elimu
PR: elimu-ai/webapp#2312
File: src/main/java/ai/elimu/entity/analytics/LetterSoundLearningEvent.java:19-31
Timestamp: 2025-07-27T03:40:02.040Z
Learning: In the elimu.ai webapp project, the database schema file at `src/main/resources/META-INF/jpa-schema-export.sql` is auto-generated from JPA entity annotations, so manual updates to this file are not needed when adding new entity fields.
Learnt from: jo-elimu
PR: elimu-ai/webapp#2237
File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java:287-288
Timestamp: 2025-06-09T06:52:22.910Z
Learning: VideoLearningEvents in CsvAnalyticsExtractionHelper never used the "time" column name and always use "timestamp", unlike other event types (LetterSoundLearningEvent, WordAssessmentEvent, WordLearningEvent, StoryBookLearningEvent) which need conditional logic to handle both "time" (for versions < 3.4.0) and "timestamp" (for versions >= 3.4.0) column names. This is because VideoLearningEvents were introduced after the schema change.
Learnt from: jo-elimu
PR: elimu-ai/webapp#2269
File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java:80-88
Timestamp: 2025-06-20T05:28:00.962Z
Learning: In CsvAnalyticsExtractionHelper.java, the CSV columns for research_experiment and experiment_group contain integer values (0 or 1) that need to be mapped to enum ordinals by adding 1 to the CSV value (0 maps to ordinal 1, 1 maps to ordinal 2).
src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java (3)

Learnt from: jo-elimu
PR: #2237
File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java:287-288
Timestamp: 2025-06-09T06:52:22.910Z
Learning: VideoLearningEvents in CsvAnalyticsExtractionHelper never used the "time" column name and always use "timestamp", unlike other event types (LetterSoundLearningEvent, WordAssessmentEvent, WordLearningEvent, StoryBookLearningEvent) which need conditional logic to handle both "time" (for versions < 3.4.0) and "timestamp" (for versions >= 3.4.0) column names. This is because VideoLearningEvents were introduced after the schema change.

Learnt from: jo-elimu
PR: #2269
File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java:80-88
Timestamp: 2025-06-20T05:28:00.962Z
Learning: In CsvAnalyticsExtractionHelper.java, the CSV columns for research_experiment and experiment_group contain integer values (0 or 1) that need to be mapped to enum ordinals by adding 1 to the CSV value (0 maps to ordinal 1, 1 maps to ordinal 2).

Learnt from: jo-elimu
PR: #2284
File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java:242-245
Timestamp: 2025-06-25T07:56:10.189Z
Learning: In Apache Commons CSV, the CSVRecord.isSet(String name) method returns true only if the column exists AND the value is not null. This means it already handles both column existence and non-null value validation, making it safe to use for conditional field processing without additional empty/blank checks.

pom-dependency-tree.txt (2)

Learnt from: jo-elimu
PR: elimu-ai/webapp#0
File: :0-0
Timestamp: 2025-05-03T08:01:30.217Z
Learning: The elimu-ai/webapp repository has a dependency on ai.elimu:model (version 2.0.97) that provides shared model classes and enums. The Language enum should be imported from ai.elimu.model.v2.enums.Language instead of creating local duplicates.

Learnt from: jo-elimu
PR: #2312
File: src/main/java/ai/elimu/entity/analytics/LetterSoundLearningEvent.java:19-31
Timestamp: 2025-07-27T03:40:02.040Z
Learning: In the elimu.ai webapp project, the database schema file at src/main/resources/META-INF/jpa-schema-export.sql is auto-generated from JPA entity annotations, so manual updates to this file are not needed when adding new entity fields.

src/main/java/ai/elimu/entity/analytics/NumberAssessmentEvent.java (1)

Learnt from: venkatesh2k3
PR: #1682
File: src/main/java/ai/elimu/dao/LetterSoundContributionEventDao.java:13-13
Timestamp: 2024-07-06T17:37:44.413Z
Learning: In the LetterSoundContributionEventDao.java file, the method signatures should use LetterSoundContributionEvent instead of LetterSoundCorrespondenceContributionEvent to maintain consistency with the renaming of entities.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
  • GitHub Check: test_rest
  • GitHub Check: test_rest
  • GitHub Check: test_rest
  • GitHub Check: test_rest
  • GitHub Check: build (windows-latest, 17)
  • GitHub Check: build (macos-latest, 21)
  • GitHub Check: build (windows-latest, 21)
  • GitHub Check: build (macos-latest, 17)
  • GitHub Check: build (ubuntu-latest, 21)
  • GitHub Check: build (ubuntu-latest, 17)
  • GitHub Check: test_rest
  • GitHub Check: test_rest
🔇 Additional comments (2)
pom-dependency-tree.txt (1)

1-2: LGTM! Version increments are consistent.

The webapp version increment from 2.6.112-SNAPSHOT to 2.6.113-SNAPSHOT and the model dependency update from 2.0.118 to 2.0.119 are appropriate incremental changes that align with the new number symbol functionality.

src/main/java/ai/elimu/entity/analytics/NumberAssessmentEvent.java (1)

22-22: LGTM! Documentation improvement enhances clarity.

The updated Javadoc comment explicitly clarifies that "१०" represents the number 10 in Hindi, which improves developer understanding and aligns well with the conditional CSV processing logic for the numberSymbol field.

Comment on lines +547 to +553
if (versionCode >= 4001005) {
// https://github.com/elimu-ai/analytics/releases/tag/4.1.5
if (StringUtils.isNotBlank(csvRecord.get("number_symbol"))) {
String numberSymbol = csvRecord.get("number_symbol");
numberAssessmentEvent.setNumberSymbol(numberSymbol);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

LGTM! Version-based conditional logic follows established patterns.

The implementation correctly follows the established pattern for version-based feature support:

  • Proper version check for 4.1.5+ (4001005)
  • Appropriate use of StringUtils.isNotBlank() for field validation
  • Consistent with other conditional extractions in the file

However, please verify consistency with the extractNumberLearningEvents method (lines 471-474), which appears to process number_symbol without version checks. Ensure this difference is intentional based on when the field was introduced for each event type.


🏁 Script executed:

#!/bin/bash
# Search for numberSymbol field usage across the codebase to verify consistency
echo "=== Searching for numberSymbol field usage ==="
rg -A 3 -B 3 "number_symbol|numberSymbol" --type java

echo "=== Checking for version-based logic patterns ==="
rg -A 5 -B 2 "versionCode.*40010" --type java

Length of output: 8976


Add version guard for number_symbol in NumberLearningEvents parsing

The number_symbol field was introduced in Analytics 4.1.5, but in extractNumberLearningEvents() it’s parsed unconditionally. This will fail on older CSVs that don’t include that column. Wrap the existing logic in a versionCode >= 4001005 check, mirroring the assessment event handler:

• File: src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java
Location: within extractNumberLearningEvents() (around lines 471–474)

• Replace:

if (StringUtils.isNotBlank(csvRecord.get("number_symbol"))) {
    String numberSymbol = csvRecord.get("number_symbol");
    numberLearningEvent.setNumberSymbol(numberSymbol);
}

With:

if (versionCode >= 4001005) {
    if (StringUtils.isNotBlank(csvRecord.get("number_symbol"))) {
        String numberSymbol = csvRecord.get("number_symbol");
        numberLearningEvent.setNumberSymbol(numberSymbol);
    }
}
🤖 Prompt for AI Agents
In src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java around
lines 471 to 474 inside the extractNumberLearningEvents() method, the code
parses the number_symbol field without checking the versionCode, which causes
failures on older CSVs missing this column. To fix this, wrap the existing
number_symbol parsing logic in a condition that checks if versionCode is greater
than or equal to 4001005, ensuring the field is only accessed for compatible
versions.

@jo-elimu jo-elimu merged commit f78147c into main Jul 29, 2025
19 of 20 checks passed
@jo-elimu jo-elimu deleted the add-number-symbol branch July 29, 2025 12:10
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.

1 participant