Skip to content

phe-sto/enthic

Repository files navigation

EOL, l'INPI supprime le FTP du RNCS et remplace tout par le RNE

L'INPI a communiqué cela le 03/04/2023:

Madame, Monsieur,

En tant que licencié aux données du RNE nous vous informons de la fermeture des anciennes applications de diffusion des données du RNCS le 30 juin 2023.

Les API et le serveur FTP RNCS ne seront plus accessibles, les données étant désormais disponibles sur les nouvelles applications API et SFTP du RNE au format JSON et PDF.

Nous vous rappelons par ailleurs que les quotas de téléchargement sont de 10 Go ou 10 000 appels par jour.

Vous pouvez retrouver l’ensemble des documentations techniques dans l’onglet « espace open data » du portail DATA INPI.

Qui est partant pour faire une version de Enthic avec le FTP du RNE?

Projet en pause

Ce projet est en pause faute de temps et d'énergie. Je me concentre maintenant sur un projet similaire, IN FRANCE, plus complet qui utilise ces mêmes données pour étudier l'économie Française. Merci à tous ceux qui ont collaboré. N'hésitez pas à me christophe.brun@papit.fr pour toute question.

Project on hold

This projet is on hold due to a lack of time and energy. I am focusing on IN FRANCE project, a similar one, more complete, studying the French economy. Thank you all contributor. Don't hesitate to contact me at christophe.brun@papit.fr.

French societies accountability extraction and treatment by PapIT

Project that treats data from opendata-rncs.inpi.fr. They contain xml files of the account declaration of all french societies. The overall project is meant to be low-code and open source. Aim to provide ethical indicators on companies. Information media is a MySQL database, CSV files, web visualisation and a swagger API. The search engine endpoint return a JSON-LD (Hydra) compliant JSON. Company JSON cannot conform to JSON-LD Organization type due to lack of data (contact for instance). Score and indicators are calculated by batch, sql and why not using fancy libraries. Help in data treatment to improve scoring would be appreciated. Scoring, AI, data scrapping for segmentation. Shell and python must be launched from their corresponding directory ./sh and ./py.

Install dependencies and python package

Synaptic packages have to be installed libxml2-utils mysql-server tree python3. Pip packages as well have to be installed for development purpose.

$ sh ./install-dependencies.sh

To install the enthic python package only.

$ sh ./install-wheel.sh

Run an instance

Extract data from zip

Data are stored in zip files on opendata-rncs.inpi.fr, group by day. Each XML is in a zip. The first step is then to read the XML files and convert data into "bundle.tmp" and "identity.tmp" You must create folders 'input' and 'output' at the root of the project, and put some daily zipfile named like "bilans_saisis<date>.zip" in 'input' folder.

$ sh ./clear-data.sh

Check the XML format

An XSD is provided by the INPI. This step verify all the XML are following this XSD. XML not following this XSD have their filename printed out.

$ sh ./check-data.sh

Format XML

Create two CSV based on the output generated by clear-data.sh. One for each table, identity and bundle.

$ sh ./csv-table.sh

Create MySQL database

Create database, tables and indexes. The content of the two tables come from the previously generated CSV files.

$ sh ./database-creation.sh --password=<your mysql password>

Run API

A flask REST API can distribute data over the web. Following Swagger standard.

$ python3 ./app.py

Development and contribution

License

Do What The Fuck You Want To Public License (WTFPL)

Development and Coding Rules

  • snake_case for variables, definition and CamelCase for classes.
  • Only argument is configuration file for python.
  • No output or print information (just raw results authorized), just log and files.
  • Sonar Qube integration.
  • Pytest python and API testing.
  • Autodocumentation using Sphinx 1.8.5.
  • Benchmark of CPython VS Pypy.
  • Common sens and clean code.

Build and install python enthic package

$ sh ./install-wheel.sh

Testing

Only python package is tested. Used test framework is pytest. Tests can be run via pytest in the python/enthic/ directory.

Generate documentation

Generate HTML documentation via Sphinx documentation framework. Sphinx is called programmatically at the beginning of setup.py. Therefore the above installation build the doc at the same time.

Library structure

./enthic
├── account-ontology.csv
├── bilans-saisis-v1.1.xsd
├── .gitignore
├── enthic.dbdiagram.io
├── input
├── LICENSE.md
├── output
│   ├── bundle.csv
│   └── identity.csv
├── python
│   ├── doc
│   │   ├── conf.py
│   │   ├── index.rst
│   │   └── papit.png
│   ├── enthic
│   │   ├── app.py
│   │   ├── company
│   │   │   ├── company.py
│   │   │   ├── denomination_company.py
│   │   │   ├── __init__.py
│   │   │   └── siren_company.py
│   │   ├── database
│   │   │   ├── mysql.py
│   │   │   ├── mysql_data.py
│   │   │   ├── fetchall.py
│   │   │   └── __init__.py
│   │   ├── configuration.json
│   │   ├── conftest.py
│   │   ├── decorator
│   │   │   ├── check_sql_injection.py
│   │   │   ├── __init__.py
│   │   │   └── insert_request.py
│   │   ├── extract_bundle.py
│   │   ├── __init__.py
│   │   ├── ontology.py
│   │   ├── static
│   │   │   ├── 404.html
│   │   │   ├── 500.html
│   │   │   ├── bootstrap.min.css
│   │   │   ├── documentation
│   │   │   │   ├── .buildinfo
│   │   │   │   ├── doctrees
│   │   │   │   │   ├── environment.pickle
│   │   │   │   │   └── index.doctree
│   │   │   │   ├── genindex.html
│   │   │   │   ├── index.html
│   │   │   │   ├── _modules
│   │   │   │   │   ├── company
│   │   │   │   │   │   ├── company.html
│   │   │   │   │   │   ├── denomination_company.html
│   │   │   │   │   │   └── siren_company.html
│   │   │   │   │   ├── decorator
│   │   │   │   │   │   ├── check_sql_injection.html
│   │   │   │   │   │   └── insert_request.html
│   │   │   │   │   ├── index.html
│   │   │   │   │   └── utils
│   │   │   │   │       ├── error_json_response.html
│   │   │   │   │       ├── json_response.html
│   │   │   │   │       ├── not_found_response.html
│   │   │   │   │       └── ok_json_response.html
│   │   │   │   ├── .nojekyll
│   │   │   │   ├── objects.inv
│   │   │   │   ├── py-modindex.html
│   │   │   │   ├── search.html
│   │   │   │   ├── searchindex.js
│   │   │   │   ├── _sources
│   │   │   │   │   └── index.rst.txt
│   │   │   │   └── _static
│   │   │   │       ├── ajax-loader.gif
│   │   │   │       ├── alabaster.css
│   │   │   │       ├── basic.css
│   │   │   │       ├── comment-bright.png
│   │   │   │       ├── comment-close.png
│   │   │   │       ├── comment.png
│   │   │   │       ├── custom.css
│   │   │   │       ├── doctools.js
│   │   │   │       ├── documentation_options.js
│   │   │   │       ├── down.png
│   │   │   │       ├── down-pressed.png
│   │   │   │       ├── file.png
│   │   │   │       ├── jquery-3.2.1.js
│   │   │   │       ├── jquery.js
│   │   │   │       ├── language_data.js
│   │   │   │       ├── minus.png
│   │   │   │       ├── papit.png
│   │   │   │       ├── plus.png
│   │   │   │       ├── pygments.css
│   │   │   │       ├── searchtools.js
│   │   │   │       ├── underscore-1.3.1.js
│   │   │   │       ├── underscore.js
│   │   │   │       ├── up.png
│   │   │   │       ├── up-pressed.png
│   │   │   │       └── websupport.js
│   │   │   ├── favicon.ico
│   │   │   ├── google7775f38904c3d3fc.html
│   │   │   ├── index.html
│   │   │   ├── jquery.min.js
│   │   │   ├── robot.txt
│   │   │   ├── sitemap.xml
│   │   │   ├── swagger.json
│   │   │   ├── swagger-ui-bundle.js
│   │   │   ├── swagger-ui-bundle.js.map
│   │   │   ├── swagger-ui.css
│   │   │   ├── swagger-ui.css.map
│   │   │   ├── swagger-ui.js
│   │   │   ├── swagger-ui.js.map
│   │   │   ├── swagger-ui-standalone-preset.js
│   │   │   └── swagger-ui-standalone-preset.js.map
│   │   ├── test_app.py
│   │   ├── test_extract_bundle.py
│   │   ├── test_treat_bundle.py
│   │   ├── treat_bundle.py
│   │   └── utils
│   │       ├── error_json_response.py
│   │       ├── conversion.py
│   │       ├── __init__.py
│   │       ├── json_response.py
│   │       ├── not_found_response.py
│   │       └── ok_json_response.py
│   ├── __init__.py
│   ├── MANIFEST.in
│   ├── setup.cfg
│   └── setup.py
├── README.rst
├── sh
│   ├── check-data.sh
│   ├── clear-data.sh
│   ├── csv-table.sh
│   ├── database-creation.sh
│   ├── install-dependencies.sh
│   └── install-wheel.sh
├── sonar-project.properties
└── sql
    ├── create-database-enthic.sql
    ├── create-index-bundle.sql
    ├── create-index-identity.sql
    ├── create-table-bundle.sql
    ├── create-table-identity.sql
    ├── create-table-request.sql
    ├── insert-bundle.sql
    └── insert-identity.sql

Donation

You can donate to support Python and Open Source development.

BTC 32JSkGXcBK2dirP6U4vCx9YHHjV5iSYb1G

ETH 0xF556505d13aC9a820116d43c29dc61417d3aB2F8

About

French societies accountability extraction and treatment by PapIT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published