Fifth Week of Coding 5th July - 9th July
Hello Everyone, sorry for getting delayed in writing this blog. Last week's work is as follows:
Worked on App Usage Tracking System of Trainer App
To track the app usage I had followed these steps-
- Created “mHBS Trainer Usage Tracker” Tracker Program
- Created Tracked Entity Attributes to store [ total page visits, total time spent on a page, page visits per user, time spent on a page by per user].
- Created “Page Usage Tracker” Tracked Entity with the above attributes.
- Created a tracker program i.e. “mHBS Trainer Usage Tracker” to track the tei created above (Page Usage Tracker).
- There are more than 40 pages in Trainer app. Enrolled tei for each page in “mHBS Trainer Usage Tracker” program.
Now we can send data for each and every page to dhis2 in the Tracker program.
2. Created Local SQL- DB table to store app usage
- Users cannot remain online every time but we want the full usage of our app to track therefore we need some local storage to store app usage in offline mode and update this data to dhis2 whenever the user comes online.
- Therefore created “app_usage” SQL table in the trainer app with the — [page_id (stores tei id of the page with which it is created at dhis2), page_name, page_visits, time spent on page ]
- Whenever a user visits any of the pages ( get to know from routes ) then we update its visits in local DB.
- And similar to time spent on any page, it will be calculated with the help of “beforePageIn” & “beforePageOut” Events with simple subtraction of time in invoking this event.
- Then update this data to dhis2
3. Idea of Threshold Limit for app usage
- I thought that instead of hitting the API continuously to update dhis2 with current usage we can make a threshold limit like 50-page visits means whenever any page visits crossed the number 50 only in that cases we will hit the API to update dhis2 and in other cases, we just update the usage in local DB.
- This will help us to save a lot of users data.
All of the above-discussed flows are integrated and set up. But recently we come up with a better approach suggested by the mentor, so I will try to implement that one and send the MR instead of this approach.
Works Done in the Fourth Week
- Created “Page Usage Tracker” Tracked Entity & “mHBS Trainer Usage Tracker” Tracker Program
- There are approx 40 pages in the trainer app, made tei instance for every page in “mHBS Trainer Usage Tracker” program to keep its usage track.
- Stored page visits and time spent on each page by the user in local SQL-DB as well as updated this to dhis2 program.
What do I plan to do next week?
- Complete Pending Tasks, reimplement this solution with a better approach suggested by the mentor.
- Try to fix some more bugs.
Have you had any blockers or issues that are impeding your project?
- Not yet