# Configuring the Medical-Safety Connection

Configure the Medical-Safety connection to sync _Adverse Event_ data between Medical and Pharmacovigilance systems.

## About the Medical-Safety Connection

Using the Medical-Safety Connection, organizations with both MedInquiry and a Safety Vault can exchange _Adverse Event_ data. MedInquiry transfers data, such as patient details, reporter information, product details, and event information to Vault Safety. For more information see [About the Medical-Safety Connection](/en/lr/662819/).

## Prerequisites

In addition to the configuration on this page, to use this feature you must configure the following:
* [Establish a Vault to Vault Connection](/en/lr/53358/#how-to-establish-a-vault-to-vault-connection)

## Medical-Safety Connection Components

The components below support the standard Medical-Safety Connection.

### Connections

The following _Connection_ records are available in **Admin > Connections**:
* _Medical-Safety Connection_ (`medical_safety__v`) is available in your Medical Vault
* _Medical Safety Connection_ (`medical_safety__v`) is available in your Safety Vault

In your Safety Vault, you can update the _Connections_ [object layout](/en/lr/26387/) to include the following fields in the [_Connection Stats_ section](/en/lr/53358/#stats):

* _Medical: Inbox Items Received_
* _Medical: Inbox Items Promoted_

### Integration & Integration Points

The _Integration_ and _Integration Point_ objects enable Vault Safety to manage the message queues and define what data the connection maps from MedInquiry to Safety. These records are read-only and are used by Safety to manage the connection and track any connection errors.

The _Medical Safety Connection_ record includes the default _Adverse Event Integration_ record with the following standard _Integration Point_ records in your Safety Vault: 
* _Adverse Event Integration Point_ (`adverse_event_oip__v`) \
The outbound integration point for sharing _Adverse Event_ information. 
* _Adverse Event Integration Point_ (`adverse_event_iip__v`) \
The inbound integration point for sharing _Adverse Event_ information. 

### Integration Rules

To support the Medical-Safety Connection, it may be necessary to transform data from the source Vault's data model to fit within the target Vault's data model. You can use [Integration Rules](/en/lr/62154/) to incorporate configurable rules for mapping object and document fields between two Vaults.

### Queues

This feature includes four (4) standard [message processing queues](/en/lr/53147/). You can access and manage these queues from **Admin > Connections > Spark Queues**. 

In your Medical Vault, you have:
* _Safety to Medical Adverse Event inbound queue_ (`safety_to_medical_ae_inbound_queue__v`)
* _Medical to Safety Adverse Event outbound queue_ (`medical_to_safety_ae_outbound_queue__v`)

In your Safety Vault, you have:
* _Medical to Safety Adverse Event inbound queue_ (`medical_to_safety_ae_inbound_queue__v`)
* _Safety Outbound Messaging Queue_ (`safety_to_medical_outbound__v`)

### User Exception Objects

Safety includes the _User Exception Message_ object and its child object, _User Exception Item_, to help you track and resolve any errors that occur with your Medical-Safety Connection. If the Safety side of the integration can't process an incoming message, Safety creates a _User Exception Message_ record to capture the failure.

You can view and manage these messages from **Admin > Connections > User Exception Messages**.

Safety also creates individual _User Exception Item_ records for each Inbox Item or related document that failed on the related _Integration Point_ record in your Safety Vault. The _User Exception Item's Error Message_ field contains the reason for the error.

A _User Exception Message_ means you need to update your configuration. After you update the configuration, Safety attempts to resolve any errors the next time the connection runs. You can also select the _Reprocess Request_ action on the _User Exception Message_ record to run the connection and resolve errors.

When the connection job runs, Safety processes all _User Exception Messages_ in the _Active_ state. Any new errors result in new _User Exception Messages_ in the _Active_ state. Once the connections on both the Safety and Medical side run, previously Active _User Exception Messages_ are inactivated.

### Last Successful Run Time Field

On each _Integration_ record, the _Last Successful Run Time_ field captures the date and time that the integration last ran with no errors. Vault uses this date to query changes since the integration's last successful run.

When you activate an integration, Vault automatically sets its _Last Successful Run Time_ to the current datetime. If you inactivate and reactivate an _Integration_ record, Vault also sets the _Last Successful Run Time_ to the current datetime. 

Vault automatically schedules a new inbound job when you manually update the _Last Successful Run Time_ field.