How to know total number of purged documents for a user?

Since purging can reduce the number of documents that reside on users’ devices, how do I know how many documents are actually residing on user’s device vs how many documents user actually created? dbinfo.doc_count in telemetry documentation mentions that this field represents the total number of docs in the local database. Does this discount the purged documents? If it discounts purged documents as of the telemetry collected date, how do I know how many documents user actually created?

Hi @yirimal

At this time, there is no service that provides the number of purged documents for a certain user.
If this is a feature that is useful, we can add it. Please submit an issue describing your use case and how you’d ideally like this information be available.

To note:

  • this information will only be available on the server. the client can request it though, but it might get stale quickly
  • this information is often subject to change (every time the purge runs, this number can change)

Hi @diana ,
Thank you for response. Having this information would be really helpful and I’d create a request regarding this. In the mean time, can you answer this question?

  • Which records does dbinfo.doc_count in telemetry display? Does it display the total number of records a user created without discounting purged records?

Hi @yrimal

Which records does dbinfo.doc_count in telemetry display

doc_count is the total number of documents that exist in the user’s local database. These documents are definitely not all created by the user (as it will include the homeplace and the user’s contact for example, which are for sure created by some supervisor or admin).

The whole dbinfo object is the unaltered result of the PouchDb info call (cht-core/telemetry.js at 275e5adc647f0e5c8cce7feaa2d496697b956622 · medic/cht-core · GitHub).
This call returns a bunch of values, with doc_count among them.