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

# Reference Lab Directory

> Manage external reference labs for order routing and result ingestion, including CLIA, NPI, and integration type configuration.

The Reference Lab Directory screen is the admin page for managing external reference labs, accessible at `/cl/settings/labs`.

## Overview

The page fetches all reference labs for the organization via `useAllReferenceLabs` and displays them in a searchable table. Rows show `lab_name` (with optional `phone`), `clia_number` (monospace), `npi` (monospace), integration type (badged: "Manual" for `none`, "HL7 v2" for `hl7v2`, "FHIR" for `fhir`), and an `Active` toggle. The search filters by `lab_name` or `clia_number`. The "Add Lab" button (gated to `cl.reference_labs.manage`) opens `ReferenceLabFormDialog`. Row actions include "Edit" and "Delete." The active toggle calls `updateLab` with `is_active` flipped.

## Who it's for

Requires permission: `cl.reference_labs.manage`

## Before you start

* You must hold `cl.reference_labs.manage` to access and modify the lab directory.
* Deleting a lab is immediate; confirm clinical and IT readiness before removing an active integration.

## Steps

<Steps>
  <Step title="Navigate to Reference Lab Directory">
    Go to `/cl/settings/labs`. All configured reference labs for your organization load.
  </Step>

  <Step title="Search labs">
    Use the search input (placeholder: "Search labs by name or CLIA...") to filter by `lab_name` or `clia_number`.
  </Step>

  <Step title="Add a new lab">
    Click "Add Lab." The `ReferenceLabFormDialog` opens with empty fields.
  </Step>

  <Step title="Edit a lab">
    Click "Edit" on any row. The `ReferenceLabFormDialog` opens pre-filled with the selected lab's data.
  </Step>

  <Step title="Toggle a lab active or inactive">
    Use the `Active` switch. The switch is disabled while the `updateLab` mutation is pending.
  </Step>

  <Step title="Delete a lab">
    Click "Delete" on a row. The deletion is immediate (no confirmation prompt).
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Empty states">
    No results matching search: "No matching labs found" / "Try adjusting your search terms."
    No labs configured at all: "No reference labs configured" / "Add a lab to enable order routing."
  </Accordion>

  <Accordion title="Integration type badges">
    The `integration_type` field drives the badge: `null` or `"none"` → "Manual" (secondary); `"hl7v2"` → "HL7 v2" (default); `"fhir"` → "FHIR" (info). Any other value renders the raw type string in an outline badge.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Clinical" icon="stethoscope" href="/cl/overview">
    Overview of the Clinical core.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  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.
</Note>

<Accordion title="Documentation sources">
  * src/routes/cl.tsx
  * src/cores/cl/pages/ReferenceLabManagementPage.tsx
  * src/cores/cl/hooks/useAllReferenceLabs.ts
  * src/cores/cl/hooks/useReferenceLabMutations.ts
</Accordion>
