Life saving product on .NET

In some life situations you need to act very quickly. Sometimes this condition is impracticable: for example, it is simply impossible without great luck in a very short time to find a person with a rare blood group, who is also ready to share it. The guys created a product called DonorUA, which really helps to save lives using a chat bot. More under the cut.



I give the word to the author.

A few years ago at the social services creation hackathon, I tried to develop a project to automate complaints about the work of housing and public utilities. The development was progressing tightly, the demo version was complex and technologically advanced, so the jury did not appreciate the effort or the idea itself. But at this event I met a girl, the head of a public organization, which had already been involved in solving various problems in the field of blood donation in Ukraine for several years. Word for word - and you are already a cofounder of a new project.

At that moment, I don’t know anything about blood donation. The only knowledge was the fact that people sometimes donate blood to other people. How it is all organized, with what problems this sphere lives, how much it costs and where we are - for me it was a complete mystery.

Having extensive experience in automating processes and writing corporate systems, I decided that creating a database and automating certain processes would not take long.

At first it turned out that there is no single registry of blood donors in the country. Then I learned that all, without exception, domestic donor organizations, at best, use an Excel file with a list of donors, their phones and blood type. When an application for donor search was received, the organization’s employees sat down at the telephone and began to call everyone in a row in the hope that someone would respond. As you know, the effectiveness of this approach was almost zero.



In all countries, the legislation in the field of donation is very, very strict. For example, in Ukraine it is impossible to donate blood for a whole year, if you did a piercing or a tattoo, or for a couple of months, if you went to an exotic country or just changed your partner. The list of contraindications and restrictions to donation takes more than one page.

In developed countries, where there are no obvious problems with donor blood, the issue is solved quite simply - the state generously finances this sphere. In less developed and underdeveloped countries, the shortage of donor blood can be up to 90%, which makes blood an expensive commodity and creates a huge shadow market. Also in many post-Soviet countries, the state often abstracts from the search for donors, shifting the responsibility to the relatives of patients who, in fact, need donor blood. And given the fact that the patient’s life very much depends on whether the transfusion was done on time or not, the question of quickly finding donors becomes, without exaggeration, a matter of “life and death.”

As it turned out later, these are not all problems, therefore the project for “two weeks” has grown into something much larger.

The first steps


The real start of the project can be called participation in the IDCEE 2014 conference, during which the hackathon on social innovations was held. We won that day, and it became clear to us that the topic was interesting and important, so we started the project with great enthusiasm. Voila, and after 4 months, in the spring of 2015, we launched the first version containing the base of recipients and donors from Excel tablets, as well as a fairly simple mechanism for selecting donors and recipients. Looking ahead, I will say that the recommendation system has undergone a huge amount of changes and at the moment takes into account from 10 to 15 different parameters.

The first turning point happened a month and a half after the launch of the project, when the coordinators were able to find a donor for the first time within 15 minutes after the application was placed on the site. I will be honest - many in our organization reacted with great skepticism to automation and the system being developed. But after the system coped with the first task, we became confident that we were moving in the right direction.

By the end of 2015, there were already about 4,000 donors in the database, which made it possible to close at least half of the requests for donor search. The second half was closed in the old manner - using the phone. The whole of 2015 passed in the struggle of the old approach and the new. In the end, the new approach won. We banned the search for donors by phone and use Excel, restricted access to the system to all coordinators without exception, and disconnected all telephone lines. We realized that we need a single platform coordinator who will have one task - to look for donors with the help of staff resources of the UA Donor system. It was painful, something had to be screwed up, but as a result, the system fully earned, and we realized that we could close more applications. But nobody knew about the project (one of the most famous Ukrainian publications in the only publication about new social projects in 2015 did not even mention a word about our project), respectively, a small number of people addressed us. Despite the huge number of messages on the search for donors in Facebook / Twitter / Vkontakte. And then…

Social Network Monitoring


... I made a proposal to the company YouScan, which is engaged in monitoring social networks in ru- and ukrnet. Their system is focused on big and medium business, and, frankly, my proposal to use their system to find reports on the search for donors has discouraged them. A company representative took a pause to conduct several tests and returned several days later with the information that our hypothesis was correct and that their system copes well with the task of searching for messages. Thus, in a flash, we were able to monitor all messages on the topic in real time and respond quickly to them. This approach allowed us to become a leader in social networks - in most publications on the search for donors in the comments there is a link to our project, and the rest of the publications we find through YouScan. After finding certain messages, we contact the authors of publications and offer various options for cooperation.

The increased number of applications for the search for blood donors had to be compensated by an increase in the base of donors. And after some deliberation, the idea arose to automate the recruitment of blood donors through social networks. We decided to combine the monitoring of social networks, chatbot and natural language processing systems to search for potential donors. With this idea, we came to Stockholm on Startup Weekend: Social Innovations and ... won again.



On the left - the general scheme of the work of Natural Language Processing and the process of converting text into a structured object. On the right is an example of the message and the entities that can be extracted from it.

From messages, we can automatically retrieve data such as the name of the recipient, the required number of donors, urgently or not, blood group and rhesus factor, city and contact details. We used WIT.AI and Microsoft LUIS to train models. We obtained very good results for the English language, but, unfortunately, such systems work poorly enough in Cyrillic languages ​​- Russian and Ukrainian. And given the fact that the system is sharpened into these languages, the development of this direction was postponed until better times.

In fact, the idea was much broader: to develop a chatbot, with the help of which you can automatically recruit blood donors through social systems and instant messengers.



An example of what dialogue between a chat bot and potential blood donors might look like

Alas, this idea is difficult to implement - first of all, because of the Facebook and Cambridge Analytica scandal, as well as after the adoption of the GPRD law in Europe, which does not allow to collect, analyze and dispose of personal data freely.

Personal Assistant to the donor - DonorUA.Bot


But after the victory in Stockholm, we appreciated the potential of chatbots and were very upset by the lack of NLP / NER tools for the Ukrainian language. Thus was born the side project - DonorUA.Bot.

Creating DonorUA.Bot, we wanted to solve several problems:


In addition, with our chat bot, we were able to opt out of a large number of email newsletters, which were replaced with personalized and automatic messages in Viber and Telegram. Email is still available in the list of options, but more and more people prefer instant messengers.



Bot in Skype and Messenger

But with SMS mailings we have not grown together. All national operators refused to provide SMS to the project. Therefore, the use of chatbots and instant messengers is an obvious step, and it is also very, very cheap.

What now?


Today DonAU is a full-fledged CRM / CMS platform for recruiting and managing donors, which includes:

  1. Administrator's offices, blood donor, blood center, doctor.
  2. A recommendation system that allows donors to see the current list of recipients who need their blood group, and system administrators see suitable donors for a specific recipient.
  3. Notification system that automatically sends notifications to Viber / Telegram / Email when a matching donor-recipient is found.
  4. Bloodshed is a set of useful information for donors in a wiki format.
  5. Bonus program for donors.
  6. Official open (and processed) data from the Ministry of Health of Ukraine and open statistics.
  7. Monitoring social networks.
  8. DonorUA.Bot and AI.
  9. Mobile applications for Android, iOS, Windows.
  10. Mobile applications for partners of the bonus program for iOS / Android.
  11. Map of blood centers and reviews of blood centers.
  12. Donor support service.
  13. Open API, on the basis of which several integrations with other services are implemented.
  14. Corporate donation.
  15. Special programs and discounts for donors from partners.

So, for example, an information stand looks like in one of the blood centers:



And this is how it looks in our system:



Red color means that the blood is critically low, yellow - blood runs out, green - enough

Or here's another example of automation. Before each donation of blood, the donor must fill out a questionnaire, which consists of approximately 30 questions, which takes from 1 to 3 minutes. If you imagine that a blood center can take an average of 40-50 people a day, then the savings will be 1-1.5 hours from 4-5 workers per day (!). In our system, the donor can fill out the online application once and update it as information changes (which happens very rarely), and the blood center can download the completed application forms in his office. And there are quite a lot of such examples where we were able to optimize certain processes.

Translating all processes into a figure has one more positive effect: we can assess the situation at any moment - both at the level of a separate blood center, and at the level of a city or the whole country.

Architecture and technology stack


The project was made on ASP.NET MVC + Web API + Entity Framework on the Microsoft Azure platform. We use Azure SQL Database, Azure Blob storage, Azure Jobs, Azure CDN, Cognitive Services + Microsoft Bot Framework. Mobile apps developed on Xamarin. For team work, Office 365, Slack, Asana and Visual Studio Team Systems are used. In general, the standard .NET / Azure stack is nothing special.

We wrote our own (fairly simple) NER for the Ukrainian language on top of the Microsoft Bot Framework + and added integration with Viber, which allowed us to quickly create QnA (questions and answers) chat bots in the Ukrainian language (similar to Microsoft's QnA Maker, which is part of Azure Cognitive Services) and quickly deploy them on all popular platforms - Messenger, Viber, Telegram, Skype, Skype for Business, Slack, Microsoft Teams, email, web chat and use the Direct Line API to integrate chat bot into mobile applications.



Standard chatbot architecture on Azure + Microsoft Bot Framework

Microsoft has kindly provided our Azure project with resources under the Microsoft Bizspark program. Recently, Microsoft Bizspark was replaced with the Microsoft for Startups program, and getting resources was much more difficult, but we successfully moved to another program - Microsoft for Nonprofit, within which you can get Office 365 for 300 users and Microsoft Azure resources for $ 5000 per year. free of charge. Thus, despite the fact that the project, in fact, is social, all processes are built as in a real business project.

Speaking of business.

Business model and positioning


The question of financing is asked us very often, as well as, actually, how we position our project.

From the very beginning, we positioned the Donor UA as a non-profitable social project. But non-profit does not mean that people do not need to pay salaries and pay bills. Yet in the minds of many people, non-profitable is equal for free. We didn’t want to deal with granteeism, and, frankly, almost all the funds otfutbolili us at an early stage of negotiations - they say, not the format. We didn’t want to fill in endless tender papers, and, in truth, we don’t know how. Therefore, almost all the financing of the project is its own funds and in part - financial assistance from one person not related to the project.

We did not consider the option of monetization of the project on recipients - the majority of recipients who come to us and experience problems of both a psychological and a material nature. And those who can buy our services, as a rule, do not apply to us, but solve problems through “their channels”.

When positioning with a social project "did not go", we began to position the project as an ehealth startup, which, in fact, is not very far from the truth, but with some nuances. This positioning has borne fruit - we regularly began to get into the media, were able to win several start-up contests and began to be invited as experts in civic tech and social innovations. Unfortunately, grants, partners and investments this did not bring us.

An amusing situation occurred at one of the start-up contests, in which the winner was to receive about $ 75 thousand for development. But after we won this match, we were presented with a ... book. Yes, Ukrainian start-up contests are senseless and merciless :-) Then there were a few finals, victories and participations, but at some point we realized that this was a waste of time.

At the moment, we offer socially responsible business to spend corporate days of the donor and be part of the development of the donor movement. We are actively looking for such companies for cooperation, offering a completely new level of team building, as well as corporate social responsibility.

So we started making some money. The key word is a bit :-) And we still have a lot of plans!

Machine learning and artificial intelligence


Monitoring of social networks, chat bots, NLP / NER - in fact, we already use separate elements of AI for solving various tasks. But the possibility of using MO and AI wider.

At the moment we are dealing with several tasks.

Forecasting demand for donated blood based on historical data


The task is rather standard, but the problem is that there are very few historical data, they are, at best, aggregated, so they cannot be used. And our data is not enough. Nevertheless, I hope that in the future, closer integration with blood centers will allow us to get impersonal historical data and this will allow us to use the full power of AI algorithms to forecast demand.

Predicting the event that the donor will re-donate blood in the next X days with a probability of N


For the development of models, we used the open dataset - Blood Transfusion Service Center Data Set , which, in fact, contains real data from one of the blood centers. Having trained on publicly available data, we went into the analysis of data that we collected with the help of UAA. More details about this can be found here.

Reducing the number of matches donor-recipient


The matching algorithm of donors and recipients works quite well, but there is one major drawback: with an increase in the database and the selection of popular blood groups, we get thousands of matches. More is not always better. We really do not want messages from us to be perceived by donors as spam. Thus, it is necessary to solve the problem of reducing the number of matches donor-recipient without loss of quality. In addition, we must incline non-very active donors to regular donation.

To solve problems, we use a large number of tools - from Microsoft Azure Machine Learning, ending with various python libraries and the new tool from Microsoft - ML.NET library.

Instead of conclusion


Modern technologies open a huge number of new opportunities, including to solve acute problems of mankind.

By our example, we want to show that the synergy of active people and modern technologies can work wonders. For three years within the framework of the Donor UA, we directly helped 2.5 thousand recipients, and 20 thousand donations of blood - this is potentially 60 thousand lives saved.

Cloud technologies, algorithms of artificial intelligence and machine learning open new opportunities for developers, businesses, which even ten years could only dream of.

Business has enormous resources. We have a great desire and great experience in solving problems in the field of blood donation.

Let's solve these problems together.

about the author


Alexander Krakovetsky - CEO DevRain Solutions, CTO Donor UA, Ph.D., Microsoft Artificial Intelligence Most Valuable Professional, Microsoft Regional Director.

Source: https://habr.com/ru/post/415017/


All Articles