luchillo17L
Convex Community2d ago
14 replies
luchillo17

I have a big issue implementing a proper

I have a big issue implementing a proper UI table (filter, sort, pagination), here's the thing, I have 3 tables
encounters
,
encounterProviders
and
encounterPatientAuthorizations
, the names should be evident but I'll make it clear:
- Encounters are clinical records.
- Encounter providers are the doctors, nurses, etc. that are involved in the encounter.
- Encounter Patient Authorizations list the permission a patient has given a specific provider or group to access their whole history (including encounters not related by
encounterProviders
, basically encouners from other providers or clinics).

Here's the issue, if it was SQL I would use JOINS then filter & paginate the result, obviously that doesn't fly in Convex, so far the best options I've thought of are:
- Use an aux table to tie the data I'll need to filter, sort & paginate the encounters (think of a custom index, materialized view or denormalization).
- Try a component to do the above like
aggregate
component.
- Forego the indexes and build it in-memory (use indexes to get enough data to fill the pages per pagination args, merge both sources manually), like if we need a 20 row page, we get 20 from both sources, merge then sort in memory to take the most recent 20.
- Outright move the query to another system to have more flexible query options.

I have also looked into
better-convex
and I'm struggling to understand the way it does filters and whether it would support multi source queries, even if it does in-memory stuff more than indexes.

I'm kind of stuck in analysis paralisis, any help would be appreciated.
Was this page helpful?