Supply chain management presents several unique challenges, with supply chain resilience particularly relevant due to disruptions from the pandemic. With thousands of SKUs and multi-tiered distribution networks, teams are using R and Python to improve forecasts, speed up operational planning, simulate variability, and design efficient supply chains.
The RStudio Enterprise Community group recently hosted an R in Supply Chain Management meetup featuring Nicolas Nguyen, Digital Supply Chain and Global S&OP Leader at Carl Zeiss Meditec. Nicolas shared the work that he is doing with Shiny to balance demand and supply to support sales. Using Shiny, he has designed powerful, scalable, and reproducible applications for the business.
It was awesome to see the beautiful applications that Nicolas built, as well as the reactions and support among the supply chain community that came together for the event. His Shiny applications served as inspiration for many of us that attended.
While we had time for a handful of questions during the session, I’ve included the full Q&A below, which also includes Nicolas’ response to any questions that went unanswered.
We have paraphrased and distilled portions of the responses for brevity and narrative quality.
How long did this take to create and what are the libraries used?
Nicolas: I created the R script to calculate the projected inventories and replenishment plan in 2017 over a few days (with trial & error). Since then, I have been reusing the same code with a bit of improvements. The libraries used are dplyr, DT, tidyverse, and lubridate.
Depending on the complexity, the Shiny applications took anywhere from 4 hours to a couple of days.
Can you provide additional background about the algorithms for the prescriptive analytics, how you build supply chain scenarios, and how you find recommendations?
Nicolas: Yes, I will also create some examples of prescriptive analytics to share with the group within a few months. The idea is to create a “virtual supply planning assistant” that is going to analyze a situation (based on our code & parameters we defined) to propose potential solutions.
A few examples of supply chain scenarios are:
Do you have any suggestions to start developing similar tools? Any material or examples related to Supply & Demand?
Nicolas: Perhaps the easiest way to get started is to look at the existing tools (Excel, APS, SAP, etc.) used by the supply chain team in your company.
Looking at the way they are used for data transformation, analysis, and charts - what are the problems faced (if any)? What is the degree of automation? Then, do the same thing using R & Shiny, and see if it answers some challenges.
I will create a github in July/August to share a few examples:
Do you have an example of using R for the right inventory in distribution channels and warehouses across geography depending on demand sensing?
Nicolas: I currently do not have this, but this is to be created! :)
For products that have 0 demand/supply for a time-point, would the forecasting algorithm impute or take actual 0?
Nicolas: The current algorithm works on projected coverages. If there is 0 demand next month but some demand the following months, it will maintain a coverage to be aligned with the demand of the following months. For any specific need, it’s always possible to modify the code to get the expected behaviour.
What did you use for the plots, graphs, and tables you are showing?
Did you calculate the value you added to your company or the money you saved them? If so, how?
Nicolas: The easiest calculation was on the automation of the process. People could spend 2 or 3 months per year just on data processing. This multiplied by the number of planners, indicates the money saved only by automating the process. Considering that R & Shiny are free, this is a quick win!
We also invested in RStudio Connect to be able to share those apps with different users (Supply Chain, Sales, Finance, Country Managers). The cost is really low compared to the savings done through automation and the time saved in sharing the analysis with different stakeholders.
Then there were all the benefits around a proper calculation of demand & supply planning (reduction of shortages, management of allocations, etc.) that we did not quantify but mentioned.
Is there any interaction with a database with your applications?
Where do you host your app? What about the security parameters and authorization matrix?
Nicolas: We are using RStudio Connect to host the various Shiny applications (and R Markdown files) behind the company firewall. Using RStudio Connect, we can decide which users can see which app and we then define a list of users per app.
Did you build an API to communicate the data?
As per today, we haven’t built an API to communicate the data.
Thank you to Nicolas for an awesome presentation on how he is using Shiny today. With all the interest from the community in this topic, we’d love to continue the discussion and connect us all through:
It would be great to hear from you on RStudio Community about your goals, challenges, and successes that you are having in this space.
This October, Jumping Rivers is hosting a conference on Shiny in Production, with talks from speakers across the UK and Europe.
We are excited to announce that the 2022 Table Contest starts today! We have been blown away by past submissions and can't wait to see what you do this year.