Skip to content

Maigration/chpc module#130

Merged
paras-dba merged 11 commits into
mainfrom
maigration/chpc_module
Jun 1, 2026
Merged

Maigration/chpc module#130
paras-dba merged 11 commits into
mainfrom
maigration/chpc_module

Conversation

@SauravBizbRolly

@SauravBizbRolly SauravBizbRolly commented May 27, 2026

Copy link
Copy Markdown
Contributor

📋 Description

JIRA ID: AMM-2232

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

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

  • New Features
    • Added comprehensive health assessment support: oral health, pain symptom evaluation, psychosocial caregiver support, nasal, throat, ear, ophthalmic, elderly health, and mental health screenings.
    • Assessments now record visit linkage and timestamp information for improved tracking of patient encounters.

Review Change Stack

@SauravBizbRolly SauravBizbRolly requested a review from paras-dba May 27, 2026 08:54
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: acdd2c83-04ca-483b-bf14-a454ee2b787d

📥 Commits

Reviewing files that changed from the base of the PR and between 5b9257c and 7b10553.

📒 Files selected for processing (1)
  • src/main/resources/db/migration/dbiemr/V82__cphc_module_migration.sql
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/resources/db/migration/dbiemr/V82__cphc_module_migration.sql

📝 Walkthrough

Walkthrough

Migration adds nine CPHC assessment tables (oral_health, pain_symptom_assessment, psychosocial_caregiver_support, nose_diagnosis_assessment, throat_diagnosis_assessment, opthalmic_visit, ear_diagnosis_assessment, elderly_health_assessment, mental_health_screening) with primary keys, patient/visit linkage columns, domain-specific nullable fields, and indexes/uniques as declared.

Changes

CPHC Health Assessment Tables

Layer / File(s) Summary
Primary symptom and assessment tables
src/main/resources/db/migration/dbiemr/V82__cphc_module_migration.sql
Six core assessment tables (oral_health, pain_symptom_assessment, psychosocial_caregiver_support, nose_diagnosis_assessment, throat_diagnosis_assessment, ear_diagnosis_assessment) created with auto-increment primary keys, patient/visit linkage fields, nullable domain-specific columns, and user_id indexes; oral_health has UNIQUE(patient_id, ben_visit_no).
Ophthalmic visit assessment
src/main/resources/db/migration/dbiemr/V82__cphc_module_migration.sql
opthalmic_visit created with visitId UUID-string primary key, patient/beneficiary/creator metadata, JSON-like text columns, sync flag, and indexes on patientID and user_id.
Comprehensive geriatric and mental health assessments
src/main/resources/db/migration/dbiemr/V82__cphc_module_migration.sql
elderly_health_assessment and mental_health_screening created with extensive geriatric and mental-health-specific fields, epoch-ms timestamp/score columns, UNIQUE(patient_id, ben_visit_no) on elderly health, and indexes on patient_id, composite (patient_id, ben_visit_no), and user_id where declared.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • paras-dba

Poem

A rabbit taps the migration key, 🐇
Nine new tables spring up with glee,
Fields for teeth, mind, ear, and eye,
Visits logged as timestamps fly,
CPHC grows—hopping records free!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title contains a typo ('Maigration' instead of 'Migration') and is overly vague with 'chpc module', failing to clearly describe the actual change: creation of nine assessment/visit tables for the cphc module. Use a clear, accurate title like 'Add CPHC assessment and visit tables' or 'Initialize CPHC schema with assessment tables' to better reflect the specific DDL changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch maigration/chpc_module

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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__cphc_module_migration.sql`:
- Around line 55-57: Several tables (pain_symptom_assessment, opthalmic_visit,
ear_diagnosis_assessment) declare `beneficiary_id` and `beneficiary_reg_id` as
mediumtext which is inconsistent with the rest of the migration where these
columns are bigint; change those column definitions to use `bigint` (e.g.,
`beneficiary_id bigint DEFAULT NULL`, `beneficiary_reg_id bigint DEFAULT NULL`)
instead of mediumtext and remove any text collation clauses, and apply the same
replacement for the other occurrences noted (the other blocks around the
commented ranges) so all tables use the same bigint type for `beneficiary_id`
and `beneficiary_reg_id`.
- Around line 19-20: The migration defines `created_date` and `updated_date` on
the oral_health table as mediumtext which diverges from the rest of V82 and
forces special-case parsing; update the column definitions in
V82__cphc_module_migration.sql for the oral_health table by changing
`created_date` and `updated_date` to a numeric epoch-ms type (bigint) consistent
with sibling assessment tables, removing the text/collation attributes so audit
timestamps are stored as BIGINT epoch milliseconds and behave the same as other
tables.
- Line 6: Change the oral_health.ben_visit_no column to NOT NULL so the
uq_oral_health_patient_visit unique constraint on (patient_id, ben_visit_no) can
prevent duplicates: update the migration SQL to alter the column definition from
"`ben_visit_no` int DEFAULT NULL" to a NOT NULL integer (e.g., "`ben_visit_no`
int NOT NULL"), and before applying the DDL ensure any existing NULL
ben_visit_no rows are backfilled or removed (update records to a valid value or
delete) so the ALTER TABLE succeeds; reference the oral_health.ben_visit_no
column and the uq_oral_health_patient_visit unique index when making the change.
- Line 3: Replace the non-failing "CREATE TABLE IF NOT EXISTS" statements in the
V82__cphc_module_migration.sql migration (e.g., the oral_health table and the
other tables created on the noted lines) with plain "CREATE TABLE" statements so
the migration fails fast on schema drift; do not add ALTERs in this file—if you
need to reconcile existing tables, create a separate follow-up migration that
explicitly alters or verifies those existing schemas instead of silencing
failures here.
🪄 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: 3306c038-9b46-48e8-8931-21b2b631202c

📥 Commits

Reviewing files that changed from the base of the PR and between 5ac862a and 5b9257c.

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

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
7.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@paras-dba paras-dba merged commit ee4aa4c into main Jun 1, 2026
7 of 9 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