Resources

Nicolas Nguyen - ZEISS | Supply Chain Management Meetup | RStudio

0 - 50:20 Presentation 50:20 - 56:52 Q&A Presentation by Nicolas Nguyen, Digital Supply Chain and Global S&OP Leader for Carl Zeiss Meditec Abstract: In demand & supply planning, we often need to calculate projected inventories and replenishment plans - sometimes for hundreds or thousands of SKUs, and through different levels of the distribution network. In the sales & operations planning (S&OP) process, we might need to run some scenarios to balance demand and supply to support sales: changing inventories plans, sales plans, delivery lead times, production plans, product mix, etc. Using Shiny, we can design simple, powerful, scalable, and reproducible apps for demand & supply planning as well as the S&OP process. In this talk, you will learn about real-life examples of web applications, which can be deployed in a few minutes to perform some popular demand & supply planning operations. __ 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: Future meetups: https://www.meetup.com/RStudio-Enterprise-Community-Meetup/ R for Data Science Online Learning Community (“chat-supply_chain”): r4ds.io/join RStudio Community: community.rstudio.com

image: thumbnail.jpg

Transcript#

This transcript was generated automatically and may contain errors.

But anyways, without further ado, we're really looking forward to diving deeper into this topic today with Nicolas, so I will turn it over to you, Nicolas.

Okay, thank you Rachel, thank you very much. So maybe now I'm going to share my screen.

Okay, so my name is Nicolas, I'm going to make a short introduction about myself, maybe I need to move this up here. So about me, it's been 15 years that I'm working in supply chain. I started in a company called Sanofi and I spent most of my time in Sanofi working in a few countries, in France, in Japan, in Singapore, in a factory, distribution center, in commercial operations.

And then in 2018, I moved back to France and I started a bit, I work a bit for a company called Pierre Fab in Dermcosmetic. And since two years, I joined another company called ZEISS, making intraocular lenses. And my journey with R started around 2017, four years ago.

And when I started, I had the need to create an app for demand and supply planning called CISO, Sales In, Sales Out. And this is what I'm going to share with you today, because this app was used in MERIA, the animal health division of Sanofi. I used it again in Pierre Fab and I used it again in ZEISS. And it's very easy to translate it from one company to another one.

And what I'm doing, before jumping to this app, in ZEISS, I'm a digital supply chain and global SAP leader. So basically, I spend a lot of time on R every day. So it's fun. I'm paid for it. I'm very happy. And on top of it, I'm teaching R at a local school to teach some students in a master of supply chain how to use R in their daily future work.

What is the CISO app?

So what is a CISO app? CISO stands for Sales In, Sales Out. So basically, here, maybe I'm going to put the pointer, you have a company selling some product to a third party, a distributor or dealer, which is after getting this product and selling it to their customers. So the idea of this type of app is to, maybe I need to make this a bit lower, is to develop a supply chain visibility between the operation of the supply chain of a distributor and the company to see how much they have in stock, how much they are going to sell, to see how much the company will sell to this third party.

So this app is a very generic app and it works very well for a very classic product. So in Meriel, we are selling some products for dogs, cats and other animals. In Pierre Fabre, we are selling some cosmetic products, shampoo, some creams. And in SICE, we are selling some intra-color lenses, this type of thing, when you have a cataract, so the human eyes cannot see anything. So we remove natural eyes, like the 3D lens, and we put a piece of plastic, the plastic kind of, and this is what we manufacture in this division where I am.

So this type of app works with any type of distributor. Sometimes they are big, sometimes they are less big than a company selling them the product. And most of the time, here, it's when there is no connection between this partner and the company, and the idea is to build this connection via R and Shiny.

So to introduce a little bit further the app, to show how it works, I propose you to go into a region, a region, for example, in Southeast Asia, where we have, in this case, several distributors in Vietnam, in Myanmar, in Malaysia, in Singapore, in Indonesia, and so on. And a company is selling to them, and there is no connection between those different distributors and the company. And the idea here is to see how much they have in stock, how much they sell, to predict how much we are going to sell to them.

And we get some data coming from our distributors, through Excel or CSV file, every month, sent by email. So when I was with Marielle, I was actually based in Singapore, and we were working in this region. In Pear Fab, it was another region, and in ZEISS, we have also some distributors, so we use always the same program.

And if you're not working with R, today we are working, or before, in Excel, and I will show you after how does it work, and the idea to switch from Excel to R.

Stakeholder needs and business requirements

And before going to this technical part, let's see what was needed, or what was expected by the different stakeholders, like the business, in blue, and the subvention. So for the people in the business, sales and marketing, the idea was to know how much am I going to sell to my partner, to my distributor, this year, but also next year. So they want to have visibility on the sales for the next 18 to 24 months, and all this depends on how much stock do our distributors hold, and how much, of course, they are going to sell.

So we need to look at how much they have in stock locally, how much they are going to sell, and based on this, we can estimate how much we are going to sell to the distributor, and it will help us to know whether we are going to reach our yearly sales target, our budget. And eventually, if we are sure to reach it, or if we are able to reach it, we can decide to postpone or advance some supplies, which are going to invoice. So it becomes a kind of business tool, and sometimes also we are late to supply. So what you want to know is, is there any risk of shortage locally, if you are late of two weeks, one month, three months, can you run some simulation, if we supplied less than what was in pre-order, what are the consequences?

Sometimes also we might have some supply constraints. One product can be used by several countries, and we need to manage some allocations, giving some stock to some distributors to maybe cover the next four weeks, six weeks. So having a view on the projected inventories will help to manage this type of situation.

And from a supply chain point of view, all this can be summarized into two points, how can we get a shared visibility of the stocks at our distributor level, of their local projected inventories, and calculate together a replenishment plan. And ideally, we would like to have an app which is simple to use and available quickly. It could be made maybe in a couple of days. And we are not connected to our distributors, so all this will be about processing some data in Excel and CSV files.

From Excel to R

So today, or before, how does it look like when we work with our distributors? If you work on Excel, you can have some massive Excel file, a little bit scary when you open them. There are plenty of lines, and sometimes plenty of comments, and plenty of formulas. So most of the time, it looks like this sample. We have in the first column, the code, the description, and after we have the sales forecast, so what the distributor is going to sell, their stock, opening inventories, at their local distribution center, some goods in transit, based on this, we are going to calculate some projected inventories, in units, in coverage, and a supply plan.

So when you have this, you can see here it's only for one product, you have 5 or 10 lines, so imagine when you have 100 products, it becomes really big, and it's a little bit difficult to read, because each distributor might have its own format, so it becomes massive, and many formulas mean so many errors.

So the idea was to check, can we do something in R, and actually when you look a little bit further, we have some yellow colors here, it's always the same thing that we see, it's a demand, sales forecast, the product inventories, and a supply plan. So basically we have three vectors. So we say vectors might say R, so R might be a good fit for it.

So it was then in 2017, the idea was, can we use R to perform those calculations, because at the end you are just dealing with some vectors. So we created a program in R, so it was pretty quick to do, and in only a couple of days, and in this program we do some calculations, which are related to a few columns, which are here, the period of time we can project ourselves a different level of granularity per month, per week, per day, then you have a demand, it can be sales forecast, it can be also some replenishment forecast out from the distributor to sub-distributors or partners, in a range of projected inventories, in units, and in coverage, then a supply plan, which is what is expected to arrive at our partners, and then you calculate also what you call a DRP, a distribution requirement planning, which is basically a supply plan, based on some parameters.

Data inputs and calculations

So how does it work? So basically we get some raw data, about 10 files, several CSV files, which are related to the sales out of the distributors, their actual sales out, their sales out forecast, some data related to the sales in, the actual sales in, so what we sold to them in the last few months, some sales in forecast, what we plan to sell to them, then an expected supply plan, which is what we plan to sell to them or supply to them, which might be aligned to the sales in forecast or different, some DRP parameters, we go through it a little bit further. Some opening inventories, which can be at the local distribution center or in transit, and what is also interesting for the business is to compare with some financial forecast, a budget, and another parameter is called a DRP grid, then a frozen horizon, that we are going to look at more details a little bit further.

So to process them, we work with RStudio, so RStudio Desktop or RConnect. We perform all VTL, and after we get a result that we show in, or that we display in Shiny. Why using Shiny? Before I was, in 2017, using Qlik, QlikView, but actually Shiny is much, much easier when it comes to create some complex visualizations, especially when sometimes we need to aggregate some data, take this result, and combine it with another aggregation. So in Qlik, it was very complex to do, and in Shiny, it's just super easy.

So in Qlik, it was very complex to do, and in Shiny, it's just super easy.

After in Shiny, we have this part that you can call write-back capabilities, sometimes using RnSumTable, it's very nice to type, to enter some data, and to learn some of our capabilities. What I like is the full control of the navigation, especially using the conditional panels, so it makes everything easier, and especially it's quick to duplicate. We see later after we can assemble, like assembling a puzzle, we have one app, another level, and we can assemble them together, and it's super fast using Shiny.

Projected inventory and coverage calculations

So we talk about some calculations. So the first calculation is a very basic one called a projected inventory, so how does it work? Basically, on one product in one country, for example, we have 1,000 units. We are going to sell, in a current event, some quantities, and after we have a projected inventory, it's in supply. So 1,000 minus what you are going to sell this month, minus 100, it remains 900, minus 100 the following month, it remains 800, minus 100 after it remains 700, plus the supply which is coming, so it becomes 7 plus 4, so 1,100, and so on. So we do this type of calculation, combining the different set of data, and we do it for all the product, whether there are 10 or thousands.

The second calculation is a projected coverage. So basically, to illustrate it today, for example, we have 1,000 units in stock. We are going to sell 200 units this month, 200 units next month, so 1,000 minus 600, it remains 400, and after, in two months from now, we are going to sell 800, and we have only 400, so we can cover two months and a half of demand. So to calculate the projected coverage, we need to look at how much we have in stock every month of the projected inventories, and we need to consume this stock based on the coming sales forecast.

So this type of formulae in Excel can be really massive, a lot of lines in each cell, so it becomes a very, very big file, and we might also create some errors when we do it, so it's not easy. So it's why some people also take a kind of shortcut, looking at the average last three, six, 12 months of sales, or the next three, six, 12 months of sales. It works, but sometimes if you have a strong seasonality or a strong trend, sales are decreasing or increasing, it can lead to some mistake. So calculating this is very easy in R, following the first approach.

Replenishment plan and DRP parameters

Then we need to calculate a replenishment plan. So there are two popular options. The first one is using a fixed threshold, a fixed min and a fixed max, means every time our projected inventories go, decrease, or consume, and reach a minimum stock target, we replenish. And after we go down, we replenish. And in the first option here, which is a fixed threshold, we replenish every time we go, for example, below 2,000 units, and replenish to be up to a max, which is 4.5 thousand units.

Another way to calculate this replenishment plan is using a dynamic min and max that we can calculate based on the demand, on the forecast, saying, for example, that you want two months of coverage for a min, for example, and four months for a max. So if the sales are increasing, decreasing, or with seasonality, all is going to be automatically calculated and adjusted. So this is the by default method that you are going to put in this app.

And here, for example, if you define a min of two months and a max of four months, it will mean that every two months, 4 minus 2, we are going to replenish. If you put a min of two months and a max of six months, it means we are going to replenish every four months, 6 minus 2.

Then we have also some DRP parameters to calculate the replenishment quantity. So sometimes you want to replenish single boxes, or parcels, or pallets. If you want to make the preparation time easier and the volumes are consequent, you might want to order some parcels. It will be faster to perform the picking, or some pallets. If the volumes are big, it's much easier at the warehouse to handle the demand. So this app must be able to be customized based on the reorder quantities that you want to define per product.

Another parameter is a frozen horizon. So we are going to receive from our distributors some purchase orders and some forecasts of supply. The idea is that in a frozen horizon, which can be the next three months, or the next six months, or maybe only one month, we only keep some purchase orders. And after, we have a kind of free horizon where we are going to launch a new calculation of DRP. So this is a parameter that should be useful in the app to decide when we start replenishing and when we need to consider the existing POS, purchase orders, in our plan. But it's also useful if we need to manage some allocations. For example, if we know that we have some supply constraints for the next four months, six months, and we cannot supply the level which would be calculated by DRP, we need to constrain the supply. So we can decide for some products or some countries to extend a frozen horizon and to define what we need to, what you want to supply to everybody in those months.

And the last one is a shipment date from the supplier. For example, we are going to calculate first when we need to receive our products in Indonesia or in Malaysia, and what products need to be shipped. They need to be shipped maybe 10 days earlier, maybe 20 or maybe 60 days earlier. All this depends on the delivery time, means how long between the supplier to the customer, considering the different means of transportation. We can ship by air, by sea, by truck, and we need to handle some product, we need to do some local custom clearance. So this can be put into parameters in the app.

So in summary, this app, or the R Markdown script, must calculate projected deliveries, projected coverages, replenishment plan, considering two parameters, a reorder quantity, a multiple of it, a frozen period, and the last thing we need to calculate is a shipment date from the supplier, considering the delivery time. And those parameters, reorder quantity, frozen period, delivery time, must be customizable for each product, whether you use 10 products or 10,000. And the good news is that in R, it's super easy. Here it's a R Markdown file which is going to do all this calculation, there are only 800 lines, actually most of the lines were spaces and comments. So it's a very short program to perform all this.

Results and benefits

And what were the results? First, from reactivity, I would say we moved to productivity. Sometimes you had some supply issues, we need to deliver fast. It was very often due to, I would say, wrong planning. And if we don't look at the stock, at the distributors, we don't anticipate, we just see the problem right now. And by looking at the projected inventories, we really can see the potential problem in the next 6 or 12 months. We also avoid many mistakes due to calculations.

And we automated and simplified everything. As we saw before, it's a very short RMADOM file, not even 800 lines, so it's very quick to code all this. And it allows us not to have any more functions. We keep the databases very clean, the 10 files that we saw before. And obviously, we save a lot of time for everybody at the distributor level or at the company level. And you can focus on analysis. And what is nice is that what is good in one region, so we are talking about here Sophistasia, is that it's easily duplicable in other parts of the world. We have some distributors in the Middle East, in Central America. It's the same code, it's the same app. We just need to put more raw data. So it's very easily scalable.

Demo: single-level DRP app

And now I'm going to show you what it looks like in Shiny. So maybe the best for this is to have two apps. The first one is the one on the top here, it's a single-level DRP to show how does it work on a few examples, and after to look at the C-swap for several distributors.

So this is the first Shiny app. Here we are going to look at a single-level DRP. We look at more levels of data. So basically, here we have four products. DFU, Demand Forecast Unit. Product A, B, C, D. So each product has a different pattern of sales. So this product, for example, has a kind of senility and a trend increasing. So we have in the first column, the demand. What we plan to sell out of the distributor. A supply plan, which is in the frozen horizon here, 1,000 units. And we are going to calculate the DRP in red. So here, every two months, we replace some quantities.

And basically, at the beginning, we have only here a minimum stock, which is equivalent to three months of sales, which is increasing and changing depending on the month. The maximum stock in the middle, in yellow. We have our projected inventories, which is always between min and max, calculated based on the supply plan here on the right. And here on the top, we have our parameters.

So how does it work? We have some parameters, a frozen horizon. This is what we saw before. So we can customize it per product. So product A has a frozen horizon only in January. And after it's free, we can calculate the DRP. Product B is frozen until March. So if you look at product B, we can see that the DRP is going to start only in April. After we have, in this frozen horizon, some PO, existing purchase orders, that we are going to upload and to keep in the frozen horizon as a confirmed supply plan.

And in this simple app, we have a simulation to see how does it look like. So we have four products. And here on the left, we have different parameters just to illustrate how it works. So here we have a safety stock of three months. It means we want to keep always three months and a frequency of supply of four months. So a maximum stock of three plus four, seven. You can see that our coverage here is always between three and seven. We can change it, we can put a safety stock of two months. Our coverage changes, we are between two and six. We can put a frequency of supply every two months. We are always between two and five. And we replenish every two months or we can change it and make it like this every five months.

So what we do here on the simple example, we are going to later to do it on a hundred or even thousand of product. We have a survey order quantity, here is a multiple of one. We can put maybe one hundred. And we have our calculated DRP, which is going to take multiple of hundred. There is a frozen period here, which runs until February. We can put it until May. And you can see that our DRP is only going to start replenishing from May. And if you make it later, maybe in July, it will start calculating in July. And you will see that we are too late, we are going to be in shortage. Our coverage is negative as well as the projected inventories here.

And we have another parameter, this one, DLT, delivery time. So what does it look like? We have what you can call a market date and a plan date. For example, here in July, we want to receive locally 7,400 units. If we need only 15 days to get those products, it means they need to be shipped, let's say, one month earlier. And if you have 60 days of delivery time, the same quantity needs to be shipped two months earlier. So those 1, 2, 3, 4, 5 parameters are the ones that we are going to use in our demand and supply planning.

Demo: multi-distributor CISO app

So this one is another app. So we are in Southeast Asia. The first example in the PowerPoint, we have different countries. Bangladesh, Cambodia, Indonesia, Malaysia, and so on. So in those countries, or to those countries, we supply some products from one supplier. So we maybe select only up to two families of product. Each family of product can have a sub-product into it, which are going to different countries.

So the idea here is, imagine that you are in the region, you are in the business, and you are in charge of all those countries. You want to know a few things. You want to know, out of your distributors, how things are going. So we are going to look at maybe here one distributor, Malaysia. We are going to look at the sales out. Their family, or maybe I put all the families here, of their product. So we are in the business, we want to see the actual sales, what we sold out of the distributor, for one product or all the products, and the sales out forecast, what we are going to sell out of the distributor.

And maybe there is a similarity, so you want to see it as a month-to-month chart. Or maybe there is a trend, so you may want to look at it this way. And it's also interesting to look at it in a consolidated way in a table, to see the growth or decrease, or stability per product.

But at the end, what we are going to sell is here, sales in versus in. So based on the sales out, we are going to calculate replenishment plan, and this is what we are going to analyse here. How much we sold per product, how much we are going to sell. And all this is in units, it gives us a sense of what are the main products and where we go. But also we can valorise it.

And here it comes, useful for the businesses, is this view, maybe I make it like that. Year-to-date versus last year-to-date, not in units as we saw before, but in euros. And we also can compare with the budget. So, what we sold in the last period per product, we are in Malaysia. What we sold now, we can see the variations, where we are going. And you can also project yourself for the whole fiscal year, or calendar year, and to see whether we have some upside-downside versus budget.

And at the end, the question is, am I going to make my budget? Yes or no, do I have room to postpone some supplies? If I have insurance that I'm going to reach my target this year, maybe I want to keep some sales for next year. And if I have enough stock at the distributor level, maybe I can postpone some shipments or decrease them. So, it becomes a tool to help the business to achieve their target.

So, it becomes a tool to help the business to achieve their target.

Then you can look at the projected inventories at the distributor level. So, we are in Malaysia, let's look at maybe this product, product 7. We can look at the projected inventories. Today, we have locally about 27,000 units. There is something upcoming in June, about 10,000 units. So, we have 5 months of stock, so far so good. And we get you a DRP, which gives us a supply every 2 months. Because we have a frequency of supply every 2 months here, so no problem.

But we have a lot of products, and it might not be very easy to look at all those products one by one. Imagine that you have only here in Malaysia all this, about 60 products. So, not so comfortable to look at this view for all the products in all distributors. So, we can create what you can call here a supply risk alarm. We are going to select all our products. And we can look at the projected coverages in months, at the end of each month, per product. So, you can see whether there are some risks or not of supplies.

So, for example, this one, product 31, is decreasing only a few months of coverage and shortage in July. So, let's look at it, 31. Actually, we are going to discontinue. So, we are going to receive something after not enough stock. And the DRP tells us we should get something else. So, we can use this view to look at the current coverages. But also to look at the result of all our calculations, the DRP, with the new coverages. So, we can see here that every 2 months or every 3 months, depending on the product, we replenish something. Sometimes it's fine, sometimes maybe a little bit too late. This one, number 44, maybe we need to advance our supply.

So, when you look at it, today we have 500 units in stock. We sell a bit. We are very low, less than 2 months of stock. And the next supply will be this one in August. It's too late. Maybe we might want to check with our factory whether we can supply earlier, maybe totally or partially from it.

And what is also interesting is that here, when you see all the products, we saw that we have some risk of shortages or maybe also some risk of overstocks. And it's where R becomes very, very useful to do this part, what you can call prescriptive analytics. So, basically, we can create a program which is going to screen all those lines and to analyze for us whether there is a risk of shortage or overstock. And also quantify the impact in terms of sales, maybe missing sales, in terms of cash flow, if you have too much stock. And propose us some possible scenarios.

So, this product is sold in Malaysia, in Indonesia, in Singapore, Vietnam, and so on. So, if one country has a risk of shortage, maybe another one can help to ship some product. So, you can see here the volume for this area, from Bangladesh, from Cambodia, Malaysia, and so on. Maybe some countries can help another one. And all this can be coded. So, we can create our scenarios in the algorithm. And RLF is going to screen all this and to propose us some solutions.

And after, how does it work further? So, we have a separate scalar. We have some inputs. Let's look at them. First input is VDRP horizon. So, frozen period for the next three months here. You can customize it per product. We have some POs, purchase order portfolio, in the frozen horizon. So, we are going to upload for the volumes. And some parameters. Stock mean. We can see it's different depending on the product and the country. Country especially because here it's only the product number 14. And we have maybe three months in Vietnam, Sri Lanka, Singapore, Myanmar, and Malaysia. Maybe five months. So, we can customize everything. Stock mean. Frequency of supply. Reorder quantity that I put here at one by default. And the delivery time.

And after, we can calculate replenishment plan. So, we can download this. It can be our conclusion of the review for distributor. To see, okay, validate this replenishment plan. Or we can ask us to advance some supplies. Or maybe to postpone some supplies. If the sales team want to keep some sales for the next quarter or the next year. And we can look at this at different perspective. From a distributor point of view. When the product need to arrive. Supplier date. When they need to be shipped. And also everything. Distributors and suppliers date all together. So, here we are in Bangladesh, for example. Product 14. The first few months are frozen. And after free horizon. And the DRP is calculated at either free or free horizon. You can see here, 88 units need to arrive in August. So, they need to be shipped in July.

So, here is a bigger example of this swap. To show you how it can be scalable to more countries. Same program. Just more lines to proceed. And to calculate this, it takes maybe 5 seconds. In R, it's very fast. And if there are many products, maybe 200 products. If you make it 1,000, it's just 7 seconds. It's very fast.

Further examples and scalability

So, now I'm going to show you with less detail. Some other examples that we can do. It's always the same approach. To show you how this code is scalable and reproducible. So, in this, we are using the products that you are using in the division I'm working with. So, intraocular analysis. It's just like glasses. You have different degrees. So, one product. Or one product family comes into maybe 30 or 50 types of degrees. And even more, if you are using what you call toric lenses. So, you have not only a power, but also a cylinder.

So, in this, a special manager in one country will manage maybe 10 or 15 product families. But in terms of queue, it's huge. It can be 1 or 2,000 materials to manage. And when it comes to demand and supply planning, so all we use Excel. And you can imagine that with this portfolio, it becomes really, really tough. Or you use R. And it becomes very simple. And in some countries, we are using R.

And it's really easy to go a little bit further. For example, in the example that we saw before, we are looking at projected inventories at monthly bucket. And here, we are going to look at the same thing. So, projected inventories per week. So, we can split our monthly sales forecast that we do in R or another tool. We are going to split this monthly sales forecast into weekly sales forecast. And we even can consider different type of things. We can consider L pattern. For example, we sell all the products the first week of the month and after less. Or a G pattern. We sell everything the last week of the month. Or a regular pattern. We sell roughly the same quantity every week. And we got our monthly sales forecast split into weekly sales forecast. And after, we are going to distribute our sales forecast per diopter or diopter cylinder. So, all this calculation is done in R. We get after a different set of demand, which are actually weekly sales forecast at skew, at material level. So, it's about millions of rows to process. And this is done very, very easily in R with the same code that we saw before. And after, we just look at it in Shiny.

We are talking before about a single level DRP. Now, we are going to look at multiple level DRP. And we said that R is very easy to become scalable and reproducible because the same code that we are going to duplicate depending on the different levels where we are. For example, here, we have a factory shipping some product to a regional hub. Shipping some product, the same product, after maybe some repacking to different countries. Here, Singapore, Philippines, Malaysia and so on, Thailand. And those countries have a local stock that they are going to ship to their customers. So, what we are going to do is to calculate first the DRP replenishment plan here at the country level. In Malaysia, in Thailand, so on. We are going to get the result of this DRP and to use it at demand for the regional hub. And then, at the regional hub, we have to keep some stock. So, we calculate another DRP and we get the replenishment plan from the factory to the regional hub. So, in R, we can calculate the whole flow from the market to the factory modeling this network. It's just the same code that we copy-paste two times. So, it's really simple and really quick.

And in ZEISS, we are also using Shiny to animate our SNOP sales and operation planning process every month. So, I couldn't put the flow of ZEISS, but here I put something very similar. So, imagine that you are in Spain, you have a factory in Madrid, you ship to a global hub in Barcelona. And from there, you ship your product to some affiliates, to some dealers, distributors. Or maybe also to a regional hub and from a regional hub to the different countries. So, following the same approach that we saw until now, we can calculate the replenishment plan of each entity here. And we get this result to know how much the global hub needs to ship. And then we recalculate again the DRP eventually here to see how much the factory needs to supply to the global hub. And when you have the factory, we can model how much we need to produce versus the production capacities, a min, a max, to see where we are and whether everything goes well. Or if we foresee in the next 18 or 24 months, a decrease of charge or maybe too much demand. Maybe we need then to make some adjustments in our production plan to adapt. And we also can play on some parameters. We also can play on the safety stock, DLT, delivery time to run some scenarios if needed. And we also can constrain the sales if we need to work on some allocations.

And another example is this one, FFO. First expired, first out. Before, for example, we look at our stocks. Let's say that we have 1,000 units in stock. And based on it, we see that we are going to sell something and recalculate our projected value. But in real life, we have different batches with different expiry dates and different quantities per batch. And some batches might not be sellable below maybe six months of remaining shelf life or 12 months. So we can also take into consideration the remaining shelf life constraint and calculate what you call the first FFO, first expired, first out demand. To identify, for example, here that 200 units might be scrapped and we need to reorder earlier our next replenishment.

So with the same code, or this one a little bit more customized, but the same approach, we can do actually plenty of things at a very different level of details. SNOP, very big picture, or maybe also something very detailed like this one per batch.

And that's all. That's what I wanted to share with everybody today. So thank you very much. And if you have any further questions, I'm here.

Q&A

Thank you so much, Nicolas. That was awesome. And I love to see all the comments in the chat window right now, too. But a lot of people saying great stuff and very interesting applications. So we do have quite a few questions on the Slido chat, and I've been copying some over from Zoom and putting them there. So anything that goes unanswered, if it's okay, Nicolas, if I send the list of questions over to you and I can maybe put them in a blog post or on community.

But one other question that aside from the repository is where do you host your applications? And what about the security parameters and authorization? Okay. So I think Rachel and Katie know very well the story. So we are using Connect, RConnect. And it was a very long story with the IT team, but finally, everybody's very happy. So we are using Connect to put that behind the firewall of ZEISS. And everybody in the organization can access to it, to all those apps through the URL. So it's safe. IT is happy and the users are happy. And it's very fast.

Another one that was upvoted is how are you integrating the emailed CSVs with the application? So actually, if I come back here. So all is processing in RStudio Desktop. So we have a markdown script. We are going to get all those CSV files which are stored or in my laptop if I use the desktop. Or if you use Connect, we actually put the CSV files on Microsoft Azure. Connect is going to pick up those CSV files, transform them, put them in a new location for the result in Azure. And Shiny is going to pick up Connect to pick up this result to display it in Shiny.

But another question was, did you, or when you were kind of selling this internally, did you calculate the value you added to the company or the money that you saved them? The first point we came is the time. The time that you are saving because it's a lot of data to process. And some people can spend two or three months per year processing data. So only this was a relief. So it was the easiest way to quantify because the rest was maybe too much details and not so easy to talk about something. If we talk about backorders, we need to quantify all this. We need to have some tangible things behind. So we have. But the best is really to say Connect costs 20,000 euros. A guy spending three times, three months per year costs this. And you have not only one guy, you have actually 50 percent. So it's really worth to buy it. And internally, it was enough to move further.

But what libraries did you use for the graphs and tables and all the plots that you'd shown? Yeah, good question. I love a lot of libraries. So first one is iChart. I really like iChart. I find it very, very beautiful. For the Sankey, I think it's data.tree. And for the table, there is one I love, it's Reactable. Reactable is, wow, it's a very, very nice guy who has created plenty of examples on YouTube. It's really beautiful. And there is another one, I think someone from Australia who created Reactformatable. Something like this, another package. So it's Reactable, but with even more visualizations. And for one table I saw, I used CableExtra plus Formatable. And for the little widget, ShinyWidget from Dreamers. ShinyWidget.

I know we're right up on time here, so I just want to say thank you so much, Nicholas, for an awesome presentation and for sharing your work with us. Would love to keep this conversation going with everyone as well. So again, as a kind of longstanding place on that R for Data Science Slack, there's a chat called chat-supplychain. And then also if anyone wants to stick around right now, we'll be on the spatial chat too. And so you can go in and join a virtual table there like we were all in person. But thank you all so much for joining. Thank you, everyone. Thank you so much, Rachel. Have a good evening, everybody, or good day.