Skip to content

Insights Page

Arafat Khan edited this page Jun 5, 2020 · 2 revisions

Learn more about how the Insights Page on my app works

This is a feature of the app that I believed required some special attention and shed some light at. It is a feature that I have created and this is a sort of analysis program that does various calculations to show the users how they are using the app. It has to do some computations so every week when the module works the Insights page will take a while to load but it is only one-time and the page will be lightning fast the next time it is visited. It only happens once a week every week

How it works

It revolves around a weekly pattern that refreshes on every Monday. The backend of this feature has been coded to work with Python date objects that will precisely check for what day it is and manage differences between days. Every Monday the user can visit this page so see information about how many tasks they created and completed the previous week. So basically if you are a new user, this page will take about 7 days to learn about you and to collect enough data. Since a week begins on a Monday, this page will be updated every Monday. After visiting this page on a Monday, the contents of this page will not change until the next Monday, but during this period the system will again collect data about your behavior and process it so that it can present them to you next Monday.

If someone opens their account on a day other than a Monday, then the backend system initially works a bit differently. A special request will be made and the Insights will be generated instantly after 7 days from the creation date though with LESS data. What I mean is, if someone created their account on a Wednesday, then on the next Wednesday they will see Insights about their behavior till the previous Monday. Let's say 13th is a Wednesday and someone created their account and 20th is the next Wednesday. So on 20th, the user will see data that they created FROM 11th (a Monday, yes your todos for those two days will be zero) UPTO 18th which is a Monday. So actually the tasks created since 13th UPTO 18th will be analyzed and generated on 20th. Keep in mind 20th is not a Monday but still the data is being generated, that's why this is a special request. So 20th is a Wednesday, what now? Now, on the next Monday which is 25th, the user will get new generated data as usual. This time they will see data FROM 18th UPTO 25th. Hope you get the idea. If you don't, dont fuss about it. Keep doing what you are doing and visit the Insights page every Monday if possible and you shall see some interesting numbers.

Type of data

The feature will every week do some computation to calculate the user's pattern and gather all the data and store it. It shows a number of different insights depending on how the user was using the app. Listing them all would be tedious. Inspecting the source code (insights.py) will surely help you understand the different calculations. Just to name some cool ones, it shows the user:

  • An efficiency rating based on how many tasks they created that week and how many they actually completed
  • Small red numbers that show how many tasks the person might have missed that week or completed after the due date
  • Uses a popular Python library called Matplotlib to draw and render a bar chart based on how many tasks they completed that week
  • And some other info too...
Clone this wiki locally