Metadata-Version: 2.4
Name: oldp
Version: 0.9.3
Summary: Open Legal Data Platform
Author-email: Malte Ostendorff <hello@openlegaldata.io>
License-Expression: MIT
Project-URL: homepage, https://openlegaldata.io
Project-URL: Source Code, https://github.com/openlegaldata/oldp
Keywords: open data,law,legal tech,case law
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Pillow>=7.1.0
Requires-Dist: python-dateutil>=2.6.1
Requires-Dist: python-slugify>=1.2.1
Requires-Dist: requests>=2.20.1
Requires-Dist: requests-toolbelt>=0.7.1
Requires-Dist: whitenoise>=4.1.3
Requires-Dist: beautifulsoup4>=4.7.1
Requires-Dist: msgpack<0.6,>=0.3.0
Requires-Dist: django==5.1.15
Requires-Dist: dj-database-url
Requires-Dist: django-appconf
Requires-Dist: django-configurations
Requires-Dist: django-environ
Requires-Dist: django-mathfilters
Requires-Dist: django-compressor
Requires-Dist: django-tellme
Requires-Dist: django-widget-tweaks
Requires-Dist: django-autocomplete-light
Requires-Dist: django-haystack
Requires-Dist: django-crispy-forms
Requires-Dist: crispy-bootstrap4>=2024.10
Requires-Dist: django-allauth>=65.1.0
Requires-Dist: django-debug-toolbar
Requires-Dist: djangorestframework
Requires-Dist: django-filter
Requires-Dist: djangorestframework-xml
Requires-Dist: drf-yasg
Requires-Dist: drf-yasg[validation]
Requires-Dist: flex
Requires-Dist: swagger-spec-validator
Requires-Dist: legal-reference-extraction>=0.4.2
Provides-Extra: dev
Requires-Dist: ruff>=0.11.6; extra == "dev"
Requires-Dist: selenium==3.141.0; extra == "dev"
Requires-Dist: coverage>=4.5.1; extra == "dev"
Requires-Dist: coveralls>=1.5.0; extra == "dev"
Provides-Extra: theme-de
Requires-Dist: oldp-de>=0.1.1; extra == "theme-de"
Provides-Extra: prod
Requires-Dist: gunicorn>=19.9.0; extra == "prod"
Provides-Extra: processing
Requires-Dist: pypandoc>=1.15; extra == "processing"
Requires-Dist: cssselect>=1.3.0; extra == "processing"
Requires-Dist: lxml>=5.3.2; extra == "processing"
Provides-Extra: mysql
Requires-Dist: mysqlclient>=2.2.5; extra == "mysql"
Provides-Extra: redis
Requires-Dist: django-redis; extra == "redis"
Provides-Extra: search
Requires-Dist: elasticsearch==7.17.12; extra == "search"
Requires-Dist: elasticsearch-dsl==7.4.1; extra == "search"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
Requires-Dist: myst-parser>=2.0; extra == "docs"
Provides-Extra: all
Requires-Dist: oldp[dev,docs,mysql,processing,prod,search,theme-de]; extra == "all"
Dynamic: license-file

# OLDP: Open Legal Data Platform

> [!NOTE]  
> We're back! This project is getting a fresh update - join us on [Discord](https://discord.gg/WCy3aq25ZF) to help revive it.

[![Documentation Status](https://readthedocs.org/projects/oldp/badge/?version=latest)](https://oldp.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/oldp.svg)](https://badge.fury.io/py/oldp)

OLDP is a Web application, written in Python 3.12 and based on the [Django web framework](https://www.djangoproject.com/),
It is used for processing legal text and providing a REST-API and Elasticsearch-based search engine.
OLDP is being develop by the non-profit initiative [Open Legal Data](https://openlegaldata.io/) with the goal
of building an Open Data platform for legal documents (mainly court decisions and laws).
The platform makes legal information freely accessible for the general public and especially third-party apps.

Our documentation is available [here](https://oldp.readthedocs.io/).

## Demo

[![Live demo](https://github.com/openlegaldata/oldp/raw/master/docs/_static/screenshot.sm.png)](https://github.com/openlegaldata/oldp/raw/master/docs/_static/screenshot.png)

A live demo is available [here](https://de.openlegaldata.io/) (in German).

## Features

- **Cases**: Court decisions with meta data and content in HTML.
- **Laws**: Full-text laws and regulations and their corresponding case-law.
- **Courts**: Browse courts organized by states, jurisdiction and level of appeal from your country.
- **Search**: A document search engine based on Elasticsearch/Haystack supporting most common search syntax and faceting.
- **API**: Adding, updating, retrieving and deleting data through CRUD REST API based on [DRF](https://www.django-rest-framework.org/) including
    auto-generated API clients from Swagger.
- **Themes**: Easily adjust the look and feel depending on your countries needs (see [German theme](https://github.com/openlegaldata/oldp-de)).

## Installation guide

Before you can use OLDP, you’ll need to get it installed.
For a more detailed guide on how to get started with OLDP have a look at:
[Getting started](https://oldp.readthedocs.io/en/latest/getting-started.html)

### Docker

To skip the whole installation procedure you can simply run OLDP as Docker (or Podman) container.
Just `git clone` the repository first and then start everything with a `docker compose up` from within the repository directory. After running `docker compose up`, navigate to [http://localhost:8000] to view the site.
A small tutorial on how to use OLDP with Docker can be found [here](https://oldp.readthedocs.io/en/latest/docker.html).

### Dependencies

Before anything else you will need to install the application dependencies.

- **Python 3.12** with pip (uv recommended)
- **Database (MySQL, SQLite, ...):** All database engines that support
  [Django's DB API](https://docs.djangoproject.com/en/2.1/ref/databases/) should work. MySQL is recommended.
- **Elasticsearch 5.4.x**: Our search engine backend. Other systems supported by [haystack](http://haystacksearch.org/)
  should also work.
- **gcc** Required to compile some Python libs
- **python-mysqldb, libmysqlclient-dev** if you choose MySQL as database
- **gettext** for Django locales with msguniq
- **pandoc** convert docbook to HTML (import GG)
- **GDAL**: Geospatial libraries used by the haystack search module (see
  [here](https://docs.djangoproject.com/en/2.1/ref/contrib/gis/install/geolibs/)).

```bash
# Create virtualenv with uv
uv venv --python 3.12
source .venv/bin/activate

# Clone repository to current directory
git clone https://github.com/openlegaldata/oldp.git .

# Install dependencies
apt-get install -y $(cat apt_requirements.txt)
uv pip install -e ".[dev]"
```

The first time you run OLDP, you will need to initialize the database with its default blank values. If you want
to run OLDP in production mode, you also need to prepare static files and localization.

```bash
# Prepare assets (JS, CSS, images, fonts, ...)
./manage.py compress

# Prepare database
./manage.py migrate

# Localization (German and English, needed for production)
./manage.py compilemessages --l de --l en

# Prepare static files (needed for production)
./manage.py collectstatic --no-input
```

## Run

Run the following command to start the web app at [http://localhost:8000/](http://localhost:8000/).

```bash
./manage.py runserver 8000
```

### Settings

The manage the app settings we rely on [django-configurations](https://django-configurations.readthedocs.io/en/stable/).
Pre-configured settings can be used by setting the `DJANGO_CONFIGURATION` environment variable to either `ProdConfiguration`, `DevConfiguration` or `TestConfiguration`.
You can as well override specific settings from `src/oldp/settings.py` with environment variables:

| Variable name | Default value | Comment |
| ------------- | ------------- | ------- |
| `DJANGO_SETTINGS_MODULE` | `oldp.settings` | Tell  Django which settings file you want to use (in Python path syntax). |
| `DJANGO_CONFIGURATION` | `DevConfiguration` | Choice a predefined class of settings: `DevConfiguration`, `ProdConfiguration` or `TestConfiguration` |
| `DATABASE_URL` | `mysql://oldp:oldp@127.0.0.1/oldp` | Path to database (usually mysql or sqlite) |
| `DJANGO_SECRET_KEY` | `None` | Set this to a secret value in production mode |
| `DJANGO_ELASTICSEARCH_URL` | `http://localhost:9200/` | Elasticsearch settings (scheme, host, port) |
| `DJANGO_ELASTICSEARCH_INDEX` | `oldp` | Elasticsearch index name |
| `DJANGO_DEBUG` | `True` | Enable to show debugging messages and errors |
| `DJANGO_ADMINS` | `Admin,admin@openlegaldata.io` | Format: `Foo,foo@site.com;Bar,bar@site.com` |
| `DJANGO_ALLOWED_HOSTS` | `None` | Format: `foo.com,bar.net` |
| `DJANGO_LANGUAGES_DOMAINS` | | Format: `{'de.foo.com':'de','fr.foo.com':'fr'}` |
| `DJANGO_DEFAULT_FROM_EMAIL` | `no-reply@openlegaldata.io` | Emails are sent from this address |
| `DJANGO_EMAIL_HOST` | `localhost` | SMTP server |
| `DJANGO_EMAIL_HOST_USER` | | SMTP user |
| `DJANGO_EMAIL_HOST_PASSWORD` | | SMTP password |
| `DJANGO_EMAIL_USE_TLS` | `False` | enable TLS |
| `DJANGO_EMAIL_PORT` | `25` | SMTP port |
| `DJANGO_FEEDBACK_EMAIL` | `feedback@openlegaldata.io` | Messages from feedback widget are sent to this address. |
| `DJANGO_TIME_ZONE` | `UTC` | Time zone |
| `DJANGO_TEST_WITH_ES` | `False` | Run tests that require Elasticsearch |
| `DJANGO_TEST_WITH_WEB` | `False` | Run tests that require web access |
| `DJANGO_LOG_FILE` | `oldp.log` | Name of log file (in logs directory) |
| `DJANGO_CACHE_DISABLE` | `False` | Set to `True` to disable cache (Redis) |



## Issues

Please use our [GitHub issues](https://github.com/openlegaldata/oldp/issues) to report bugs, request feature or simply
leave some feedback.

## Contact

To contact Open Legal Data Platform, see here:

https://de.openlegaldata.io/contact/

## Citation

Please cite the following [research paper](https://arxiv.org/abs/2005.13342), if you use our code or data:

```bibtex
@inproceedings{10.1145/3383583.3398616,
author = {Ostendorff, Malte and Blume, Till and Ostendorff, Saskia},
title = {Towards an Open Platform for Legal Information},
year = {2020},
isbn = {9781450375856},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3383583.3398616},
doi = {10.1145/3383583.3398616},
booktitle = {Proceedings of the ACM/IEEE Joint Conference on Digital Libraries in 2020},
pages = {385–388},
numpages = {4},
keywords = {open data, open source, legal information system, legal data},
location = {Virtual Event, China},
series = {JCDL '20}
}
```

## License

OLDP is licensed under the MIT License.
