Tracking a patient's most recent appointment date

I’m new to the CommCare world and am struggling a bit to understand and
edit an application that was created by a predecessor a couple years ago.

First, some background:

Among several functions, the application is being used to register and
track tuberculosis patients at three clinics. The two forms I will focus on
here are the Register Patient Form (used to register patients) and an Appointment
Form
(used to record relevant patient information during appointments).
The register patient form is only used once per patient (a patient can only
be registered once), while the appointment form is used and updated
multiple times – every time the patient comes to the clinic for an
appointment.

We are now requiring the nurses at the clinics to schedule the patients for
their first appointment when they register the patient. Therefore, we added
a new question called "first_poc_appointment" to the register patient
form. When the nurse gets to this question, they select an appointment date
using the calendar. So, now the patient is registered and their first
appointment is scheduled.

Now we move to the appointment form. Within this form, the nurse is also
asked to schedule the patient’s next appointment. This question is called “
next_poc_appointment.” Within this form, we are also able to see the
patient’s most recent appointment. We know this because we have mapped the
"next_poc_appointment" case value onto a hidden value called “
prev_poc_appointment.” This case value mapping allows us to know, at any
point, when the patient’s most recent scheduled appointment was.

In fact, the first question on our Appointment Form (question #1) is a
label, saying "The patient’s most recent appointment was scheduled for:
<output value="/data/prev_poc_appt_date" /
> " Therefore, the nurse knows
right away when the patient’s most recent appointment was scheduled for.

Finally, the actual problem. Say we have a patient who was registered in
the patient registration form, and their “first_poc_appt” was set.
However, this patient hasn’t actually attended their first appointment yet,
so the “next_poc_appointment” and “prev_poc_appointment” values are not yet
relevant to them. BUT we still want their most recent scheduled appointment
to appear within the appointment form in question #1. Currently, I don’t
see how we can do this.

One initial solution/thought I had was to copy and paste the
“next_poc_appointment” question from the Appointment form into the
Registration form. But unfortunately, CommCare says I need a unique
question ID and can’t just drop “next_poc_appointment” into the patient
registration form. So for now, the value within the patient registration
form is still referred to as: “first_poc_appointment”

Ideally, if it is the patient’s first scheduled appointment,
“first_poc_appointment” would map onto “ prev_poc_appointment" . But if it
is not the first appointment, “next poc appointment” would map onto
prev_poc_appointment.

Is this at all possible? Are there any solutions I am overlooking? Happy to
provide screen shots if helpful.

Thanks in advance!

Alexandra

Hey Alexandra,

Have you tried using an if() statement in the output value to show the
previous appointment date if it exists, and the first appointment if it
does not? For example:

Where count(/data/prev_poc_appt_date) is a common way to check whether a
value is set or not.

Cheers,
Will

··· On Thu, Sep 15, 2016 at 9:20 AM, Alexandra Gordon < alexandra.gordon88@gmail.com> wrote:

I’m new to the CommCare world and am struggling a bit to understand and
edit an application that was created by a predecessor a couple years ago.

First, some background:

Among several functions, the application is being used to register and
track tuberculosis patients at three clinics. The two forms I will focus on
here are the Register Patient Form (used to register patients) and an Appointment
Form
(used to record relevant patient information during appointments).
The register patient form is only used once per patient (a patient can only
be registered once), while the appointment form is used and updated
multiple times – every time the patient comes to the clinic for an
appointment.

We are now requiring the nurses at the clinics to schedule the patients
for their first appointment when they register the patient. Therefore, we
added a new question called "first_poc_appointment" to the register
patient form. When the nurse gets to this question, they select an
appointment date using the calendar. So, now the patient is registered and
their first appointment is scheduled.

Now we move to the appointment form. Within this form, the nurse is also
asked to schedule the patient’s next appointment. This question is called “
next_poc_appointment.” Within this form, we are also able to see the
patient’s most recent appointment. We know this because we have mapped the
"next_poc_appointment" case value onto a hidden value called “
prev_poc_appointment.” This case value mapping allows us to know, at
any point, when the patient’s most recent scheduled appointment was.

In fact, the first question on our Appointment Form (question #1) is a
label, saying "The patient’s most recent appointment was scheduled for:
<output value="/data/prev_poc_appt_date" /
> " Therefore, the nurse knows
right away when the patient’s most recent appointment was scheduled for.

Finally, the actual problem. Say we have a patient who was registered
in the patient registration form, and their “first_poc_appt” was set.
However, this patient hasn’t actually attended their first appointment yet,
so the “next_poc_appointment” and “prev_poc_appointment” values are not yet
relevant to them. BUT we still want their most recent scheduled appointment
to appear within the appointment form in question #1. Currently, I don’t
see how we can do this.

One initial solution/thought I had was to copy and paste the
“next_poc_appointment” question from the Appointment form into the
Registration form. But unfortunately, CommCare says I need a unique
question ID and can’t just drop “next_poc_appointment” into the patient
registration form. So for now, the value within the patient registration
form is still referred to as: “first_poc_appointment”

Ideally, if it is the patient’s first scheduled appointment,
“first_poc_appointment” would map onto “ prev_poc_appointment" . But if it
is not the first appointment, “next poc appointment” would map onto
prev_poc_appointment.

Is this at all possible? Are there any solutions I am overlooking? Happy
to provide screen shots if helpful.

Thanks in advance!

Alexandra


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.