Create a report template
Overview
This flow describes how to create a new report template for a facility in the Template Builder.
Pre-requisites
- You work in the facility that the template is for. Care creates the template for that facility.
- You know which record the report is for: an encounter, a patient, or a billing account. This decides the report type and the context.
- You have the permissions listed below.
Permissions
| Permission | Access |
|---|---|
| Can Create Template on Facility | Shows Create Template if your permissions in the facility include it. To save the new template, you must hold it in the root organization of the facility, Administration. Facility Admin, Doctor and Nurse have it by default. |
| Can Read Template | Shows Templates in the facility settings and lists the templates. You can hold it in any organization of the facility. Facility Admin, Administrator, Staff, Doctor, Nurse, Volunteer and Pharmacist have it by default. |
| Can View Template Schema | Loads the contexts and their fields in the Template Builder. You can hold it in any organization of any facility. Only Facility Admin has it by default. |
| Can Preview Template | Needed only for step 5. Lets you preview the template. You can hold it in any organization of any facility. Only Facility Admin has it by default. |
By default, only a Facility Admin in Administration has all of these permissions. A Doctor or a Nurse has Can Create Template on Facility by default, but not Can View Template Schema or Can Preview Template.
Steps
1. Open the template builder
In the facility sidebar, select Settings.
In the settings sidebar, under Forms, select Templates. Care shows the Templates page.
Select Create Template. Care opens the Template Builder.
Note: If the facility has no templates, you can also select Create Your First Template.

2. Fill in the template details
Complete these fields. All of them are required.
| Components | What it captures |
|---|---|
| Template Name | The name of the template. Enter a name. |
| Slug | The short name of the template. Care fills it from the template name. You can change it before you save. |
| Status | Draft, Active, or Retired. A new template starts as Draft. Care generates reports only from an Active template. |
| Default Format | HTML or PDF. A new template starts as HTML. If people print the report, select PDF. Only PDF reports open and print in Care. |
| Report Type | Discharge Summary, Patient Summary, or Account Report. There is no default. |
The slug must have 5 to 50 characters.
Use only letters, numbers, hyphens and underscores in the slug. Start and end the slug with a letter or a number.
The slug must be different from the slugs of the other templates of the facility. If it is not, Care shows "Slug already exists."
Note: You cannot change the slug after you save the template.

3. Select the context
The context is the set of data that the template can use.
In the right panel, open Select Context. Select the context that matches the report type.
| Report Type | Record that the report is for | Context to select |
|---|---|---|
| Discharge Summary | An encounter | Encounter Report |
| Patient Summary | A patient | Patient Report |
| Account Report | An account | Account Report |
Always select a context, even if the Fields card already lists fields.
If the report type and the context do not match, Care shows "Report Type and Context are not compatible" or "Invalid report type or context" when you save.

4. Insert data fields into the template body
The Template HTML text area holds the content of the report. You write it in the Jinja2 template language.
Note: A new template starts with a sample discharge summary in Template HTML. Change it or replace it.
The Fields card lists the fields of the context that you selected.
Put the cursor in Template HTML at the position for the data.
Select a field in the Fields card. Care inserts the field at the cursor.
If a field has nested fields, select it to show or hide them.
If the field is part of a list, Care inserts it inside a loop over the list.
When Care generates a report, each field shows the data of the record at that time.

5. Check the result
Care does not check the syntax of the template body when you save it. Errors show only in a preview or when someone generates a report.
Preview the template before you save it. See Preview a template.
6. Save the template
Select Save Template.
If a required field is empty, Care shows "This field is required". Complete the field and save again.
If Care cannot save the template, it shows the reason in a message.


Expected Outcome
- Care shows the message "Report template saved successfully".
- Care opens the new template in the Template Builder, so that you can continue to change it.
- The new template shows on the Templates page of the facility.
- If the status is Active, Care offers the template when someone generates a report of that report type. If the status is Draft or Retired, Care does not offer it.
Related
Concepts:
Flows: