patient_form_appointment_type table has one row per form set on an appointment type. These settings are what make an appointment ask its patient for forms: book an appointment of a type, and the type’s current forms become the forms that appointment requires. Join patient_form_id to patient_form.id, practice_id to practice.id, and appt_type_id to appointment.appt_type_id.
Staff can override the list for a single appointment, which is recorded in Per-appointment form changes. For how practices set forms on appointment types, see the Patient Forms Guide.
This table’s columns and relationships are shown in the Hosted Database schema.
For reporting on but not limited to:
- The forms an appointment type currently asks for
- The forms an appointment requires of its patient
- Forms that have been removed from an appointment type, and when
- Which appointment types ask for the most forms
Before you query forms on appointment types
The current setup is the rows where deletion_time is null
Those rows are the appointment type’s current forms, in sequence order. Everything else is history.
Elation replaces every row when a type’s forms are saved
Each time a practice saves an appointment type’s forms, Elation deletes all of that type’s rows and writes new ones. Two consequences follow:idis not stable. The same form on the same appointment type gets a newidon every save, soidcannot be used to track a form over time. Useappt_type_idwithpatient_form_idinstead.- A form that is still on the type will also have older rows carrying a
deletion_time. Counting rows overstates how many forms a type asks for, so count distinctpatient_form_idamong the rows wheredeletion_time is null.
deletion_time on its own does not say a form was removed. It says the row stopped applying, which is usually just a resave. A form was genuinely removed only when it has no row with deletion_time is null, as the forms removed from an appointment type query shows.
Only today’s setup is kept
There is no record of when a current form was added to a type. A query that works out the forms a past appointment required will give you the type’s setup as it stands today, not as it stood on the day of the appointment. Treat “forms required” as a current-state answer, not a historical one.The forms an appointment requires, matching Elation
Joinappointment.appt_type_id to appt_type_id here, keeping rows where deletion_time is null. Left join patient_form on patient_form_id and leave out forms whose patient_form.deletion_time is set; the left join matters because a few older forms are not in your Hosted Database at all. Then apply the per-appointment overrides: remove forms with a not_required change for that appointment, and add forms with a required change. See Per-appointment form changes.
Appointment types have no table of their own
There is noappt_type table. An appointment type’s name lives on the appointments that use it, as appointment.appt_type. Pick the name up from there when you need to label a type.
Two forms can share a sequence
Where they do, Elation lists an appointment’s required forms in patient_form.sequence order instead. Sort by both to match what the practice sees.