After having some exposure to C# projects, I wanted to explore if it's possible to use the Data Service design pattern in R. The end result is a proof-of-concept layer of code including robust, reliable and tested queries for reading and writing into a MongoDB database.
The GitHub repo is here: https://github.com/nik01010/rBuildReleaseTest
The most interesting aspects were using object oriented programming in R, basic dependency injection for the database context and data service, and most of all creating automated CI pipelines to test the package.
There are integration-style unit tests to check all the queries work as expected, and this requires a localhost instance of MongoDB to be available to the CI process - luckily both Travis and GitHub actions support this.
The project also uses standard techniques like validation, logging, error handling, etc to improve maintainability.
Hope others find this PoC useful - any ideas to improve it would be welcome.