Skip to content

Commit

Permalink
use request.base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
m-goggins committed Feb 25, 2025
1 parent 17fa1ec commit a2fb1ce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/recordlinker/routes/patient_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ def get_orphaned_patients(
return schemas.PaginatedPatientRefs(
patients=[], meta=schemas.PaginatedMetaData(next_cursor=None, next=None)
)

# Prepare the meta data
next_cursor = patients[-1].reference_id if len(patients) == limit else None
base_url = str(request.url).split("?")[0]
next_url = f"{base_url}?limit={limit}&cursor={next_cursor}" if next_cursor else None
next_url = (
f"{request.base_url}patient/orphaned?limit={limit}&cursor={next_cursor}"
if next_cursor
else None
)

return schemas.PaginatedPatientRefs(
patients=[p.reference_id for p in patients if p.reference_id is not None],
patients=[p.reference_id for p in patients if p.reference_id],
meta=schemas.PaginatedMetaData(next_cursor=next_cursor, next=next_url),
)

Expand Down

0 comments on commit a2fb1ce

Please sign in to comment.