Skip to content

104: Add Call Activity Details Section for Outbound Calls#96

Merged
paras-dba merged 5 commits intomainfrom
nd/vs/outbound_call
Mar 3, 2026
Merged

104: Add Call Activity Details Section for Outbound Calls#96
paras-dba merged 5 commits intomainfrom
nd/vs/outbound_call

Conversation

@vanitha1822
Copy link
Member

@vanitha1822 vanitha1822 commented Feb 20, 2026

📋 Description

JIRA ID:

AMM-2083


✅ Type of Change

  • New feature (non-breaking change which adds functionality)

Summary by CodeRabbit

  • New Features

    • Added outbound call activity tracking with structured records for activity IDs, names, status, remarks, beneficiary phone and additional call metadata to improve monitoring and reporting.
  • Chores

    • Applied a safe, idempotent database migration to create the new activity table and add missing call-related columns without disrupting existing schemas.

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds SQL migration V61 that creates m_outbound_call_activity and uses INFORMATION_SCHEMA-driven dynamic SQL to conditionally add or modify columns on t_104CoMoOutboundCallDetails (ActivityID, CallStatus, CallRemarks, CzentrixCallID alteration, BeneficiaryPhoneNumber).

Changes

Cohort / File(s) Summary
Database Migration
src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql
Adds creation of m_outbound_call_activity. Uses INFORMATION_SCHEMA checks and prepared statements to conditionally add ActivityID (BIGINT), CallStatus (VARCHAR(50)), CallRemarks (VARCHAR(500)), BeneficiaryPhoneNumber (VARCHAR(255)) to t_104CoMoOutboundCallDetails, and attempt to alter CzentrixCallID to VARCHAR(30) if present (no-op otherwise).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through schema fields so bright,
Checked each column by soft starlight,
Added Activity rows with care,
Tucked defaults in — all set and fair,
Now migrations dream in quiet night. 🌙✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a Call Activity Details section for outbound calls via a new SQL migration script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nd/vs/outbound_call

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@vanitha1822 vanitha1822 self-assigned this Feb 20, 2026
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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql`:
- Around line 66-80: The prepared statement for modifying CzentrixCallID is
using a hardcoded table name `db_iemr.t_104CoMoOutboundCallDetails` instead of
the dynamic schema/table variables; update the construction of
`@preparedStatement` (the SELECT/IF that builds the ALTER) to use
CONCAT(`@dbname`, '.', `@tablename`) for the ALTER TABLE target (consistent with the
other blocks using `@dbname` and `@tablename`) so the ALTER operates on the intended
database/table at runtime.
- Around line 3-11: Add a UNIQUE constraint on ActivityName in the
m_outbound_call_activity table to prevent duplicates (modify the CREATE TABLE in
V61__Outbound_CallActivity.sql to include UNIQUE on ActivityName), insert the
required seed rows for the master data immediately after the CREATE TABLE (use
INSERT INTO m_outbound_call_activity (...) VALUES (...) for the expected
activities), and fix the hardcoded ALTER TABLE statement that references
t_104CoMoOutboundCallDetails by replacing the literal SQL string with a CONCAT
using `@dbname` and `@tablename` (e.g., change the `'ALTER TABLE
db_iemr.t_104CoMoOutboundCallDetails ...'` entry to use CONCAT('ALTER TABLE
',`@dbname`,'.',`@tablename`,' ...') so it follows the same variable-driven
pattern).
- Around line 17-30: The new ActivityID column on t_104CoMoOutboundCallDetails
needs a conditional foreign key creation block added immediately after the ADD
COLUMN step: check INFORMATION_SCHEMA.TABLE_CONSTRAINTS for the existence of
constraint fk_104CoMoOutboundCallDetails_ActivityID and, if missing, run an
ALTER TABLE t_104CoMoOutboundCallDetails ADD CONSTRAINT
fk_104CoMoOutboundCallDetails_ActivityID FOREIGN KEY (ActivityID) REFERENCES
m_outbound_call_activity(ActivityID); use the same PREPARE/EXECUTE/DEALLOCATE
PREPARE pattern as the ADD COLUMN block so the FK is created only when absent.

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

♻️ Duplicate comments (3)
src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql (3)

17-32: Missing FK constraint for ActivityID.

Already raised in a previous review — a conditional ALTER TABLE … ADD CONSTRAINT … FOREIGN KEY (ActivityID) REFERENCES m_outbound_call_activity(ActivityID) block using the same PREPARE/EXECUTE pattern is still absent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql` around
lines 17 - 32, Add a conditional foreign-key constraint creation for ActivityID
similar to the existing column-add block: after the ALTER/ADD COLUMN logic for
ActivityID, build a `@preparedStatement` that checks
INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS/KEY_COLUMN_USAGE for an existing FK
and, if absent, CONVERT it into an ALTER TABLE ... ADD CONSTRAINT
fk_outbound_call_activity FOREIGN KEY (ActivityID) REFERENCES
m_outbound_call_activity(ActivityID); then PREPARE stmt FROM `@preparedStatement`;
EXECUTE stmt; and DEALLOCATE PREPARE stmt; so the code using `@preparedStatement`,
PREPARE stmt, EXECUTE stmt, and DEALLOCATE PREPARE stmt mirrors the column
creation pattern but enforces the FK.

73-85: Hardcoded table reference on line 80.

Already flagged in a previous review — the 'ALTER TABLE db_iemr.t_104CoMoOutboundCallDetails MODIFY COLUMN CzentrixCallID VARCHAR(30);' literal should use CONCAT(@dbname, '.', @tablename, ' MODIFY COLUMN CzentrixCallID VARCHAR(30);') to match the pattern used in every other block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql` around
lines 73 - 85, The ALTER TABLE statement currently hardcodes the schema and
table name in the `@preparedStatement` string; update the `@preparedStatement`
construction (where `@columnname` = 'CzentrixCallID' and PREPARE stmt / EXECUTE
stmt are used) to build the ALTER statement with CONCAT(`@dbname`, '.',
`@tablename`, ' MODIFY COLUMN CzentrixCallID VARCHAR(30);') so it matches the
pattern used elsewhere and avoids the literal
'db_iemr.t_104CoMoOutboundCallDetails'.

3-11: No UNIQUE constraint on ActivityName and no seed data.

Already flagged in a previous review — both the missing UNIQUE constraint and absent seed INSERT statements should be addressed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql` around
lines 3 - 11, Add a UNIQUE constraint on the ActivityName column and include
seed INSERTs for the m_outbound_call_activity table: modify the CREATE TABLE
m_outbound_call_activity statement to define ActivityName as UNIQUE (either
inline UNIQUE key or a separate UNIQUE INDEX on ActivityName) and append
idempotent seed INSERT statements (e.g., INSERT IGNORE or INSERT ... ON
DUPLICATE KEY UPDATE) that populate default activities with values for
ActivityName, IsActive, CreatedBy, CreatedDate, ModifiedBy, LastModDate so the
migration creates the constraint and inserts initial rows for
m_outbound_call_activity.
🧹 Nitpick comments (1)
src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql (1)

87-199: Inconsistent DEFAULT NULL across ADD COLUMN statements.

The first three blocks (lines 28, 46, 64) declare columns with DEFAULT NULL explicitly, while all ten columns in the "Additional Columns" section omit it entirely. Functionally equivalent, but inconsistent within the same script.

♻️ Proposed fix (representative example)
- CONCAT('ALTER TABLE ',`@dbname`,'.',`@tablename`,' ADD COLUMN BeneficiaryRegID BIGINT;')
+ CONCAT('ALTER TABLE ',`@dbname`,'.',`@tablename`,' ADD COLUMN BeneficiaryRegID BIGINT DEFAULT NULL;')

Apply the same DEFAULT NULL suffix to all ten ADD COLUMN strings in this section.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql` around
lines 87 - 199, The ADD COLUMN statements for BeneficiaryRegID,
ProviderServiceMapID, PrefferedDateTime, BenCallID, RequestedFor, CallTypeID,
SubServiceID, AssignedUserID, RequestedFeature, and IsSelf are missing the
"DEFAULT NULL" suffix and should match the earlier blocks; update the
CONCAT(...) strings that build `@preparedStatement` (the dynamic ALTER TABLE
statements) to append " DEFAULT NULL;" for each column so the generated ALTER
TABLE for each column includes DEFAULT NULL, keeping the same pattern used in
the first three column blocks and using the same `@columnname/`@preparedStatement
flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql`:
- Around line 113-122: The migration V61__Outbound_CallActivity.sql currently
creates/checks for the misspelled column name PrefferedDateTime; update the
migration to use the correct column name PreferredDateTime everywhere (change
the `@columnname` value and the ALTER TABLE ADD COLUMN clause), and also handle
existing databases that may already have the misspelled PrefferedDateTime by
adding logic to detect PrefferedDateTime and RENAME it to PreferredDateTime (or
add PreferredDateTime if rename is not desired), keeping the PREPARE
stmt/EXECUTE stmt pattern consistent.

---

Duplicate comments:
In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql`:
- Around line 17-32: Add a conditional foreign-key constraint creation for
ActivityID similar to the existing column-add block: after the ALTER/ADD COLUMN
logic for ActivityID, build a `@preparedStatement` that checks
INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS/KEY_COLUMN_USAGE for an existing FK
and, if absent, CONVERT it into an ALTER TABLE ... ADD CONSTRAINT
fk_outbound_call_activity FOREIGN KEY (ActivityID) REFERENCES
m_outbound_call_activity(ActivityID); then PREPARE stmt FROM `@preparedStatement`;
EXECUTE stmt; and DEALLOCATE PREPARE stmt; so the code using `@preparedStatement`,
PREPARE stmt, EXECUTE stmt, and DEALLOCATE PREPARE stmt mirrors the column
creation pattern but enforces the FK.
- Around line 73-85: The ALTER TABLE statement currently hardcodes the schema
and table name in the `@preparedStatement` string; update the `@preparedStatement`
construction (where `@columnname` = 'CzentrixCallID' and PREPARE stmt / EXECUTE
stmt are used) to build the ALTER statement with CONCAT(`@dbname`, '.',
`@tablename`, ' MODIFY COLUMN CzentrixCallID VARCHAR(30);') so it matches the
pattern used elsewhere and avoids the literal
'db_iemr.t_104CoMoOutboundCallDetails'.
- Around line 3-11: Add a UNIQUE constraint on the ActivityName column and
include seed INSERTs for the m_outbound_call_activity table: modify the CREATE
TABLE m_outbound_call_activity statement to define ActivityName as UNIQUE
(either inline UNIQUE key or a separate UNIQUE INDEX on ActivityName) and append
idempotent seed INSERT statements (e.g., INSERT IGNORE or INSERT ... ON
DUPLICATE KEY UPDATE) that populate default activities with values for
ActivityName, IsActive, CreatedBy, CreatedDate, ModifiedBy, LastModDate so the
migration creates the constraint and inserts initial rows for
m_outbound_call_activity.

---

Nitpick comments:
In `@src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql`:
- Around line 87-199: The ADD COLUMN statements for BeneficiaryRegID,
ProviderServiceMapID, PrefferedDateTime, BenCallID, RequestedFor, CallTypeID,
SubServiceID, AssignedUserID, RequestedFeature, and IsSelf are missing the
"DEFAULT NULL" suffix and should match the earlier blocks; update the
CONCAT(...) strings that build `@preparedStatement` (the dynamic ALTER TABLE
statements) to append " DEFAULT NULL;" for each column so the generated ALTER
TABLE for each column includes DEFAULT NULL, keeping the same pattern used in
the first three column blocks and using the same `@columnname/`@preparedStatement
flow.
ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a5238b and ed10e25.

📒 Files selected for processing (1)
  • src/main/resources/db/migration/dbiemr/V61__Outbound_CallActivity.sql

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2026

@paras-dba paras-dba merged commit ec5b8d9 into main Mar 3, 2026
7 of 8 checks 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