开放式法律数据平台
oldp的Python项目详细描述
oldp:开放的法律数据平台
oldp是一个web应用程序,用python 3.5编写,基于Django web framework, 它用于处理法律文本,并提供基于rest-api和elasticsearch的搜索引擎。 oldp是由非营利组织Open Legal Data开发的,目标是 为法律文件(主要是法院判决和法律)建立一个开放的数据平台。 该平台使公众特别是第三方应用程序可以自由访问法律信息。
我们的文档是可用的here。
演示
有一个现场演示here(德语)。
功能
- 案例:以html格式提供元数据和内容的法院判决。
- 法律:全文法律法规及其对应的判例法。
- 法院:浏览按国家、管辖权和您所在国家上诉级别组织的法院。
- search:基于elasticsearch/haystack的文档搜索引擎,支持最常见的搜索语法和faceting。
- api:通过基于DRF的crud rest api添加、更新、检索和删除数据,包括 从swagger自动生成api客户端。
- themes:根据您所在国家的需要轻松调整外观(请参见German theme)。
安装指南
在使用oldp之前,需要先安装它。 有关如何开始使用oldp的更详细指南,请查看: Getting started
Docker
要跳过整个安装过程,只需将oldp作为docker容器运行即可。
只需git clone
存储库,然后从存储库目录中的docker-compose up
开始所有操作。
关于如何将oldp与docker结合使用的小教程可以在here中找到。
依赖性
在进行其他操作之前,您需要安装应用程序依赖项。
- python 3.5带有pip(建议使用virtualenv或conda)
- node js 8.12.x使用npm构建js依赖项
- 数据库(mysql,sqlite,…):所有支持 Django's DB API应该可以。建议使用mysql。
- elasticsearch 5.4.x:我们的搜索引擎后端。由haystack支持的其他系统 也应该有效。
- redis 4.x:缓存引擎(可选)
- gcc编译一些python libs所需的
- python mysqldb,libmysqlclient dev如果选择mysql作为数据库
- gettext用于带有msguniq的django地区
- pandoc将docbook转换为html(导入gg)
- gdal:Haystack搜索模块使用的地理空间库(请参见 here)。
# Create virtualenv
virtualenv -p python3 env
source env/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)
pip install -r requirements.txt
npm install
第一次运行oldp时,需要使用默认空值初始化数据库。如果你愿意 要在生产模式下运行oldp,还需要准备静态文件和本地化。
# Prepare assets (JS, CSS, images, fonts, ...)
npm run-script build
# 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
运行
运行以下命令在http://localhost:8000/启动web应用程序。
./manage.py runserver 8000
设置
管理我们依赖的应用程序设置django-configurations。
通过将DJANGO_CONFIGURATION
环境变量设置为Prod
、Dev
或Test
,可以使用预先配置的设置。
您还可以使用环境变量覆盖oldp/settings.py
中的特定设置:
Variable name | Default value | Comment |
---|---|---|
^{ | ^{ | Tell Django which settings file you want to use (in Python path syntax). |
^{ | ^{ | Choice a predefined class of settings: ^{ |
^{ | ^{ | Path to database (usually mysql or sqlite) |
^{ | ^{ | Set this to a secret value in production mode |
^{ | ^{ | Elasticsearch settings (scheme, host, port) |
^{ | ^{ | Elasticsearch index name |
^{ | ^{ | Enable to show debugging messages and errors |
^{ | ^{ | Format: ^{ |
^{ | ^{ | Format: ^{ |
^{ | Format: ^{ | |
^{ | ^{ | Emails are sent from this address |
^{ | ^{ | SMTP server |
^{ | SMTP user | |
^{ | SMTP password | |
^{ | ^{ | enable TLS |
^{ | ^{ | SMTP port |
^{ | ^{ | Messages from feedback widget are sent to this address. |
^{ | ^{ | Time zone |
^{ | ^{ | Run tests that require Elasticsearch |
^{ | ^{ | Run tests that require web access |
^{ | ^{ | Name of log file (in logs directory) |
^{ | ^{ | Set to ^{ |
问题
请使用我们的GitHub issues报告错误、请求功能或 留下一些反馈。
联系人
要联系开放法律数据平台,请参见此处:
https://de.openlegaldata.io/contact/
许可证
oldp是根据mit许可证授权的。