 So let me get this shared here. All right, so as mentioned, I'm gonna be talking about a Shiny app that I developed in collaboration with the Infectious Disease Dynamics Group at Hopkins. And this was intended to help evaluate the impact of COVID-19 test trace isolate programs. So if you'd like to access these slides, I'll post them after this talk at lucymagallan.com slash talk, see if you can find them there. They should be there in just a couple of minutes after I finish giving this talk. So I wanted to just start by acknowledging my collaborators on this project. Emily Gurley, Justin Lesler, Elizabeth Lee and Kira Grantz did a lot to sort of build both the methods that I'm gonna be talking about today and also influence how this particular application was developed at the time we're all at Hopkins, although a couple of them have since gone elsewhere. And so this is sort of the outline of what I'm gonna talk about today. I'll start by describing the model that we used. And so this group came up with a novel way to model this particular, this phenomenon, this test trace isolate, kind of how people move through these compartments and how you can use information that you might have about a certain community to try to estimate the effective reproductive number. I'll talk about what that means in a second using these epidemiological tools. And then I'll very briefly talk about an R package that we developed that implements this model. And then I'll spend the bulk of the time focusing on the Shiny application and sort of a couple of small details on some different tools that we used within Shiny to make this application work. And then I don't think I'm actually gonna have time to demo it myself, but I'll show you the link. And if you'd like to sort of demo the application, you can do that as well. And I also have a link to the GitHub repository. So if you're interested in creating an application like this, all of the code is open and you can do so. So the goal of this work, basically these test trace isolate programs, these are an essential part of infectious disease control in general. And they essentially offer this targeted approach, a more targeted approach than many non-pharmaceutical interventions. But an effective use of these programs basically require the folks who are implementing them to be able to estimate their impact. And so that's what the tools that we developed were intended for. So these were essentially intended for public health departments to be able to, or any institution who might be implementing some kind of contact tracing or test trace isolate program to be able to see how their program is impacting the community transmission, as well as be able to evaluate whether they kind of to optimize for certain changes they might wanna make to their program to figure out how that could kind of optimally impact transmission. So a little bit about the model behind the scenes. This actually, I'm realizing the picture I have here is to the Med Archive, but this has since been published in PLOS and so you can find in PLOS Medicine. It's the same title maximizing and evaluating the impact of test trace isolate programs. You can find the actual mathematical details there. So this is a little bit about the mathematical framework. I've sort of simplified it for this particular talk, but I thought it would be somewhat helpful, especially because most of the folks in the audience are quantitative and so you're likely interested a little bit in kind of the gears behind what this is actually implementing. So the reproductive number, I think a lot of us are familiar with this term now just based on how, based on all the news and things around COVID-19, but in case you're not, this is the average number of onward transmissions and infected individuals expected to make. So here I've got this little person who's sick and they infect two people. So in this case, the reproductive number would be two. And so for our model, we've basically designed these compartments that infected individuals could fall into. They could either be detected. So those would be infected individuals who were detected through testing and then subsequently isolated. Or they could be in quarantine at the time of infectiousness. So that would be like someone who was previously contact traced by an infected individual and then put into quarantine. And then while they were in quarantine, they themselves became infectious. So those would be infections among quarantined contacts of identified cases. And then finally, the final compartment is just infections in the community. So these would be undetected infections. So each of those basically, you could calculate the proportion of infections that fall into each of these compartments at time T. So for example, here I'm saying that 20% of infected individuals are detected through testing. 10% of them are already in quarantine at time of infectiousness and 70% of them go undetected. So just start out in the community. So again, this reproductive number, we can, this average number of onward transmissions that an individual is expected to make, you could have a reproductive number for each of these compartments. For example, people who are detected, maybe they will still transmit to two people. And so the implication here is that they're transmitting to folks prior to being detected. So before they test positive, they might infect two individuals on average. People in quarantine may only infect one individual on average. And so this would mean that they were discovered to be infectious once they were in quarantine. Maybe they had a little bit of infectious time prior to getting into quarantine, but less time than someone who was only detected via testing. And then finally, people in the community who are going totally undetected, their average reproductive number would be something like 2.5. So this would be like they on average are infecting two and a half people. So we have this image here in our paper that sort of helps to explain why those reproductive numbers would be different depending on when you're infected or when you're detected rather, which compartment you fall into. So for example, here at Generation T, an individual might be infected. These distributions here show their infectiousness. So the probability of infecting someone else. And so maybe their symptoms are onset here and they're tested at this point in time and then they're isolated in this point in time. So all this red portion of this distribution is time when they might be infecting people or they have some probability of infecting people. But this green time on the right side of when they were isolated would be reductions in transmission due to case isolation. And so that's why in that previous slide, the R that I showed for people in the detected compartment was two compared to those in the undetected compartment at 2.5 because basically you're reducing some of that transmission time here in the green. And then time T plus one, this next little graph on the bottom, this is showing for the quarantined individuals. So people in that queue or that middle compartment that I had shown. And so those would be infected contacts. And so they might get, because you found out that this person was sick at this time period and they gave their contact tracer all of the potential contacts to identify, they may have been put into isolation before they even got their positive test result back because they were actually quarantined at that point. And so the time that was reduced in transmission was even greater for them. And so that's why that R queue or the R value for those in the queue or quarantine compartment was just one because it was reduced by basically removing all this green part because they weren't able to infect anybody else since they were put into isolation at the right time. Okay, so the way that we get these reproductive numbers through this, that the mathematical model here is that we essentially put, we have these gammas which are like the reduction in infectious time that we multiply the R for the community which is basically the overall average of reproductive number for a given pathogen. So we take that RC that this gamma comes from basically integrating from time, from symptom onset to isolation. And this here, this is just the infectiousness distribution. And similarly, this is gonna be the time from symptom onset of a case to quarantine of the contacts. And then again, we're integrating it over the infectiousness distribution. So that's how we get those reduced reproductive numbers. Okay, so just briefly then, so we take these reproductive numbers and we put them in this infectious matrix, this infection matrix which basically each row corresponds to each of those compartments and those R values go on the diagonals. And then we multiply to figure out the new infections at time T we multiply the proportions in each compartment by this infectious matrix. So we have 20% in detect 10 in quarantine, 70% in the community at time. So then the new infections that resulted from time T would be those proportions multiplied by those R values. So I think hopefully intuitively, this kind of makes sense. You have 20% of folks are in this detect and they're each infecting two people on average. Then you end up sort of seeing how many infections resulted from that. And then those folks who are then infected end up getting detected or not. And so we end up with this matrix that on the rows we have who they were infected by. So someone who is detected someone in quarantine or someone in the community. And then in the columns, those are dictated by where they themselves end up. So dude, they get detected. Did they end up in quarantine? Did they end up back in the community? So this like for example, would be someone who was infected by someone who had been detected and then they themselves get detected. So all of these quadrants here just end up getting determined by probabilities that you can input as the kind of knowledgeable person about whatever pathogen you're interested in. So the way this works, basically this Omega here is the probability that a contact of a detected individual in the detect department is traced and quarantined. And so you could for example, say that that was maybe 50%. And then so Omega Q is gonna be the probability of a contact of a detected individual in the quarantine compartment is traced and quarantined. So for example, I could say maybe that was a 30% probability. And then these rows are gonna be the probability that a community infection is detected and isolated. So maybe we're detecting 20% of our folks out in the community. Okay, so we've got this detection matrix. And basically the way that you get to the proportion of infections at time T plus one is you just multiply all these pieces together. So the proportions at time T times the infection. So that tells us how many people are infected. And then to figure out what proportions end up in each of those different detection boxes, we end up multiplying by that detect matrix. And then we normalize it by dividing by the sum of this DQC matrix. Okay, so using all of those, for example, I started with 20%, 10%, 70% and after going from time T to time T plus one, I ended up with 18% detected, 12% in quarantine and 70% in the community. And then we're gonna multiply all of those by those effective reproductive numbers. And we end up with an overall average reproductive number of 2.23. Now the different values that we input for these matters. So for example, before I was saying that we were detecting 20% of cases and 80% were remaining in the community. Let's say we're doing better. Let's say we're detecting 50% of cases. So I'm gonna replace all of those with these 0.5s here. And so if I run that through the same calculation, now I end up with different proportions. And obviously I'm gonna have a much more in the detection of 44% of people are getting detected and 44 ending up in the community. And now my effective R is lower. So now it's 2.1 and we want lower, that's the goal. So basically what I'm trying to show is that we've come up with this way to be able to sort of see how these programs are able to detect or are able to how effective they are at reducing transmission. So the big picture here is that the application that we're building is gonna allow public health departments to tweak these different parameters in a way that they think is practical. So if they think that they could maybe ramp up testing such that they could detect 50% of the cases in their community, they could see how that would impact onward transmission based on the other assumptions. So we have this R package that can be found on GitHub and CRAN called TTI that will allow you to do these calculations. But we also have a Shiny application for this as well. So you can find this Shiny application at, you can find the code at github.com slash Hopkins IDD slash Contessa. And this is what it looks like when you go to the site. So essentially it starts by just explaining a little bit about what it is. And then we've got these different panels where you can input the assumptions that go into those calculations that I had talked about. So for example, you could input information about surveillance and isolation, like how much testing you're doing and how quickly you're getting people into isolation. And then once you've put in all of these, there's an interactive dashboard that lets you sort of see what those reductions in R would be. And we also have the ability to generate like a PDF report as well as save your inputs and so you can upload them later. So I'm just gonna quickly show how to do some of these things in Shiny in case that's of interest to anybody in the audience. Okay, so this is kind of the big picture. If you've run Shiny before, this is gonna feel a little bit of a beginner's kind of intro, but essentially here, the UI or the user interface for this particular application is done using Shiny dashboard. So we wrap the UI in this dashboard page function. So that's kind of what generates the user interface or what you see. And so this dashboard header function is what basically we put in certain inputs to update this header at the top. So we've got like our logo and the colors and things like that are all updated from that. The dashboard sidebar here dictates what this looks like on the left side. And then finally, the dashboard body is where the main, the code for kind of the main part of the application goes. And then in the servers where we put all of that behind the scenes, code, we run the TTI package, for example, to actually calculate these quantities after the user has input all of their information. And then finally, the Shiny app function is what actually runs the app. So the first argument is the UI and the second argument is the server. Okay, so this next part, and I'm going to do this a little bit quickly, but hopefully you'll be able to at least get a little glimpse of the types of things that you could do with an application like this and then be able to dig through our code on GitHub if it's of more use to you. But the other thing I thought was a little bit unique about this particular package is we had the ability to generate a report from the outputs. And this was because the stakeholders were often interested in a PDF or Word document that they could then hand off to their supervisors that could show, if we were able to ramp up testing by 30%, then we think we would be able to reduce transmission by 22% or something like that. So these reports were really important as opposed to having only this kind of interactive web interface they wanted to also have a static version. So to do that, we used RMD files, our markdown files, where basically in the YAML or the part at the top of your file, you can add these parameters. And so for example, you could have a parameter called A and B. And the way that we did it, I'm sure there are other ways that the way that we did it is we just initialized these parameters by having them be missing values. And then you can do things with these parameters and the reports themselves. And this is nice, this method is nice because you can actually pass shiny input variables to these parameters when you're allowing that file download to happen. I'm gonna just show you quickly how you can do that. So this is a download handler, which basically gets output into this, and this code would all go in the server side of your shiny coding. And so the part that I think is of interest here is in the content, which allows you to update the file. And so the first part is, I create this temporary file called report.rmd. And then you have to actually copy this file. It's kind of like a weird process. So then you copy this file, overwrite is true because sometimes people will do this more than one time. And then this is the part where I think this method kind of shines in particular with shiny is that you can pass parameters to this particular file. And so the way you do that is just by creating a list of those parameters. And the names of the lists need to match the names of the parameters that you've put in the YAML or the top of your rmd file. And then down here, you can just do a normal rmarkdown render function where you specify that temporary file. You have the output file be the one that the user is gonna download. And then you can pass the actual parameters into that via this params function. And then on the UI or user interface side, it's quite simple. And I had mine in the sidebar. So this code went in the dashboard sidebar portion of the dashboard page. And I just had this download button where they could click that button and it would generate a report. And notice that this report here keyword is the same one from the previous slide where I was this output report. Those were identical. And that's what let shiny know that this is what I would like to do when I click this button. The last part is just the saving and loading inputs. And this was because sometimes people wanted to be able to save their work later. So they went through and put in 20 or 30 little inputs. And then they wanted to be able to reload this page and maybe kind of load those same inputs. And so to do this, this was again with another download handler. And what we did here is we input this, we allowed them to input a file name here and we called this file, the name of their file dot yaml. So this was a yaml file. And then the inputs were gonna be all of the values from the shiny that were input into the shiny input via the shiny dashboard itself. So this input is like the name of the kind of object in shiny that saves everything that the user is putting in. So this reactive values to list will take all of those reactive values, stick them in a list and then we can make that list into a yaml file. And then we could output that so that when the user came back, they could load that yaml. I have like maybe two minutes, I'm not sure. In case I have, I'll just show you what this link, I'm not sure I'll actually have time to really demo this much, but essentially there's also a course Sarah class that's free if you're interested in this type of methodology that we created that uses this application. So it goes into more of the details about the math behind it as well as kind of how you could use this to evaluate your contact tracing program if you happened to have one. You can find the app here. So IDDDynamicsjhu.shinyapps.io slash Contessa v2. And so this v2 is we've updated a couple of things like allowing for vaccine information and a couple other population level estimates that people might want to update in an advanced section of the application. All right, so that's all I have. If you have any questions, I'm happy to answer them. You can find me on Twitter at Lucy Stats. Thank you so much, Lucy. Questions, I don't see any quite yet in the chat. So I just had a brief question in terms of have you tried to implement this now with the monkey pops at all and have you been utilizing it in that space as well? Yeah, that's a great question. So I was brought onto this particular project as a contractor, so I am not actually on the infectious disease dynamics team as like on a regular basis. So I'm not sure, it's very possible that this team at Hopkins is working, I'm sure that they're working on something monkey pops related. I'm not sure if they're doing this exact process, but I think you certainly could use the same methodology. It's agnostic to the pathogen. So I'm sure you could use the same tools to be able to see how effective contact tracing is. That's a harder problem because the incubation period is much longer. So it can be harder to trace people quickly, but yeah.