#34 AI for Good Specialization [Course 1, Week 3, Lesson 1]

A walkthrough of an air quality mapping project in Bogota. The speaker covers deployment challenges like streaming data and uptime monitoring, then demonstrates creating interpolated maps where white-bordered sensors show direct measurements and black-bordered ones show model estimates. Building time animations lets you watch pollution patterns shift across 24-hour windows.
Chapters
For the implementation and deployment of an air quality monitoring application like the one you've been developing in these labs, there are going to be a number of practical challenges, and many of them will be technical in nature. So these are going to be things like how do you deploy your system on a cloud or hosted server? How will you receive and process the data stream of current system measurements, how you monitor for uptime, how will you deal with outliers which are different to the kind of errors you've seen before, and more practical user experience. Things like how you display the user interface on a web or mobile application, depending how somebody accesses it. All of these things would be technical challenges that you would need to overcome to actually go into production for a system like this one. For the purposes of these courses, we won't be spending time on those technical strategies, but we will be reminding you that they exist. However, if you do have some software engineering experience or you're part of a team who does, then you could think about how you might go ahead and deploy your mapping application into production. To wrap up this project, we'll jump back into the lab and add a couple of small features to the mapping application that you've been working on, and then spend some time discussing what else you might be concerned with in some final implementation evaluation of your project. But first, let's head back over to the lab. If you've already been working in the lab here and you've run the cells up to this point, then you can go ahead and start right here by running this code cell. If you're just opening this lab now, then what you'll need to do is go ahead and start at the top and run these code cells in order. Start in here with the imports, and then run in each of these until you get down to here and now. At this point, what you're going to do is choose a value for K, define a start and end date. And when you run this, you'll generate a map that shows you the current PM2.5 levels, which is to say the levels at the end date, timestamp at each sensor station, as well as the interpolated values between the stations. And again, when the border around the circle shown as sensor station is white, that indicates a direct measurement. And when the border is black, that indicates an estimate generated by your neural network model. And now, in addition to the map, you can click on each sensor station to see a plot of the historical values back to whatever start date you choose. So in this case, we're grabbing 24 hours in the month of August 2021. And you've created a map representation using a particular value of k k1 in this case to interpolate in between the sensors. And so now, based on the analysis above, I'm going to change my k value to 3, because up here it looked like beyond k of 3 or 4, things really didn't improve that much. But you can choose whatever value of K you like. I'll also choose a different start date to show more history in the plots. And once I've run that, you can see I've got a smoother interpolation map. And when I click on a sensor station now, I have more historical data in the plot. So this is still a little prototype where we're just running code in a jupyter notebook. But you can start to imagine how this might look in a slightly nicer user interface, where maybe the user has pulled down menus to select a start date, or maybe where they want to see the past week or month of data in the plots. And you can imagine that the map is regularly updated to show the most current values similar to what you saw before in the Purple Air app. So that's just an idea for what the user application could look like. So what you can do here is try different dates and try different values of K and have a look at the example user interface that you're generating. And next what you'll do is create an animation over a particular time range, in this case, the past 24 hours between the start date and end date indicated here. And again you can choose a value of K. I'll just run this first using K equals 1 again. So when you run this cell, you. You're building the animation that will be displayed below. And so once it's finished running, it'll say animation created successfully. And then you can run this last cell to display your animation. And when you run that, you'll see something like this, where now you can pause the animation to investigate a particular frame, or you can advance that frame one at a time, or you can play the animation and change the speed here. And so again, it's a little prototype Y, but in principle it's similar to what you'll find in a lot of air quality mapping applications that are online right now. And this is something where again, you could let the user specify the dates that they wanted to see animated, or click into the sensor stations to see more information about these recent measurements. I'll run this again for k equals 3 and let's see how that looks and here you can see that smoother interpolation between the different sensors. This is also something if you build out for a forecasting aspect of your application, you might want it to be used to animate the future forecasts of air quality. As mentioned before, when it comes to deploying something like this online to a web or mobile application, there are a number of software development challenges that will come along with that. But you can imagine, just like some of the other air quality monitoring applications that are online, with a little help from a designer and some number of engineers, you could have an interface where someone is able to either see an animation like this or interact with the map that allows them to see something about the current measurements. You could also look at the history of sensor measurements at a particular location, or estimates at other locations within the city. And so that's what it looks like with the smoother map created using a k value of 3. And that's it for the implementation phase of the Bogota air quality project. Of course, there would be many more details to consider in an actual implementation of a system that you're taking into production to support citizens in the city of Bogota or the health care professionals there who care about air quality. But I hope at this point you feel like you've gotten a sense of what it might look like, and at least at a high level, to see a project like this through, from the initial exploration to the design and the eventual implementation.










