Able french citizens to search in French Construction and Housing Law Code
You can see the demonstration on this video
We create a docker-compose file to combine elasticsearch (ES) and dejavu UI.
We added in ES configuration inside the docker-compose the CORS domain allow-origin
for to able the website running on localhost:8080 to request ES Rest API.
I recommend you to create a virtualenv before installing pip dependancies.
Cleaning and converting the dataset in json
Filename | Description |
---|---|
code-construction-habitation-all.json | JSON containing all french laws for construction and housing. |
code-construction-habitation-legislative.json | Part of full dataset containing only legislative articles. |
code-construction-habitation-all.js | JavaScript variable containing all JSON dataset to be able to use it on future JS script. |
generated-for-es-with-parentid-array.json | File generated by convert-dataset-for-es.js with all laws articles text and parentID in an array. (If you uncomment line 18, [31 to 38], and comment line 20, [39 to 45]) |
generated-for-es-with-parent-as-object.json | File generated by convert-dataset-for-es.js with all laws articles text and parentID and his title into an object. (If you comment line 18, [31 to 38], and uncomment line 20, [39 to 45]) |
Run script convert-dataset-for-es.js to be able to generate dataset which can be import in the Elasticsearch index.
Cause actually you can't insert the dataset without cleaning and formatting it.
Insert the new dataset into elasticsearch.
You should have followed the Docker part so you have an ES running on your docker. You will need to create the template for the index. Using template-laws-with-analyser.txt curl command.
Finally, you will be able to run the last script inside the import-in-elasticsearch
folder.
There is 3 python files, insert-elastic.py is the most important. But it will need the two other which contains the generated dataset.
You will need to specify an index name while running the command.
$ python3 insert-elastic.py -I laws-all
$ python3 insert-elastic.py --index laws-all
Running the website
Go to search-engine-website
folder and follow the README.md.
Finally you will be able to open the website on your favorite browser and start searching for some french laws.
Antoine Frau - Student in Master degree of Full-Stack Developer.
This project is licensed under the MIT License - see the LICENSE file for details.