Saving lives with Elixir

Tech has the power to create a worldwide impact. Read more about how Elixir was used to empower life-saving work in Kenya.

32 min read

When you think about programming languages, you might not think about them literally changing people’s lives, but they do more often than you would expect. Elixir has empowered Linda Achieng and Sigu Mawa to build emergency software that is already saving lives in Kenya. What started with the death of a close friend, has expanded into an inspirational project, with Elixir being used to empower local communities. Watch the video below or read the transcript for one of the most moving tech stories we’ve seen. 

If you want to be the first to see the amazing stories shared at our conferences you can join us at ElixirConf EU will be held on 7-8 April in London and online, Code BEAM Europe, 19-20 May in Stockholm and Online or Code BEAM America, 3-4 November, in Mountain View or online. We hope to see you soon. 

Please accept marketing-cookies to watch this video.


Linda Achieng: I’m doing this with a longtime friend. We’ve known each other for I think a decade now. So, my name is  Linda Achieng and my friend is Sigu Magwa. I think he’ll introduce himself.

Linda Achieng: Well, thank you. My name is  Linda Achieng. I’m a software engineer at Synchro. And, yes, my second name is Achieng.

Sigu Magwa: Oh, and that’s your Twitter handle, I guess?

Linda Achieng: Yes, yes.

Sigu Magwa: I’m Sigu Magwa. And I just found a new favorite tagline. Open Source made me. Open source, in that, I use Open Source tools to do almost everything. Elixir is Open Source. Open source again, because I got better programming because I was in a community of Open Source learning, not Open Source software. We could just meet and do more programming. That’s actually how I also met Elixir some years back. 

I’m the co-founder and CTO of Podii, we do Elixir consulting over here. So, I had to rush to the office with a nice background logo over there. Just because of too many kids at home.  Linda, I loved your profile. But I think my profile is way cooler than yours.

Let’s start from 2018.

The story behind the emergency software

Linda Achieng: Okay, so it’s 2018. At that time, I’m learning how to code, doing professional things. I get to reconnect with a friend of mine. This friend is called Malcolm. So I’m learning how to code and at that point, I still don’t know of Stack Overflow. I mean, I know it’s a site but I don’t know what it does. I didn’t know what it did by then. And I’m learning new things and Malcolm is my go-to person because he’s a friend I’ve known for a long time. And just learning software for the first time like in a professional environment and getting to understand what is happening and having that arm to always go to was just like a good experience. 

I’d just like to introduce Malcolm, he’s the one with a computer. That little guy over there I’m carrying is my little guy, he’s my son. So as I said, Malcolm was is a key person in my software development journey. I got to learn a lot from him. He’s also a Python guru. He loves Python. He also loves Elixir because it’s functional. He feels like now he now has control over functional programming he now understands it. So, a little story about Malcolm. Malcolm has sickle cell anemia. So, he gets attacks frequently. But since we are in Kisumu, we know how to do it. If he’s sick, we know we call his dad, his dad is going to call his physician, and his physician is going to come to where we are. Since Kisumu is a small city, the whole thing might take like 10, 15 minutes tops, and we are for sure that Malcolm is going to get treated. 

But  Malcolm has got a job offer in the city. It’s an exciting thing. It’s exciting because he’s quite a handful, so we’re excited that he’s leaving. But it’s also emotional, because, this is my one person to go-to person, if I have anything that I want to do or if I’m having a problem, he’s not going to be around. That was just like the first part.

Malcolm goes to the city. One time, this is like the third time he’s going there. And he’s still not familiar. I remember us making jokes that, “Make sure you know one place so that when you’re lost, you can call us and we’ll ask our contacts in the city. And they will come for you.” So this was just something funny because it was his third time officially in the city alone. So, it’s an interesting time for him. It’s really interesting. But in the city, Malcolm gets an attack. We have to get him to the hospital. I mean, it’s crazy. We have to get him to the hospital. We are new in Nairobi, Nairobi is the city, we are sure of one hospital. We want to take him there. Just to give you an example of how far we’ve gone. The hospital we are at this point, we are here and the hospital is down here. So, we left we went through all this whole journey and it’s long, there’s traffic. It’s a crazy journey. We get to the hospital and he’s treated. We are a little…we feel like we’ve taken about an hour and a half to go to the hospital, but he’s treated. So we let him go. We tell him, “Hey, let me go get a few things, and then I will come back.” Before we leave the hospital, just like 10 minutes after the hospital and we get called. “Malcolm is dead.” Yes, he died.

It’s crazy because when we were leaving the hospital, we were talking like, “Hey, this was close, because we came a long way. We were just happy that he was given, like, something to stabilize him but we didn’t know how bad it was. We were a little bit late. And when the mum was giving a eulogy, she said that “If these people would have gotten to hospital earlier I’m sure Malcolm will still be alive.” So, that is one thing that haunted us and give us a really hard time in the office.

Sigu Magwa:I remember that time. It was a bit of us. Not a bit, it was a sad moment for us in the office. You could not get night sleep and sometimes I remember you were not…you refused to get out just maybe to the washrooms alone, thinking that maybe Malcolm is still playing some tricks on you. So you just wanted someone to accompany you to the washrooms.

Linda Achieng: You’re pushing.

Sigu Magwa: Yes. So during this period is when you started talking about, “What if we did something for Malcolm?” I remember all the time, every time we have our morning stand-ups or the evening stand-ups you’re like, “What if we did something so that we don’t have another Malcolm or family and friends of another Malcolm with a sickle cell attack do not go through the same?” And during this period, again, we were in the office just on the whiteboard trying to come up with a name before even coming up with the product. So what can we call this? We need to do something, we need to build something for another Malcolm of the future. We started coming up with a name then we settled on Nai Linda Achieng.

Linda Achieng: Yes. And it has nothing to do with my name.

Sigu Magwa: And what really does Nai Linda Achieng mean actually?

Linda Achieng: So, Nai Linda Achieng is a Swahili word it means to protect. Yes. Am I right,Sigu Magwa?

Sigu Magwa: Yes, it means to protect your loved ones and it’s called Nai Linda Achieng, so everyone confuses and thinks that you named it after yourself. We know people name things after themselves. But…

The Emergency Software

Linda Achieng: Nai Linda Achieng gives you an option of locating a hospital and an extra option of locating and sending a notification to a hospital. So what happened to us is we went, we travelled for like an hour, but in between, we had hospitals that we could go to, but we didn’t know about it since we are new in that place. We thought, “Okay, fine, this thing happens, people go to new places.” Someone like me, I don’t look at the hospital, I don’t look for hospitals around me, because I’m not thinking that I’m going to get sick. That is not the first thing in my mind. So, this is one thing that we wanted to have so that you don’t think about getting sick. But if you do, if something happens, you have the option of finding a place near you. We understand at that time there’s panic, there’s a lot of things going through your mind. So we want to give you a seamless experience to find a hospital and also let the hospital know that you’re coming. So, I will talk about the third option. The second option just gets you to a hospital. But I’ll talk more about the third option, maybe Sigu you can play the video to see how it works. 

This is how it works- we ask you where you are, what your emergency is, and we ask you your landmarks, like just any landmark that you see around you. When we’re asking about a landmark, we are expecting names of bars, we’re expecting names of parks, or we’re expecting the name of a building.

We’ve done our research to know that if I am at this place, these are some of the names that we are expecting people to say. So, the moment you give us that we give you the closest hospital that is close to you. We send it to you as a text message. We also sent a notification to the hospital. What the hospital does is they have a responsibility to respond to your emergency by either telling you, “Yes, you can come, we can handle your emergency, we are waiting for you,” or, “No, you can’t come, we can’t handle your emergency.” So, we don’t want you to go to this hospital and waste your time over there. Don’t waste your time. We don’t want you to go and wait and in the end be taken to another hospital. So, that is what Nai Linda Achieng does. 

We created it in a way that allows you to be able not to use the internet because we don’t have very reliable internet in Kenya, you would be lucky to be in the rural places and even get 3G, I usually get a lot of network interruptions. So many times I’ve had to drop out of calls just because my internet is not stable. But this is an emergency service. I don’t want you to have to think about not having the internet, and you want to get to a hospital. So honestly, the vision we have is to just have health care for people. We want people to be able to rely on us when they have an emergency. Am I getting it right, Sigu? I’m I leaving anything out?

The current state of the emergency app

Sigu Magwa: No, I don’t think you’re leaving anything. I think maybe you’ve not just told us the current state of the application?

Linda Achieng: Currently we are at our soft launch, we are testing the site. We have a few users that have access to the software. We are also talking to hospitals and they also have the software. So, we’re testing what is happening, how many requests we are getting, if we can handle the requests, how we are handling…if the users are experiencing errors, how are we handling it? That is what we are doing right now. It’s been an interesting journey, a learning journey. And it’s exciting. It’s exciting to be able to see this come to action. 

Sigu Magwa: Awesome. So, I think I can add a few things to that. The first thing is that the soft launch is getting out but also, when things are going out there’s this crazy idea of, “What can we do? What can we add on top of this?” So we also thought, “What if we provide this as infrastructure?” Because we can’t do this alone, we need other third parties or those who are existing to help us do this. What if we provided an infrastructure for everyone else to just plugin and use this? 

The first people that we approached were a group of girls. They call themselves the iCut Group. So, what they do is deal with FGM. I know some of you might be hearing this for the first time, it’s full…it’s an abbreviation for female genital mutilation. It’s more of circumcision, but female circumcision. In some parts of the country, they normally practice this. So, the ladies are out there to stop this. They’re out there to educate other people on how to stop this particular practice. They’re also giving out emergency numbers and responses. So, we’re talking with them to provide them with such a kind of infrastructure so that they can concentrate on getting the word out and getting to the right people. I think  Linda, that’s as far as we’ve gone, right?

Linda Achieng: Yes.

Sigu Magwa: I think so far, maybe there might be a question from the audience asking themselves, we’re not opening up. But they might be asking, “Have we managed to save any life yet? Or has Elixir managed to save any life yet?”

Why Elixir?

Linda Achieng: Before I answer that, I’ll probably say why Elixir…

Sigu Magwa: I think that’s a great idea.

Linda Achieng: Let me say why Elixir. This is an emergency service, we can’t afford to lose a connection. If we lose one, we want to be able to reconnect. We don’t want to worry about this. So, this is one of the major reasons why we chose Elixir. Also, when we are learning it, we are finding more about it. And it’s exciting. We’re seeing people talking about, like, the promises it has, and getting to see it in action was just amazing. And just as I was saying, real-time is crucial. We can’t afford to lose a connection. And another thing we had in mind. Sorry?

Another thing we had, is this is an application, we want to give out for free. We don’t want anyone to have to pay if the hospital paid, they might be reluctant to have it if a patient pays. That is not an emergency, that’s a business. So, we are giving it free of charge. This is why we were looking for something that is going to scale. We are seeing the promise that it can scale, but also save us costs. So that was one thing that we also thought about. We said, “Okay, we can chip into our pocket and say, okay, we can maintain this.”

Sigu Magwa: Yes. Sorry I interjected earlier, but you reminded me of the fun times when you were aligning Elixir in the office, the mob sessions in the afternoon, and you’re like, “Ah, this is exciting, we need to use this.” So that’s also contributed to why we chose Elixir at that particular moment. So, I’ll just throwback that question to you. Have you managed or has Elixir managed to save any life so far?

Linda Achieng: Not yet.

Sigu Magwa: Not yet.

Linda Achieng: I don’t think we have.

How Elixir has changed people’s lives

Sigu Magwa: Okay. So it’s because of the state that we are in at the moment. But I have a few things to share about how Elixir has touched and changed a few lives. Can I take the stage for a minute? 

I’ll share with you how Elixir has managed to touch and change some lives. Looking at that photo for a minute is a bit too long. So, just do it for just three or four seconds. One, two, three. Okay, three seconds are up. So, if you try to guess what’s going on in this photo, it’s a bit like throwing everything everywhere.

I’ll let you know what’s going on. Let me tell you a story about the old man, the man in the red t-shirt. He is a farmer. He’s a farmer, and he has a farm right next to his home. This farm is not a big place. It’s big enough for him. But it’s not commercially viable. So, what the farmer does is every year he has to farm for his domestic consumption. Where we live there are two seasons, we have the long rain season and the shorter dry season. So the farmer has to time the longer rain season, be prepared so that he can cultivate for his domestic consumption. Sometimes if they miss being prepared, the rains might start, and you don’t yet have your farming inputs. So really, this needs to be done as soon as possible.

Luckily enough, there’s a nonprofit organization that covers the area that this farmer lives in. This nonprofit organization allows the farmers to register and tell them what they intend to cultivate for the next season. So, they prepare them early enough. They don’t get shocked that the long rains are here. 

What the organization does is, once you’re registered, you tell them what you want for the next long rain season, they have experts that package your inputs. Some of the inputs start from about $20 or so. But you have to pay for that input for you to pick it up. So the least package, I think it’s about $20. And $20 according to our living standards, not everyone, but according to the living standards for some people it’s a bit on the higher side,  Linda was a witness to that back when we were in the office.

Linda Achieng: You’re putting me in the spotlight. But yes, I think that’s a lot. There were times we walked from the office to home, we would be walking as a group, so it’s fun. But what we’re trying to do is to save 30 cents, so that we could be able to use it the next day. So be able to come back to the office from home. 

Sigu Magwa: That’s back when lunch would cost 30 cents and sometimes you’ll have to think about, “Should I eat lunch? Or should I take a ride back home?” So 20 USD is a lot, sometimes and even to the farmer, it might be a lot of money. The organization luckily allows the farmers to pay bit by bit. The fact that they can pay this bit by bit means that by the end of the year or something, they’ll have finished their payments. We’ve witnessed cases of a farmer not being able to clear up the 20 USD by the end of the year. 

They’re allowed to pay as little as 10 cents, 30 cents, or even $1. If a farmer pays regularly, and they have a good payment pattern, you will be allowed to pick a product without fully paying for it once you attain a particular percentage. The photo you’re seeing right here is one of the days that we were lucky to accompany the organization to the delivery site. There you have the fertilizers they are being ready to be given out to the farmers. On this day, there are a few things that might happen, there might be problems. But sometimes things go well. So, they pick up their product. Right here you can see the old lady, she’s happy. She has the fertilizer, the big bang, and the smaller bag it’s a bag of a seed of maize. So, this is enough for farming for one hectare of one acre of land.

Just take a look at the phone that she’s using. It’s of interest to us in a few. Let’s go back to the old man. So this story was the story of the old man, don’t forget about it. So, let’s go back. What do you think might have been the problem? 

I want to let you try to guess that but there are a couple of problems that might have been there. So, the first one is that maybe he sent some payments but the payments are missing. Maybe he requested a seed but the seed is no longer there. Maybe an officer accidentally delivered items and it was claimed that the items were already delivered, but they were not. Maybe he was among qualifiers but actually, he qualified. So, here they are trying to find out what the problem is for this old man. So I designed a system for this. Yes,  Linda Achieng.

So what did Elixir help with in this case? Why are we even telling you all these stories for the old man? The first thing we were approached to talk about, was to design a system that can help manage all this from the beginning to the end. We chose Elixir for some reason, we get spikes. The spikes are during registration deadlines or payments. They have deadlines to make their payments, and they are micropayments. So, most of them try to beat the deadline, they pay as late as 11:59 in the night, just so that they can beat the deadline, and they can get their farming input. The other thing is you saw the phone that the lady was using, sometimes we don’t have a smartphone or anything. Sometimes when we do deliveries, it’s somewhere we don’t have completed, we don’t even have GSM, or we don’t have internet connectivity. So we collect all the information offline, then when we get back to the internet, we do a synchronization back to the servers. The second reason is this one. 

Sigu Magwa: Can you guess how I felt when instant cameras came out?

Linda Achieng: I remember the feeling, getting instant photos. Yes.

Sigu Magwa: The fact that you can validate everything instantly, was a nice feeling. And that’s why the dashboard for the system has been designed using Live View, in this case, and scenario. So, this is why we continue using Elixir for such system designs. The other reason is yes, it’s a tool we know, it’s a tool we know how to handle. Not really I can’t claim expertise in this, but it’s something we know how to use. So, it’s a natural choice when you go into that. I know when you have a hammer, everything looks like a nail. But this looks like the right nail for the hammer that we had. Yeah, so those are some of the advantages that we had. The disadvantages, why we should not have used Elixir, this is more of a paradoxical thing. If you look at this image, and you’re a bit young, you might know where he lived. It’s in the middle of nowhere. So that’s where sometimes you take your deliveries in the middle of nowhere. Things have to work offline. That’s sometimes why you can not just use Elixir. But again, we had to find other solutions like mobile applications or having progressive web apps just to handle that.  Linda, you talked about your child a few minutes ago?

The future

Linda Achieng: Yes.

Sigu Magwa: You want a good future for your child, right?

Linda Achieng: Yes, he’s three now. And that is all I can think of now.

Sigu Magwa: Awesome. But again, I know you want them to have the best education and all that for the future of your kid.

Linda Achieng: I think that is all parents’ dream.

Sigu Magwa: Okay, so let’s go to this. I would like you to make a guess. Now I’m not talking to the audience, just not a guess. Can you tell me what you can see?

Linda Achieng: I see kids. And I see an adult who looks like a tutor. And this kid is holding some alphabet, a paper that has alphabets? So, probably they’re learning or something?

Sigu Magwa: You’re right. I took a photo of this. And we were requested to create a system again in Elixir that helps these kids to improve in their education. So it’s a complementary system to help an existing running system to help these kids improve. The criteria for choosing the children as they take the bottom 10. So, look at this classroom, look at these kids. And again, you take the bottom 10 out of this. So, these are the kind of things that we have used Elixir to improve their lives. The challenges and the reason as to why we chose Elixir is the same as what you’ve just talked about above. I know you’ve done a bit of commercial nonprofit work. We’ve talked a lot about nonprofits. So, I don’t know if you have anything about that.

Linda Achieng: Yes. And you’ve put me in the spotlight so many times I’ll have to put you too. So, I want you to guess something.

Sigu Magwa: Okay.

Linda Achieng: Yeah. What do you think is happening here, Sigu?

Sigu Magwa: So there’s frustration, but there’s the money going up? So it’s a bit confusing because if this was my monthly salary, I’ll be like, “Yes,” I would not be this emoji. I’ll be the emoji. The happy one.

Linda Achieng: Yes, the figures look good. This is good money if it’s coming in. But the thing is, this money was going out. So we were outsourcing an API for real-time data, we wanted to be able to give our users notifications, whether they’re offline, or they’re online, or when they’re back online, the most important thing was to have them online. Anytime they went offline, we wanted to give them a notification. The moment we got to a hundred good socket connections, our bill started going high. The more internet connections we got, the more the bill came up. And the moment it got to 15,000. We were like, “Hey, no, no, no, I think we can do this.” We were thinking, “Hey, Elixir is promising as real-time. So, we can try and build this service we are paying for. That is what we did. At that point, we jumped into channels. I remember when we were doing mob obsessions when I was still with Sigu, I would ask myself, “Okay, so where am I going to use channels in my Elixir life?” But life is so funny, I feel like programming is so funny, you never know what is waiting for you, and solving this problem we talked about channels.

So we came up with the name “Free Bird” because we are breaking up with our PubSub provider and we are now building ours. There’s this song called “Free Bird” by Lynyrd Skynyrd. It’s a breakup song. It’s a really interesting song. I had it from a colleague and it was really interesting. So when we were now building this, we had to make sure that we are still going to give our clients the same promise that we have been giving them the same experience. We don’t want them to start complaining, “Hey we’re having notifications that we are offline yet we are online.” We wanted to give them the same experience that they were having before. We also didn’t want them to know that we are shifting, or rather we are now doing something different. So we ended up coming…we built this. The reason why we built this was because we knew we were going to scale, we knew we’re continuing, we were growing, it’s a business, we are growing and we didn’t want to have our costs go high. Once we were able to build this, we cut our costs. Now our bill came from 15,000 to something less, we only have to pay for hosting now for our servers, which is much cheaper than what we were doing.

I think we saved the day. We didn’t save it because we are having problems. We chose Elixir because we knew it would solve our problem but to some point, we also dug ourselves into a pit hole. Now we are having problems that we don’t…I honestly don’t know how to solve them. Like sometimes when we…what is this thing called in English? We are getting connections and when one device goes offline, we get like 7 or 10 API calls depending on the number of nodes we have up. So, we are having problems that we still don’t know how to go about. But we are happy we use Elixir because yeah, we solved a problem that we cut our costs down. So, thank you Sigu Magwa for jumping me. But one last thing we swear this is the last thing you’re going to see.

Sigu Magwa: Thanks for promising that this is the last thing.

Linda Achieng: I’m I talking too much? 

Sigu Magwa: Not really. Let’s go to the last thing, which is a disclaimer. So you’ve heard a lot, you’ve seen a lot. The first disclaimer, let’s start with that. You might not be able to guess what’s going on here, again, this has been a lot of guesswork. But again, San Francisco is one of the richest regions in the world. But again, you find such photos, you find such regions, and everyone who’s been to San Francisco knows about downtown San Francisco. Any photo that you have witnessed during this talk, is a disclaimer, is a niche, and it’s a selected region. And there are selected problems that we work with. And in that case, I think,  Linda Achieng, we can show them a bit about where we live. Where I currently am, yeah?

Linda Achieng: Yes. We have nice nightlife. It’s an active nightlife. It’s amazing. We have amazing clubs, we love our beer, and our spirits too. Yeah. And we live in a very beautiful city, we have amazing places. Yes, we have some places that don’t have internet. Even in the city, we have places that don’t have, like, really good internet. But it’s a really beautiful place that one time you should put on your bucket list. And as you can see, there is a lake over there that is the largest freshwater lake in…is it the world?

Sigu Magwa: Milder Africa not sure yet. But I’m happy to talk about the internet and if I didn’t have internet, then we would not be streaming this while I’m right in the office, our office is somewhere there. So this is the lake that you’re talking about. That’s the sunset.

Linda Achieng: It’s one of the most beautiful sunsets that we have. I feel like I want to say the best. But yeah.

Linda Achieng: Thank you so much for taking this journey with us. It’s really exciting to know that we can help. And we have a tool, and we have a community that is actively developing and giving us more tools to be able to just solve problems that not many people have heard of. And we’re excited to share with you all this. Sigu Magwa, you have something else?

Sigu Magwa: Yeah, it’s a very big thank you to the whole Elixir team, the core team, the support, Elixir forum, Slack, and all everywhere that we’ve been able to go to. The books that have been published enabled us to know this. Thank you for the Elixir conferences, we get a lot of information, lightning talks, and all that. We get a lot of help from there. So, thank you very much and thank you for attending these. I think I can say that in Swahili for those who are interested. So, in Swahili you say thank you, you say asante. Sorry, I almost blew that. So you say asante?

Linda Achieng: You say, asante.

Sigu Magwa: Yes, asante in Swahili.

Linda Achieng: Yes, asante sana.

Sigu Magwa: Asante sana.

Linda Achieng: So, I think we can take questions now right?

Sigu Magwa: Yes, yes.

Please accept marketing-cookies to watch this video.

Keep reading

How HCA Healthcare used the BEAM to fight COVID – Code BEAM V Talk review

BEAM VM is ideal technology to equip the healthcare industry with optimum delivery and minimal downtime. Learn more about how this was put into action by HCA Healthcare to fight COVID.

A guide to tracing in Elixir!

Our Erlang Solutions team explores tracing and gives an overview on tracing tools for the BEAM.