My app has suddenly lost its sharing of cases from one user to another using owner_id

Hello folks -- I have a new problem with the "case sharing by means of
passing owner_id" that has proved so useful to me.

Here is the story. As Sheel and other Dimagi people know all too well by
now, my app https://www.commcarehq.org/a/praha-lao/ has a few levels of
case sharing. first, outreach workers create cases of type "client" when
they interview people. When it's appropriate to create a referral to a
clinic, it creates a child case using normal case sharing, and thanks to
each user's case sharing group, the *HCT clinic *can load that case and
work with it.

But ---> My *second *level of referrals is different. It is a child case
that is made by that HCT clinic user when the client tests HIV positive and
so should create a new case of type ART-Client. FOR THIS ONE, I could not
use regular case sharing, because at this level, the originating user is in
more than one case sharing group. Therefore, I used the method where it
uses case management to pass owner_id to the child case. That worked just
great to create that second jump, so the full chain (from outreach, to hct
clinic, to art clinic) worked fine.)

Please see the attached diagram that shows the overall method. (see the
sloppy addition in the middle link that illustrates the problem I describe
below.)

BUT -- Here is my problem -- I needed to make another new form at that
second level (the HCT clinic) that would process walk-ins to that clinic
(rather than always getting referrals from the outreach workers. Therefore,
This walk-in form (case type SNS-walkin) would collect data on the walk-in
person, and then that form would create the child case of type referral.
So, this walk-in form would simply do almost the same as the outreach form
did -- create "referrals" to HCT...
BUT, it does it from the very same mobile user as will ultimately handle
the Referral case form that it is creating.

And, my problem is, I now find that when the new referral cases are
initially created by child-case-creation from this new SNS-walkin form, it
is NOT succeeding in the pseudo-case sharing when the referral form goes to
make the onward child case creation to ART by passing owner_id
! In other
words, when "referral" case has originated by child-case from that new
form, and the user at the referral form determines the client is HIV
positive and goes to create a new child case of type ART, it does so, and
that new ART case IS visible on that SAME phone of that same user... but
that other mobile user over at the ART clinic, on a different phone, is not
able to see those new ART child cases! they are only seeing the ones that
were created by the normal, original route. So the "pass the owner_id"
method is failing in this new situation.

To be honest, I thoughI had this working correctly when I made the SNS
forms, but now I realize I guess I never tested it successfully making that
last share (jeez!!)

Can you tell me why owner_id passing is not working in this situation?
It's important, I have a deadline :frowning: ....

HUGE THANKS --

Eric

By the way, if any Dimagi person can help:

– the project space on this is https://www.commcarehq.org/a/praha-lao/

– the application is the one called Clinic

– the owner_id passing that is failing is going from the form titled "C1"
to the form titled “D1” … it only fails in the circumstances I
mentioned above

– FYI, the app version currently shown is reverted a few steps from the
highest, I tried to use reversion because I thought I had broken the app to
make this problem. Now I guess it was never working to begin with.

Huge thanks –

Eric

OK, having thought about this a bit, I think I see why it’s not possible
for this to work correctly as it is…

In this new “initiated at the sns-walk-in form instead of initiated at
outreach level” scenario, the “original” owner_id when that second jump is
made will be simply the ID of the HCT Clinic *user, *not a group… since
that HCT clinic user is not in case sharing. And therefore creating this
new ART case, passing the owner_id of a different user over to the new user
can’t work… probably needs to be a group.

So I am guessing that the solution would have to involve something like
having that HCT clinic form, instead of always just happily passing on the
existing owner_id on to this new ART child case, it would somehow
intelligently say “no, in this case, the owner_id is not a group, so I
will arbitrarily pick any existing case sharing group that I am in to
assign to this new child case, since they will all work equally well.”

So I guess I am asking:

(1) is my stab at understanding the problem here correct or totally wrong,
and

(2) what’s the easiest way to fix it so that in this new scenario, that
last referral does indeed correctly make its way to the ART clinic user?

Thanks again. I am hoping this will be my final drama on this app…

Eric

Sorry, one more note. When I said above that the HCT clinic form could
arbitrarily choose any case sharing group that the user was in since they
would all work equally well – that would not be good, I now realize, for
our app. I would rather do something like (1) make a single additional case
sharing group that contained only those final two clinic mobile users, (2)
designate that additional group as the “default” group, and (3) have the
HCT clinic form choose that default group when it could tell that the
existing owner_id was not a group but just a user. I’d be delighted if
I am totally wrong and there is a simpler way, but how would I do this?

Thanks! Eric

Hi Eric,

In the “Walk In” situation, you have a few options:

  1. You would need to add a question that lets you pick the case sharing
    group for the referral (
    https://confluence.dimagi.com/display/commcarepublic/Assigning+cases+to+one+of+multiple+groups).
    The clinic user would then need to choose which mobile user is also
    responsible for the client.
  2. You could create a separate case sharing group for just the clinic
    users and then use the same method as above and train the clinic users to
    ONLY pick the case sharing group that is just for the clinic.

Thanks,
Sheel

··· On Wed, Jun 10, 2015 at 9:54 AM, Eric Stephan wrote:

Sorry, one more note. When I said above that the HCT clinic form could
arbitrarily choose any case sharing group that the user was in since
they would all work equally well – that would not be good, I now
realize, for our app. I would rather do something like (1) make a single
additional case sharing group that contained only those final two clinic
mobile users, (2) designate that additional group as the “default” group,
and (3) have the HCT clinic form choose that default group when it could
tell that the existing owner_id was not a group but just a user. I’d
be delighted if I am totally wrong and there is a simpler way, but how
would I do this?

Thanks! Eric


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.


Sheel Shah
Project Manager | Dimagi
m: +1.781.428.5419 | skype: sheel_shah

Eric,

To add to Sheel’s suggestion, I can think of a couple ways you could
automate what you want to do (IE avoid having users select the default
group in certain conditions) via the use of custom XML. If you’re
interested, please email me directly (wpride@dimagi.com) and we can discuss.

Thanks,
Will

··· On Wed, Jun 10, 2015 at 10:00 AM, Sheel Shah wrote:

Hi Eric,

In the “Walk In” situation, you have a few options:

  1. You would need to add a question that lets you pick the case
    sharing group for the referral (
    https://confluence.dimagi.com/display/commcarepublic/Assigning+cases+to+one+of+multiple+groups).
    The clinic user would then need to choose which mobile user is also
    responsible for the client.
  2. You could create a separate case sharing group for just the clinic
    users and then use the same method as above and train the clinic users to
    ONLY pick the case sharing group that is just for the clinic.

Thanks,
Sheel

On Wed, Jun 10, 2015 at 9:54 AM, Eric Stephan estephan@fhi360.org wrote:

Sorry, one more note. When I said above that the HCT clinic form could
arbitrarily choose any case sharing group that the user was in since
they would all work equally well – that would not be good, I now
realize, for our app. I would rather do something like (1) make a single
additional case sharing group that contained only those final two clinic
mobile users, (2) designate that additional group as the “default” group,
and (3) have the HCT clinic form choose that default group when it could
tell that the existing owner_id was not a group but just a user. I’d
be delighted if I am totally wrong and there is a simpler way, but how
would I do this?

Thanks! Eric


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.


Sheel Shah
Project Manager | Dimagi
m: +1.781.428.5419 | skype: sheel_shah


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.

Thanks to both of you – This is greatly appreciated. Will, I will send you
an email!

Eric