Track data entered on android phones

Hi everyone,

Is there a way to track data each user/activist submits on android phones?

Activists collect data on the phones in their activities in the community and we want to be able to track data they submit.

Thanks

Hi @ferdinandmussavene,

Are you using Tracker Programs, Events, or Aggregate Datasets?

Thank you!

Hi @Gassim,

I am using event and tracker programs.

Thanks

Hi,
Okay I will start with what I know from the Web and then we can get more info for the android phone (I will ask for support from @dhis2-android), thanks!

I’d first like to refer you to the Audits doc which you can use as a guide to get audit log from the database.

For tracker programs:

Track changes to the tracked entity type:
  1. make sure that you checked “enable tracked entity instance audit log” in the tracked entity type settings:
  2. You will be able to view audit log in the profile widget in Tracker Capture:

Tracked entity data value audits, Tracked entity attribute value audits, and Enrollment audits:

Unfortunately, I don’t think that it’s possible to get these directly from the UI (not yet) but you can do so using the API, so you’d need to use either the docs above using the audit logs in the database, or this docs using API.

However, you could still create a Data Element that requires the user to enter their name (but then the only way to validate that is using the audit logs from the API or from the database).


Audit history for events was available directly in the UI in the old app but in the new Capture app, the audit history is no longer available in the UI. Currently the way to get the audit history for events is using the audit log in the database. ^^


All these answers were for the Web but I hope you will still find them helpful! I’m not an expert so if anyone from the dhis2 core team experts or from the community finds a mistake please correct me. :grinning:

Thanks :+1:

HI @ferdinandmussavene . It is not clear to me what are you trying to track so if you provide more information on your request we can maybe guide you more.

In addition to @Gassim response I will add:

  1. You could also use the power of your reverse proxy logs (or Tomcat directly) to get some information.
  2. On top of this, for a while Android has introduced Matomo as tracking system which would allow you to set up a Matomo instance and collect much more information per user. Please review this: DHIS2 Android App - DHIS2 Documentation
1 Like

Hello,

I have some questions related to this sentence "Audit history for events was available directly in the UI in the old app but in the new Capture app, the audit history is no longer available in the UI. Currently the way to get the audit history for events is using the audit log in the database. "

1- Do you know if the new Capture app will have this feature in the future?

2- Could you show me how to see the audit log via SQL? Is this possible to have an sql view inside dhis2 to get this information?

3- The api https://mydhis2serverXXX./test/api/events/XJlr2MoK3Gf shows part of the updated information for a data element, but it doesn’t show all the historic changes about it. For example:

<dataValue created=“2022-10-23T12:54:22.089” lastUpdated=“2022-10-23T18:19:11.055” value=“v22222222222222222ee.” dataElement=“YUDW8j6dyo6” providedElsewhere=“false”>
<createdByUserInfo>
hLDEprRBKAD
Surveys1

<lastUpdatedByUserInfo>
B9HAcawLqqG
Surveys2

For the up code, the data element “YUDW8j6dyo6” had three real changes, but the API only shows the last one.

Thanks a lot for your time.

1 Like

@tracker-products

In the Maintenance app → Other → SQL View, you can run Postgresql queries. Create a SQL View and use make sure after executing it to change the sharing to ‘capture and view.’

These are the tables that you can start with the build your audit queries:

audit
metadataaudit
programtempownershipaudit
trackedentitydatavalueaudit
trackedentityinstanceaudit
trackedentityattributevalueaudit
dataapprovalaudit
datavalueaudit

Yes maybe it will be visible in the database but I’m not sure how far back the database will log these changes. I guess this depends on the configuration.

Thanks!

Hello again,

I have been investigating, and this data is located at: trackedentitydatavalueaudit
With excel I could filter and locate the different changes.

Do you know if DHIS2 maintains the total history of a datavalue in the audit tables? In other words, are they recycled in some way or another?

Is there any place I could see the relationship between the sql tables? Kind of map or similar? I tried to find without success.

Thanks a lot.

:+1::+1: thanks for sharing!

“DHIS2 does automatic auditing on all updates and deletions of aggregate data values, tracked entity data values, tracked entity attribute values, and data approvals.” https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-236/audit.html

I say the best way is to use pgadmin … :+1:

I prefer DBeaver which can produce maps out of the relantionships. You can search in the CoP as I posted a it a while ago. :slight_smile:

1 Like

Thank you.

  It has been very useful.

Regards.

2 Likes