Skip to content

Commit

Permalink
fixed encounter validation in medicine administration spec
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar committed Dec 31, 2024
1 parent 7d3a6a5 commit 3e20678
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion care/emr/resources/medication/administration/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pydantic import UUID4, BaseModel, Field, field_validator

from care.emr.fhir.schema.base import Coding, Quantity
from care.emr.models.encounter import Encounter
from care.emr.models.medication_administration import MedicationAdministration
from care.emr.models.medication_request import MedicationRequest
from care.emr.registries.care_valueset.care_valueset import validate_valueset
Expand Down Expand Up @@ -182,7 +183,7 @@ class MedicationAdministrationSpec(BaseMedicationAdministrationSpec):
@field_validator("encounter")
@classmethod
def validate_encounter_exists(cls, encounter):
if not PatientConsultation.objects.filter(external_id=encounter).exists():
if not Encounter.objects.filter(external_id=encounter).exists():
err = "Encounter not found"
raise ValueError(err)
return encounter
Expand Down

0 comments on commit 3e20678

Please sign in to comment.