Resources

Posit Presents: A Stroke of Innovation

Introducing "A Stroke of Innovation," a short film made possible by a team of innovators looking to make the world a better place. Visit https://posit.co/about/customer-stories/iceland/ for the full web experience

image: thumbnail.jpg

Transcript#

This transcript was generated automatically and may contain errors.

Iceland can be harsh like a lunar landscape. But it can also be vivid and green. And I have these moments when I'm biking to work and it's dark. And I can see the stars and I can see the moon. A harsh winter and a long night can also be beautiful. And when the summer finally arrives, it brings out the joy. And you really reconnect to people who live here again. A really close-knit community. And being a part of that matters to me.

Yes, my name is Olli Pátl Geysan and I serve as the Chief Data Officer at the city of Reykjavík.

The mission of Reykjavík's data science office

The data scientist finds the story in the data. When I started here, I felt like it was a clean slate. Our mission was to build something. We know that digital transformation is ahead. We need to evolve with society. How can we, as a city, use data and data analytics to help people? To have them accessible on the web. To put down these barriers, these walls. To improve the quality of life for the residents of Reykjavík.

So your work means something to somebody.

Our role here as Data Science Office is to bring value from data to our stakeholders within the city of Reykjavík. The stakeholders could be the Department of School and Leisure. It could be the Department of Welfare, Urban Planning or the City Council or the residents. It's almost like going through the phone book or something like that. But you have to go there, talk to them, listen and do it again and again and again.

Iceland's swimming pool culture

We are just right outside the Arctic Circle. So during the winter it gets dark and it's obviously cold in Iceland. So the first thing you kind of get to know about Icelanders is that they are crazy about their swimming pools. It's ingrained in our culture. You know, when you have family photos you maybe go to the countryside and take photos. But my brother, for instance, got a photographer to meet them up at the swimming pool because that's where they were every day, essentially. So his family photos, you know, them standing by the swimming pool, you know, they are crazy.

I got frequent requests, even phone calls, on why can't I see how many guests are in the swimming pools right now. I need to know this. And also, like, why can't I just predict how many people are going to be in the pools for the next hour or so, two hours, or in different swimming pools. And what we'd like to do is show the percentage, the capacity of the swimming pool. Like, Laugardalslaug, which is one of the cool swimming pools here, is at 50% right now. And we predict it's going to be at 70% in an hour and 35% in two hours.

So we started looking into this and this became a project on our side with the Department of Sports and Leisure. But when we started to dive into it, we saw that, hey, this is going to be a bit complicated.

Meet the team

My name is Inga Rós Gunnarsdóttir. My name is Linnur Halkimsson. My name is Sýri Rerla. My name is Þorbjörn Þoranarsson. I'm a senior data scientist. I am a data scientist. A project manager for Reykjavík City. My role is modelling, advanced analytics and predictive modelling.

Finding meaning or value in something that looks like chaos at first. And finding a meaningful and beautiful way to present it. To put a structure on the data team's work. How to break it down and help them keep their deadlines. Nothing ever happens too quickly for me.

We have, like, different backgrounds and different skill sets within the team. Þor is an amazing, you know, machine learning guru. But he's also, like, he has this, you know, eye for detail. And, you know, there's something of an artist about him. He's a great programmer.

Solving the swimming pool data problem

We have these gates. And it counts how many guests are arriving to the pool. We can say, OK, this is just a cumulative sum of people that have gone swimming today. That's a bit of a pickle. Because we really don't want to know how many people have been counted in. Hey, there are 10,000 people at the pool. Like, that makes no sense.

We have historical data for in and out of the gates. For one swimming pool in Iceland. The largest swimming pool. Because there you have these bracelets that you need to hand in when you go out. So, we contacted the hardware provider. And they provided us with historical data. And the data is corrected with respect to these bracelets afterward. So, we have the data on how long they're staying. There is a distributional property that we can extract out of it.

But to make things a little bit more complicated. If there's a queue of people trying to leave the swimming pool. The people who work at the swimming pool are kind enough to... Like, OK, we'll just open the gates for you. You don't have to use your card to leave. But that's wonderful for everybody, except for the data people. Because that ruins our data, essentially. Or we look at it like it's the kindness of man ruining our perfect structured data. So, we have to account for that discrepancy.

Or we look at it like it's the kindness of man ruining our perfect structured data.

The model and the tech stack

Our model is a very simple one. It's a linear spline model. And the only inputs are... Time of the day. Day of the week. And time of the year. Every five minutes we have a process in WebMethods that reads data from the swimming pool gates. And stores them in our data lake. We then use the pins package. We get pinned linear models from our RStudio Connect. And we then predict the duration. Then we pin that results table in our RStudio Connect. And that's what our Shiny app accesses.

So, before launching it, it had to go through testing. To make sure that this is grounded in reality. Because we are not swimming pool executives. We don't really know these numbers. We set up a separate Shiny app for the managers of the swimming pools. So, going through the testing, it matters to it to go fast. To quickly deliver quickly. And in a way that they understand. To show them the numbers. Show them the time series. And preferably live. So, it's just like an interactive ggplot. So, you just hover over. Like, this is the time now. It's half past twelve. The app says that there are fifty people here. Let's do a count.

The feedback was... It's essentially ten minutes later. Everything is spot on. And we thought, okay, is there something we need to improve? And they said, no, this is fine. Because that's maybe how long it takes for you to walk there. Or bike. Or ride your car there. When we launched it, it was immediately well received by the residents of Reykjavik.

R and RStudio Connect as force multipliers

Like, a lot of how we are able to get things off the ground quickly. Has to do with R and RStudio Connect. So, when you do it often enough, you have kind of... You have all the tools. And you just have to pick and choose what works best. We are the people that actually work with the data. But now we're also the people that can deploy this and schedule it. And, you know, put up a shiny app in production within a week. All the process of transforming and building up these analytical tables of products. And publishing it. The data science team, if it can do all of that inside one domain, they become superheroes. They can do everything.

The data science team, if it can do all of that inside one domain, they become superheroes. They can do everything.

I think I do what I do not only because I love coding and making beautiful things. But also because I believe that working at the city of Reykjavik, I can improve people's lives. If only a small bit. Making a difference. And maybe it's small. At least it's making an impact which hopefully ends with the citizens. And making life better for them.

If you want to make changes, if you want to matter, then you need to embrace the fact it's going to be challenging. You have to just know it's going to be alright. That's something that I didn't quite realize the magnitude of it before I started. But that's a ride worth taking. Because through the experience, you grow.