Created patients not found in database

Hi, CHT community!

I ran into something interesting that I’d like to get more insight into - hopefully have it resolved. The problem is manifesting in two forms, leading me to thinking it could a database conflict issue.

  1. Enrolled patients appear in the UI, but they don’t seem to be found in the database through this endpoint https://itech-zimbabwe-training.dev.medicmobile.org/medic/3495de5c-b0e3-47f9-ae37-f7377303605f or by directly searching in couchdb.

  1. The instance is not talking to rapidpro, despite having added the rp token to the database - enrolled contacts can’t be found on rp.

I initially thought the instance was talking to a different database. Had to rule out database conflicts as described in this section of the docs, as the endpoint returns an empty list

Has anyone faced a similar issue? I’d really appreciate any pointers.

Thank you.

Hi @kawerewagaba

Are you using an offline user’s account to create the contacts? Did you synchronize?
Offline users are only allowed to upload contacts and reports that they would have access to, so if your form doesn’t generate the correct lineage, then your upload could be blocked.

If you login as one of these users, open dev tools, create a contact, sync, and watch for logs, are there errors reported?

Hi @diana

I’m using an offline account, and the app is syncing fine.

An important detail to add is that the same app is running on two other instances - including local - and it is only this that’s misbehaving. Could it be with how the instance was provisioned?

Can you please check the console for errors?

No errors (for the container), surprisingly!

and here’s what a global search for error returns

I meant browser console errors when you sync.

Got it. Here’s a screenshot from the console. No errors reported.

Thanks. If you create any other type of document, do you see it on the main instance after replication?

Do you have a replication_depth setting for your user’s role?

Hi @diana

When you talked about user roles I had to double-check that. Turns out I had assigned the user a supervisor role, named as chw.

Changed that to nurse and everything worked perfectly - in fact messages of all the previously enrolled users started flooding in.

Thanks a lot for the help :tada:

1 Like