Skip to content
CKAN extension for the LA Counts project
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Bootstrap extension Jul 20, 2018
.travis.yml Bootstrap extension Jul 20, 2018
LICENSE Bootstrap extension Jul 20, 2018
dev-requirements.txt Bootstrap extension Jul 20, 2018
requirements.txt Add textblob requirement Jan 22, 2019


CKAN extension for the LA Counts project


This extension is being developed against CKAN 2.8.x


To install ckanext-lacounts for development, activate your CKAN virtualenv and do::

git clone
cd ckanext-lacounts
python develop
pip install -r requirements.txt

API (Get Involved page actions)

Actions for the Get Involved page are available in the CKAN Action API.

Event actions:

Available parameters:

  • id: a uuid (required for some actions, see below)
  • name: a string (required)
  • date: a date string e.g. "2019-01-21" (required)
  • free: a boolean-like, e.g. "yes" or true (required)
  • url: a string url
  • location: a string
  • topic_tags: a list of strings, e.g. ["Housing", "Employment"]

A full example for event_create:

$ curl -X POST -H "Authorization:{YOUR-API-KEY}" -d '{"name": "My New Event", "free": "yes", "date": "2019-01-21", "url": "", "location": "Downton, Los Angeles", "topic_tags": ["Housing", "Employment"]}'

All Event actions:

# create a new event (sysadmins only)
curl -X POST -H "Authorization:{YOUR-API-KEY}" -d '{"name": "My New Event", "free": "yes", "date": "2019-01-21"}'

# update an existing event (sysadmins only)
curl -X POST -H "Authorization:{YOUR-API-KEY}" -d '{"id": "my-event-id", "name": "My Updated Event", "free": "no", "date": "2020-01-21"}'

# delete an event (sysadmins only)
curl -X POST -H "Authorization:{YOUR-API-KEY}" -d '{"id": "my-event-id"}'

# show an event
curl -d '{"id": "my-event-id"}'

# list events ``limit`` and ``offset`` are optional.
curl -H "Authorization:{YOUR-API-KEY}" -d '{"limit":<int>, "offset":<int>}'

Running the Tests

To run the tests, do::

nosetests --nologcapture --with-pylons=test.ini

To run the tests and produce a coverage report, first make sure you have coverage installed in your virtualenv (pip install coverage) then run::

nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.lacounts --cover-inclusive --cover-erase --cover-tests

Theme development

Get dependencies with npm install.

CSS and JS are built from the src directory into the fanstatic directory.

CSS is built with PostCSS. Do so with grunt postcss.

JS is built (minified) with grunt uglify.

You can watch both for changes with grunt.

Create initial data

There are scripts defined in the scripts folder that create initial objects:

  • topics (groups)
  • harvest sources + publishers (organizations)

To run them you'll need a sysadmin API key and the URL of the site to update (dev, staging or production). For instance:

python http://localhost:5000 API-KEY

python API-KEY

Note: Some of them require extra libraries (eg slugify)

Initialize 'Get Involved' database tables

The 'Get Involved' pages require additional database tables to be initialized: events and volunteering. These are created with the following paster command:

In development

docker-compose -f run --rm ckan-dev bash -c "cd src_extensions/ckanext-lacounts && python develop && paster get_involved init-db -c ../../production.ini"

In production & staging

deis run "paster --plugin=ckanext-lacounts get_involved init-db -c production.ini"


Apart from the tables defined in the application, the following view is used to generate reports and can be created manually:

CREATE VIEW topic_terms_sources
    AS SELECT AS term, s.url AS source_url, s.title as source_title, COUNT(*)
    FROM tag t
        JOIN package_tag pt ON = pt.tag_id
        JOIN package_extra pe ON pt.package_id = pe.package_id
        JOIN harvest_object ho ON pe.package_id = ho.package_id
        JOIN harvest_source s ON = ho.harvest_source_id
    WHERE pe.key = 'harvest_source_id'
    GROUP BY s.url, s.title,
You can’t perform that action at this time.