Skip to content

Commit

Permalink
Show current location in encounter retrieve
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshhari committed Jan 29, 2025
1 parent 91b0735 commit f9e1852
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions care/emr/resources/encounter/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ class HospitalizationSpec(BaseModel):

class EncounterSpecBase(EMRResource):
__model__ = Encounter
__exclude__ = ["patient", "organizations", "facility", "appointment"]
__exclude__ = [
"patient",
"organizations",
"facility",
"appointment",
"current_location",
]

id: UUID4 = None
status: StatusChoices
Expand Down Expand Up @@ -111,7 +117,7 @@ class EncounterRetrieveSpec(EncounterListSpec):
created_by: dict = {}
updated_by: dict = {}
organizations: list[dict] = []
current_location: dict = {}
current_location: dict | None = None

@classmethod
def perform_extra_serialization(cls, mapping, obj):
Expand All @@ -125,6 +131,7 @@ def perform_extra_serialization(cls, mapping, obj):
FacilityOrganizationReadSpec.serialize(encounter_org.organization).to_json()
for encounter_org in organizations
]
mapping["current_location"] = None
if obj.current_location:
mapping["current_location"] = FacilityLocationListSpec.serialize(
obj.current_location
Expand Down

0 comments on commit f9e1852

Please sign in to comment.