# Using the TMF Bot

Veeva eTMF users may upload a large number of documents frequently. The TMF Bot can automatically <a href="/en/gr/25787/">classify</a> new documents and automatically set metadata, saving your organization time and effort. Auto-classification with the TMF Bot can help reduce the number of classification errors, and surface potential issues sooner, thus increasing compliance. The TMF Bot can also automatically set the _Study_ value for documents.

If <a href="/en/gr/72747/">configured to use TMF Bot for auto-classification</a>, Vault will analyze documents added to the <a href="/en/gr/15020/">Document Inbox</a> and populate their _Document Type_, _Subtype_, and _Classification_ fields, with the current status of each document listed in the _TMF Bot_ column. This column is empty when TMF Bot is not enabled or if TMF Bot confidence level is lower than the PCT.

Once this auto-classification is complete, you have the chance to review the classification before completing and removing it from the Document Inbox.

If <a href="/en/gr/576479/">configured to use TMF Bot for metadata extraction</a>, Vault automatically populates the _Study_, _Study Country_, and _Site_ fields on documents, including any documents created via email processors or Vault API.



<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>: If you are unable to locate the answers you need, please see our <a href="/en/gr/73297/">TMF Bot FAQ</a>.</p>
    </div>
  </div>
</div>




## How to use Auto-Classification or Metadata Extraction

Once an Admin has <a href="/en/gr/72747/">deployed an Auto-Classification Trained Model</a> and a <a href="/en/gr/576479/#creating-a-study-metadata-extraction-model">Metadata Extraction model</a> in your eTMF Vault, no additional action is needed on your part. The following methods of adding documents to the Document Inbox result in auto-classification and automatic population of the _Study_, _Study Country_, or _Study Site_ fields by the TMF Bot when possible:

* Uploading a document normally and selecting **Classify documents later**
* Drag and drop documents into the Document Inbox
* Upload via <a class="external-link " href="https://developer.veevavault.com/" target="_blank" rel="noopener">Vault API<i class="fa fa-external-link" aria-hidden="true"></i></a>
* Upload via <a href="/en/gr/26605/">Vault Loader</a>
* Upload via <a href="/en/gr/38653/">file staging</a>
* Upload via <a href="/en/gr/77877/">Vault Mobile</a>
* Create documents via <a href="/en/gr/78164/">Email Ingestion</a>


The TMF Bot then follows these steps to queue, auto-classify, and automatically populate the _Study_ field on uploaded documents:

1. Vault checks the origin of each file and assigns it to a classification queue:
    * Documents uploaded via Vault API, Vault Loader, file staging, or email are placed in a bulk processing queue, ensuring that large imports do not slow down typical auto-classification processes.
    * All other documents, including those uploaded via Vault Mobile, are placed in an express processing queue.
2. The TMF Bot automatically scans each added document. If you navigate to the Document Inbox, you can see the progress for each document in the _TMF Bot_ field. If you cannot see the TMF Bot field, you can <a href="/en/gr/1745/#adding_or_removing_columns">add it as a column</a> in your Document Inbox. Each document will list one of the following statuses:
    * **Express Queued…**: The TMF Bot is waiting to process the document from the express queue.
    * **Bulk Queued…**: The TMF Bot is waiting to process the document from the bulk queue.
    * **Done**: The file has finished processing.
3. If the TMF Bot can auto-classify the document, the document has its _Type_, _Subtype,_ _Classification_, or _Study_ fields populated, and the _Tags_ field will include the _TMF Bot Auto-classified_ tag.
4. If a Metadata Extraction model is deployed, the TMF Bot scans the file name and content to identify a _Study_ > _Study Country_ > _Study Site_ hierarchy match in your Clinical Operations Vault. To populate _Study_, _Study Country_, and _Study Site_ metadata, TMF Bot verifies or applies the following:
   * The user must have permissions on the matched _Studies_.
   * These _Studies_ are not in study migration mode.
   * There is no ambiguity with another matched hierarchy.
   * If parent matches are found, only their children are considered as possible matches.
   * If there are multiple parent matches, their children matches can be used to determine a single parent.
   * If parents are not found, children must be unique to retrieve the hierarchy.
If TMF Bot does not identify a hierarchy match, or rules above are violated, then the TMF Bot does not put anything in the _Study_, _Study Country_, or _Study Site_ fields for that document.

<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>: It is important to note that, while the Bot will search for <em>Study</em>, <em>Study Country</em>, and <em>Site</em> matches, it will set none of those fields if the user has specified the <em>Study</em> in the initial upload of the document to the Inbox. Thus, if you want the Bot to try to populate these fields, you must not specify a <em>Study</em> when you load the document to the Inbox.</p>
    </div>
  </div>
</div>



<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>: In order to populate the <em>Site</em> field, the <em>Site</em> must be at least three characters long. In cases where the <em>Site</em> is less than five characters, the TMF Bot will not populate the field unless it identifies a matching <em>Study</em>.</p>
    </div>
  </div>
</div>



For example, imagine a study, AVEG 027, that has the following sites in it: F1, US4, and US245.
* Matches on the name "F1" will be completely ignored.
* Matches on "US4" will only be considered if the Bot also finds a match for "AVEG 027".
* Matches on "US245" can be actioned, even if a match for "AVEG 027" is not found.



<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>: If the <em>Tags</em> field is not selectable as a column within the Document Inbox, an Admin may need to <a href="/en/gr/2942/">update the default security</a> of the <em>Tags</em> document field in <strong>Admin &gt; Configuration &gt; Document Fields &gt; Base Document &gt; Tags &gt; Security Overrides</strong> . Default security should be set to Read Only.</p>
    </div>
  </div>
</div>



While the time to process each document can vary, Vault aims to have each file processed in five (5) seconds.

### Accepting Auto-Classifications and Metadata Extractions

Once documents have a value of Done in the _TMF Bot_ field, use the checkboxes to select documents, then click **Complete** to enter any necessary document fields. Note that you can only complete documents with the same classification in bulk.

Once completed, the uploaded documents are available for additional processing. Document tags will indicate whether the document was Auto-classified or had any metadata set by the TMF Bot.

### Rejecting an Auto-Classification or Metadata Extraction

If you find that TMF Bot applied an incorrect classification, you can navigate to the document and select **Reclassify** as normal. When you manually reclassify a document, Vault tags the document as **TMF Bot Misclassified**.

If you find that TMF Bot populated an incorrect _Study_, _Study Country_, or _Study Site_ for a document, you can navigate to the document and manually update those fields.

<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>: The <strong>TMF Bot Misclassified</strong> tag only applies to documents loaded into the Inbox, not documents reclassified through the TMF Bot QC step.</p>
    </div>
  </div>
</div>



## Auto-Classification Limitations

1. Some document classifications may not be available to the TMF Bot. This is often because not enough documents were available to train the TMF Bot on that classification or because the classifications were deliberately excluded from training.
2. The TMF Bot only auto-classifies documents if it is confident in its selection. Documents typically have low confidence when the document could easily be classified as two (2) or more different document types.
3. Some categories of documents cannot be auto-classified. These include:
    * Audio or video files
    * Non-text files, such as ZIP files, statistical files, or database files
    * Non-English files, if your Vault does not have the Multilingual Model feature enabled.
    * Files where Vault cannot extract text, for example, if the text is too blurry or if the file is password-protected or encrypted.

<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>: To enable auto-classification and metadata extraction functionality for documents in languages other than English, contact Veeva Services to enable the Multilingual Model feature.</p>
    </div>
  </div>
</div>

