Skip to main content

A library for searching Tunisian court cases from the public judicial repository e-justice.tn.

Project description

Court Case Search

A Python library for searching Tunisian court cases.

Installation

You can install the library using pip:

pip install tun_justice

Usage

Here's a basic example of how to use the library:

from tun_justice import CourtCaseSearcher, Tribunal

searcher = CourtCaseSearcher()
results = searcher.search(tribunal=Tribunal("محكمة ناحية باردو"), annee="2023", numero="10737")

if results:
    for case in results:
        print(f"Case Number: {case.numero_dossier}")
        print(f"Subject: {case.sujet}")
        print(f"Type of Case: {case.type_de_case}")
        print(f"Type of Affair: {case.type_affaire}")
        print("Details:")
        for detail in case.details:
            print(f"  - Date: {detail.date}")
            print(f"    Action: {detail.action}")
            print(f"    Phase: {detail.phase}")
            print(f"    Text: {detail.text}")
        print("---")
else:
    print("No results found or an error occurred.")

API Reference

CourtCaseSearcher

The main class for searching court cases.

Methods:

  • __init__(self, log_level: int = logging.INFO): Initialize the searcher with an optional log level.
  • search(self, tribunal: str, annee: str, numero: str) -> Optional[List[CourtCase]]: Search for court cases based on the provided parameters.

CourtCase

A dataclass representing a court case.

Attributes:

  • tribunal: str: The tribunal code.
  • type_de_case: str: The type of the case.
  • numero_dossier: str: The case number.
  • annee: str: The year of the case.
  • sujet: str: The subject of the case.
  • type_affaire: str: The type of affair.
  • details: List[CaseDetail]: A list of detailed actions related to the case.

CaseDetail

A dataclass representing detailed information about a specific action in a court case.

Attributes:

  • phase: str: The phase of the action.
  • action_number: str: The number of the action.
  • action: str: The description of the action.
  • date: str: The date of the action.
  • text: str: Additional text related to the action.

Error Handling

The search method returns None if an error occurs during the search process. It's recommended to check if the result is not None before processing it.

Logging

The library uses Python's built-in logging module. You can set the log level when initializing the CourtCaseSearcher:

import logging
from tun_justice import CourtCaseSearcher

searcher = CourtCaseSearcher(log_level=logging.DEBUG)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tun_justice-0.1.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file tun_justice-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tun_justice-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for tun_justice-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 850ae071a37125ce61aab0046929b73ac4e4542d4ad63e9cef1e3b5d30446875
MD5 373f2cf395ce79ade757bb278d65b550
BLAKE2b-256 e180e0477339dc710d7d42f6b9e9655f07a181408ae585255f312c1175d0ca05

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page