Skip to content

Commit

Permalink
Fix for failing parsing of rechtspraak search results
Browse files Browse the repository at this point in the history
  • Loading branch information
dafnevk committed Aug 16, 2017
1 parent 8684c6c commit 4dd9ea1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion caselawnet/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.3.0'
__version__ = '0.3.1'
14 changes: 8 additions & 6 deletions caselawnet/search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from . import matcher
import httplib2

from . import utils

def get_post_data(keyword, contentsoorten=['uitspraak'], rechtsgebieden=[], instanties=[],
date_from=None, date_to=None,
Expand Down Expand Up @@ -88,23 +88,25 @@ def ecli_to_creator(ecli):

def result_to_node(result):
node = {}
# Remove possible null values
result = {k: result[k] for k in result if result[k] is not None}
node['id'] = result['DeeplinkUrl']
node['ecli'] = result['TitelEmphasis']
node['ecli'] = result.get('TitelEmphasis', utils.url_to_ecli(node['id']))
# TODO - search meta data doesn't contain creator:
node['creator'] = ecli_to_creator(node['ecli'])
node['title'] = result.get('Titel', node['id'])
node['title'] = result.get('Titel', node['ecli'])
node['abstract'] = result.get('Tekstfragment', '')
node['date'] = result['Publicatiedatum']
node['date'] = result.get('Publicatiedatum', '')
node['subject'] = ','.join(result.get('Rechtsgebieden', []))

matched_articles = matcher.get_articles(node['abstract'])
node['articles'] = [art + ' ' + book for (art, book), cnt in
matched_articles.items()]
node['year'] = int(node['date'].split('-')[-1])
node['year'] = int(node['ecli'].split(':')[3])
node['count_version'] = len(result.get('Vindplaatsen', []))
node['count_annotation'] = len([c for c in result.get('Vindplaatsen', []) if
c['VindplaatsAnnotator'] != ''])
# New:
node['procedure'] = result['Proceduresoorten']
node['procedure'] = result.get('Proceduresoorten', '')
return node

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def read(fname):

setup(
name = "caselawnet",
version = "0.3.0",
version = "0.3.1",
description = ("Flask application for querying networks of Dutch case law"),
license = "Apache 2.0",
keywords = "Python",
Expand Down

0 comments on commit 4dd9ea1

Please sign in to comment.