[PYTHON] I made my own research tool using the legal API [Smart Roppo]

1. 1. Introduction
2. I made a legal tech-like product
3. 3. Smart Roppo concept
4. Main functions and features of SmartRoppo
5. Why did you decide to make it yourself?
6. Future tasks
7. in conclusion

1. 1. Introduction

This article inherits the baton from Jank (@ jank_2525) and says "** Legal Advent Calendar 2019 I am writing as the 14th day entry of "3900) ** [^ 1]".

Everybody's entries are very unique and wonderful, and I see them with great interest every day.

2. I made a legal tech-like product

By the way, suddenly, I tried to make a legal tech product, so I will release the beta version with this entry. It is called ** [Smart Roppo] **.

** SmartRoppo-Make your legal database smarter-** https://smartroppo.com/SmartRoppo/index.html movie2.gif

No troublesome work such as user registration is required, and anyone can use it.

3. 3. Smart Roppo concept

The concept of SmartRoppo is "** Update the UI / UX of the law **" (magnificent).

I myself often deal with financial matters, but many financial laws and regulations, such as the Money Commercial Law and the Banking Law, are extremely complicated and esoteric.

Therefore, I am ashamed to say that even now, five years after I became an attorney, I sometimes realize that "Is there such a text!" Or almost misread it (I should not be the only one ... ).

However, on the flip side, these complicated and esoteric decree are written concretely and in detail assuming various cases (the range of interpretation is narrow). In fact, even if the consultation is from a client who is familiar with the laws and regulations of the industry, there are some cases where we can answer just by the content of the article.

In other words, if you can read the contents of the law "** accurately **", you will often be able to reach the information you are looking for. Or rather, there is no interpretation if you can't do that. Of course, it is important to refer to documents such as business books, but in the end it is essential to check the original text.

Here are some slides from when I talked about it at an event. The concept of Smart Roppo is to solve these problems with the power of technology. GGAプレゼン資料 2_アップ用_ページ_2.png GGAプレゼン資料 2_アップ用_ページ_3.png GGAプレゼン資料 2_アップ用_ページ_4-min.png GGAプレゼン資料 2_アップ用_ページ_6.png GGAプレゼン資料 2_アップ用_ページ_7.png GGAプレゼン資料 2_アップ用_ページ_8.png GGAプレゼン資料 2_アップ用_ページ_9.png

4. Main functions and features of SmartRoppo

At present, there are three main functions and features of SmartRoppo. (Maybe it's faster to actually use it or watch the demo video above than to explain it in the text.)

(1) Data acquisition function from the law API (+ real-time search function for laws)
(2) Automatic reference function for subordinate rules
③ Highlight function in parentheses

(1) Data acquisition function from the law API (+ real-time search function for laws)

I think that many electronic six-code apps so far have a database method that holds data on their own.

On the other hand, SmartRoppo uses the "** Law API ** [^ 2]" published by the Ministry of Internal Affairs and Communications. In other words, basically, the application does not hold the data, and the latest XML data is acquired from e-gov each time it is accessed.

In the API method, legal data is always kept up to date (as long as e-gov is updated in a timely manner), and maintenance on the application side (reflection work such as law revisions) is basically unnecessary [^ 3] ] There is a merit in that. However, the display speed may be inferior to the database method because the data is acquired each time.

(2) Automatic reference function for subordinate rules

・ Importance of subordinate rules

In order to accurately understand the contents of complicated laws and regulations, it is essential to read the subordinate rules such as "Cabinet Order" and "Cabinet Office Ordinance" referred to in each article. However, it is a laborious task to identify and confirm the subordinate rules associated with each of these articles. Many of you may have checked the thick paper lawbook while going back and forth (by pinching a pen instead of a bookmark).

Therefore, SmartRoppo has implemented a function (automatic reference function) that automatically acquires these subordinate rules and displays them in a list with the laws and regulations of the reference source.

・ Have you never seen it before?

There have been a small number of electronic six-law apps that seem to have been manually referenced (hence limited laws and regulations). On the other hand, at least as far as I know, I don't think I've ever seen anything with the ability to add a "** automatically **" reference (hence all laws) (I'm sorry if it's different). ..

However, the accuracy of SmartRoppo is still not good, and it is not compatible with all the laws and regulations at present [^ 4], so I would like to improve this area one by one.

・ Why is it difficult? -"Reverse reference" wall

I've always wondered why the automatic reference feature for subrules isn't implemented. Somehow, I feel that it seems to be relatively easy to implement.

However, when I actually made it, I understood it well. Actually, this is technically challenging (or rather annoying) because of the structural problems of the law.

In particular, it was difficult to make it compatible with the API method, and as a result of trying various methods, I could only find one that seems to work with a certain degree of accuracy.

The reason why it is difficult is simply that the reference of the subordinate rule says, "The reference source does not have the information to specify the reference destination, and only the reference destination has the information to specify the reference source [^ 5]. This is because it has a structure like "** eggs and chickens **" that "it is necessary to specify the destination, but the problem is how to specify the reference destination."

I call this "** reverse reference **".

GGAプレゼン資料 2のコピー.png

When humans work, add an atari such as "The" Cabinet Office Ordinance "here refers to the" XX Office Ordinance "and should be written around here," and check the surrounding text. I think that we often take such a method.

However, it is quite difficult to write such "skin-sensing" things in a program.

③ Highlight function in parentheses

As you can see, this is a function to color-code the parentheses for each layer. It makes it easier to read texts with long parentheses or multiple parentheses.

However, the processing of this multiple parenthesis (nesting) is quite awkward, and ** currently bugs have appeared **. I know the cause [^ 6], but I haven't had enough time to deal with it yet. I'm sorry. ..

5. Why did you decide to make it yourself?

In developing SmartRoppo, I tried to move my hands by myself for the time being, including not only coding but also design and (not cool) design [^ 7].

I am a "super-humanities" person who admits both myself and others. There is no technical background. I had never touched a programming language, and started from the level of "HTML ...?: Thinking:".

From such a state, why did you come up with the idea of making / making it yourself? I'm not sure (or forgot) myself, but I think I had the following feelings.

--The word legal tech has begun to spread, and there have been cases where specialists such as attorneys start their own businesses [^ 8]. ――I'm interested, so I'll look into overseas cases and think vaguely about ideas (I wish I could automate DD or something!), But I didn't do anything concrete and ended up with a fantasy. --Something is moody. ** It's a waste to just look at it without moving anything, even though it's a tech field where you can make the most of your legal expertise ** [^ 9]. --I don't know how much I can do, but I'm also technically interested [^ 10], so let's make what I want for the time being. I've never done programming, but if I do my best, I'll be able to do something (appropriate).

I started development in this way, but it is harder than I expected to fight the infinite error hell by writing and erasing the code while thinking that it is neither uh nor uh, in the interval of lawyer work. did.

In particular, I was really worried about the "reverse reference" function mentioned above [^ 11]. While trying various techniques and breaking them repeatedly, ** my head seemed to be bald ** [^ 12].

But ** If you're not an engineer and you want to learn programming, there's no point in doing it unless you take some form (Deploy or Die [^ 13]). There is no point in making it, at least if you don't want to use it in practice. ** I thought so, so I got through with a spirit. Basically, I'm a lazy person, but I've decided to do something.

As a result, I managed to take shape and feel a little relieved (although there are still many issues to be solved).

I would like to write about the details of development (how I studied programming) and technical details at another time (if anyone is interested). On the technical side, I think that legal personnel will also be interested in the fact that the data they handle is ** "the law itself" **.

6. Future tasks

Although I tried to publish it for the time being, it cannot be said that it has sufficient performance and functions due to time and technical constraints. If you briefly write down future issues and features to be added, it looks like this (in no particular order).

-** Improved processing speed ** (due to API method and automatic reference function, but still a bit slow) -** Improved accuracy and expanded scope of automatic reference function (reverse reference) ** -** Article number search / term search function ** (There is a UI, but this is also short of time) -** Automatic reference function for forward reference ** (I should have done this before reverse reference) -** Automatic reference function of foreign language translation DB ** [^ 14] -** Reference function for related materials such as case law and pub rice ** -** Personalization function for memos, bookmarks, etc. ** -** Design refurbishment ** (Desperately lacking sense, please help someone ...) -** Cover of laws and regulations (court rules, notifications, etc.) that are not converted to XML data ** -** Regular expression search function ** -** Other minor bug fixes **

7. in conclusion

It's still an immature product, but I hope you'll give it a try. And any content is fine, so I would be very happy if you could give us your opinions and requests (@lawyer_alpaca).

Thank you for staying with us for a long time! Next is 10ru (@ oga10ru)! Thank you!

[^ 1]: There is also "Back".

[^ 9]: However, I think that legal tech has different ways of being involved, such as those who start a business, those who develop it, those who try it, those who disseminate information, and those who wait and see. I think that each person has their own evaluation of each technology and product, and I think that's fine.

[^ 10]: At this time, I thought that if I learned programming, I would be able to understand the technology. But now it's a little different, and I think they are basically separate (although they are complementary to each other) and need to be studied. If you compare it to legal affairs, it's like, "A review of hundreds of contracts doesn't give you an idea of civil and commercial law. And vice versa. Both have to be studied as such." Is it?

[^ 11]: It doesn't matter at all, but the Bachelor 3 was interesting.

[^ 12]: Originally, I have a lot of hair, so I think it's still okay.

[^ 13]: A famous phrase by Joi Ito, the former director of MIT Media Lab. The full speech is here.

[^ 14]: The number of English translation laws published in Japanese Law Foreign Language Translation Database System is currently about 750 (a little less than 10% of all laws). ), But it seems that significant expansion is planned in the next three years, centering on important laws and regulations. http://www.moj.go.jp/housei/hourei-shiryou-hanrei/housei03_00013.html

Recommended Posts

I made my own research tool using the legal API [Smart Roppo]
Since I made my own smart lock, I will summarize the difficult points
I made my own language. (1)
I made my own language (2)
I made my own AML
I made an original program guide using the NHK program guide API.
I made my own Python library
I tried using the checkio API
I tried using the BigQuery Storage API
I don't have the skills or strength, but I made my own compiler
I made a LINE BOT that returns a terrorist image using the Flickr API
I checked the library for using the Gracenote API
I tried using the Google Cloud Vision API
[I tried using Pythonista3] Importing my own module
I made my own primitive static site generator
I made my own parallel link robot (software version)
I tried learning my own dataset using Chainer Trainer
I tried using the API of the salmon data project
I made my own parallel link robot (mechanical edition)
I made my goimports
I wrote a Python script that exports all my posts using the Qiita API v2
I made a VGG16 model using TensorFlow (on the way)
[Python] I tried collecting data using the API of wikipedia
I made my own OSS because I wanted to contribute to it
I made a Chatbot using LINE Messaging API and Python
[For beginners] I tried using the Tensorflow Object Detection API
I made my own 3-layer forward propagation neural network and tried to understand the calculation deeply.
Try using the Twitter API
I touched the Qiita API
Try using the Twitter API
Try using the PeeringDB 2.0 API
[Python] I made my own library that can be imported dynamically
Python> I made a test code for my own external file
I tried using the COTOHA API (there is code on GitHub)
I tried to analyze my favorite singer (SHISHAMO) using Spotify API
I made a scaffolding tool for the Python web framework Bottle
I made my own filter plugin for text parsing of Ansible
I made a Chatbot using LINE Messaging API and Python (2) ~ Server ~
[Kaggle] I made a collection of questions using the Titanic tutorial