-
Notifications
You must be signed in to change notification settings - Fork 170
Add btr-persister.yml for birth module #3717
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
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
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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.ymlandprintf '\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.
📒 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
localityoften expects the boundary code, not the display name. Current mapping usesaddress.locality.name.If the schema expects the code, switch to
address.locality.code:- - jsonPath: $.BirthRegistrationApplications.*.address.locality.name + - jsonPath: $.BirthRegistrationApplications.*.address.locality.codePlease 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
| - jsonPath: $.BirthRegistrationApplications.*.address.createdBy | ||
|
|
||
| - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedBy | ||
|
|
||
| - jsonPath: $.BirthRegistrationApplications.*.address.createdTime | ||
|
|
||
| - jsonPath: $.BirthRegistrationApplications.*.address.lastModifiedTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Summary by CodeRabbit