Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

The UDS Testing screen at /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 via useUDSTests, 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-level RequirePermission 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.view to access the RH module.
  • Understand your program’s UDS testing policy before recording or interpreting results (confirm with SME).

Steps

1

Open UDS Testing

Navigate to /rh/uds-tests. The table loads all UDS tests ordered by most recent test date first.
2

Filter by result

Use the Result dropdown to show only Negative, Positive, or Pending tests. Select “All Results” to clear.
3

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.
4

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.
5

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.
6

Record a new test

Click Record Test. The UDSTestDialog opens. Complete the form and save.

Key concepts

Observable result values: negative, positive, pending. A positive result on the detail page triggers a prompt to file a significant event.
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.
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.
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.

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.
  • src/routes/rh.tsx
  • src/cores/rh/pages/UDSTestsPage.tsx
  • src/cores/rh/hooks/useUDSTests.ts
  • src/cores/rh/types/index.ts