patient_form_appointment_change table has one row per change staff made to a single form on a single appointment. It is the override layer on top of the forms an appointment type asks for: a form can be removed from one appointment, added to one appointment, or marked complete for one appointment. Join appointment_id to appointment.id and patient_form_id to patient_form.id.
The forms an appointment starts with are in Forms required by an appointment type. This table is also where the answer to “did this appointment’s forms get done?” comes from, because a form can be complete without a submission.
This table’s columns and relationships are shown in the Hosted Database schema.
For reporting on but not limited to:
- Forms marked complete by staff rather than submitted by the patient
- The status of every form an appointment required
- How often staff override the forms an appointment type asks for
- Which staff mark forms complete, and how often
Before you query per-appointment form changes
marked_complete is the only change type used today
override_type can be one of three values:
not_required: the form was removed from this appointment, although its appointment type asks for it;required: the form was added to this appointment, although its appointment type does not ask for it;marked_complete: staff marked the form complete for this appointment, whether or not the patient submitted it.
marked_complete. The other two are supported and your queries should still handle them, but do not expect them in your data.
A row counts while deletion_time is null
Undoing a change, for example unmarking a form that was marked complete, sets deletion_time rather than removing the row. Always filter on deletion_time is null when asking what is true now, and leave the filter off only when you want the history of overrides including the ones that were undone.
The status of a form an appointment required, matching Elation
For a form that an appointment requires, the status is:- submitted if a
patient_form_submissionthat counts has the sameappointment_idandpatient_form_id; - otherwise marked complete if a
marked_completerow here counts for that appointment and form; - otherwise incomplete.
Start from the forms the appointment requires
This table only holds changes, so it says nothing about the forms that were never overridden. To report on an appointment’s forms, build the required list first frompatient_form_appointment_type and then layer the status on top, as the status of every form an appointment required query does.
There is no practice on a change
A change carries only the appointment and the form. To group by practice, joinappointment and use its practice_id.
Who undid a change is not always recorded
created_by_user_id is the member of staff who made the change. deleted_by_user_id is filled in only where Elation records who undid it, so expect nulls there.