Skip to content

Resolve "feat: implement DOB input (year required) and dynamic age update"

POORNA CHANDRA SAI TEJA KUMPATLA requested to merge 245-update-dob into develop

Overview

This MR introduces frontend support for managing Date of Birth (DOB) as the single source of truth for age. Instead of storing or manually editing age, it is now dynamically calculated from DOB, ensuring consistency and accuracy across the application.

Why this change?

Previously, age was entered manually, which could lead to:

Inconsistent or outdated data Validation issues Poor data integrity

This implementation resolves those issues by:

Deriving age directly from DOB Eliminating manual age input Ensuring a single, reliable source of truth

What’s included in this MR?

Core Functionality Added DOB input/display in the UI Implemented dynamic age calculation from DOB Made age field read-only Synced frontend with backend DOB field Conditional UI Handling Valid DOB users → Display DOB + calculated age Auto-generated DOB users → Show warning prompting user to update DOB Technical Details State Management DOB is stored in component state Age is derived dynamically during render Age Calculation Age is calculated using DOB and the current date Automatically updates whenever DOB changes Component Structure Reusable DOB input/display component Derived age display component (read-only) Data Flow Backend → DOB → Frontend → Age (derived)

ScreenShots Patient Registration Existing Patient Patient Profile

Type of Change

New feature 🎨 UI/UX improvement ️ Refactor

How to Test Locally

npm install npm run dev

Test Scenarios

Scenario Expected Result New user enters DOB Age auto-calculates Update DOB Age updates instantly Auto-generated DOB Warning message displayed Attempt to edit age Field remains read-only

Testing Done

Manual testing completed Unit tests added

Known Limitations

Auto-generated DOB detection is handled on the frontend (can be improved with backend flag) Minor edge cases possible due to timezone differences Future Improvements Add backend flag to explicitly identify auto-generated DOB Centralize DOB validation logic across frontend and backend

Summary

This change enforces DOB as the single source of truth, improves data integrity, and enhances user experience by removing inconsistencies associated with manual age entry.

closes #245 (closed)

Edited by POORNA CHANDRA SAI TEJA KUMPATLA

Merge request reports

Loading