Skip to content

Conversation

@ranelbatra
Copy link

@ranelbatra ranelbatra commented Aug 19, 2025

Summary by CodeRabbit

  • New Features
    • Supports creating and updating birth registration records, including baby details, parent references, birth event information (place and time), and full address.
    • Ensures transactional processing for reliable data persistence across related records.
    • Enables consistent capture of audit information (created by/modified by and timestamps) during save and update flows.
    • Improves backend readiness for handling birth registration application submissions and subsequent edits without user-facing changes to the interface.

@ranelbatra ranelbatra requested review from a team and kapil-eGov as code owners August 19, 2025 20:37
@coderabbitai
Copy link

coderabbitai bot commented Aug 19, 2025

Walkthrough

Adds a new persister YAML configuration for birth registration. It defines serviceMaps for btr-services with two transactional mappings: one consumes save-bt-application to insert into eg_bt_registration and eg_bt_address; another consumes update-bt-application to update fields in eg_bt_registration. Data is extracted from BirthRegistrationApplications.* via jsonPath mappings.

Changes

Cohort / File(s) Summary
Birth registration persister config
egov-persister/btr-persister.yml
New serviceMaps for btr-services. Mapping 1 (v1.0): fromTopic save-bt-application, inserts into eg_bt_registration and eg_bt_address using JSONPaths under BirthRegistrationApplications.*. Mapping 2 (v1.0): fromTopic update-bt-application, updates tenantid, babyFirstName, timeOfBirth in eg_bt_registration by id.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Producer as Producer
  participant Kafka as Kafka Topics
  participant Persister as EGOV Persister (btr-services)
  participant DB as Database

  rect rgba(230,245,255,0.6)
    note over Producer,Kafka: Create flow
    Producer->>Kafka: publish save-bt-application
    Kafka-->>Persister: save-bt-application event
    Persister->>Persister: Extract BirthRegistrationApplications.* (jsonPath)
    Persister->>DB: INSERT into eg_bt_registration
    Persister->>DB: INSERT into eg_bt_address
    DB-->>Persister: ACK (transactional)
  end

  rect rgba(240,255,230,0.6)
    note over Producer,Kafka: Update flow
    Producer->>Kafka: publish update-bt-application
    Kafka-->>Persister: update-bt-application event
    Persister->>Persister: Extract BirthRegistrationApplications.* (jsonPath)
    Persister->>DB: UPDATE eg_bt_registration SET tenantid, babyFirstName, timeOfBirth WHERE id=?
    DB-->>Persister: ACK (transactional)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit taps out YAML beats,
Two topics hop to storage seats.
One saves tiny toes and names,
One updates times in tidy frames.
Tables burrow, bytes take flight—
BTR now persists just right.
Thump-thump, shipped tonight! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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

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

🧹 Nitpick comments (2)
egov-persister/btr-persister.yml (2)

18-18: Lint failures: trailing spaces and missing newline at EOF.

Static analysis flags trailing spaces on multiple lines and a missing newline at EOF. Please strip trailing spaces and add a final newline to keep CI happy.

Quick fix suggestions:

  • Remove trailing spaces on the listed lines.
  • Ensure the file ends with a single newline.

You can auto-fix locally with:

  • VS Code: Toggle “Trim Trailing Whitespace on Save”.
  • CLI: sed -i 's/[ \t]*$//' egov-persister/btr-persister.yml and printf '\n' >> egov-persister/btr-persister.yml (only if the last line isn’t already newline-terminated).

Also applies to: 20-20, 22-22, 24-24, 26-26, 28-28, 30-30, 34-34, 40-40, 101-101, 104-104


95-104: Update query should also set lastModified fields; align column casing.

Currently only tenant, baby name, and time are updated. Persisting audit changes (lastModifiedBy/Time) is standard and useful for traceability. Also, align column casing with the insert (lowercase) to avoid ambiguity.

Proposed change:

-        - query: UPDATE eg_bt_registration SET tenantid = ?,babyFirstName = ?, timeOfBirth = ? WHERE id=?;
+        - query: UPDATE eg_bt_registration
+                 SET tenantid = ?, babyfirstname = ?, timeofbirth = ?, lastmodifiedby = ?, lastmodifiedtime = ?
+                 WHERE id = ?;
           basePath: BirthRegistrationApplications.*
           jsonMaps:
             - jsonPath: $.BirthRegistrationApplications.*.tenantId
-
-            - jsonPath: $.BirthRegistrationApplications.*.babyFirstName
-           
-            - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth
-
-            - jsonPath: $.BirthRegistrationApplications.*.id
+            - jsonPath: $.BirthRegistrationApplications.*.babyFirstName
+            - jsonPath: $.BirthRegistrationApplications.*.timeOfBirth
+            - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedBy
+            - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedTime
+            - jsonPath: $.BirthRegistrationApplications.*.id
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6b8e739 and 9e7a7f6.

📒 Files selected for processing (1)
  • egov-persister/btr-persister.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
egov-persister/btr-persister.yml

[error] 7-7: syntax error: found character '\t' that cannot start any token

(syntax)


[error] 18-18: trailing spaces

(trailing-spaces)


[error] 20-20: trailing spaces

(trailing-spaces)


[error] 22-22: trailing spaces

(trailing-spaces)


[error] 24-24: trailing spaces

(trailing-spaces)


[error] 26-26: trailing spaces

(trailing-spaces)


[error] 28-28: trailing spaces

(trailing-spaces)


[error] 30-30: trailing spaces

(trailing-spaces)


[error] 34-34: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 101-101: trailing spaces

(trailing-spaces)


[error] 104-104: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
egov-persister/btr-persister.yml (3)

10-41: Insert into eg_bt_registration: placeholders and jsonPaths align.

  • 15 columns, 15 placeholders, 15 jsonPaths — consistent.
  • Base path and jsonPath usage are aligned.

No blocking issues here.


74-74: Confirm which locality attribute is expected in DB (name vs code).

Column locality often expects the boundary code, not the display name. Current mapping uses address.locality.name.

If the schema expects the code, switch to address.locality.code:

-            - jsonPath: $.BirthRegistrationApplications.*.address.locality.name
+            - jsonPath: $.BirthRegistrationApplications.*.address.locality.code

Please confirm against the table definition for eg_bt_address.locality.


6-6: Confirm Kafka topic names
The persister config in egov-persister/btr-persister.yml (lines 6 & 92) references:

  • fromTopic: save-bt-application
  • fromTopic: update-bt-application

The service is named “btr-services,” but we didn’t find any occurrences of “save-btr-application” or “update-btr-application” in this repo. Please verify that the producer actually emits to save-bt-application and update-bt-application (or update these mappings if the topics should be “btr”).

- version: 1.0
description: Persists birth details in tables
fromTopic: save-bt-application
isTransaction: true
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

YAML syntax error: tab character present.

YAML does not allow tabs. This line has a tab at the end, causing a parser error (see YAMLlint).

Apply this diff to remove the tab:

-      isTransaction: true	
+      isTransaction: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
isTransaction: true
isTransaction: true
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 7-7: syntax error: found character '\t' that cannot start any token

(syntax)

🤖 Prompt for AI Agents
In egov-persister/btr-persister.yml around line 7, the value line
"isTransaction: true" contains a trailing tab character which causes a YAML
syntax error; remove the tab and replace it with spaces (or delete the trailing
whitespace) so the line ends with standard spaces/newline, ensure the file uses
spaces instead of tabs throughout, and re-run the YAML linter to confirm the
file parses correctly.

Comment on lines +82 to +88
- jsonPath: $.BirthRegistrationApplications.*.address.createdBy

- jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedBy

- jsonPath: $.BirthRegistrationApplications.*.address.createdTime

- jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedTime
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Address audit fields mapped from address.*; likely should use application auditDetails.

Typical eGov payloads carry auditDetails at the root object, and child entities reuse those values. Using address.createdBy/lastModified* will insert NULLs if those fields don’t exist under address and may violate NOT NULL constraints.

Apply this diff to source the audit fields from the application’s auditDetails:

-            - jsonPath: $.BirthRegistrationApplications.*.address.createdBy
-            - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedBy
-            - jsonPath: $.BirthRegistrationApplications.*.address.createdTime
-            - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedTime
+            - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdBy
+            - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedBy
+            - jsonPath: $.BirthRegistrationApplications.*.auditDetails.createdTime
+            - jsonPath: $.BirthRegistrationApplications.*.auditDetails.lastModifiedTime

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