DEV Community

Andre Willomitzer
Andre Willomitzer

Posted on

OpenAQ - My first open source PR :)

I've always had an interest in how software and programming can be used to make a difference in the world (socially, environmentally). When researching an issue to work on for my VERY FIRST CONTRIBUTION... I wanted to pick something to do with climate change. That led me to stumble upon this website regarding Sustainable Tech.

Most of the repositories on the list are Python and C++ but I managed to find OpenAQ-API which is the data source (or used to be) for their API which is written in JavaScript. Since I want to work on JavaScript I picked This Repository. Initially, I wanted to fix an issue about their "adapters" returning location names with spaces at the end. However when I went to ping their API, it no longer seemed to be an issue and maybe wasn't closed on the repo.

To begin I forked the repository, and cloned my fork. Next, I made a branch for the issue called "issue-467" to make the changes.

What I picked was an issue to remove unused commented code from one of their files. The issue can be found here Issue 467. The commented code consisted of older methods the developer team used for querying the databases. The PR for this change can be found Here. An example is this chunk of code that I removed alt text

It appears to be a way to build the base SQL query. However, in the /lib/utils folder of the project there is newer code to handle all the SQL query building and payload sorting. For example in this code, it checks if payload exists and runs through each of the query params the user could enter, and "sanitizes" the payload or result based on what is asked for (date ranges, locations, etc). alt text

The purpose of the change I made is to increase readability of the codebase. There is not a purpose of having code that isn't relevant to the application if there is a newer way things are being done. In terms of addressing reviewer comments, my PR has yet to be reviewed, but since it was removing commented code and not messing with functionality I believe it will be okay.

It was an interesting experience contributing to such a large project because it takes a while to get a feel of how things are done and which functions are in which folders. Overall once I got going it was fun though!!!

Top comments (0)