Conversation
…lter Changed isoutbound filter from "is false" to "IS NOT TRUE" in Pr_104BeneficiaryReport stored procedure to include NULL records. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…as V64__Facility_Hierarchy.sql Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Creates tb_stoptb_general_examination, tb_stoptb_general_opd, tb_stoptb_diagnostics tables. Adds Stop TB nurse flow columns (_id variants + referral/screening/diagnostic fields) to tb_screening. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis pull request adds a Flyway database migration that establishes the Stop TB clinical module schema. It creates three new tables for general examination, outpatient, and diagnostics data, then extends the existing screening table with investigation recommendations and symptom-tracking columns using safe conditional additions. ChangesStop TB Schema Expansion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/resources/db/migration/dbiemr/V82__StopTB_tables.sql`:
- Around line 7-39: The column name in tb_stoptb_general_examination is
inconsistent: change beneficiary_reg_id to match the other Stop TB tables
(ben_reg_id) to avoid query/join confusion; update the CREATE TABLE statement in
V82__StopTB_tables.sql (table tb_stoptb_general_examination and column
beneficiary_reg_id) to use ben_reg_id, and also search/update any related
migration SQL, foreign key references, indexes, and application/entity code that
reference beneficiary_reg_id so they reference ben_reg_id instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0dcfc356-61f1-421a-86de-f86067ad0cc3
📒 Files selected for processing (1)
src/main/resources/db/migration/dbiemr/V82__StopTB_tables.sql
| CREATE TABLE IF NOT EXISTS `tb_stoptb_general_examination` ( | ||
| `id` BIGINT NOT NULL AUTO_INCREMENT, | ||
| `beneficiary_reg_id` BIGINT DEFAULT NULL, | ||
| `provider_service_map_id` INT DEFAULT NULL, | ||
| `pulse_rate` INT DEFAULT NULL, | ||
| `systolic_bp` INT DEFAULT NULL, | ||
| `diastolic_bp` INT DEFAULT NULL, | ||
| `random_blood_sugar` DOUBLE DEFAULT NULL, | ||
| `pallor_id` INT DEFAULT NULL, | ||
| `pallor` VARCHAR(50) DEFAULT NULL, | ||
| `icterus_id` INT DEFAULT NULL, | ||
| `icterus` VARCHAR(50) DEFAULT NULL, | ||
| `lymphadenopathy_id` INT DEFAULT NULL, | ||
| `lymphadenopathy` VARCHAR(50) DEFAULT NULL, | ||
| `oedema_id` INT DEFAULT NULL, | ||
| `oedema` VARCHAR(50) DEFAULT NULL, | ||
| `cyanosis_id` INT DEFAULT NULL, | ||
| `cyanosis` VARCHAR(50) DEFAULT NULL, | ||
| `clubbing_id` INT DEFAULT NULL, | ||
| `clubbing` VARCHAR(50) DEFAULT NULL, | ||
| `key_population_risk_factor_ids` TEXT DEFAULT NULL, | ||
| `key_population_risk_factors` TEXT DEFAULT NULL, | ||
| `hiv_status_id` INT DEFAULT NULL, | ||
| `hiv_status` VARCHAR(50) DEFAULT NULL, | ||
| `referral_to_hwc_needed_id` INT DEFAULT NULL, | ||
| `referral_to_hwc_needed` TINYINT(1) DEFAULT NULL, | ||
| `created_by` VARCHAR(255) DEFAULT NULL, | ||
| `created_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| `modified_by` VARCHAR(255) DEFAULT NULL, | ||
| `last_mod_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| `deleted` TINYINT(1) DEFAULT 0, | ||
| PRIMARY KEY (`id`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
There was a problem hiding this comment.
Inconsistent beneficiary column naming across tables.
This table uses beneficiary_reg_id while tb_stoptb_general_opd and tb_stoptb_diagnostics use ben_reg_id. This inconsistency can cause confusion when writing queries or JOINs across these related Stop TB tables.
Consider standardizing on one naming convention across all three tables.
Proposed fix to align naming
CREATE TABLE IF NOT EXISTS `tb_stoptb_general_examination` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
- `beneficiary_reg_id` BIGINT DEFAULT NULL,
+ `ben_reg_id` BIGINT DEFAULT NULL,
`provider_service_map_id` INT DEFAULT NULL,📝 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.
| CREATE TABLE IF NOT EXISTS `tb_stoptb_general_examination` ( | |
| `id` BIGINT NOT NULL AUTO_INCREMENT, | |
| `beneficiary_reg_id` BIGINT DEFAULT NULL, | |
| `provider_service_map_id` INT DEFAULT NULL, | |
| `pulse_rate` INT DEFAULT NULL, | |
| `systolic_bp` INT DEFAULT NULL, | |
| `diastolic_bp` INT DEFAULT NULL, | |
| `random_blood_sugar` DOUBLE DEFAULT NULL, | |
| `pallor_id` INT DEFAULT NULL, | |
| `pallor` VARCHAR(50) DEFAULT NULL, | |
| `icterus_id` INT DEFAULT NULL, | |
| `icterus` VARCHAR(50) DEFAULT NULL, | |
| `lymphadenopathy_id` INT DEFAULT NULL, | |
| `lymphadenopathy` VARCHAR(50) DEFAULT NULL, | |
| `oedema_id` INT DEFAULT NULL, | |
| `oedema` VARCHAR(50) DEFAULT NULL, | |
| `cyanosis_id` INT DEFAULT NULL, | |
| `cyanosis` VARCHAR(50) DEFAULT NULL, | |
| `clubbing_id` INT DEFAULT NULL, | |
| `clubbing` VARCHAR(50) DEFAULT NULL, | |
| `key_population_risk_factor_ids` TEXT DEFAULT NULL, | |
| `key_population_risk_factors` TEXT DEFAULT NULL, | |
| `hiv_status_id` INT DEFAULT NULL, | |
| `hiv_status` VARCHAR(50) DEFAULT NULL, | |
| `referral_to_hwc_needed_id` INT DEFAULT NULL, | |
| `referral_to_hwc_needed` TINYINT(1) DEFAULT NULL, | |
| `created_by` VARCHAR(255) DEFAULT NULL, | |
| `created_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| `modified_by` VARCHAR(255) DEFAULT NULL, | |
| `last_mod_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| `deleted` TINYINT(1) DEFAULT 0, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
| CREATE TABLE IF NOT EXISTS `tb_stoptb_general_examination` ( | |
| `id` BIGINT NOT NULL AUTO_INCREMENT, | |
| `ben_reg_id` BIGINT DEFAULT NULL, | |
| `provider_service_map_id` INT DEFAULT NULL, | |
| `pulse_rate` INT DEFAULT NULL, | |
| `systolic_bp` INT DEFAULT NULL, | |
| `diastolic_bp` INT DEFAULT NULL, | |
| `random_blood_sugar` DOUBLE DEFAULT NULL, | |
| `pallor_id` INT DEFAULT NULL, | |
| `pallor` VARCHAR(50) DEFAULT NULL, | |
| `icterus_id` INT DEFAULT NULL, | |
| `icterus` VARCHAR(50) DEFAULT NULL, | |
| `lymphadenopathy_id` INT DEFAULT NULL, | |
| `lymphadenopathy` VARCHAR(50) DEFAULT NULL, | |
| `oedema_id` INT DEFAULT NULL, | |
| `oedema` VARCHAR(50) DEFAULT NULL, | |
| `cyanosis_id` INT DEFAULT NULL, | |
| `cyanosis` VARCHAR(50) DEFAULT NULL, | |
| `clubbing_id` INT DEFAULT NULL, | |
| `clubbing` VARCHAR(50) DEFAULT NULL, | |
| `key_population_risk_factor_ids` TEXT DEFAULT NULL, | |
| `key_population_risk_factors` TEXT DEFAULT NULL, | |
| `hiv_status_id` INT DEFAULT NULL, | |
| `hiv_status` VARCHAR(50) DEFAULT NULL, | |
| `referral_to_hwc_needed_id` INT DEFAULT NULL, | |
| `referral_to_hwc_needed` TINYINT(1) DEFAULT NULL, | |
| `created_by` VARCHAR(255) DEFAULT NULL, | |
| `created_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| `modified_by` VARCHAR(255) DEFAULT NULL, | |
| `last_mod_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | |
| `deleted` TINYINT(1) DEFAULT 0, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/main/resources/db/migration/dbiemr/V82__StopTB_tables.sql` around lines 7
- 39, The column name in tb_stoptb_general_examination is inconsistent: change
beneficiary_reg_id to match the other Stop TB tables (ben_reg_id) to avoid
query/join confusion; update the CREATE TABLE statement in
V82__StopTB_tables.sql (table tb_stoptb_general_examination and column
beneficiary_reg_id) to use ben_reg_id, and also search/update any related
migration SQL, foreign key references, indexes, and application/entity code that
reference beneficiary_reg_id so they reference ben_reg_id instead.



📋 Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit