> ## Documentation Index
> Fetch the complete documentation index at: https://help.elationhealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Patient form submissions

> The forms patients submitted, with when each one was submitted and the chart document it created.

The `patient_form_submission` table has one row per form a patient submitted. It is the record that a form came back: which form, which patient, when they submitted it, and the chart document the submission created. Join `patient_form_id` to `patient_form.id`, `patient_id` to `patient.id`, `report_id` to `report.id`, and, for forms tied to an appointment, `appointment_id` to `appointment.id`.

This is the table to count when you want submitted forms. For how staff review responses in Elation, see [Managing forms responses](https://help.elationhealth.com/articles/Managing-forms-responses.md).

This table's columns and relationships are shown in the [Hosted Database schema](https://help.elationhealth.com/articles/hdb/schema.md).

**For reporting on but not limited to:**

* How many forms patients submitted, by form, practice, or period
* Whether submissions arrived from an ad-hoc request or an appointment
* Patients who submitted the same form more than once
* Forms that were sent but never came back

## Before you query patient form submissions

### This is the count of submitted forms

Do not count `report` rows with `report_type = 'PatientForm'` instead. Every submission creates one of those chart documents, but not every one of them has a submission behind it, so the `report` count comes out higher. `report` also reaches further back in time than this table does. Count rows here, and use `report_id` only when you need to get from a submission to its chart document.

### The user who created a submission is not the patient

`created_by_user_id` is a system user, almost always Elation's, and never the patient or the member of staff who sent the form. Do not read it as "who filled the form in". The patient is `patient_id`.

### Submissions arrive by two routes

* **Ad-hoc requests:** the submission is pointed at by `patient_form_request_form.patient_form_submission_id`. See [Forms on a patient form request](https://help.elationhealth.com/articles/hdb/patient-form-request-form.md).
* **Appointment forms:** `appointment_id` is set on the submission itself. A form that an appointment requires counts as submitted when a submission that counts has the same `appointment_id` and `patient_form_id`. See [Per-appointment form changes](https://help.elationhealth.com/articles/hdb/patient-form-appointment-change.md).

Most submissions come in through appointments, so filtering on an ad-hoc request will leave out the bulk of them.

### A submission counts while `deletion_time` is null

`creation_time` is when the patient submitted the form, and it is Pacific Time, as are the other timestamps here.

### Take the earliest submission of a duplicate

A patient can submit the same form twice for the same appointment. Where that matters, for example when measuring how long a form took to come back, use the earliest `creation_time`. The same patient submitting the same form at different appointments over the years is normal and not a duplicate, so scope duplicate checks to one appointment.

### Answers are not included

The questions on a form and the patient's answers are not in the Hosted Database. `report_id` points at the chart document the submission created, which is where the answers live in Elation.

### What is included

A submission is included when a practice in your Hosted Database owns the form and the patient is in your `patient` table. Submissions of forms created before 2024-07-11 and not edited since are not included, and nor are submissions made before 2024-07-11 and not changed since.

## Submissions by form and month

Counts submitted forms per form per month, including forms the practice has since deleted.

```sql sql theme={null}
select
    s.practice_id
  , pr.name as practice_name
  , date_trunc('month', s.creation_time)::date as month
  , s.patient_form_id
  , f.title as form_title
  , count(*) as submissions
  , count(distinct s.patient_id) as patients
from patient_form_submission s
  left join practice pr on pr.id = s.practice_id
  left join patient_form f on f.id = s.patient_form_id
where s.deletion_time is null
  and s.creation_time >= '2026-01-01'
group by s.practice_id, pr.name, month, s.patient_form_id, f.title
order by month, submissions desc;
```

## How submissions arrived

Splits each practice's submissions by route, so you can see how much of the volume comes from appointment forms rather than forms staff sent by hand.

```sql sql theme={null}
select
    s.practice_id
  , pr.name as practice_name
  , date_trunc('month', s.creation_time)::date as month
  , count(*) as submissions
  , count_if(s.appointment_id is not null) as for_an_appointment
  , count_if(rf.id is not null) as from_an_ad_hoc_request
  , count_if(s.appointment_id is null and rf.id is null) as route_not_recorded
from patient_form_submission s
  left join practice pr on pr.id = s.practice_id
  left join patient_form_request_form rf
    on rf.patient_form_submission_id = s.id
   and rf.deletion_time is null
where s.deletion_time is null
  and s.creation_time >= '2026-01-01'
group by s.practice_id, pr.name, month
order by month, submissions desc;
```

## The same form submitted twice for one appointment

Finds appointments where a patient submitted the same form more than once, with the submission to keep.

```sql sql theme={null}
select
    s.practice_id
  , s.appointment_id
  , s.patient_id
  , s.patient_form_id
  , f.title as form_title
  , count(*) as submissions
  , min(s.creation_time) as first_submitted_at
  , min_by(s.id, s.creation_time) as submission_to_keep
  , max(s.creation_time) as last_submitted_at
from patient_form_submission s
  left join patient_form f on f.id = s.patient_form_id
where s.deletion_time is null
  and s.appointment_id is not null
group by s.practice_id, s.appointment_id, s.patient_id, s.patient_form_id, f.title
having submissions > 1
order by submissions desc, last_submitted_at desc
limit 100;
```

*If you have any questions about this topic please reach out to [Elation Support Portal](https://help.elationhealth.com/articles/support-portal-introduction.md) with the subject line HDB - \<your\_question>*
