# Report Template

## Definition

A report template in Care is a facility's reusable definition of a document, such as a discharge summary. Users generate reports from it for an encounter, a patient or a billing account, and its report type decides which.

A report template is not a report. Each report is a separate file that Care fills with the data of the record at the moment of generation, and then stores.

## Key Attributes

The **Template Builder** shows these fields.

| Components | What it captures |
| - | - |
| **Template Name** | The name of the template. Care shows this name when a user chooses a template to generate a report. |
| **Slug** | A short identifier of the template, unique in the facility. Care fills it from the name when you create the template. You cannot change it later. |
| **Status** | Draft, Active or Retired. Only an Active template produces reports. |
| **Default Format** | The file format of the reports: PDF or HTML. A new template starts with HTML. |
| **Report Type** | The kind of record that the template is for: Discharge Summary, Patient Summary or Account Report. |
| **Select Context** | The set of data that the template can use. The **Fields** card lists the data of the selected context. Select a field to add it to the template. |
| **Template HTML** | The content and layout of the document, written in the Jinja2 template language. Its placeholders take their values from the record when Care generates a report. |

### Report Type and context

The report type decides the kind of record that each report is for. Each report type works with one context, which holds the data of that kind of record.

| Report Type | A report is for | Context to select |
| - | - | - |
| **Discharge Summary** | One encounter of a patient | Encounter Report |
| **Patient Summary** | One patient | Patient Report |
| **Account Report** | One account | Account Report |

The report type and the context must be for the same kind of record. If they are not, Care does not save the template.

### What a report can show

Apart from the name of the user who generated the report, a template can show only the data that its context holds. Other data of the record cannot appear in a report.

A Discharge Summary can show:

* The details of the encounter, such as its status, class, care team, location, start and end time, and the patient and the facility.
* The diagnoses and the symptoms recorded in this encounter.
* The diagnostic reports of this encounter, each with its observations, conclusion and attached files.
* The allergies recorded in this encounter.
* The medication prescriptions of this encounter.
* The completed questionnaire responses of this encounter.
* The service requests of this encounter.

A Patient Summary shows only the demographic details of the patient, such as name, gender, age, blood group, address, phone number and date of birth. It has no clinical data: no conditions, medications, allergies, reports or encounters.

An Account Report shows the details and totals of the account, its invoices, charge items and payments, and its primary encounter. Through the primary encounter, it can also show the encounter data in the list above.

Every report can also show the name of the user who generated it.

Conditions appear in a report only as the diagnoses and symptoms recorded in an encounter. Chronic conditions do not appear. Procedures and immunizations cannot appear in a report at all, because no context includes them. Observations appear only inside a diagnostic report.

### Generated reports

When a user generates a report, Care makes it in the background, so the report can take a moment to appear. Each generation stores a new report.

Care keeps the earlier reports. For each template and record, the report viewer lists them under **Report History**. The newest report has the badge **Latest**.

To regenerate a report is to generate it again. **Regenerate** adds a new report with the current data and keeps the earlier ones.

You can archive a report. You must give a reason, and Care records the reason, the user who archived the report and the time.

An archived report stays in the report list with an **Archived** badge. You can open its archive details, but the report viewer no longer shows it.

Care has no action to delete a report, and no action to undo an archive.

Care has no action to delete a report template. To take a template out of use, set its status to Retired. Retiring a template does not remove the reports made from it.

### PDF and HTML reports

Only PDF reports open and print in Care. The report viewer shows a PDF report on the page, and **Print** sends it to the print dialog of the browser.

The report viewer does not show an HTML report, and **Print** is not available for it. To read an HTML report, download it.

A new template starts with HTML as its default format. If people print the reports of a template, set **Default Format** to PDF.

### Status

| Status | Description |
| - | - |
| **Draft** | The template is in preparation. Care does not offer it when users generate a report. A new template starts as Draft. |
| **Active** | The template is ready for use. Care offers it when users generate a report. Only an Active template produces reports. |
| **Retired** | The template is out of use. Care no longer offers it for new reports. |

Note: On the **Templates** page, the status filter calls Retired templates **Archived**.

## Report templates and print templates

Care has two facility features with similar names. They do different jobs.

A report template decides the content of a report: which data the report shows, and how the data is laid out.

A print template decides how Care prints a fixed document, such as an invoice or a prescription. It sets the page size, orientation and margins, the branding (a logo, and header and footer images), a watermark, and auto print.

Print templates are in the facility settings, under **Facility** > **Print Templates**. Report templates are under **Forms** > **Templates**.

Report printing does not use print templates. The report viewer prints the stored report file as it is, so to change how a report looks, change its report template. A report already generated keeps its file, so generate the report again to see the change.

Print templates apply only to fixed documents, and none of these documents is a report type.

## Permissions

You get the permissions in this table through your roles in the organizations of a facility. The roles in this table hold each permission by default.

| Permission | What it allows | Default roles |
| - | - | - |
| Can Create Template on Facility | Save a new or changed template in the **Template Builder**. You must hold it in the root organization of the facility, Administration. | Facility Admin, Doctor, Nurse |
| Can Read Template | See the **Templates** page and its templates, open a template, and choose a template when you generate a report. | Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer, Pharmacist |
| Can View Template Schema | Load the contexts and their fields when the **Template Builder** opens. You can hold it in any organization of any facility. | Facility Admin |
| Can Preview Template | Preview a template in the **Template Builder**. You can hold it in any organization of any facility. | Facility Admin |
| Can generate report from template | Generate a report from a template of the facility. | Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer, Pharmacist |
| Can generate report for completed encounter | Generate or archive a Discharge Summary after the encounter is completed, cancelled, discontinued or entered in error. | Facility Admin |

By default, a Facility Admin creates and edits report templates. Doctor and Nurse hold Can Create Template on Facility, but they do not hold Can View Template Schema or Can Preview Template.

To generate or archive a report, you also need permission to change the record that the report is for:

* Discharge Summary, if the encounter is not completed: Update Encounter non clinical, in an organization of the encounter. A discharged encounter counts as not completed. By default, Facility Admin, Doctor and Nurse hold it.
* Discharge Summary, after the encounter is completed, cancelled, discontinued or entered in error: Can generate report for completed encounter, in an organization of the encounter. By default, only Facility Admin holds it.
* Patient Summary: Can Update a Patient's data, through a role that you have for the patient.
* Account Report: Can Update Account, in the facility of the account. By default, only Facility Admin holds it.

To see the reports of a record, you need permission to read that encounter, patient or account.

## Where to find it

Report templates are on the **Templates** page of the facility. In the facility sidebar, select **Settings**. Then select **Templates** in the **Forms** group.

The **Templates** page shows a card for each template. **Create Template** opens the **Template Builder** for a new template, and **Edit** on a card opens it for that template.

Reports are in these places:

* Encounter: the **Reports** sub-tab of the **Files** tab lists the Discharge Summary reports of the encounter and holds **Generate Report**.
* Encounter: the side panel of the **Overview** tab has a **Reports** tab, with a button for each Active Discharge Summary template.
* Patient: the **Reports** sub-tab of the **Files** tab of the patient lists the Patient Summary reports and holds **Generate Report**.
* Account: the **Reports** tab of the account lists the reports of the account and holds **Generate Report**. The menu of an active account also lists the Account Report templates.

Select **View** on a report to open it in the report viewer. The report viewer has **Regenerate**, **Print** and **Download**. To archive a report, open the ⋮ **More Actions** menu in the report list and select **Archive**.

## Related

* Flow: [View report templates](https://docs.ohc.network/flows/platform/report-template/view-report-templates.md)
* Flow: [Create a report template](https://docs.ohc.network/flows/platform/report-template/create-a-report-template.md)
* Flow: [Preview a template](https://docs.ohc.network/flows/platform/report-template/preview-a-template.md)
* Flow: [Edit a report template](https://docs.ohc.network/flows/platform/report-template/edit-a-report-template.md)
* Flow: [Generate and view a report](https://docs.ohc.network/flows/platform/report-template/generate-and-view-a-report.md)
* Flow: [Print a report](https://docs.ohc.network/flows/platform/report-template/print-a-report.md)
* Flow: [Archive a report](https://docs.ohc.network/flows/platform/report-template/archive-a-report.md)
* Concept: [Encounter](https://docs.ohc.network/concepts/clinical/encounter.md)
* Concept: [Diagnostic Report](https://docs.ohc.network/concepts/clinical/diagnostic-report.md)
* Concept: [Account](https://docs.ohc.network/concepts/billing/account.md)
* Reference: [Report & Templates](https://docs.ohc.network/references/platform/report.md)
