https://github.com/datamade/django-councilmatic

:heartpulse: Django app providing core functions for *.councilmatic.org

https://github.com/datamade/django-councilmatic

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.9%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

:heartpulse: Django app providing core functions for *.councilmatic.org

Basic Info
  • Host: GitHub
  • Owner: datamade
  • License: mit
  • Language: Java
  • Default Branch: 3.x
  • Homepage: http://councilmatic.org
  • Size: 24.4 MB
Statistics
  • Stars: 26
  • Watchers: 5
  • Forks: 16
  • Open Issues: 41
  • Releases: 6
Created over 10 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.rst

django-councilmatic
===================

The django-councilmatic app provides the core functionality for the `Councilmatic family `_, a set of web apps for keeping tabs on local city council. It is built upon the Open Civic Data standard and ultimately makes Councilmatic easier to re-deploy in new cities.


Requirements
------------
- Python >= 3.8

Features
--------

- Models for bills, people, organizations, events, and more
- Base views for Bill, Person, Organization, and Event listing and detail pages
- Search infrastructure powered by :code:`django-haystack` and Solr

The `Councilmatic family `_ includes:

- Philly Councilmatic (the original and first Councilmatic, by Mjumbe Poe, an important predecessor to DataMade's django-councilmatic)
- `Chicago Councilmatic `_
- `Los Angeles Metro Board `_


Councilmatic in your city
-------------------------
If you're interested in bringing Councilmatic to your city, `contact us `_! We'd love to help.

Want to build your own Councilmatic? Check out our `Starter Template `_. It contains everything you need to create your own Councilmatic from scratch.


Extending Open Civic Data/Councilmatic models
---------------------------------------------

django-councilmatic leverages, and in some instaances, lightly extends the Open Civic Data Standard, implemented in Django as :code:`python-opencivicdata`. If you'd like to add additional attributes or Python properties to your models, there are two approaches to be aware of: subclassing and proxying.

Subclassing
===========

Leverage `multi-table inheritance `_ to add additional fields to OCD models. The primary use case in django-councilmatic is adding slugs to first-class models – Person, Event, Bill, and Organization - and adding metadata outside of the OCD standard, e.g., a headshot to Person and division boundaries to Post.

We recommend using :code:`pupa` to scrape legislative data. Since :code:`pupa` creates OCD objects, `django-councilmatic includes Django signals `_ to each of the subclassed models to create the related Councilmatic model on save. It also includes management commands to import metadata (see above).

If you subclass a model, be sure to include a signal to create instances of your subclass when the parent class is created, and, if applicable, some way to add any metadata, e.g., a management command or admin interface.

Proxying
========

django-councilmatic makes extensive use of proxy models to add custom managers and additional properties and methods to model classes. In order to take advantage of these elsewhere in the code, it is desirable for related objects to be returned as instances of other proxy classes or subclasses, rather than the upstream OCD model classes. In order to force related objects to be returned as Councilmatic models, django-councilmatic makes use of `django-proxy-overrides `_.

If you wish to customize the class of related objects, first proxy an OCD model, then override one or more of its related object attributes with an instance of `ProxyForeignKey`. See `councilmatic_core.models.BillAction `_ for an example.


Running tests
-------------

Did you make changes to django-councilmatic? Before you make a pull request, run some tests.

First, install the test requirements:

.. code-block:: bash

    pip install -r tests/requirements.txt

We test for functionality with `pytest`:

.. code-block:: bash

    pytest

If you made material changes to the Councilmatic models, refresh the test fixture from a local instance database. From your instance directory (assuming you've already installed :code:`django-councilmatic` with :code:`pip install -e /path/to/django-councilmatic`), install the test requirements:

.. code-block:: bash

    pip install -r /path/to/django-councilmatic/tests/test_requirements.txt

Add :code:`fixture_magic` to your instance's :code:`INSTALLED_APPS` in :code:`settings.py`.

Run the management command to update the test fixture.

.. code-block:: bash

    python manage.py make_fixtures

Run the tests and commit your updated fixture with your PR!


Patches and Contributions
-------------------------
We continue to improve django-councilmatic, and we welcome your ideas! You can make suggestions in the form of `github issues `_ (bug reports, feature requests, general questions), or you can submit a code contribution via a pull request.

How to contribute code:

- Fork the project.
- Make your feature addition or bug fix.
- Send us a pull request with a description of your work! Don't worry if it isn't perfect - think of a PR as a start of a conversation, rather than a finished product.


Copyright
---------

Copyright (c) 2023 Participatory Politics Foundation and DataMade.
Released under the `MIT
License `__.

Owner

  • Name: datamade
  • Login: datamade
  • Kind: organization
  • Email: info@datamade.us
  • Location: Chicago, IL

We build open source technology using open data to empower journalists, researchers, governments and advocacy organizations.

GitHub Events

Total
  • Issues event: 1
  • Issue comment event: 1
  • Push event: 1
  • Create event: 1
Last Year
  • Issues event: 1
  • Issue comment event: 1
  • Push event: 1
  • Create event: 1

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 72
  • Total pull requests: 29
  • Average time to close issues: 6 months
  • Average time to close pull requests: 3 months
  • Total issue authors: 11
  • Total pull request authors: 6
  • Average comments per issue: 1.31
  • Average comments per pull request: 3.14
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • cathydeng (30)
  • fgregg (11)
  • derekeder (8)
  • patcon (8)
  • hancush (4)
  • reginafcompton (3)
  • trivisonno (2)
  • ErnieAtLYD (2)
  • mccc (2)
  • evz (2)
  • wordyallen (1)
Pull Request Authors
  • patcon (19)
  • reginafcompton (4)
  • derekeder (2)
  • evz (2)
  • fgregg (1)
  • cathydeng (1)
  • hancush (1)
Top Labels
Issue Labels
bug (8) enhancement (4) question (4) seo (3) data (1) wontfix (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 803 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 6
  • Total versions: 124
  • Total maintainers: 2
pypi.org: django-councilmatic

Core functions for councilmatic.org family

  • Versions: 124
  • Dependent Packages: 0
  • Dependent Repositories: 6
  • Downloads: 803 Last month
Rankings
Dependent repos count: 6.0%
Dependent packages count: 10.0%
Average: 12.2%
Downloads: 20.5%
Maintainers (2)
Last synced: 10 months ago

Dependencies

setup.py pypi
  • Django >=2.2.13,<2.3
  • boto ==2.38.0
  • django-adv-cache-tag ==1.1.2
  • django-haystack >=2.8.0,<2.9
  • django-proxy-overrides >=0.2.1
  • opencivicdata >=3.1.0
  • psycopg2-binary >=2.7
  • pysolr >=3.8,<3.9
  • python-dateutil >=2.7,<2.8
  • pytz >=2015.4
  • requests >=2.20,<2.21
  • sqlalchemy *
  • tqdm *
tests/requirements.txt pypi
  • django-fixture-magic fix-merge test
  • flake8 * test
  • pytest ==3.7.0 test
  • pytest-django ==3.3.3 test
  • pytest-mock * test
.github/workflows/main.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • postgis/postgis 14-3.2 docker
.github/workflows/publish-to-pypi.yml actions
  • actions/checkout main composite
  • actions/setup-python v2 composite
package.json npm
  • @typescript-eslint/eslint-plugin ^4.8.1 development
  • @typescript-eslint/parser ^4.8.1 development
  • babel-eslint ^10.1.0 development
  • eslint ^8.29.0 development
  • eslint-config-prettier ^8.5.0 development
  • eslint-config-react-app ^6.0.0 development
  • eslint-plugin-flowtype ^5.2.0 development
  • eslint-plugin-import ^2.22.1 development
  • eslint-plugin-jsx-a11y ^6.4.1 development
  • eslint-plugin-react ^7.21.5 development
  • eslint-plugin-react-hooks ^4.2.0 development