 Hello everyone, my name is JB, I am a technical leader in a data team and today I'm going to talk about unlocking the power of what if analysis, which is a technique with TaiPai TaiPai is a new Python library, which has been released last year and with TaiPai you can build interactive dashboards It is one of the few libraries featuring both front end as well as back end features and we will come back to that later I propose we go over, we discover what if analysis in four parts In the first part that I untitled hard coded filters, we will see anti patterns, so stuff you should avoid to do And then from here we will iterate towards more and more advanced patterns until we use TaiPai at its full potential Hard Coded Filters, so I would like to start this talk with a story This story happened to me last year, I actually had to build a BI dashboard And this dashboard had to be built with Looker, which is a BI dashboarding tool in the Google Cloud ecosystem The goal of this dashboard was to expose analytics KPIs for a SaaS KPIs such as, for example, the number of sessions open per user per day or the total duration of user sessions Stuff like this, so analytics And the dashboard was, the data looked like this, the data was stored in BigQuery And there was a huge pile of data which was clustered by customers So you would have a lot of data about customer one, a lot of data about customer two And the company had a lot of customers Users play an important role in our story because we, as developers, we always need to remember that what we build is for them first And this is what should lead the features that we are releasing To build this dashboard, we first went with a first mockup This mockup worked like this, so first you had a customer selector So you would select customer one, customer two, customer whatever And then you would have KPIs about this customer like this You would also have another column with the same KPIs aligned But this time for a customer group related to the first customer So the data was aggregated at a group level And then you would have also other columns with other groups of customers related to this one When you think about user experience, there are several things that can be improved on this version But the one that I would like to highlight the most is that we are dealing with hard-coded use cases And by that I mean that those customer groups are forced Which might lead to user frustration because it will prevent them to... Like you're kind of forcing them to use the tool the way you wanted them to use You're not allowing them to use the tool the way they would like to prefer And usually when programming you want to avoid hard-coding stuff So yeah, but it's a story, so I hope you guys want a happy ending So let's make this happen Let's make this happen thanks to the scenario A versus scenario B approach What the release dashboard looked like was something like this So first we have visual KPIs, cool But most importantly what we have is two groups of customers That are dynamically set thanks to those filters And this way you can configure the orange group here The blue group here and have direct comparison between the two In your plot So yeah, by opposition with hard-coded filters Here you have an infinite amount of use cases You can compare one customer with a lot of customers You can compare a group between a group and stuff like this When we released this dashboard users were very happy Because this pattern, this way of presenting stuff was actually very ergonomic Because the users could dig into data in a way they could not be for And they could really compare customer performances It's a cool story, but the title of the talk was about what if analysis So what's the connection? Well I'm coming to it But first I need to introduce the concept of scenarios What is a scenario? A scenario is a set of input parameters When you set those input parameters you get an output Which is in our case a line And when you change input parameters you get another output It's another scenario and so on It's simple But on what if analysis is the process of iterating this way By changing input parameters and trying to figure out What your data can reveal on your customers This actually might look simple But actually it is what made users happy When I think about it one year after When we released this dashboard I was not aware of the concept of what if analysis Of the concept of scenarios But now I think that this is pretty much related to it And if we want to go deeper on the definition of what if analysis We can ask chat GPT for instance Which we will have an extensive definition In this definition what interests me is that The conclusion is that what if analysis is a structured approach To exploring your data or your data sets Then chat GPT adds some keywords such as scenario Which is important, input variables, assessing the impact Decision makers gaining insights Which is what makes users happy Because they gain a lot of insights about your data this way What do we have? Specialized software such as type I You can also use spreadsheets Even if it's less ergonomic To simulate your scenarios Then chat GPT also gives us examples Of some industries that can benefit from it Such as financial planning or supply chain management But actually as long as you have data You are able to perform what if analysis on it And this includes machine learning If you consider your features as input parameters Ok so now we know what if analysis is How to unlock its power So this is what I just explained This is performing what if analysis That on the other hand feels more like Unlocking the power of it Why? Because in this case we are stacking multiple scenarios On one plot So this allows us to compare things To make more visual comparisons To get a more visual sense of our data Just to make sure we understand the Importance of stacking your scenarios On one plot Let's have a look at this case Where we have isolated scenarios So you can perform what if analysis With isolated scenarios like this But what you will have to do If you want to compare your data Is you have to open one tab And then another tab And set some parameters And switch between tabs So it's not really user centric You will also have to work with different scales Which can prevent you to have a visual sense of your data And this is especially important Because usually BI tools set the scale automatically And sometimes you don't have control over it So it's not the best What you will also have difficulties Is figuring out correlations between your scenarios Like again, yes you can do by switching between your tabs But yeah, it's less optimal This is not something that I am inventing This is based on user feedback I said they were not happy They are less happy if you do this They are still happy So they made feedback about that And this is why we ended up with this version This is what was deployed With a scenario A versus scenario B approach I actually had the opportunity to reach those users Two weeks ago And they are still using this dashboard So they didn't change the structure So they are still happy about it That being said There is a trade off Like if you want to stack multiple scenarios On one plot like this You will have difficulties implementing it With mainstream BI tools I had to implement it with Looker I managed to do it But it felt like hacking the tool to achieve this result Actually I had to write hundreds of lines of SQL In order to be able to have this result Thanks to the help of derive tables for those who know In Looker you are not supposed to write SQL You are more supposed to write LookML So yeah, like this was not really easy to implement With the mainstream tool And the thing about it Is that it puts pressure on the development team Because maintenance will be hard to achieve Especially because this is 100 lines of SQL per KPI And we had 30 KPI KPI's were still getting added So like it becomes a huge patch of SQL that you have to maintain What about POROBI Can we achieve this in POROBI I don't think you can But even if you could You would have to hack the tool as well to achieve this result And you will have to maintain it the hard way So we are in this situation Where on one side we have users that are happy about a feature Developers that are less happy about this situation And I am here in the middle Trying to figure out if there is something we can do It would be so cool if you had a tool to be able to perform this And guess what, that tool actually exists It is named TIEPI And I have a small demo for you Oh, here we go, TIEPI I have a small demo for you In this demo I will showcase TIEPI's native scenarios Because with TIEPI you can have native scenarios This is the only library with which you can do this As far as I know In this demo I also have two input parameters Like in my drawings So what I will do is I will add a scenario Like this Details don't really matter I just name the scenario And there I have a sign function Which is quite simple But what is interesting is that If I do this Ok Oh, I am getting insights about my data Ok, so what if I add another scenario to compare So I am adding another scenario Ok What if I change the amplitude Oh, I see I understand better the sign function now Let's add a third scenario just for the fun On that's it We have three scenarios What if I do that I see What if I do this So yeah That's me performing what if analysis With a simple sign function Of course this is a demo But I hope you can relate to your business cases On this application This type I application is about 80 lines of python Which is quite short For the feature that it highlights We will have a look at the application in a moment But first let's come back to our presentation So thank you type I Introducing type I What is type I So type I just to recap Is a python powered library With which you can build interactive dashboards The library is open source And if you are a company You might be interested in enterprise paid features The library features native scenarios With which you can build What if analysis use cases on top of it You can also build other use cases But here we are focusing mainly on what if analysis And again like this is the only library In the That I know which allows you to do this Another key aspect about type I Is that you are able to write MVP code On put that code to production fast You can turn that MVP to production grade software Thanks to the library Which is actually a cool thing Because Gartner reports that 85% of python pilots Actually fail to go to production Who knew about that? Raise your hand if you knew about that Okay no one Yeah so one person This is a tabou in our community Like nobody talks about it But it's real And type I is aware of that So this is why the library Has been designed to offer you The ability to write MVP applications And then it has also the features That allow you to turn them to production grade To a production grade code base How does the application How does the library achieve this Well first what you build is web applications From the start Featuring a low code syntax And something I didn't mention yet Is that type I features user management Because once you want to go to production You usually have cases such as I want my users to see only that I want other users to see this And to be able to perform that action This kind of use cases And this is what you will be able to do With type I thanks to its user management features Both native scenarios on user management Are backend features Which might sound odd At the first look When you think about a dashboarding library But I hope you understand better The interest of having backend features And this actually is a competitive advantage Of type I compared to other library Data visualization libraries Which you can find a lot these days I would also like to show you the code Of the demo that I just showed you So this demo This is the code of that demo That you can see here I hope it's big enough What do we have? We have some backend code Which is not very interesting to describe here This is mainly glue code Which sets parameters to the appropriate scenarios We have this state here Which is specific to type I I will not be able to cover everything Due to time constraints But what you also have is Scénarios related functions So get scenarios Set this value for this scenario And this kind of stuff And then what you also have Is this And this part is the front end part When you're writing a front end In type I you basically have two options You can write either HTML Or markdown I used markdown here Because it was easier to get started So this is native markdown And that's Actually it's extended markdown Because those tags are not Standard markdown tags Those are type I specific tags What this line means With this line, only one line You get this whole component here Which allows you to manipulate your scenarios Like create updates stuff like this Read On this line, how does it work Well you have a selected scenario variable Which is updated each time You select a new scenario This is the name of the components And that is A simple callback So when things happen In the components The callback is called so that you can handle The changes All type I components work like this So you have a variable With which you can get the value You have the component itself Such as the slider here And then a callback So that you can react to Everything happening on this component There is something else There is this configuration part For this application to work We need to give it a configuration We need to tell type I How our scenarios are Wired under the hood So this is what I do here By loading this Tomal configuration file Which is This file I'm just showing it to you For the record But type I's documentation recommends you Not to update this file This file manually Instead you have a nice VS code plugin With which you can See The configuration In a visual way What this basically means Is that you have two input parameters That we mapped to our variables We have a Python function Which is mapped to this Component here This function And then we have a data frame As an output This here I will not cover But it basically says This is a demo This is a small use case Of course when you write a production Dag Then you will have a lot more Data nodes As well as tasks And yeah So if you happen to Use type I in production You might have variables Such as I am using here As well as SQL queries Data sets On everything you can imagine As data So that's it for the code Let's go back to the Presentation So this slide I copy pasted a graph That type I Has produced in other talks The key idea of this graph Is that type I is in a sweet spot Because you get a lot of features While having a low learning curve On the other hand You have other Popular libraries such as Plotly With which you can have a lot Of features but the learning curve Is quite high And if you happen to use Streamlitz in production You might be aware that You can get started easily But then you don't scale You are not able to scale in production And you cannot benefit from These features such as Native scenarios or user management So let's recap We have seen that Hard coding your use cases Might be not the way to go Then we have seen that What if analysis is more user centric That you can implement With tools like looker Or bi streamlitz which are popular We have also seen the limits Of having only one scenario per plot This is where type I comes to play And we can Thanks to native scenarios Thanks to native scenarios We are able to implement This We can implement stacking multiple scenarios On one plot way more easily And this actually like Stacking multiple scenarios On one plot is my favorite Type I feature That you can build upon Native scenarios So now that we know what type I is That we understand more what it does We can have a look at advanced type I Features And those features I would like to introduce With a concrete example The example of McDonald's Which is Which uses type I For one of their use case This use case is that Every week each single McDonald's Point of sale must publish A forecast of revenues How do we achieve this Forecasting revenues Well we can do it thanks to What if analysis Thanks to native scenarios Then you might want to publish Your executions So that everyone is aware in the company And it's cool because type I Has a nice scenario registry feature That we have seen in the demo And since we are dealing With a use case based on Recurrence So every week every month Every whatever you want Then type I has a cycle feature That allows you to Take advantage of Of this Recurring Need to compute your scenarios Of course this McDonald's application Is a living application It evolves over time So You might get interested in versioning Your scenarios Your executions Because everybody is talking about Versioning code, versioning models But nobody is talking about Versioning executions Of course all of those Features are completely optional You can only work with type I On the front end part Or only with native scenarios If you want I actually don't expect you to remember All of those by tomorrow Is that once you have Native scenarios You can build features on top of it And benefit from it Thanks to type I So if Using native scenarios To perform native analysis Is performing native analysis Combining all of these Features all together For this use case Feels more like unlocking the power of it So that's it You can find the Live demo that I Like the demo that I showed you On my computer, you can find it live On type I cloud Which is currently in beta Which will have Free tiers to deploy type I applications The code that I used Is available on github here And if like me You think that type I has a role To play in the future of Data So Thank you Thank you for your talk We have Around three minutes for Some questions if you have Just please use the microphones I will put mine there No one? Ok You can find Jean-Baptiste in Code space or in Discord So you can ask him To have Thanks again