Skip to content

refactor(frontend): switch from age to dob input and consume backend age

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

Overview

This MR updates the frontend to replace the Age field with Date of Birth (DOB). Age calculation is handled entirely in the backend, and the frontend only consumes and displays the computed value.

What does this MR do and why?

Previously, the frontend directly used and displayed the Age field. Now, the system is updated to:

  • Accept DOB input instead of Age
  • Send DOB to backend APIs
  • Display calculated Age received from backend

️ Why this change?

  • Age is dynamic and should not be handled in frontend
  • Backend becomes the single source of truth
  • Avoids inconsistent calculations across UI

Changes Made

  • 🔄 Replaced Age input field with DOB field in:

    • Forms (Profile / Patient / Registration)
  • 🔗 Updated API integration:

    • Send dob instead of age in request payload
    • Read age from backend response (if provided)
  • 🎯 UI Updates:

    • Added Date Picker for DOB selection
    • Display age as read-only / computed value
  • 🧹 Removed:

    • Any frontend-based age calculation logic
    • Age validation logic

Technical Details

  • Frontend no longer calculates age
  • Backend handles age calculation and sends it in response

Data Flow:

  1. User enters DOB
  2. Frontend sends DOB → Backend
  3. Backend calculates age
  4. Frontend displays returned age

Screenshots

Register Patient


Type of Change

  • 🐛 Bug fix
  • New feature
  • ️ Refactor
  • 🎨 UI/UX improvement

Testing Done

  • Manual testing completed

Test Cases

Scenario Expected Result Status
Enter DOB Value sent correctly to backend
API response Age received and displayed
Edit DOB Updated age shown from backend

Additional Notes

  • Frontend strictly depends on backend for age calculation
  • No duplicate logic maintained in UI
  • Ensures consistency across the application

Edited by POORNA CHANDRA SAI TEJA KUMPATLA

Merge request reports

Loading