I got an Alexa device as part of the perks program last November. However, I couldn’t find that many skills that weren’t „just games“, but actually useful. As a law student, I thought I could do my part by creating a useful skill aimed at lawyers, law students and people generally interested in the law.
What it does
My skill offers you a big range of laws. You can just ask for a specific norm and Alexa will read it to you.
How I built it
I saw that the Federal Ministry of Justice offers every German Law in an XML-Format (free to use). I converted more that 150 laws into a JSON format and filtered the relevant data. Then I coded a Js-Algorithm in the Alexa Developer Console, which is able to work with the data structure of the converted JSON-Files and which can fetch the law text which is needed for the spoken Response as well as a sent a card to the user’s App.
Challenges I ran into
A big challenge was the data structure of the converted JSON files, because they varied quite a bit and lead to errors. To solve that problem, I „taught“ my algorithm to detect the kind of data structure of the specific law and then to fetch the content accordingly. This was really complicated, because I had to take a different approach for each deviant data structure. Furthermore, laws have different levels as each paragraph can be filtered into several parts (called „Absätze“). Then there are many different ways of enumerations (eg. a-f or 1-9), which made the progress of creating a code which works every time even more complicated
Accomplishments that I'm proud of
I’m proud that I was able to solve the problems mentioned above. I created a code that was abstract and prepared for all kinds of different „law formats“. It felt good, that in the end I only had to add the laws without having to worry about the code itself. I learned coding just by watching a few Youtube videos and by trial and error. So I’m really proud that I finished a skill all by myself.
What I learned
I learned a lot about coding and how big sets of data can be used in a creative way. I also learned how to tackle problems, that I though couldn’t be solved.
What's next for Deutsche Gesetze
First of all, it’s important to keep every law up to date. Next steps could be creating similar skills for other countries or adding European legislative. However, not all countries offer they laws in a usable data-format.