# Working with FHIR Messages

Fast Healthcare Interoperability Resources (FHIR) messages are structured XML files that detail product data in service of various Health Authority data standardization initiatives.

When you generate regulatory data in your Vault, the accompanying FHIR messages are mapped to the objects and fields Vault uses to store source and output data. Once generated, Vault stores the output according to the selected Submission Mode:
* For eCTD submissions, messages are stored as XML files in the Vault Library for submission with the eCTD dossier through the EMA's gateway.
* For Product Management Service (PMS) submissions, Vault generates a ZIP file along with any applicable attachment files for export and submission to the PMS.



<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: This feature is available in RIM Registrations Vaults only and must be <a href="/en/lr/60772/#fhir-message-generation-and-export">configured</a> by an Admin.</p>
    </div>
  </div>
</div>



## Generating FHIR Messages {#generating}

After creating a *Product Data Submission* record and [generating IDMP elements](/en/lr/64159/), you can generate FHIR messages individually from a *Product Data Submission* record, or in bulk from a *Regulatory Objective*.

To generate an individual FHIR message, navigate to a *Product Data Submission* record, then select **Generate FHIR Message** from the record's **All Actions** menu.

To generate FHIR messages in bulk:

1. Navigate to a *Regulatory Objective* record. 
2. Select **Bulk create FHIR Messages** from the record's **All Actions** menu. Depending on your Vault's configuration, the action may only be conditionally available in a certain state, for example the *Planned* and *In Progress* states.
3. Select an **IDMP Submission Mode**, **Operation Type**, and **Sender**, then click **Next**.
4. Select or deselect *Medicinal Product* records as required, then click **Next**.
5. On the **Confirmation** page, Vault summarizes the selected records and updates. Click **Back** to make adjustments to your selections, or **Finish** to begin creating messages.

Once you've completed this process for either method, Vault initiates a job to create messages, then:

* Sends you an email and notification with a link to a CSV file confirming the status of each referenced *Medicinal Product*.
* Uploads and classifies the related output in the Vault Library under the _IDMP_ > _EU IDMP Submission_ subtype.
* Links the FHIR message to the _Product Data Submission_. Except for any messages generated for [PMS data enrichment](/en/lr/48830/#submitting-to-pms), Vault additionally saves the message as an object Attachment.



<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Vault only generates XML for the <a href="/en/lr/60772/#pds-elements">PDS output objects</a> to which you are granted <em>Read</em> permission.</p>
    </div>
  </div>
</div>



### About eAF FHIR Messages

The IDMP Viewer supports viewing FHIR message XML in human-readable format. For more information, see [Generating eAF Output Reports](/en/lr/5062580/).

## Viewing & Comparing FHIR Messages

When [enabled](/en/lr/60772/#idmp-viewer-enhancements), the [IDMP Viewer ](/en/lr/76688/) allows you to select FHIR messages for viewing and comparison alongside other [IDMP data sets](/en/lr/76688/#idmp-data-sets).

## Exporting FHIR Messages {#exporting}

To export FHIR messages for one or more *Medicinal Products*:

1. Navigate to a *Regulatory Objective* record.
2. Select the **Bulk Export FHIR Messages** action. Depending on your Vault's configuration, the action may only be conditionally available in a certain state.
3. Select or deselect *Medicinal Product* records as required.
4. Click **Finish**.

Once Vault completes generating the XML messages, you'll receive an email and notification with a link to a ZIP file.

## Baselining IDMP Records for FHIR Message Submission {#baselining}

When Vault is [configured](/en/lr/60772/#fhir-message-submission) to [submit][4] FHIR messages to PMS, IDMP records must first be baselined, or populated with all critical PMS identifiers such as the *PMS ID*, pack-level *PMS ID*, *PCID*, and *MPID* to RIM via API. This process maps and updates the returned identifiers to the *Medicinal Product* and related *Registered Packaged Product* records, based on the *Medicinal Product* record's *EV Code*.

To do this, use the **Populate PMS Identifiers** action from a *Medicinal Product* record. When viewing a *Medicinal Product* record in Business Admin, you can additionally use the **Bulk Populate PMS Identifiers** action. These actions are generally available only when the *Medicinal Product*:

* Has an *Authorisation Type* field referencing the Authorised Medicinal Product *Controlled Vocabulary* record.
* References the appropriate *Country* record, via that record's *Region*. The action appears only when a country's *Region* is "European Union".
* References a *Medicinal Product Registration* record with an *EV Code* field value. 

Additionally, these actions may be configured as entry actions only, meaning they are unavailable for manual execution in your Vault.

Upon completion, Vault sends you an email and notification with a link to a CSV file confirming the status of each related *Medicinal Product*. 

* When you select a large number of *Medicinal Product* records for bulk population, Vault processes them in groups of 500 and sends an email and notification with a results CSV for each group. 
* In the event PMS is down at the time you execute the action, Vault notifies you and generates a "No packaging indicated" error.



<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: When a <em>Medicinal Product Registration</em> record does not have a <em>Packaging</em> field value, Vault populates the <em>PMS ID</em> and <em>MPID</em> identifiers on the <em>Medicinal Product</em> record only. Additionally, Vault maps identifiers to existing <em>Medical Product</em> records only. Vault does not create new records when there is not a match with PMS data.</p>
    </div>
  </div>
</div>



## Submitting FHIR Messages to PMS {#submitting-to-pms}

You can submit FHIR messages to the EMA Product Management Service (PMS) individually from a *Product Data Submission* record (`idmp_product_data_submission__v`), or in bulk from a *Regulatory Objective*.



<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: This feature currently supports manufacturing amd pack size enrichment submissions only. It must be <a href="/en/lr/60772/#fhir-message-submission">configured</a> by an Admin, and includes a prerequisite to <a href="/en/lr/48830/#baselining">baseline</a> the related IDMP records.</p>
    </div>
  </div>
</div>



The *Product Data Submission* records selected for either individual or bulk submission must be active and have:

* The *Operation Type* field set to "Manufacturer and Pack Size Enrichment"
* The *IDMP Submission Mode* field set to "PMS"
* The *Submission Status* set to "Not Submitted", or the field is blank.

For pack size details, this excludes records for centralised procedures. This means Vault excludes any _Product Data Submission_ where its _Medicinal Product_'s related _Application_ has a _Procedure Type_ (`application_procedure__rim`) of "Centralised Procedure" (_Veeva RIM UUID_ 7aa0df44-87b9-4309-91a5-20185cdd2415).

To submit an individual FHIR message, navigate to a *Product Data Submission* record, then select **Submit FHIR Message** from the record's **All Actions** menu.

To submit FHIR messages in bulk:

1. Navigate to a *Regulatory Objective* record.
2. Select <i class="far fa-paper-plane"></i> **Bulk Submit FHIR Messages** from the record's **All Actions** menu.
3. Select or deselect *Medicinal Product* records as required.
4. Click **Finish**.

Once you've completed this process for either method, Vault initiates the *Submit FHIR Messages to PMS* SDK job, then:

* Sends you an email and notification with a link to a CSV file confirming the status of each related *Medicinal Product*.
* Updates the impacted records' *Submission Status* field to indicate transmission progress to PMS. Vault sends an additional email and notification once the message reaches a [final status][5].


### About Submission Status & Manual Polling {#about-submission-status}

Vault uses the *Product Data Submission* record's *Submission Status* field to track the record's transmission progress from Vault to PMS, as well as control the available actions for that record.

To do this, Vault polls the PMS API, then updates the *Submission Status* when a response is received. While the status of most transmissions is typically available within seconds, you can use the *Product Data Submission* record's **Update Submission Status** action to manually poll the API in the event a record's status remains as "Message Sent". This action is only available for individual *Product Data Submission* records and cannot be executed in bulk.

| Submission Status | Meaning | Available Actions |
|---|---|---|
| Not Submitted | The default status, populated upon creation of a _Product Data Submission_ record. | _Submit FHIR Message_<br> _Bulk Submit FHIR Messages_ |
| Queued for Submission | A user successfully ran the _Submit FHIR Message_ or _Bulk Submit FHIR Messages_ action. | None |
| Message Sent | Transmission is complete and Vault is awaiting a status response from PMS. | _Update Submission Status_ |
| Submission Rejected | A final status indicating PMS rejected the transmission. | None. See [additional details][6] about resubmission. |
| Submission Accepted | A final status indicating PMS accepted the transmission. | None |

### About Failures & Resubmission {#about-failures-and-resubmission}

Once a given *Product Data Submission* reaches a final *Submission Status*, Vault sends an email and notification with a link to a CSV file confirming the transmission details, including any errors. 

In the event a submission is rejected, review the CSV file to determine the cause.

* When a failure is due to non-technical reasons, we recommend creating a new *Product Data Submission* record to track and manage subsequent submissions.
* When a failure is due to technical issues (such as with the PMS API), a Vault Admin or other user with appropriate permissions can update the record's *Submission Status* field to the default "Not Submitted" status, then users can repeat the submission process.

## FHIR Message Version Support {#fhir-version-support}

Vault generates FHIR messages using FHIR v5.0.0 only. Similarly, the IDMP Viewer only displays complete comparison data for FHIR v5.0.0. See [additional details](/en/lr/76688/#idmp-data-sets) about IDMP data sets in the IDMP Viewer.

For IDMP and PMS FHIR messages, this means Vault only generates messages using v5.0.0, and comparison data reflects v5.0.0 only.

For eAF FHIR messages, this means some comparison data may be incomplete where that version's requirements do not overlap with v5.0.0. For example, the IDMP Viewer displays complete data for a FHIR v4.2.0 message with the same requirements in v5.0.0, but does not display comparison data for a v4.2.0 message which does not have a v5.0.0 equivalent. 

Vault manages FHIR versions using *Controlled Vocabulary* (CV) records of the *FHIR Message Version* type. See additional details about CV record requirements for [PMS](/en/lr/60772/#fhir-cv) and [eAF](/en/lr/5062581/#configuring-fhir-message-viewing)-related messages.

[1]: #generating
[2]: #exporting
[3]: #baselining
[4]: #submitting-to-pms
[5]: #about-submission-status
[6]: #about-failures-and-resubmission