The UDS Testing screen atDocumentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
/rh/uds-tests displays a filterable list of urinalysis drug screening (UDS) tests for the current organization and allows staff to record new tests via a dialog.
Overview
The page loads UDS tests viauseUDSTests, which queries the rh_uds_tests table joined to rh_episodes and rh_uds_random_schedule, scoped to organization_id (from useOrganization), ordered by test_date descending. The hook applies episodeId filtering server-side via the Supabase query builder; remaining filters (result, isRandomTest, dateFrom, dateTo) are applied client-side.
Filters available on the list page: free-text search input (wired to UI but not yet connected to UDSTestFilters in the observed code — the Input has no onChange handler setting the filter), result (negative, positive, pending), and test type (Random, Scheduled). The Record Test button opens UDSTestDialog. Individual rows navigate to /rh/uds-tests/:id. Creating a test also requires RH_PERMISSIONS.UDS_TESTS_CREATE (rh.uds-tests.create) for the create action — however this permission is not applied as a route-level gate; the button is shown to all users with rh.dashboard.view.
Who it’s for
No route-levelRequirePermission beyond the outer RHViewGuard (rh.dashboard.view). RH_PERMISSIONS.UDS_TESTS_CREATE (rh.uds-tests.create) and RH_PERMISSIONS.UDS_TESTS_EDIT (rh.uds-tests.edit) exist in the permission constants but are not applied as route-level or button-level guards on this page in the observed code.
Before you start
- Hold
rh.dashboard.viewto access the RH module. - Understand your program’s UDS testing policy before recording or interpreting results (confirm with SME).
Steps
Open UDS Testing
Navigate to
/rh/uds-tests. The table loads all UDS tests ordered by most recent test date first.Filter by result
Use the Result dropdown to show only
Negative, Positive, or Pending tests. Select “All Results” to clear.Filter by test type
Use the Test Type dropdown to show only
Random or Scheduled tests. Select “All Types” to clear. This maps to the is_random boolean on rh_uds_tests.Search
The search input is present in the UI. Confirm with a subject-matter expert or the development team whether text search is active for this page.
View a test record
Click a row to navigate to
/rh/uds-tests/:id for the full detail view including result, substances tested, and follow-up notes.Key concepts
Result values
Result values
Observable result values:
negative, positive, pending. A positive result on the detail page triggers a prompt to file a significant event.Random vs scheduled tests
Random vs scheduled tests
is_random is a boolean on rh_uds_tests. A random test references rh_uds_random_schedule. The useRunRandomUDSSelection hook exists in the hooks directory but is not used on this list page; its entry point within the module should be confirmed with a subject-matter expert or development team.Client-side filtering
Client-side filtering
useUDSTests applies result and isRandomTest filters in JavaScript after the Supabase query returns, because of type inference limitations in the Supabase query builder with nested selects (documented in the hook source). episodeId is applied server-side.42 CFR Part 2 sensitivity
42 CFR Part 2 sensitivity
UDS data in a substance use disorder treatment or recovery housing context may be subject to 42 CFR Part 2 SUD confidentiality protections. The applicability to this module and the required safeguards must be confirmed with a subject-matter expert and legal/compliance review.
Related
Recovery Housing
Recovery Housing references and overview.
Governance & parity
Documentation coverage and governance.
This page documents shipped product behavior. It is not medical, legal, or
billing advice. Verify against your organization’s policies and applicable
regulations before using it for clinical, compliance, or billing decisions.
Protected health information (PHI) shown in the product is governed by your
tenant’s access controls and is never exposed in this documentation.
Documentation sources
Documentation sources
- src/routes/rh.tsx
- src/cores/rh/pages/UDSTestsPage.tsx
- src/cores/rh/hooks/useUDSTests.ts
- src/cores/rh/types/index.ts