Skip to content

Commit

Permalink
Switch to using year of birth for patient transfer confirmation (#2061)
Browse files Browse the repository at this point in the history
* Switch to using year of birth for patient transfer confirmation

* update tests
  • Loading branch information
rithviknishad authored Apr 8, 2024
1 parent cda2db9 commit 76a72d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions care/facility/api/serializers/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ class PatientTransferSerializer(serializers.ModelSerializer):

class Meta:
model = PatientRegistration
fields = ("facility", "date_of_birth", "patient", "facility_object")
fields = ("facility", "year_of_birth", "patient", "facility_object")

def validate_date_of_birth(self, value):
if self.instance and self.instance.date_of_birth != value:
raise serializers.ValidationError("Date of birth does not match")
def validate_year_of_birth(self, value):
if self.instance and self.instance.year_of_birth != value:
raise serializers.ValidationError("Year of birth does not match")
return value

def create(self, validated_data):
Expand Down
6 changes: 3 additions & 3 deletions care/facility/tests/test_patient_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def test_patient_transfer(self):
response = self.client.post(
f"/api/v1/patient/{self.patient.external_id}/transfer/",
{
"date_of_birth": "1992-04-01",
"year_of_birth": 1992,
"facility": self.destination_facility.external_id,
},
)
Expand Down Expand Up @@ -477,7 +477,7 @@ def test_transfer_with_active_consultation_same_facility(self):
response = self.client.post(
f"/api/v1/patient/{self.patient.external_id}/transfer/",
{
"date_of_birth": "1992-04-01",
"year_of_birth": 1992,
"facility": self.facility.external_id,
},
)
Expand All @@ -496,7 +496,7 @@ def test_transfer_disallowed_by_facility(self):
response = self.client.post(
f"/api/v1/patient/{self.patient.external_id}/transfer/",
{
"date_of_birth": "1992-04-01",
"year_of_birth": 1992,
"facility": self.destination_facility.external_id,
},
)
Expand Down

0 comments on commit 76a72d8

Please sign in to comment.