Corona Legal Chatbot

Health Education
Project thumbnail

Place to go to for all legal questions concerning Corona.

Hedwig Brobeil, Sebastian Seeger, Elias Künstler, Marvin Fechner, Ina Draijer, Onur Karademir, Chris B.

Inspiration

The corona crisis has taken hold of every area of our lives. We are all, in our own way, confronted with questions about the legal implications of the coronavirus almost every day. Consumers ask themselves what will happen to their travel bookings. Employees ask themselves whether their employer is allowed to require them to perform another function or whether their employer can withdraw authorised leave. Businesses are affected, too. Especially the German ‘Mittelstand’, the small and medium-sized enterprises which underpin the German economy. Questions arise around home office, requirements for receiving compensation for reduced working hours, or state aid.

We aren’t doctors or virologists who can help directly in the fight against Covid-19. But as employees of a tech startup, several law. firms and a student LegalTech initiative, we have expertise in the fields of legal and tech. We’ve combined these and together created the Corona Legal Chatbot.

What can the Corona Legal Chatbot do?

The Corona Legal Chatbot will be able to answer questions about the legal implications of Covid-19 – whether you’re a business with a question about employment law and the government’s coronavirus assistance programmes, or a consumer with questions about travel law. You can ask the Corona Legal Chatbot questions via Telegram #coronalegalchatbot in the first instance. We are working on opening more channels, and are already in discussions with Facebook over a licence for Whatsapp.

Conversely, as a legal expert or a representative of an authority or public body, you can also supply answers for the Corona Legal Chatbot and leave your contact details for further questions or legal advice. Doing so is quick and easy thanks to our input tool.

The Corona Legal Chatbot is made for every person and every legal question. The crawler function helps ensure that the facts are up to date, which is particularly important for the quality of the answers given that the legal framework is dynamically changing.

Unlike a Google search, the Corona Legal Chatbot offers a low-threshold option which leads more quickly and easily to a suitable result. Through a rating system, our chatbot learns which is the best answer to a question and prioritises this for future questions. Above all, our chatbot is interactive and intuitive to use. It’s not merely a window to an FAQ database, but is based on the intelligence of a large group of experts.

Our Chatbot meets people where lots of them are these days: at home on the sofa, on social media channels. And it captures the special momentum of the crisis, the ‘all for one, one for all’ mentality, by empowering experts to take action as content creators and to expand the Corona Legal Chatbot.

The Corona Legal Chatbot is also impressively sustainable. We might soon have got through the health dimension of the crisis (fingers crossed), but the negative economic consequences will be with us for months yet, if not years. In this context, many legal questions will remain relevant or will come back again.

How we built it

The idea to build a chatbot for legal questions grew out of the existing collaboration between Adornis Ventures (a software startup) and FPS (a renowned legal firm), which involved skills in many relevant areas that are now in demand in the current crisis. This initial contact allowed us to develop the idea and to get lots more contacts, experts and helpers onboard to support us with technical, legal or marketing issues.

Responsibilities were divided up into two teams: ‘content’ and ‘tech’. While the ‘content’ group collected frequently asked questions and entered suitable answers with references into an Excel spreadsheet, the ‘tech’ group started programming. The first question was which software could be used as a basis. It had to be scalable and enable the necessary features which the Corona Legal Chatbot would have. ‘Intercom’ was suggested, but eventually rejected in favour of Google’s Dialogflow and Telegram. Dialogflow offers the option to use so-called ‘intents’ with the help of machine learning to better understand the user’s intentions over time and provide accurate answers.

To save and process data, we drew on familiar systems like MongoDB and Adornis’s own AdornisEngine for the design, because our group were best acquainted with them. It was of crucial importance for the hackathon that robust code could be written quickly thanks to familiarity with the code and the approach. Ultimately the programme had to be ready for use within 48 hours.

The front end concept – the chat through which the user communicates with the bot – was also overhauled during the design process. Initially, a separate web-based chat interface was created. But ‘Telegram’ established itself as the messaging app instead, as it allows automated bots to be easily created and integrated in Dialogflow with just a few clicks. Nevertheless, the communication channel through which the user can write to the bot is flexible, and our vision encompasses a wide range of possibilities.

The fourth and final building block of the programme involved adding a dedicated editor to the database, via which data can be recorded in a structured way and entered by experts. It remains possible to import .csv files into the database.

Diagram of the technical structure

Challenges and how we overcame them

The idea of a Corona Legal Chatbot is an obvious one. But it’s not innovation until you actually do it. And the challenges which arise from this principle are exactly the ones which we decided to take on.

Providing answers in the right place for people seeking advice

The aim is to reduce complexity for people seeking legal advice. We don’t want another FAQs website. We are offering a bot which is accessible via Telegram (CoronaLegalChatBot) and will in future be accessible via Whatsapp and Facebook Messenger (pending approval from Facebook in both cases), and is therefore already integrated in every mobile phone. In this way, we are achieving scalability of information distribution.

A low-threshold offer to provide content

The Corona Legal Chatbot’s added value to society depends on the provision of good content. Anyone who can contribute to this content will be given the opportunity to add important information, whatever technical skills and options they have at their disposal. This particularly applies to state institutions such as authorities at the local, district and federal state level. We provide two ways to pass on information: a simple online form is used to input an answer and a question. At the same time, a whole range of answers can be recorded in an Excel file which is passed on to the bot. In this way, more than 100 answers can also quickly be entered in one go.

Keeping the bot’s answers up to date

Answers to legal questions can quickly change because of new regulations from authorities at the local, district, federal state and national level. This makes it all the more important that an answer which was once right is constantly corrected if it is no longer up to date. We ensure this by giving authors the opportunity to update their answers. FAQs which have been asked and compiled in a document (e.g. Excel file) can be uploaded afresh afterwards. This allows authorities in particular to reliably provide up-to-the-minute information.

How to we differentiate between ‘crawled’ and ‘proactively uploaded’ content?

We search the websites of authorities, institutions, law firms, etc. for FAQs or similar pages. At the same time, we enable experts to make answers available on our interface via the bot. The crawled content is not subject to any editing or checking as to whether it is up-to-date. Nonetheless, we would like to use it. We mark corresponding answers in the crawler so that they are visible to the user. Proactively uploaded content comes from experts who have previously registered and are named contacts for the information provided. The bot also makes this visible to the user by marking the answer as "approved".

Technology

In principle, we are looking at a two-sided system: data collection on the one hand and consumption via the chat bot on the other. It is necessary to make data input and output not only compatible with one another, but also reactive to one another. Artificial intelligence mediates between the two sides, structuring the abstract aims (intents) of the chatbot users and reconciling them with the knowledge base. Conversely, interactions with the bot are logged anonymously to train the AI and detect gaps in the content.

Because of this architecture, we had to develop many parts from scratch (the authoring tool, integration with the AI, integration with the chat itself, deployment, database management...). Of course, we used existing solutions where possible (Telegram, Dialogflow, MongoDB, AdornisEngine ...), but we could not build on any similar existing structure.

Expert Tool

So that we could manage the data pool in a structured way, we built it directly on the basis of a database solution (MongoDB). This was necessary to guarantee the clean transmission of the data to the artificial intelligence. A separate frontend was therefore necessary; this allowed the database to be managed by less technically experienced users (https://coronalegalchatbot.de/contentadmin, login with TestUser - test). It was a particular challenge in this respect to keep a focus on both usability and performance at the same time. In numerous team discussions, including with legally experienced colleagues, we iteratively incorporated and tested valuable feedback time and again.

Chatbot

Within the prototype, the chat is based on Telegram because the API for integration is comparatively open and liberal. However, thanks to the modularisation within the development process, integrating WhatsApp is not a problem from a technical perspective (it remains to be seen whether Facebook will accept our application for a WhatsApp Business API account).

AI

Artificial intelligence is more than a buzzword for us: on the basis of Google's Dialogflow (the basis of Google Assistant), it has already been trained with 100 data sets and over 300 interactions with the chatbot as part of the hackathon weekend. In order to be classified as "intelligent" by a human being and to be able to answer the majority of questions satisfactorily, it requires much greater scaling and a lot of manual input, but we know from other systems that this approach is practicable and realistic. The technical system to do this is ready, in any case.

Achievements we are proud of

When we started this project one Friday evening at 10pm, we could not have foreseen just how much spirit, commitment and vigour the team would put into tackling this project. We have managed to spread these qualities to other fellow campaigners, and are already proud of our rapidly growing network of partners and our Corona Legal Chatbot expert group.

Our partners

On this weekend alone, we successfully gained partners from the public sector, science and business by inspiring our network. So far these include:

  • FPS Rechtsanwälte
  • Zentrale Beteiligungsgesellschaft der Stadt Mainz
  • Legal Tech Lab Frankfurt
  • Weblaw.ch
  • Rechtsanwaltskanzlei Mirella Endt-Eckhardt
  • KSB Intax
  • NOTOS Rechtsanwälte

We will expand this network in the coming days to include law firms and especially public institutions such as employment agencies, the KfW, Ministries, the RKI and associations. All of them will add their legal content on corona to our database. In this way, we can also make a contribution to the development of e-government in Germany, which until now has had room for improvement.

We have even gained a partner in Switzerland already: Weblaw.ch. They heard about our activities and got in touch with us on LinkedIn. Weblaw.ch is the Swiss counterpart to Beckonline, the most important legal database in Switzerland. Discussions about the Corona Legal Chatbot Switzerland will start tomorrow.

Our Corona Legal Chatbot expert group

Our expert group fulfils several functions at once. First, the experts will supply the chatbot with answers (content creation). If a question can ultimately only be answered with legal advice, the chatbot will pass it on to the appropriate expert as a point of contact. Experts are also involved in evaluating answers, thus ensuring that the chatbot provides high-quality responses.

In our Corona Legal Chatbot group on LinkedIn, 114 people have already come together.

Technology

Without the unbelievable motivation of our team and our partners’ significant investment in terms of human resources, we would not have been able to implement this complex project in one weekend. We are particularly proud of the technical organisation of the project, with individual parts being almost seamlessly integrated into a complete prototype during development.

For the hackathon, a feasible and completely normal approach would have been only to hint at large parts of the prototype (for example the AI) and focus more on the pitch. However, we unanimously decided to lay a solid foundation for the sustainability of the project now, and especially, if possible, to put into practice those parts that were difficult to implement, at least as proof of concept. An important prerequisite for a stable system later on is that it should have a modular setup. For example, we ensured that the chat client can be flexibly exchanged, as can the AI engine.

Open Source

In the spirit of the hackathon, the code is publicly available. The documentation is a work in progress. We are happy to answer questions on Discord or Slack or via issue in Repository. In the next few days, the code will be restructured to allow third party use.

What have we learned?

First of all we learned about ourselves, and how much we can achieve in two days. A big thank you to the organizers and for the tireless efforts of the many supporters. From a technical point of view, there are a few key points:

  • MongoDB’s $text indexing is an amazingly good search engine compared to other pure full-text searches without concepts like Google's PageRank, which are based on Markov chains or machine learning.
  • Unfortunately, the integration of chatbots is in no way standardised. Most formats that go beyond pure text or images are specified for each platform individually. This means relatively high complexity when implementing a bot for multiple chat platforms.
  • Telegram allows only 2000 characters per message. If these are exceeded, the integration between Dialogflow and Telegram will absorb the corresponding error message. Debugging this took us over 30 minutes.

Next steps

It was already clear to the project team over the course of the hackathon that this project would continue. The next steps planned are:

  • Continuing to collect answers (content creation)
  • Expanding the partner network and expert platform 
  • Holding discussions with Swiss colleagues to open the Corona Legal Chatbot for the Swiss jurisdiction
  • Refining the concept for updating answers and for the rating system
  • Deepening cooperation with authorities and public institutions

Try it out

Email the builderSee more on Devpost

A project from #BuildforCOVID19

Explore by theme