Week 8 | More webhooks

July 20, 2020

This week involved testing Github webhooks and process data for Recharts to understand.

Testing webhooks was a bit of a problem as I had to test them from a public server. I tried to port-forward my local server but that did not work no matter what I did. Instead I looked into using a service such as “ngrok” to test them. However, it was a paid service and I was not satisfied with the free-tier as it changed the domain every time I decided to use it. Instead I found a service that was specifically for testing webhooks called “ultrahooks”. With this, I was able to have my own subdomain to test from. This service could only forward POST requests to my local server and it would always return a 204 to the webhook. However it was good enough for my purposes.

After testing the webhooks and ensuring that data was being stored correctly, I had to process the data in a format that Recharts would understand. For this, I utilized pandas. A tricky part of the processing was that there had to be at least a commit a day by every contributor so that we can see that nothing happened on that day. Otherwise, the graph would interpret a gap of inactivity as constant activity. For instance, if someone did a commit one day and then not commits until 7 days later. Then there would be a line between those two points, making it seem like there was some type of activity even when there was no activity. There was a PostgreSQL way to solve this using a function that was able to generate days. However, I did not know how to do it for every contributor. Instead I used pandas to generate days and aggregated the data returned from PostgreSQL.

« Week 7
Week 9 »
Back to blog