# Archive a file

## Overview

[Video: Archive a file](https://www.youtube.com/watch?v=4v8fbvw2S5I)

This flow describes how to archive a [file](https://docs.ohc.network/concepts/clinical/files.md) on the **Files** tab of a patient or of an encounter. Care has no way to delete a file, and you cannot undo an archive.

## Pre-requisites

* The file is on the **Files** tab of the patient or of the encounter. Patient files and encounter files are in separate lists.
* The file is not archived. An archived file has an **Archived** badge and no **More Actions** button.
* You know why you archive the file. Care asks you to type the reason.
* If you need the content of the file later, download it first. After you archive it, you cannot open or download it from the **Files** tab. See [Download a file](https://docs.ohc.network/flows/clinical/files/download-a-file.md).
* If the file is on an encounter, you opened the encounter from a facility, not from an organization.
* If the file is on an encounter, you look at the encounter that you opened. If you select another encounter of the patient on that page, Care does not show **Archive**.
* If the file is on an encounter, the encounter is not closed. Care treats an encounter as closed when its status is Completed, Cancelled, Entered in error or Discontinued.
* You have the permissions listed below.

## Permissions

| Permission | Access |
| - | - |
| Can Update a Patient's data | Archive patient files. Care shows **Archive** on the patient's **Files** tab only with this permission. Hold it through [a role on the patient](https://docs.ohc.network/concepts/clinical/files.md#permissions). By default, Staff, Doctor, Nurse, Administrator and Facility Admin hold it. |
| Update Encounter related clinical data | Archive encounter files. Hold it in a [department](https://docs.ohc.network/concepts/facility/department.md) of the encounter or of its current location. Nobody can archive the files of a closed encounter. By default, Doctor, Nurse and Facility Admin hold it. |
| Update Encounter non clinical | Care shows **Archive** on the encounter's **Files** tab only with this permission. Hold it through a role on the encounter. By default, Doctor, Nurse and Facility Admin hold it. |
| Can view clinical data about patients | Shows the patient's **Files** tab and lists the patient files. Hold it through [a role on the patient](https://docs.ohc.network/concepts/clinical/files.md#permissions). By default, Staff, Doctor, Nurse and Facility Admin hold it. |
| Can Read encounter related clinical data | Shows the encounter's **Files** tab and lists the encounter files. Hold it in a department of the encounter or of its current location. By default, Doctor, Nurse and Facility Admin hold it. |

Note: By default, the Administrator role holds "Can Update a Patient's data" but not "Can view clinical data about patients". So a user who has only the Administrator role cannot open the patient's **Files** tab, and cannot archive files there.

## Steps

### 1. Open the Files tab

Open the patient or the encounter that the file belongs to.

Select the **Files** tab. In an encounter, you can also press `g` and then `f`.

Make sure that the **Files** sub-tab is selected. Care selects it when you open the tab.

For help to find the file in the list, see [Find a file](https://docs.ohc.network/flows/clinical/files/find-a-file.md).

![The row of Duplicate lab report.pdf in the Files list](/assets/images/archive-a-file-1-d6a600960a7408f2a05c09e6263e777a.webp)

### 2. Open the More Actions menu

In the row of the file, select **More Actions**. This is the button with three vertical dots.

The menu shows **Download**. If you can change the files here, the menu also shows **Rename** and **Archive**.

If the menu shows only **Download**, you cannot change the files here. Check the pre-requisites and the permissions on this page.

![The More Actions menu of a file with Download, Rename and Archive](/assets/images/archive-a-file-2-ea9a746b87c46b10171a501312f76d48.webp)

### 3. Select Archive

Select **Archive**. Care opens the **Archive File** dialog.

The dialog shows this warning: **This action is irreversible. Once a file is archived it cannot be unarchived.**

![The Archive File dialog with the warning that the action is irreversible](/assets/images/archive-a-file-3-47abdf2b18f4112c4a7596f89b2feffc.webp)

### 4. Enter the reason

The dialog asks for the reason to archive the file. The question shows the name of the file.

Type the reason in the box. The box shows **Type the reason...** until you type.

The reason is required. If the reason has only spaces, Care shows **Please enter a valid reason!**

![The reason Uploaded twice by mistake typed in the Archive File dialog](/assets/images/archive-a-file-4-3a1f1928e30a46d2671b57b72c2f3226.webp)

### 5. Archive the file

Select **Proceed**.

To close the dialog without archiving the file, select **Cancel**.

![The message File archived successfully, and the Archived badge on Duplicate lab report.pdf](/assets/images/archive-a-file-5-632fe391d568e75eab7ddf2be241faaf.webp)

## Expected Outcome

* Care shows **File archived successfully** and refreshes the list.
* If no status is selected, or **Status** is set to **Archived**, the file stays in the list.
* If **Status** is set to **Active**, the file leaves the list.
* The row of the file has muted colors and an **Archived** badge.
* The **Archived** badge shows the archive details when you point to it or tap it.
* The details are the reason, who archived the file, and when.
* The row has a **View** button. **View** opens the **Archived file** dialog with **Archived reason**, **Archived by**, and **Archived at**.
* On a small screen, a tap on the row opens the same dialog.
* The **Archived file** dialog does not show the content of the file.
* The row has no **More Actions** button. You cannot download, rename, or archive the file again from the **Files** tab.
* To see only archived files, set **Status** to **Archived**.
* Care has no way to restore an archived file.

## Related

Concepts:

* [Files](https://docs.ohc.network/concepts/clinical/files.md)

Flows:

* [Find a file](https://docs.ohc.network/flows/clinical/files/find-a-file.md)
* [Download a file](https://docs.ohc.network/flows/clinical/files/download-a-file.md)
* [View or preview a file](https://docs.ohc.network/flows/clinical/files/view-or-preview-a-file.md)
* [Rename a file](https://docs.ohc.network/flows/clinical/files/rename-a-file.md)
* [Upload a file](https://docs.ohc.network/flows/clinical/files/upload-a-file.md)
