Skip to content

⚙️ Backend Feature Request — Update /sample_user Endpoint for Person Filter

🎯 Goal

Provide a backend endpoint that returns a distinct list of Sample Users for the frontend Person filter in the sample search UI.

  • Should support lookup / search by name or partial match.
  • Used to populate the multi-select dropdown for filtering samples by associated users.

🧩 Implementation Details

Endpoint

  • Endpoint: GET /sample_user?session_id=....

  • Query Parameters:

    • search (optional): string to search by given_name, family_name, or full_name
    • distinct (optional, default False) but for using it for filtering input in search, we should provide distinct = True
    • limit (optional, default 50): maximum number of results
    • offset (optional, default 0): pagination offset

Response

{
  "items": [
    {
      "id": 123,
      "given_name": "Alice",
      "family_name": "Smith",
      "full_name": "Alice Smith",
      "email": "alice@example.com"  // optional
    },
    ...
  ],
  "offset": 0,
  "limit": 50,
  "total": 234
}

Backend Tasks

  • Query distinct Sample Users from Sample.sample_users.
  • Support partial matching on given_name, family_name, and full_name.
  • Implement pagination (limit + offset).
  • Ensure performance for large datasets.
  • Include optional fields (email) for convenience.

🧪 Testing

  • Returns distinct sample users across all samples
  • Supports partial search queries
  • Pagination works correctly (limit + offset)
  • Response structure matches API spec

🏷️ Labels

backend feature sample person-filter priority::medium