Modern web applications are useful software solutions that can be accessed from any web-connected device. Most of the newer applications are responsive (i.e. the user-interface adjusts automatically to suit the device viewport size) and are compatible with most modern Web Browsers. However, a professional quality web application can take hundreds, if not thousands, of hours of development time to create, deploy, and maintain, often reaching into the tens-of-thousands of dollars for the total cost of ownership. That’s where rapid development, or “low code”, software solutions have an advantage. Low-code solutions are often promoted to companies lacking the resources and expertise, or needing to get a solution to market fast. These tools can help companies be up and running in no time flat, at a fraction of the cost.
In this post, I will discuss a Full-Stack Web Application platform that I’ve recently discovered, called Anvil1. I will also highlight one of the projects I completed using this new platform.
Anvil – Production Ready Web Applications
In addition, Anvil takes care of the DevOps for you, with one-click deployment to the Cloud. Also, because Anvil is an open-source platform, you can run it anywhere, even on your own servers behind a firewall. Another nice feature of Anvil is the backend database is built on PostgreSQL, and the Anvil web-based IDE makes interacting with the database extremely simple. There is no need to use PostgreSQL PgAdmin, or to create the database schema using SQL DDL scripts. It’s all handled for you by the Anvil IDE.
In addition, Anvil also has some very powerful integrations with User/Session management, User authentication, API tools and interfaces, Google Maps, Google Drive, Media files, and built-in GIT version control. In all my years working with software, I have never seen a more rich set of features out of the box than what Anvil provides. You can literally have a fully functional web application running in a matter of minutes.
I typically work solo, and using Anvil has been a godsend, increasing my productivity 300-400%. It’s like having three or four professional web developers on the payroll, without the payroll. What I’ve built thus far with Anvil are in the style of SPA’s (single-page web applications), but Anvil also has features for building visual dashboards and applications that showcase Data Science solutions.
In the next section, I will describe the project I completed recently using Anvil.
Loblolly Pine Thinning Schedule Using an SDI Approach
One of my favorite pastimes is reading scientific journals that describe growth and yield models developed for Loblolly Pine plantations. When I find one that I’m really interested in, I try to replicate the models using a Spreadsheet, or Jupyter Notebook. This process is helpful for learning something new, or if you’re like me, remembering something you’ve previously forgotten.
Recently, I discovered a paper that I had stashed away almost twenty years ago titled “Use of Stand Density Index to Schedule Thinnings in Loblolly Pine Plantations: A Spreadsheet Approach.” by Paul F. Doruska, and W. Robert Nolan, Jr. (1999). I was immediately drawn to the simplicity of the approach the authors presented. In the article, the models were incorporated into a Spreadsheet solution, but my goal was to update this approach using a Single-page application that was user-friendly and responsive. For the remainder of the article I will briefly discuss this process.
In the article, the authors presented four methods to schedule a thinning, or harvest, for Loblolly Pine stands based on the user-supplied current stand information,
- schedule the next thinning
- schedule one thinning and a harvest
- schedule two thinnings and a harvest
- schedule a final harvest
My Solution and Approach
My previous experience with growth and yield projection models, is that they work well for planning purposes, but fail miserably on an operational level. I believe this is partly due to highly variable stand dynamics, and because thinning operations can have significant stand altering effects, which add a heuristic element to these forecasts.
Knowing this, my approach was to develop a tool that would be more practical, at least operationally, and so I removed the one- and two- thinning approaches outlined above. The application I built only addresses the next-thin and and final harvest scenarios. My assumption is that a Forester using the model would have a good understanding of the current stand conditions, and thus predictions to the next future operation (thin or harvest) would be more applicable than attempting to model the stand through one or more unpredictable thinning operations.
One additional feature that I wanted to build was a diameter distribution chart in the output screen, to visually display the change in stand structure resulting from an operation. For the harvest scenario, only the pre-harvest diameter distribution is plotted. This was accomplished using the Moment-Percentile Estimation approach on the Weibull distribution, described by Baldwin & Feduccia (1987). Anvil provides an interactive charting component that works with Plotly, and various other graphical libraries.
I will avoid getting into the details about the development process and the models here, but, I urge readers to download Doruska & Nolan’s article (1999) to learn more about the models and methods involved.
For the technical stuff, all I did was replicate the methods using Python code running in a Server module. The client-side interface passes data to the Server for calculations, and the Server sends the result back to the client for display to the user. In all, this was accomplished with 1034 lines of Python code (client and server-side). I estimate that the total time from start to completion was around 35 man-hours, which included development, debugging, and testing. If you are interested in seeing the source code for this project, please email me directly, or provide a comment in the post.
Screenshots of the application interface and Next Thin process are shown below.
Baldwin, V. C., Jr., and Feduccia, D. P. (1987). Loblolly pine growth and yield prediction for managed west gulf plantations. U.S. Department of Agriculture, Forest Service – Southern Forest Experiment Station. Research Paper SO-236
Doruska, P. F., and Nolen, W. R., Jr. (1999). Use of stand density index to schedule thinnings in loblolly pine plantations: a spreadsheet approach. Southern Journal of Applied Forestry 23(1), pp. 21-29
1Anvil is a trademark of the Tuesday Project, LTD.