Skip to content

Commit

Permalink
override dob/age
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacobjeevan committed Jan 29, 2025
1 parent f9e1852 commit 9945261
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions care/emr/resources/patient/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ def perform_extra_deserialization(self, is_update, obj):
obj.geo_organization = Organization.objects.get(
external_id=self.geo_organization
)
if not is_update:
if self.age:
obj.year_of_birth = timezone.now().date().year - self.age
else:
obj.year_of_birth = self.date_of_birth.year
if self.age:
# override dob if user chooses to update age
obj.date_of_birth = None
obj.year_of_birth = timezone.now().date().year - self.age
else:
obj.year_of_birth = self.date_of_birth.year


class PatientListSpec(PatientBaseSpec):
Expand Down

0 comments on commit 9945261

Please sign in to comment.