Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 2.51 KB

USAGE.md

File metadata and controls

47 lines (34 loc) · 2.51 KB

Using the Knesset-data-django from Open Knesset

This document assumes you have a properly installed Open Knesset environment and you would like to use knesset-data-django features from it.

how to fetch updated data from the Knesset

Best way is to download a prepared datapackage, knesset-data-datapackage project does that and uploads to S3, for example - https://s3.amazonaws.com/knesset-data/datapackage_last_120_days_2017-03-10.zip

Alternatively, you can make a datapackage locally, but bear in mind that Knesset blocks some IPs sometimes, so it might not always work.

  • to create a datapackage you need to pip install knesset-data-datapackage
  • you can then use the make_knesset_datapackage command, try make_knesset_datapackage --help

See Available commands section below for more details.

Available management commands

  • ./manage.py download_knesset_datapackage
    • Supports downloading or extracing a previously prepared datapackage file
    • The knesset-data-datapackage project creates a package every day, you can download those packages
    • to download a prepared datapackage from a url, use the following command:
      • ./manage.py download_knesset_datapackage --url=https://s3.amazonaws.com/knesset-data/datapackage_last_120_days_2017-03-10.zip
    • you can add the --scrape parameter to also start the relevant scrapers to update from the downloaded datapackage
    • run with --help to see the available options

Common Tasks / Known Issues

Reparsing committee meeting protocols

It's very common to have some details changed requiring to reparse the protocols. For example, when an MK has a mis-spelled name.

# (knesset-data) $ ./manage.py shell_plus
from knesset_data_django.committees.meetings import reparse_protocol
from knesset_data_django.mks.utils import get_all_mk_names
from datetime import datetime
qs=CommitteeMeeting.objects.filter(date__gt=datetime(2016, 1, 1), date__lt=datetime(2016, 11, 1))
mks, mk_names = get_all_mk_names()
for meeting in qs:
    print(meeting.id)
    reparse_protocol(meeting, redownload=False, mks=mks, mk_names=mk_names)

See also