# eRx Setup and Configuration

This is a step-by-step guide to complete the eRx (electronic prescribing) configuration within your Welkin environment.

## Overview

Two areas must be configured:

1. **Step 1: Designer Portal** – set up CDT data types, data views, security policy, layout, and access point
2. **Step 2: Admin Portal** – create the API client and enable the notification widget

After configuration is complete, provide the following details to your Welkin implementation manager to enable the eRx integration:

1. Tenant name
2. Environment name
3. API Client ID and Secret
4. Welkin user ID and Dr First user ID for each user registered with Dr First (Welkin user ID is found in the **Users** section of the Admin Portal)
5. Dr First SSO Credentials:
   * `rcopia_portal_system_name`
   * `rcopia_practice_user_name`
   * `secret_key`
6. Dr First API Credentials:
   * `vendor_name`
   * `vendor_password`
   * `practice_user_name`

***

## Step 1: Designer Configuration

### 1. Add CDT Data Types

1. Log in to Welkin's Designer Portal
2. Select the environment for which you want to configure eRx
3. Go to **Data > CDT Builder** in the left panel
4. Create three CDT data types by importing the JSON definitions (see Appendix below):
   * `df_allergies`
   * `df_medications`
   * `df_diagnoses_problems`

### 2. Create Data Views

Create a Data View for each of the three CDTs above:

1. Go to **Presentation > Data Views** in the left panel
2. Click **Create Data View**
3. Under the **General Information** tab, give the data view a name (e.g., "Allergies")
4. Set the **CDT** to the corresponding data type (e.g., `df_allergies`)
5. Under the **Columns** tab, add the fields you want to display. Exclude system fields from the **Available Fields** section (like `id`, `created_by`, `created_at`)
6. You can set labels for fields – for example, a field named `onset_date` can be labeled "Onset Date" to display a human-readable label in the UI
7. Under the **Sort** tab, click **Add Sort**
8. In the **Data Type Field**, select the `status` field. Keep **Direction** as **Asc**
9. Click **Save Changes**

Repeat this process for all three CDTs (Allergies, Medications, Problems).

### 3. Add a Security Policy

1. Go to **Access Control > Security Policies** in the left panel
2. Click **Create Security Policy**
3. Under the **General Information** tab:
   * Give the security policy a name
   * Under **Data Types**, select `df_allergies`, `df_medications`, and `df_diagnoses_problems`
   * Check the **Select All** boxes under the **Patient** and **CDT** tabs
4. Click **Save Changes**

### 4. Add a Layout

1. Go to **Presentation > Layouts**
2. Click **Create Layout**
3. Under the **General Information** tab, give the layout a name (e.g., "Clinical Summary") – this name will appear in the Care Portal
4. In the **Roles** field, set the role created in the previous steps
5. Under the **Layout** tab, select the Data Views for Allergies, Medications, and Problems
6. Click **Save Changes**

### 5. Add an Access Point

1. Go to **Presentation > Action Bar**
2. Add the **"ePrescription"** action button to the **Visible Action Buttons** section
3. Click **Save Changes**

***

## Step 2: Admin Configuration

### 1. Create an API Client

1. Log in to Welkin's Admin Portal
2. Go to **API Clients** in the left panel
3. Click **Create Client** to create an API client and save the credentials
4. Open the new API client and scroll to the bottom
5. Select the appropriate environment and click **Submit**
6. Click the edit icon for that environment:
   * Fill in the **Role**, **Primary Role**, and **Policies** fields as created in Designer
   * Select all applicable **Regions** and **Territories**
7. Click **Save**

### 2. Enable the Notification Count Widget

To see the count of pending pharmacy messages and prescriptions, enable eRx from the Admin portal. This step must be performed **after** the Welkin Engineering team has configured eRx for your practice – the enable button will be disabled until that is complete.

1. Go to **Integrations > eRx**
2. Enable eRx for the same environment configured in Designer

***

## Related Pages

* [DrFirst eRx Overview](/integrations/drfirst-erx/drfirst-erx-overview.md)
* [Dr First Implementation Checklist](/integrations/drfirst-erx/dr-first-implementation-checklist.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.welkinhealth.com/integrations/drfirst-erx/erx-setup-and-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
