> ## 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.

# Forms on a patient form request

> The individual forms sent on each ad-hoc patient form request, and whether each one has been completed.

The `patient_form_request_form` table has one row per form on an ad-hoc patient form request. It is where the status of a single form lives: which form was sent, where it sat in the list, and the submission that completed it. Join `patient_form_request_id` to `patient_form_request.id`, `patient_form_id` to `patient_form.id`, and `patient_form_submission_id` to `patient_form_submission.id`.

A request can carry several forms, so this is the table to count when you are counting forms rather than requests. For how staff track 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:**

* The status of every form on a request
* How long patients take to complete a form after it is sent
* Which forms get completed most often and which stall
* Forms that are outstanding or overdue across a practice

## Before you query forms on a request

### The status of a form, matching Elation

A form on a request is:

* **complete** if `patient_form_submission_id` is set, meaning the patient submitted it, or `completed_override_at` is set, meaning staff marked it complete without a submission;
* **outstanding** otherwise, and **overdue** once the request's `due_date` has passed.

Staff marking a form complete is supported but unused in practice: `completed_override_at` is null on every row today. Keep the check in your queries so they stay correct if that changes.

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

`deletion_time` here means the form was permanently removed from the request in Elation, which is different from the request itself being deleted. Exclude these rows. Who removed the form is not recorded. Whether the request was deleted is `patient_form_request.deletion_time`.

### Deleted requests are mostly the unanswered ones

A row only counts for Elation's own worklists if its request also counts, which means joining `patient_form_request` and filtering on `deletion_time is null` there. But staff delete the requests patients never completed, so that filter also drops most of the forms that went unanswered. For a response rate, keep forms on deleted requests. See [Patient form requests](https://help.elationhealth.com/articles/hdb/patient-form-request.md).

### A form can show as submitted with no submission row

`patient_form_submission_id` can point at a submission that is not in your Hosted Database, so use a left join to `patient_form_submission` and expect some submission times to come back null. Usually the form was created before 2024-07-11 and has not been edited since, so neither it nor its submissions are included; occasionally the form belongs to a practice outside your Hosted Database. The same applies to `patient_form`, so left join that too when all you want is a name.

### Time from sending to completion

There is no elapsed-time column. Measure from `patient_form_request.creation_time`, which is when the request was sent, to `patient_form_submission.creation_time`, which is when the patient submitted. Both are Pacific Time.

## The status of every form on a request

Returns each form on one request with its current status and, where the patient submitted it, the time they did.

```sql sql theme={null}
select
    rf.patient_form_request_id
  , rf.sequence
  , rf.patient_form_id
  , f.title as form_title
  , case
        when rf.patient_form_submission_id is not null then 'submitted'
        when rf.completed_override_at is not null then 'marked complete'
        when r.due_date < convert_timezone('America/Los_Angeles', current_timestamp())::timestamp_ntz
            then 'overdue'
        else 'outstanding'
    end as form_status
  , r.creation_time as request_sent_at
  , r.due_date
  , s.creation_time as submitted_at
from patient_form_request_form rf
  join patient_form_request r on r.id = rf.patient_form_request_id
  left join patient_form f on f.id = rf.patient_form_id
  left join patient_form_submission s on s.id = rf.patient_form_submission_id
where rf.patient_form_request_id = <patient_form_request_id>
  and rf.deletion_time is null
order by rf.sequence, rf.id;
```

## How long patients take to complete a form

Measures the gap between a request being sent and the patient submitting the form. Forms whose submission is not in your Hosted Database are left out, because there is no submission time to measure to.

```sql sql theme={null}
select
    r.practice_id
  , pr.name as practice_name
  , date_trunc('month', r.creation_time)::date as month
  , count(*) as forms_completed
  , round(median(datediff('hour', r.creation_time, s.creation_time)), 1) as median_hours_to_complete
  , count_if(datediff('hour', r.creation_time, s.creation_time) <= 24) as completed_within_a_day
  , count_if(datediff('day', r.creation_time, s.creation_time) > 7) as completed_after_a_week
from patient_form_request_form rf
  join patient_form_request r on r.id = rf.patient_form_request_id
  join patient_form_submission s
    on s.id = rf.patient_form_submission_id
   and s.deletion_time is null
  left join practice pr on pr.id = r.practice_id
where rf.deletion_time is null
  and r.creation_time >= '2026-01-01'
group by r.practice_id, pr.name, month
order by month, forms_completed desc;
```

## Completion rate by form

Shows which forms come back and which stall. Deleted requests are kept, so a form that is routinely ignored is not quietly removed from the denominator.

```sql sql theme={null}
select
    rf.patient_form_id
  , f.practice_id
  , f.title as form_title
  , count(*) as times_sent
  , count_if(
        rf.patient_form_submission_id is not null
        or rf.completed_override_at is not null
    ) as times_completed
  , round(
        100 * count_if(
            rf.patient_form_submission_id is not null
            or rf.completed_override_at is not null
        ) / count(*)
      , 1
    ) as pct_completed
from patient_form_request_form rf
  left join patient_form f on f.id = rf.patient_form_id
where rf.deletion_time is null
group by rf.patient_form_id, f.practice_id, f.title
having times_sent >= 10
order by pct_completed, times_sent desc;
```

*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>*
