Mhwc 161 navigation and workflow integration#151
Conversation
… Identification with mandatory field validation and referral capture
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 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 |
|
@coderabbiteai review the changed files |
|
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
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 betweenvalidate()andgetMissingMandatoryField().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
📒 Files selected for processing (3)
app/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningFragment.ktapp/src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningViewModel.ktapp/src/main/res/layout/fragment_ophthalmic_screening.xml
...src/main/java/org/piramalswasthya/cho/ui/ophthalmic_screening/OphthalmicScreeningFragment.kt
Show resolved
Hide resolved
|
3989408
into
other-cphc-services-release-5.0
…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 ---------



JIRA ID: 161
Enable navigation to the previous page after Case Identification with mandatory field validation and referral capture
✅ 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