Skip to content

Commit

Permalink
Clean up paths
Browse files Browse the repository at this point in the history
  • Loading branch information
samamorgan committed Oct 27, 2023
1 parent 4a00a23 commit 3a32fd4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
7 changes: 4 additions & 3 deletions welkin/models/assessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class AssessmentRecords(Collection):

@model_id("Patient")
def get(self, patient_id: str, **kwargs):
path = f"{self._client.instance}/patients/{patient_id}/assessment-records"

return super().get(path, **kwargs)
return super().get(
f"{self._client.instance}/patients/{patient_id}/assessment-records",
**kwargs,
)
23 changes: 8 additions & 15 deletions welkin/models/encounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,17 @@ def get(
*args,
**kwargs,
):
root = ""
path = f"{self._client.instance}/"
if patient_id:
root = f"patients/{patient_id}"
path += f"patients/{patient_id}/"
elif user_id:
root = f"users/{user_id}"
elif self._parent:
if self._parent.__class__.__name__ == "Patient":
root = f"patients/{self._parent.id}"
elif self._parent.__class__.__name__ == "User":
root = f"users/{self._parent.id}"
path += f"users/{user_id}/"
elif self._parent.__class__.__name__ == "Patient":
path += f"patients/{self._parent.id}/"
elif self._parent.__class__.__name__ == "User":
path += f"users/{self._parent.id}/"

encounters = "encounters"
if related_data:
encounters = "full-encounters"

path = f"{self._client.instance}/{encounters}"
if root:
path = f"{self._client.instance}/{root}/{encounters}"
path += "full-encounters" if related_data else "encounters"

params = {
"withCareTeam": with_care_team,
Expand Down

0 comments on commit 3a32fd4

Please sign in to comment.