Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update patient_id for reports after it is generated #9011

Open
1yuv opened this issue Apr 15, 2024 · 3 comments
Open

Update patient_id for reports after it is generated #9011

1yuv opened this issue Apr 15, 2024 · 3 comments
Labels
Type: Improvement Make something better

Comments

@1yuv
Copy link
Member

1yuv commented Apr 15, 2024

What feature do you want to improve?
When CHT is used in offline mode and CHWs perform multiple functionalities in a row. For example, register a patient, register pregnancy for them and send pregnancy visit form. Patient id is populated when a report is synced to server and sentinel picks it and generates patient id. This then updates the patient's document. However, it doesn't check or update any reports that were filled out for this patient before the document got patient id.

Describe the improvement you'd like
When patient_id is generated, update other reports that were filled for patient.

Describe alternatives you've considered
For analytics, since we can't rely on patient_id being populated always because of this issue, we've been using patient_uuid and joining it against the person registration to link documents.

@1yuv 1yuv added the Type: Improvement Make something better label Apr 15, 2024
@dianabarsan
Copy link
Member

There's an unfortunate case to this when:

  • user creates contact A while offline
  • submits a bunch of reports about contact A (reports collection X)
  • syncs and goes offline again
  • submits more reports about contact A (reports collection Y)
  • sentinel picks up contact A, updates reports collection X with new patient_id, marks transition as executed
  • user syncs reports collection Y

In this case, reports from collection Y will not be updated. So the solution would require to also check, for every report that is missing patient_id, to get the patient and populate this field retroactively.

There is no problem in using patient_uuid for analytics. Is there a definitive disadvantage to using patient_uuid for analytics?

@1yuv
Copy link
Member Author

1yuv commented Apr 16, 2024

It's working for analytics, however this behavior is causing major incident for CHT's functionality. When

user creates contact A while offline
submits pregnancy report about contact A

And at this point, 8 ANC reminder schedules are generated. These ANC Schedules are supposed to contain patient name and patient id. However, when these schedules are generated without patient id, the message is malformed and the patient id never gets populated. FCHVs don't know for which patient id is a particular reminder and they can not report.

@dianabarsan
Copy link
Member

Ah, I see. And these are scheduled messages? I believe that the messages should be generated correctly, as in you could access the patient_id property from the patient.
Can you share the translation of one of these messages that gets malformed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Improvement Make something better
Projects
None yet
Development

No branches or pull requests

2 participants