Is contact.reports limited to a certain number of documents?

Happy new year to all of you guys!

We have stock_receipt documents that belong to a CHW area (doc.place_id === chw_area._id).

The documents are still on the user device and can be accessed by their uuids.

The fact is that :

  • We can’t see them in the Contact Summary reports pane
  • They also cannot be contacted via the ‘reports’ property in the contact summary.
  • If we reduce the number of other documents, they can be reached again.

Do you know if there is a limitation on the number of documents of the ‘contact.reports’ property?

The short answer is that I do not think there should be a hard limit on the number of reports accessible to the contact summary.

I can try to recreate this behavior, but it would be helpful to know:

  1. What version of the CHT are you seeing this on?
  2. Approximately how many docs are associated with the contact in question?

Thank you for your prompt reply @jkuester ,

  • We are using CHT version 3.15.
  • With a query based on place_id the contact has ~40 documents since 2 months and “stock_receipt” documents are among them.

However, 50 documents are displayed in the contact summary. These 50 documents include reports related to CHW such as self-assessment and EPI use.

These 50 docs do not include stock_receipt documents which appear to be older than the reports displayed.

The list seems to be limited to 50 documents…

:+1: Thanks for the context! I was able to confirm that my initial statement was wrong and there is, in fact, a hard limit on the number of reports accessible to the contact summary calculation (and displayed on the contact’s page).

Even on the latest version of cht-core, the limit is 50 docs. I expect this was deliberately done, probably for performance purposes, but I do plan to update the contact-summary documentation to be more explicit about this limitation!

Regarding your current use-case, it probably makes sense to evaluate your purging rules to see if any of the other docs could be removed from the client device so that the stock_receipt docs are not drowned out.

Hi
this is really a bad surprise for us, we’ve developed a workflow for stock management that performs calculation on contact sumary but if no stock management data_records are produced and other data_records arrives to 50…
We should

By the other side we know about a module for the cht here GitHub - medic/cht-stock-monitoring-workflow
In this repo the getSummary function is defined cht-stock-monitoring-workflow/src/cht/stock-summary.js at 6ace50cd9419ffeff5530c0cc7260a8d2192c4f6 · medic/cht-stock-monitoring-workflow · GitHub to use reports and modify the contact summary and in the index.js this function is exported,

I’m figuring out that once this module GitHub - medic/cht-stock-monitoring-workflow installed, we would need to call the exported getStockMonitoringSummaryCards from the ontact-summary.templated.js file of our config, so, if i’m right the same 50 report restriction will be in place even if we installed medic’s GitHub - medic/cht-stock-monitoring-workflow module,
am I right ?

in the updated docs “an array of reports for the contact or for any of the contact’s children.” but I think that the correct is “an array of reports for the contact or for any of the contact’s PERSON children.”
thanks

1 Like

in the updated docs “an array of reports for the contact or for any of the contact’s children.” but I think that the correct is “an array of reports for the contact or for any of the contact’s PERSON children.”
thanks

Good point! Fixed in feat(contact-summary): clarify that children reports are only for persons by jkuester · Pull Request #1258 · medic/cht-docs · GitHub

Just for the record, the answer to this question is, yes, the 50 report limit is at the framework level and to the best of my knowledge the cht-stock-monitoring-workflow does not provide any way to bypass this limit.

Is this a CHT-Core regression? I suspect it is.

Basically if a woman is pregnant, there is no way in the CHT to know she is pregnant if it happened 50 reports ago…? This is a very poor experience.

Is this a CHT-Core regression? I suspect it is.

I have confirmed that this 50-report limit behavior is the same in 3.9. So, if it is a regression it is crazy old.

1 Like

That’s surprising… Thanks so much for confirming :slight_smile:

1 Like

After additional discussion, we are treating this as a bug (unintentional behavior):

1 Like

The Unintentional behavior was fixed and merged.
After the fix:

  1. Now the calculation of the contact-summary currently uses all fetched 500 reports.
  2. However, only 50 reports are displayed in the contact detail page (For performance reasons, we don’t want to app freezing as it fetches the max number of reports (500) all at once). I will open an issue to add pagination to lazy load reports in the contact summary.

contact-summary documentation has been updated accordingly.

1 Like

Hi there, I do not understand this very well, if now we have 500 reports used but only 50 reports shown, and the docs is updated why we have this on docs:


I understand that now the 500 docs are provided. or not ?

Hi @bamatic sorry for any confusion.

  1. There is an open PR for CHT docs that will update the documentation. (My mistake jumping the gun and responding on the forum before merging the PR)
  2. Once merged the documentation will correctly indicate that the contacts summary calculations now include the max fetched reports (500)
  3. I have opened an issue to implement pagination in order to efficiently load All reports associated with a contact.
2 Likes

Hi Ben_Kiarie
Thank you for your answer and this is great new for us, thank you for this implementation.
Could we now in which CHT4.x versions will be this available ?

It should be available in the upcoming 4.7.0 release

1 Like