Skip to content

feat(app): facilitate exchange of db column names through bundle keys#366

Merged
jo-elimu merged 3 commits intomainfrom
365-enable-future-renaming-of-database-column-names
Jun 27, 2025
Merged

feat(app): facilitate exchange of db column names through bundle keys#366
jo-elimu merged 3 commits intomainfrom
365-enable-future-renaming-of-database-column-names

Conversation

@jo-elimu
Copy link
Copy Markdown
Member

@jo-elimu jo-elimu commented Jun 26, 2025

Issue Number

Purpose

Technical Details

  • This issue will be solved through two separate pull requests (see Enable future renaming of database column names #365); First one for the :app module, and then (a few days/weeks later) another pull request for the :utils module. This way, the refactoring can happen gradually without disruption.

Screenshots

Testing Instructions

Regression Tests

  • I tested my changes on Android 16 (API 36)
  • I tested my changes on Android 15 (API 35)
  • I tested my changes on Android 14 (API 34)
  • I tested my changes on Android 13 (API 33)
  • I tested my changes on Android 12L (API 32)
  • I tested my changes on Android 12 (API 31)
  • I tested my changes on Android 11 (API 30)
  • I tested my changes on Android 10 (API 29)
  • I tested my changes on Android 9 (API 28)
  • I tested my changes on Android 8.1 (API 27)
  • I tested my changes on Android 8.0 (API 26)

UI Tests

  • I tested my changes on a 6-7" screen (▯ portrait orientation)
  • I tested my changes on a 6-7" screen (▭ landscape orientation)
  • I tested my changes on a 7-8" screen (▯ portrait orientation)
  • I tested my changes on a 7-8" screen (▭ landscape orientation)
  • I tested my changes on a 9-10" screen (▯ portrait orientation)
  • I tested my changes on a 9-10" screen (▭ landscape orientation)

Content Tests

  • I tested my changes with English content (eng.elimu.ai)
  • I tested my changes with Hindi content (hin.elimu.ai)
  • I tested my changes with Tagalog content (tgl.elimu.ai)
  • I tested my changes with Thai content (tha.elimu.ai)
  • I tested my changes with Vietnamese content (vie.elimu.ai)

Summary by CodeRabbit

  • New Features
    • Added metadata bundles to query results for emojis, images, letters, letter sounds, sounds, storybooks, videos, and words. This metadata includes app version and column information, enhancing compatibility with external tools that process query data. No changes to user-facing app behavior.

@jo-elimu jo-elimu requested a review from tuancoltech June 26, 2025 08:13
@jo-elimu jo-elimu self-assigned this Jun 26, 2025
@jo-elimu jo-elimu requested a review from a team as a code owner June 26, 2025 08:13
@jo-elimu jo-elimu linked an issue Jun 26, 2025 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 26, 2025

Walkthrough

This update augments the query methods of multiple ContentProvider classes by attaching a metadata Bundle to the returned Cursor. The Bundle contains the app version code and the relevant database column names for each entity. These enhancements facilitate downstream conversion of Cursor data to JSON, supporting elimu.ai's mission to build innovative learning software that empowers out-of-school children to teach themselves basic reading📖, writing✍🏽 and math🔢 within 6 months.

Changes

Files (Grouped) Change Summary
.../provider/EmojiContentProvider.kt
.../provider/ImageContentProvider.kt
.../provider/LetterContentProvider.kt
.../provider/LetterSoundContentProvider.kt
.../provider/SoundContentProvider.kt
.../provider/StoryBookContentProvider.kt
.../provider/VideoContentProvider.kt
.../provider/WordContentProvider.kt
Added a metadata Bundle (with app version code and entity-specific column names) to the extras property of Cursors returned by all query cases in each provider. No changes to query logic or error handling.

Sequence Diagram(s)

sequenceDiagram
    participant ClientApp
    participant ContentProvider
    participant Database

    ClientApp->>ContentProvider: query(requested URI)
    ContentProvider->>Database: Execute query
    Database-->>ContentProvider: Return Cursor
    ContentProvider->>ContentProvider: Create metadata Bundle (version code, column names)
    ContentProvider->>ContentProvider: Attach Bundle to Cursor.extras
    ContentProvider-->>ClientApp: Return Cursor with metadata
Loading

Possibly related PRs


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 599ed5d and 8a06137.

📒 Files selected for processing (8)
  • app/src/main/java/ai/elimu/content_provider/provider/EmojiContentProvider.kt (5 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/ImageContentProvider.kt (5 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/LetterContentProvider.kt (5 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/LetterSoundContentProvider.kt (4 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/SoundContentProvider.kt (5 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/StoryBookContentProvider.kt (6 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/VideoContentProvider.kt (5 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/WordContentProvider.kt (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • app/src/main/java/ai/elimu/content_provider/provider/SoundContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/EmojiContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/LetterSoundContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/VideoContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/StoryBookContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/ImageContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/WordContentProvider.kt
  • app/src/main/java/ai/elimu/content_provider/provider/LetterContentProvider.kt
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: build (ubuntu-latest, 17)
  • GitHub Check: build (windows-latest, 17)
  • GitHub Check: build (windows-latest, 21)
  • GitHub Check: build (macos-latest, 21)
  • GitHub Check: build (macos-latest, 17)
  • GitHub Check: build (ubuntu-latest, 21)
  • GitHub Check: test (28)
  • GitHub Check: lint
  • GitHub Check: test (29)
✨ Finishing Touches
  • 📝 Generate Docstrings

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

@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: 3

♻️ Duplicate comments (15)
app/src/main/java/ai/elimu/content_provider/provider/LetterSoundContentProvider.kt (1)

79-87: Same extras assignment bug (see above)

Please apply the same fix here.

app/src/main/java/ai/elimu/content_provider/provider/EmojiContentProvider.kt (3)

56-67: extras assignment bug – identical to LetterSound provider

Apply cursor.setExtras(bundle) instead.


84-95: Repeat of extras assignment bug


112-123: Repeat of extras assignment bug

app/src/main/java/ai/elimu/content_provider/provider/WordContentProvider.kt (3)

64-74: extras assignment bug – use setExtras.


91-101: Repeat of extras assignment bug


118-127: Repeat of extras assignment bug

app/src/main/java/ai/elimu/content_provider/provider/LetterContentProvider.kt (3)

52-62: extras assignment bug – swap to setExtras.


79-89: Repeat of extras assignment bug


106-115: Repeat of extras assignment bug

app/src/main/java/ai/elimu/content_provider/provider/VideoContentProvider.kt (3)

64-74: extras assignment bug


91-100: Repeat of extras assignment bug


117-126: Repeat of extras assignment bug

app/src/main/java/ai/elimu/content_provider/provider/ImageContentProvider.kt (1)

63-74: Same duplication pattern – apply a shared helper

Exactly the same comment as for SoundContentProvider: replicate-free code by introducing a buildImageExtras() (or generic) helper and constant keys, then assign cursor.extras with a single call.

Less duplication → easier maintenance → more time for features that advance elimu.ai’s learning mission. 🚀

Also applies to: 91-102, 119-130

app/src/main/java/ai/elimu/content_provider/provider/StoryBookContentProvider.kt (1)

63-75: Refactor away repeated Bundle construction (as per other providers)

See earlier note in SoundContentProvider. A shared helper (e.g., StoryBookExtras.builder()) will cut the repeated 13-line block, shrink the class, and avoid mistakes like the one flagged above.

Also applies to: 95-107

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f0a40b7 and 599ed5d.

📒 Files selected for processing (8)
  • app/src/main/java/ai/elimu/content_provider/provider/EmojiContentProvider.kt (4 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/ImageContentProvider.kt (4 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/LetterContentProvider.kt (4 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/LetterSoundContentProvider.kt (3 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/SoundContentProvider.kt (4 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/StoryBookContentProvider.kt (5 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/VideoContentProvider.kt (4 hunks)
  • app/src/main/java/ai/elimu/content_provider/provider/WordContentProvider.kt (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: test (28)
  • GitHub Check: test (29)
  • GitHub Check: build (ubuntu-latest, 17)
  • GitHub Check: build (macos-latest, 17)
  • GitHub Check: build (windows-latest, 17)
  • GitHub Check: build (ubuntu-latest, 21)
  • GitHub Check: build (windows-latest, 21)
  • GitHub Check: build (macos-latest, 21)
  • GitHub Check: lint

@elimu-ai elimu-ai deleted a comment from coderabbitai bot Jun 26, 2025
@jo-elimu jo-elimu merged commit 4be579a into main Jun 27, 2025
9 checks passed
@jo-elimu jo-elimu deleted the 365-enable-future-renaming-of-database-column-names branch June 27, 2025 10:35
@coderabbitai coderabbitai bot mentioned this pull request Jul 28, 2025
22 tasks
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.

Enable future renaming of database column names

1 participant