> ## Documentation Index
> Fetch the complete documentation index at: https://help.elationhealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tag System

> Query the Elation Billing tag catalog - the tag definitions (label, color, type) a practice can apply to claims and patients.

One row per Elation Billing tag definition - the catalog of tags (label, color, type) a practice can apply. Includes both practice-created definitions and the global Elation defaults (for example `QUEUED`, `BILLED`), which are replicated into each practice's data with a null `practice_id`. Applied tags in the `tag` table point back here via `tag_system_id`.

This table's columns and relationships are shown in the [Hosted Database schema](/articles/hdb/schema).

<Note>
  Global Elation default definitions carry a null `practice_id`; practice-created definitions carry the owning practice. The `custom` flag distinguishes the two (`true` = practice-created, `false` = Elation-provided). `type` records the entity a tag applies to - known values are `claim` and `patient`.
</Note>

**For reporting on but not limited to:**

* The full tag catalog available to a practice
* Distinguishing custom (practice-created) tags from Elation defaults
* Listing the global default tags shared across all practices
* Resolving an applied tag (`tag.tag_system_id`) to its label and color

## Tag catalog

Lists the active tag definitions, defaults first.

<CodeGroup>
  ```sql sql theme={null}
  select
      ts.id as tag_system_id
    , ts.practice_id
    , ts.type
    , ts.tag as label
    , ts.color
    , ts.custom
    , ts.readonly
  from tag_system ts
  where ts.is_deleted = false
  order by ts.custom, ts.type, ts.tag;
  ```
</CodeGroup>

## Most-applied tags

Joins definitions to the applied tags in the `tag` table to rank which labels are used most.

<CodeGroup>
  ```sql sql theme={null}
  select
      ts.tag as label
    , ts.type
    , ts.custom
    , count(t.id) as times_applied
  from tag_system ts
    left join tag t
      on t.tag_system_id = ts.id
     and t.is_deleted = false
  where ts.is_deleted = false
  group by ts.tag, ts.type, ts.custom
  order by times_applied desc;
  ```
</CodeGroup>

*If you have any questions about this topic please reach out to [Elation Support Portal](/articles/support-portal-introduction) with the subject line HDB - \<your\_question>*
