GSoC 2020 : Extending the PEcAn API | Wrap Up

Tezan Sahu
5 min readAug 25, 2020

Wrapping Up GSoC 2020!

This summer has truly been one of the most eventful summers for me till date, packed with some awesome learning experience coming my way as a part of Google Summer of Code 2020 šŸ˜„ !

This is a wrap up post, discussing all the work I have done over this summer as a part of GSoC 2020 with the PEcAn Project. With over 11,000 lines of code across 2 repositories, this summer has certainly boosted my GitHub stats.

My GitHub Contributions during the period of GSoC 2020

Project Summary

Mentors: @kooper, @infotroph, @ashiklom
Student: @tezansahu
Project Proposal can be found here

The Predictive Ecosystem Analyser (PEcAn) Project is an open source framework initiated to meet the demands for more accessible, transparent and repeatable modeling of ecosystems.

Currently, the most preferred way of interacting with the PEcAn project is through the web interface. The prime objective of this project was to extend the PEcAn API package to achieve its full functionality. This translated to work being split into two major deliverables:

  • PEcAn Library (rpecanapi): This is the R library intended for PEcAn users to work with
  • PEcAn RESTful API: This consists of all the endpoints which allows users to remotely interact with PEcAn servers

Potential Impact of the Project

Having the PEcAn API, along with the library in place would now allow a large number of members in the community to utilize the full functionalities and capabilities of the PEcAn Project directly through an R script. This would also facilitate developers to integrate the PEcAn project into other projects or software that rely on ecosystem modeling and related phenomena.

We did see a lot of enthusiasm about this project among community members from the very beginning, and have received constant feedback for improving the user experience with this API over the course of GSoC. I am pleased to note that this project has gained a lot of popularity across the community now.

Spent some time playing around with the new API yesterday. Works great ā€” excellent work! That will definitely be my main method for running PEcAn moving forward.

- Alexey Shiklomanov (Post Doctorate Researcher, PNNL)

Work Completed during GSoC 2020

The course of the project was broadly divided into 3 phases:

  1. Phase 1 (May 21 to June 28) focused primarily on understanding the PEcAn database and catering to the basic GET requests that were needed by users to retrieve information for completing a workflow configuration. The end of this phase also saw the birth of the rpecanapi repository.
  2. Phase 2 (June 29 to July 26) involved bringing the rpecanapi up to terms with the API server, implementing all the GET functionality defined in the API. This phase also targeted a much more rigorous implementation in order to allow users to submit a workflow (as an XML file) using the API and also plot required variables from run outputs. Another highlight of this phase was the dockerization of the API server. All corresponding rpecanapi functions were also developed and tested.
  3. Phase 3 (July 27 to August 24) saw me refining the code and catering to some feature requests made by the community members (in terms of additional endpoints). Workflow submission was extended to JSON formats as well and downloading of files from PEcAn servers was enabled using the API. This phase also involved authoring the much needed vignette for using rpecanapi after actually implementing all necessary functions. Towards the close of the last phase, I managed to add pkgdown integrations and set up a GitHub Page for rpecanapi.

Throughout the GSoC period, I had elaborate weekly discussions with my mentor (usually on Wednesdays) which helped me immensely to streamline my attention, while getting timely assistance. All the details of our weekly discussions could be found in this document.

PEcAn API Server

The novel PEcAn API allows users to remotely interact with the PEcAn servers and leverage the functionalities provided by the PEcAn Project. It has been designed using plumber to follow common RESTful API conventions. These API endpoints use Basic HTTP Authentication and communicate directly with PEcAnā€™s database to relay necessary information back to the user. The API server has been dockerized and included in the docker-compose.yml file.

Hereā€™s the link to the API codebase developed during GSoC 2020.

The following links clearly mention all the PEcAn features that have been incorporated as a part of the API:

Pull Requests Merged:

Contributions for revamping the existing API were made primarily in the form of PRs. During the community bonding period, we had discussed to just have 1 PR per month (once before each review), but as the project progressed, we zeroed down on having a more continuous flow of PRs being merged into the develop branch for community members to actually start playing with the API so that they could give us feedback about bugs or feature requests.

Over the course of GSoC, I was able to get 6 PRs merged into PEcAnā€™s pecan repository, each focusing on a designated set of features as planned according to the proposal (as well as some on demand features from the community).

Detailed information about the discussions that took place, including the commits involved in each PR can be found on this page.

rpecanapi Package

rpecanapi is the open source R package developed (from scratch during GSoC 2020) to interact with the PEcAn Server(s) and leverage the functionality of the PEcAn bioinformatics toolbox. Emphasis has been laid to present the user with an intuitive library to search for relevant information used to create a workflow, submit a workflow and also download relevant files for future analysis. The detailed documentation (with usage guide) has been published using pkgdown and GitHub Pages.

Following are some useful links to understand the usage of rpecanapi:

Pull Requests Merged:

The idea of having this package was conceived during the discussion prior to GSoC 2020. Hence, most of the initial functionality was directly incorporated into the master branch. Later, advanced functionalities like workflow(s) submission, more refined searches and setting up of GitHub pages, etc. were included in the form of PRs.

The details about the PRs merged can be found on this page.

Final Video Presentation: The API in Action!

Hereā€™s a video of me walking through the usage of the rpecanapi & the PEcAn API server

--

--

Tezan Sahu

Applied Scientist @Microsoft | #1 Best Selling Author | IIT Bombay '21 | Helping Students & Professionals Ace Data Science Roles | https://topmate.io/tezan_sahu