Custom App Development for Improved Milk Supply Forecasting

This case study explores the use of predictive analytics tools to better predict milk supply across multiple farms.


Dairy companies receive their milk supply from a number of dairy farms located across different regions. It is critical for the dairy companies to accurately forecast the expected future volumes of milk produced, so that accurate plans can be created to optimally allocate milk amongst production lines for different dairy products. Better planning leads to reduced instances of wastage and shortfall.

Forecasting expected milk volumes accurately is a challenge. The volume of milk produced at a farm in a given time-period depends on a variety of general and localised factors. These include the stage in cows’ breeding cycles, seasonal factors such as rainfall and temperature, soil condition, and one-off unpredictable events such as disease or farmer resourcing levels.  

Further, it is also important to predict the composition of milk, because it is the actual fat and protein content of the milk that drives the quantity of milk products that can be produced from it. Milk composition can also depend on general and local factors.


While many off-the-shelf forecasting tools exist, this customer was able to benefit from a customised app that took into account unique requirements. The customer required a solution that ensured the forecasting process tied in with the rest of the production planning processes. Further, given the range of external factors that could influence the forecast, the client required a customized forecast model.



We designed and developed an app that met the client’s specific needs. Specifically our app was designed to offer:

  1. a flexible, intuitive front-end tool for the business user

  2. a set of features facilitating integration with production planning processes  

  3. a robust, customised forecasting engine

  4. integration with customer’s existing SAP HANA data platform


We developed our solution as a customized app that sits on an integrated SAP HANA technology stack. SAP HANA is SAP’s in memory database offering. We used SAPUI5 (SAP UI for HTML 5) for the front-end. Forecasting was performed using the forecast packages in the R environment.

The app offers good speed due to SAP HANA’s column store. The actual data used by the app is loaded to the HANA database from the relevant source systems using data transformations. SAP HANA offers integration with R for advanced, customised analytics.


We utilized the forecast package in R to forecast the expected milk supply from historical supply data and external datasets. The external data included historical weather data obtained from Bureau of Meteorology.  As many of the external variables showed collinearity (e.g. season, and level of rainfall are correlated), we used machine learning methods to refine the features used in modeling. The forecast methods report forecast values for a time horizon with confidence intervals.  We performed rolling cross-validation on several datasets to measure and report on forecast accuracy.


Further, we developed a user-friendly app that allows business users to create ‘custom forecasts’.  The business user has a workspace in which they create the custom forecast, and are able to visualise and further explore results in depth.

Within the workspace, the user can create a custom forecast by specifying the region/farm, the historical time-period, and horizon for the forecast.  The results are visualised through a clear time-series graphical presentation.  The results show milk supply forecasts for both total milk and also at fat, protein composition level. The presentation also contains a reports on measured accuracy levels of the custom forecasts. Users can perform in depth analysis of their custom forecast, for example, by comparing the custom forecast with previous years data from the same time period.  

A unique feature is that the business user can override parts of the forecast manually, if new information comes to light, such as a temporary closure of sections of a farm. As these changes are not derived from a model, the changes and associated meta-data are recorded and logged for future reporting purposes.  

Further, users can schedule email / text notifications for the completion of large scheduled forecast runs. Users can also download forecast data in Excel.


Future capabilities may include additional functionalities to automatically create the optimal production plans based on the forecasts created.


The particular app was customized for the dairy industry.  However, the app was designed with flexibility in mind and be customised for different use-cases. It can sit on top of other (non-SAP) technology stacks, and the user interface, and integration components (e.g. SMS/email notifications) can be tweaked for your business.

Unlike off-the-shelf predictive analytics packages, we offer a team of data scientists, engineers and experienced consultants to help with customer onboarding. Our highly qualified, multi-disciplinary local team will use their business skills and local presence to ensure the app will fit within your business culture and processes, be intuitive for your business to use, and critically, offer a robust analysis against your specific data set.    

Because the ‘bones’ of the app already exist, we can offer onboarding and customization at an affordable price.  


Sandra Cutic