Skip to content

Mhwc 161 navigation and workflow integration#151

Merged
abhilashkadu-tekdi merged 3 commits intoother-cphc-services-release-5.0from
mhwc-161-navigation-and-workflow-integration
Feb 25, 2026
Merged

Mhwc 161 navigation and workflow integration#151
abhilashkadu-tekdi merged 3 commits intoother-cphc-services-release-5.0from
mhwc-161-navigation-and-workflow-integration

Conversation

@abhilashkadu-tekdi
Copy link
Copy Markdown

@abhilashkadu-tekdi abhilashkadu-tekdi commented Feb 24, 2026

JIRA ID: 161

Enable navigation to the previous page after Case Identification with mandatory field validation and referral capture


✅ 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
    • Enhanced form validation in the ophthalmic screening process to detect and report missing mandatory fields before saving.
    • Improved user experience with automatic navigation to incomplete fields when attempting to save, including visual feedback and automatic focus.
    • Updated UI interactions to provide clearer guidance on required form completion.

… Identification with mandatory field validation and referral capture
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 24, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes implement pre-save validation for ophthalmic screening forms. The ViewModel introduces a MissingField enum and validation logic to identify incomplete mandatory fields. The Fragment handles missing fields by displaying guidance (toast notification, scrolling to field, and focusing it). The layout is updated to enable programmatic scrolling and removes data-binding for button state.

Changes

Cohort / File(s) Summary
Validation Logic
app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningViewModel.kt
Added MissingField enum, getMissingMandatoryField() function, and helper methods (areVisibleSubFieldsAnswered, getMissingSubField) to compute missing mandatory fields. Integrated validation triggers after symptom/setter updates (setCataractSymptoms, setGlaucomaSymptoms, setDrSymptoms, setPresbyopiaSymptoms, setTrachomaStatus, setCornealDiseaseType, setVitaminADeficiency).
UI Validation Handling
app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningFragment.kt
Added pre-save validation in navigateAfterSave that queries ViewModel for missing mandatory fields. Introduced handleMissingField to map missing fields to string resources and focusable views, show toast, scroll to field, and focus it. Added ScrollView import for programmatic scrolling.
Layout Updates
app/src/main/res/layout/fragment_ophthalmic_screening.xml
Added android:id="@+id/scroll_view" to ScrollView for programmatic access. Removed android:enabled data-binding from btn_next button.

Sequence Diagram

sequenceDiagram
    actor User
    participant Fragment as OphthalmicScreeningFragment
    participant ViewModel as OphthalmicScreeningViewModel
    participant UI as ScrollView/Toast

    User->>Fragment: Click Save Button
    Fragment->>ViewModel: getMissingMandatoryField()
    ViewModel->>ViewModel: Check mandatory fields
    ViewModel->>ViewModel: Validate sub-fields
    ViewModel-->>Fragment: MissingField (if any)
    
    alt Missing Field Found
        Fragment->>Fragment: handleMissingField(missingField)
        Fragment->>UI: Show Toast with Field Name
        Fragment->>UI: Scroll to Field
        Fragment->>UI: Focus on Field
    else No Missing Fields
        Fragment->>Fragment: navigateAfterSave()
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A form validation quest, we humbly present,
With missing fields caught before they're sent,
Toast messages guide, and scrolls take the lead,
While focus finds each field users need,
No data shall slip through this rabbit-reviewed gate! 🥕✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Mhwc 161 navigation and workflow integration' is vague and generic, using technical identifiers without conveying what the specific changes accomplish. Use a more descriptive title that clarifies the main change, such as 'Add mandatory field validation and auto-focus for ophthalmic screening form' or 'Implement validation and navigation flow for case identification to vitals/prescription screens'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 mhwc-161-navigation-and-workflow-integration

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.

@abhilashkadu-tekdi abhilashkadu-tekdi changed the base branch from main to other-cphc-services-release-5.0 February 24, 2026 10:52
@abhilashkadu-tekdi
Copy link
Copy Markdown
Author

@coderabbiteai review the changed files

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 24, 2026

@abhilashkadu-tekdi, I'll review the changed files in this PR for you.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@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

🧹 Nitpick comments (1)
app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningViewModel.kt (1)

541-575: Avoid rule drift between validate() and getMissingMandatoryField().

Both encode required-field logic; future changes could diverge. Consider deriving one from the other (shared helper or a single source of truth) to keep behavior consistent.

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

In
`@app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningViewModel.kt`
around lines 541 - 575, The validate() and getMissingMandatoryField() logic are
duplicated and risk drift; refactor so there is a single source of truth:
extract the required-field decision logic into a shared private helper (e.g., a
function like determineMissingField(reason, diabetic, rightVA, leftVA,
nearVaValue, caseIds, chart, screening) or reuse validate() to produce a
structured result) and have both getMissingMandatoryField() call that helper (or
map validate()'s result to MissingField) instead of duplicating checks; refer to
getMissingMandatoryField, validate, getMissingSubField and the helpers
isVisualImpairment/isNearVAReduced when locating and consolidating the logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningFragment.kt`:
- Around line 203-228: handleMissingField currently scrolls using
viewToFocus.top which is in local parent coordinates and mispositions deeply
nested controls; replace that logic to compute the absolute Y using
viewToFocus.getLocationInWindow(intArray) (or getLocationOnScreen) and the
ScrollView's window position fetched via
binding.root.findViewById<ScrollView>(R.id.scroll_view) so you scroll to (viewY
- scrollViewY) (plus a small offset) and then call smoothScrollTo and
requestFocus on viewToFocus; update references in OphthalmicScreeningFragment's
handleMissingField to use
binding.root.findViewById<ScrollView>(R.id.scroll_view) and
viewToFocus.getLocationInWindow(...) rather than viewToFocus.top.

---

Nitpick comments:
In
`@app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningViewModel.kt`:
- Around line 541-575: The validate() and getMissingMandatoryField() logic are
duplicated and risk drift; refactor so there is a single source of truth:
extract the required-field decision logic into a shared private helper (e.g., a
function like determineMissingField(reason, diabetic, rightVA, leftVA,
nearVaValue, caseIds, chart, screening) or reuse validate() to produce a
structured result) and have both getMissingMandatoryField() call that helper (or
map validate()'s result to MissingField) instead of duplicating checks; refer to
getMissingMandatoryField, validate, getMissingSubField and the helpers
isVisualImpairment/isNearVAReduced when locating and consolidating the logic.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eab2859 and 7050304.

📒 Files selected for processing (3)
  • app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningFragment.kt
  • app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningViewModel.kt
  • app/src/main/res/layout/fragment_ophthalmic_screening.xml

@sonarqubecloud
Copy link
Copy Markdown

@abhilashkadu-tekdi abhilashkadu-tekdi merged commit 3989408 into other-cphc-services-release-5.0 Feb 25, 2026
2 checks passed
@abhilashkadu-tekdi abhilashkadu-tekdi deleted the mhwc-161-navigation-and-workflow-integration branch February 25, 2026 05:25
abhilashkadu-tekdi added a commit that referenced this pull request Mar 23, 2026
…HWC-166][MHWC-167] (#212)

* MHWC-155 Screening Workflow for Diabetic Patients (#133)

* feat(MHWC-155): Implement diabetic patient screening workflow with mandatory validations, visual acuity checks, alert trigger (≤6/18), and conditional case identification module logic

* resolve code rabbit error

* resolve code rabbit error

* MHWC-156 Screening Workflow for Non-Diabetic Patients (#137)

* feat(screening): add visual acuity flow for non-diabetic patients with impairment alerts and case identification trigger

* Merge Release 4.0 into Release 5.0 (#139)

* MHWC-158: Enable Case Identification module conditionally (#140)

Show Case Identification module only when patient is symptomatic or has reduced visual acuity (distance ≥ 6/18 in either eye or reduced near VA); hide/disable otherwise.

* feat: Capture Case Identification and Multi-Condition Selection [MHWC-159] (#142)

Implement mandatory multi-select for eye conditions (when symptomatic or VA ≥ 6/18), require at least one selection, and dynamically enable corresponding symptom/status fields.

* feat: Add Ear Diagnosis Form and its corresponding Model [MHWC-146] (#143)

* feat: Add the EarDiagnosisFormFragment and its corresponding ViewModel to manage the UI and business logic.

* fix sonarqube and coderabbit issue

* feat: Add Hearing Test Outcome dropdown  and update diagnosis model (#144)

* feat: Add congenital ear malformation and condition type to ear diagnosis [MHWC-148] (#146)

* feat: Add congenital ear malformation and condition type to ear diagnosis

- Add `earConditionType` and `congenitalEarMalformation` fields to the `EarDiagnosisAssessment` model.

* fix coderabbit issue

* MHWC-160: Add condition-based symptom capture and referral alerts in Ophthalmic module

* feat : capture symptoms and secondary level referral alerts [MHWC-160] (#148)

* MHWC-160: Add condition-based symptom capture and referral alerts in Ophthalmic module

* feat: Assess severity duration of pain other distressing symptoms [MHWC-184] (#150)

* feat: Add Pain and Symptom Assessment form
* Fixed sonarqube issue

* feat: Add Psychosocial and Caregiver Support module (#152)

* Add Psychosocial and Caregiver Support module

* fix sonarqube and coderabbit issue

* feat : navigation and workflow integration (#151)

* feat(MHWC-161): enable navigation to Vitals & Prescription after Case Identification with mandatory field validation and referral capture

* feat : Capture Tooth Decay and Symptoms [MHWC-165] (#163)

* Add mandatory Tooth Decay field with conditional multi-select Symptoms and auto-trigger Dentist referral alert when symptoms are recorded.

* feat : Enable Injury & Trauma module based on “Reason for Visit” selection[MHWC-162] (#162)

* Enable Injury & Trauma module based on “Reason for Visit” selection
Make Injury Type multi-select mandatory and block workflow progression without selection

* feat : Capture Injury Management and Referral Alerts [MHWC-163] (#165)

* Add injury management capture with referral alert logic

* feat: Enable nose diagnosis based on chief complaint [MHWC-149] (#176)

* feat: add Nose Diagnosis assessment module and Enable Nose Diagnosis & Management section only for nose-related chief complaints

* Resolve coderabbit and sonarqube issue

* Resolve sonarqube issue

* Merge release 4.0 in release 5.0 (#182)

* feat: Add referral and follow up for patients requiring higher level[MHWC-186] (#184)

* feat: add referral and follow-up sections to Palliative Care and Elderly Health assessments

* feat : Capture Gum Diseases and Symptoms [MHWC-166] (#183)

* Add gum diseases capture with symptoms multi-select and dentist referral alert

* feat: Capture nose symptoms and trigger clinical alerts [MHWC-150] (#187)

* feat: add Nose Diagnosis assessment module and Enable Nose Diagnosis & Management section only for nose-related chief complaints

* feat:  Nose Diagnosis assessment with breathing checks and visit-based retrieval

* refactor: Remove "Other symptoms present" field from pain assessment and streamline button state management in visit details.

* fix coderabbit issue

* Hwc - hindi lang fixes (#205)

* Add gum disease assessment with symptoms logic and other dental condition referral alerts

* resolved code rabbit warnings

* code rabbit warnings resolved

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