Perf System implementation

Hey,

I am working on perf system and wanted make sure that I am going in right direction. I will breifly explain what I am doing or will implement.

Firstly, projects and users are fetched from asana API and store them in database, if they are not currently present. Then, for each project, tasks are fetched.New tasks are directly inserted in database and which are already in db are updated if changed.

For calculating the scores, the list of the tasks completed in last week are fetched from database and and the score is updated for member who is assigned for the task according to the task tag color. If a task belongs the project “Learning and Improvements” the score will be 25% for that task. If a particular member has no completed tasks in last week, score for that member is zero.

Is it the good way to do it?

1 Like

So it’s like you calculate scores for all tasks from all projects. Say your score from all boards except Learning is x , and your score from Learning is y.

Then your final score will be x + min(x/4, y).

Also when do you fetch and store tasks in the DB? On every call to view score or periodically?

So do you store the scores everytime a getScore call is made? Maybe you can store the score once a day after updating the tasks. And then till the next day that score would be returned by getScore.

I was not storing scores in DB so was fetching and storing task on every call to view score. So what I will do is store the score in db for a day.

So, whenever we call getScore, first it will check the score for current date in DB. If, it doesn’t has score in DB then first tasks will be fetched and stored for the DB and for updated tasks, score will be calculated and stored in DB for that particular day.

So, if we do this, then we won’t need keen.io? Because we’re already using it to store the scores. So, we could either keep using keen.io to store daily scores and plot charts; or we store our scores daily and use some other JS library to plot charts. This allows us to retrieve history from the DB, while generating fresh score on every page load and setting the latest point in the chart as of that moment.

Secondly, we should try to retrieve task updates from Asana on a real time basis. I’m sure they have a webhook that we can get triggered to let us know about updates in Asana. The reason this would be useful is that once you mark a bunch of tasks as completed, it’s a common curiosity to figure out how your score has moved.

So, essentially, what I’m proposing is, we get real-time updates from Asana, and then calculate scores in real time as well. The latter means we probably don’t use keen.io for plots, instead using a combination of historical daily scores + latest today’s score in the plot. What do you think, @pawan, @adisha?

Update: One more thing, I find useful is to know what happens if you don’t do any task for the next 1 or 2 days. How would your score look? This is useful to plan tasks and/or absence from office, or even just a general weekend.

Yup means we don’t need keen.io. Should be fairly simple to make basic plots and I suppose Adisha has good experience with charting libraries. Updating scores in real time should be ok, as long as they are triggered by the webhook if there is one.

We could do it on page load as well. It shouldn’t be that expensive. Less than 100 lines of MySQL rows retrieved.

And if it does turn out to be slow, we can just add a simple cache on the server itself.

I checked for webhooks, they are available for asana. Also, I have experience in making charts and graphs. So I think plotting charts will be simple.

2 Likes

Also, note you’d be storing the scores for a particular date for each member. So that we can plot scores for the last week/weeks.

1 Like

Its up @core-devs thanks to @adisha. Good job.

http://52.10.185.224:8080/score. Things that come to my mind next.

  1. Associate IP with a domain name.
  2. Implement some sort of authentication(maybe Github auth should be good).
  3. Clicking on a person should show tasks completed by him in the last week(recent first) on the same page. Maybe something that appears below his name. Clicking back on his name should close it.
  4. Sort by score
  5. Shift to RDS instead of MySQL within the instance or publish data to keen.io.
  6. Improve the CSS styling of the page.
  7. Integrate Github Pull Requests.
  8. Whitelist some users, we don’t need Akhil/Pulkit and Adisha there.