Skip to content

hhueber/BVGer-Auto

Repository files navigation

BVGer Auto

Scrapping of the Swiss Federal Administrative Court jurisprudence database.

Setup

  1. Clone the repo, cd into it.
    • git clone git@github.com:hhueber/BVGer-Auto.git; cd BVGer-Auto
  2. Create virtual environment.
    • python -m venv env; source env/bin/activate
  3. Install requirements.
    • pip install -Ur requirements.txt
  4. Install pre-commit.
    • pre-commit install
  5. Configure the instance.
    • cp secret.dist.py secret.py

Usage

Pipeline : bvger_auto -> merge -> pattern_counter -> data_processing -> data_filtering

Récupérer un ou des arrêts : bvger_auto.py

Ce script va parcourir le site https://bvger.weblaw.ch pour récupérer soit une liste d'arrêts, soit un arrêt précis.

$ python bvger_auto.py --help

usage: BVGer Auto [-h] [-l QUERY_LANG] [-v] [-f] [-d] [-o DOWNLOAD_FOLDER] {page,collect} ...

Crawler for BVGer

positional arguments:
  {page,collect}        `page` for a specific page, `collect` for multiple pages
    page                Search and return a specific page
    collect             Search and return multiple pages

options:
  -h, --help            show this help message and exit
  -l QUERY_LANG, --query-lang QUERY_LANG
                        Lang for the research interface
  -v, --verbose         Debug
  -f, --full-text       Save the full text in the resulting dictionary. If `download` is True, the text is saved as a file instead
  -d, --download        Download the PDF. If `full_text` is True, the text is saved as a file as well
  -o DOWNLOAD_FOLDER, --download-folder DOWNLOAD_FOLDER
                        Where the result will be saved

Remember, be excellent to each others

Notes :

  • L'option -l (query-lang) va déterminer le nom des en-têtes du tableau de résultats.
  • L'option -v (verbose) permet de "suivre" le scraper dans son "chemin".
  • L'option -f (full-text) va intégrer la totalité du texte de l'arrêt dans le tableau des résultats si elle n'est pas utilisée avec l'option -d (download), ce qui va alourdir le fichier de résultats.

Récupérer un arrêt : page

$ python bvger_auto.py page --help

usage: BVGer Auto page [-h] title

positional arguments:
  title       Specific page title ("D-1234/2020")

options:
  -h, --help  show this help message and exit

Par exemple, pour récupérer les informations sur l'arrêt "D-1234/2020", et sauvegarder le texte correspondant au format PDF :

python bvger_auto.py -d page D-1234/2020

Récupérer plusieurs arrêts : collect

$ python bvger_auto.py collect --help

usage: BVGer Auto collect [-h] courts years numbers

positional arguments:
  courts      Courts to be used for collection, either a single letter (A), or multiple letters ("A;F")
  years       Years to be used for collection, either a single year (2007), or multiple years ("2007;2025"), or a range ("2007-2025")
  numbers     Numbers to be used for collection, either a single number (1), or multiple numbers ("1;9999"), or a range ("1-9999")

options:
  -h, --help  show this help message and exit

Par exemple, pour récupérer les 20 premiers arrêts numérotés (s'ils existent) de la Cour V (droit d'asile), de l'année 2025 :

python bvger_auto.py -d collect E 2025 1-20

Cette commande spécifique va télécharger les trois arrêts numérotés entre 1 et 20 qui existent en 2025 pour cette cour spécifique, à savoir E-11/2025, E-15/2025 et E-18/2025.

merge.py

TODO

Pattern Counter (pattern_counter.py)

usage: pattern_counter.py [-h] --path_to_patterns_folder PATH_TO_PATTERNS_FOLDER --path_to_text_files PATH_TO_TEXT_FILES --path_to_stats_file PATH_TO_STATS_FILE --path_to_result_file PATH_TO_RESULT_FILE [--langs LANG [LANG ...]] [--extra FILE]

Find patterns within one or multiple files.

options:
  -h, --help            show this help message and exit
  --path_to_patterns_folder, -p PATH_TO_PATTERNS_FOLDER
                        path to folder with patterns files
  --path_to_text_files, -t PATH_TO_TEXT_FILES
                        path to the folder with the text files to be looped upon
  --path_to_stats_file, -i PATH_TO_STATS_FILE
                        input stats file path
  --path_to_result_file, -o PATH_TO_RESULT_FILE
                        output result file path
  --langs, -l LANG [LANG ...]
                        lang or list of langs (names of the files in the folder)
  --extra, -e FILE      name of the file in the folder with patterns to include with each language

About

Scrapping of the Swiss Federal Administrative Court jurisprudence database.

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages