A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Climate Action Plans

A simple, open database of local government climate action plan documents and emissions data.
https://github.com/mysociety/caps

Category: Sustainable Development
Sub Category: Data Catalogs and Interfaces

Keywords

citizen-participation climate climate-change docker local-government mapit vagrant

Keywords from Contributors

community democracy mysociety civic-tech transparency politics parliamentary-monitoring politicians civictech perl

Last synced: about 12 hours ago
JSON representation

Repository metadata

A simple, open database of local government climate action plan documents and emissions data.

README.md

caps - Climate Action Plans

Development Install

Clone the repository

git clone [email protected]:mysociety/caps.git
cd caps
script/bootstrap

You then have two options for a local development environment, Vagrant and Docker. These instructions don't cover installing and setting up these tools.

This application makes calls to MapIt. If you plan on making more than 50 calls a day, you'll need an API key.

Loading Data

The first time you stand-up a local development environment, you'll need to pull down the Council, plans and emissions data and import this into the database and search index. The instructions below provide details on how to do this for each environment.

This process can take some time, and a slightly faster update process is also available.

Docker

This project contains a Docker Compose file that uses the Django development server, enables debug mode and maps the local working copy into the container for testing.

If you are using a MapIt API key, add this to your .env file, e.g.: echo 'MAPIT_API_KEY=xxxaaa111222333zzz' >> .env.

Using the setup script

Warning running script/setup will remove all locally cached data and reset the environment to the default state!

Having rest the environment, script/setup will perform all the necessary setup steps, including loading all data. Once this has completed, you should have a functional environment.

This may take a long time to run!

Manual setup

Run docker-compose up. This will build an application container and stand-up this, together with PostgreSQL and Solr containers. These will run in the foreground, so you will see console output in the shell from the containers. You can stop the containers by hitting control-C. If you'd rather run in the background, add the -d switch; if you do this you can stop the environment with docker-compose down.

You can then run docker-compose exec app script/update --all to perform the initial data load. This will take a long time. Run the same command without the --all switch to run the short-cut data load.

You can rebuild the application container by running script/build. Bear in mind that when running the container in development mode, your local working copy will be included along with any local uncommitted changes.

The environment will be visible at http://localhost:8000 and the Solr admin interface at http://localhost:8983

Codespaces/VSCode

In your Github Codespaces settings, set up the relevant secrets (mostly MAPIT_API_KEY) and give the caps repo access to this secret.

Then in the caps repo, click the code dropdown (top right), and select the codespaces tab, then create new codespace.

Once it has cloned and set up the docker configuration (it may prompt you to reload with the pylance extension, this is fine and takea a few seconds), you should have a set-up populated a recent version of the current data process.

If you have used one of the devcontainer options that doesn't use this repopulation:

  • To run the data population from scratch run script/setup-in-docker (as warned above, this takes a while).
  • To restore a previous database dump, run script/restore-dev-data.

Once this is finished script/server will run the test server. You can access this by right clicking the 0.0.0.0:8000 link in the terminal, or follow the links in the ports page (where it can also be made public/shared to organisation).

Vagrant

Copy across some basic config. You may need to add a MapIt API key.

cp conf/config.py-example conf/config.py

A functional Vagrantfile is included for local development so you can create a Vagrant VM with:

vagrant up

Then SSH into the VM, and run subsequent commands from inside.

vagrant ssh

Importing data

Before running the development server for the first time, you'll need to import the data and set up the search index:

script/update --all

This process will take some time. Once you have done a full import, you can subsequently run script/update to take a few shortcuts in future.

Starting the development server

Then you can start the development server:

script/server

The site will be visible at http://localhost:8000.

The Solr server interface will be visible at http://localhost:8983

Updating the solr schema

If you want to update the solr schema then you'll need to edit the
conf/schema.xml file and then run the script/update_solr_schema on the
solr instance:

docker compose exec solr update_solr_schema

This will copy the new schema in to place and reload the core. You will
then need to re-index for the changes to be useful. This will only work
if you are adding to the schema, if you're altering an existing property
then you should probably use the solr API to do so.

Code style

black is run for code tidying: python -m black .

This is monitored by a github action for pull requests.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 1,415
Total Committers: 8
Avg Commits per committer: 176.875
Development Distribution Score (DDS): 0.654

Commits in past year: 119
Committers in past year: 4
Avg Commits per committer in past year: 29.75
Development Distribution Score (DDS) in past year: 0.639

Name Email Commits
Struan Donald s****n@e****k 489
Lucas h****o@l****v 329
Zarino Zappia m****l@z****k 269
Alex Parsons a****s@m****g 124
Louise Crow l****w@g****m 109
Sam Pearson s****m@s****k 49
dependabot[bot] 4****] 45
M Somerville m****b@d****k 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 337
Total pull requests: 415
Average time to close issues: 3 months
Average time to close pull requests: 14 days
Total issue authors: 17
Total pull request authors: 8
Average comments per issue: 1.39
Average comments per pull request: 1.11
Merged pull request: 345
Bot issues: 0
Bot pull requests: 62

Past year issues: 49
Past year pull requests: 41
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 21 days
Past year issue authors: 5
Past year pull request authors: 4
Past year average comments per issue: 0.55
Past year average comments per pull request: 1.12
Past year merged pull request: 28
Past year bot issues: 0
Past year bot pull requests: 15

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/mysociety/caps

Top Issue Authors

  • zarino (136)
  • struan (72)
  • crowbot (46)
  • ajparsons (38)
  • lucascumsille (21)
  • JenMysoc (6)
  • MyfanwyNixon (4)
  • sequencefree (4)
  • pmackay (2)
  • RichardTaylor (1)
  • sagepe (1)
  • davea (1)
  • alexander-griffen (1)
  • mrchrisadams (1)
  • emilyk383 (1)

Top Pull Request Authors

  • struan (127)
  • lucascumsille (75)
  • zarino (71)
  • dependabot[bot] (62)
  • ajparsons (47)
  • crowbot (21)
  • sagepe (11)
  • dracos (1)

Top Issue Labels

  • project:scorecards (106)
  • project:cape (62)
  • bug (44)
  • design (17)
  • tech debt (7)
  • deeper integrations (3)

Top Pull Request Labels

  • dependencies (62)
  • design (1)
  • blocked (1)

Dependencies

requirements.dev.txt pypi
  • black ==21.12b0 development
  • pylint ==2.12.2 development
requirements.txt pypi
  • Django ==3.2.14
  • Markdown ==2.6.8
  • MarkupPy ==1.14
  • Pillow ==9.0.1
  • PyYAML ==5.4
  • altair ==4.2.0
  • asgiref ==3.3.2
  • beautifulsoup4 ==4.9.3
  • certifi ==2020.6.20
  • chardet ==3.0.4
  • cryptography ==36.0.1
  • csscompressor ==0.9.4
  • defusedxml ==0.6.0
  • diff-match-patch ==20200713
  • django-autoslug ==1.9.7
  • django-bootstrap4 ==1.1.1
  • django-debug-toolbar ==3.2.2
  • django-filter ==2.4.0
  • django-haystack ==3.0
  • django-htmlmin ==0.11.0
  • django-import-export ==2.0.2
  • django-markitup ==4.0.0
  • django-simple-history ==3.0.0
  • django_hosts 55634e5dd5cce33619dcb641c5e3c6a9c85e7caa
  • djangorestframework ==3.12.4
  • et-xmlfile ==1.0.1
  • feedparser ==5.2.1
  • future-fstrings ==1.2.0
  • gunicorn ==20.0.4
  • html5lib ==1.1
  • idna ==2.10
  • jdcal ==1.4.1
  • libsass ==0.12.3
  • mailchimp_marketing a734b605fe457f429144ec81c7ba721f47ad4e57
  • numpy ==1.22.0
  • odfpy ==1.4.1
  • olefile ==0.44
  • openpyxl ==3.0.9
  • pandas ==1.3.4
  • pdftotext ==2.1.5
  • psycopg2 ==2.8.5
  • pysolr ==3.9.0
  • python-dateutil ==2.8.1
  • python-slugify ==4.0.1
  • pytz ==2020.1
  • requests ==2.25.1
  • requests-cache ==0.5.2
  • six ==1.10.0
  • soupsieve ==2.0.1
  • sqlparse ==0.4.2
  • tablib ==2.0.0
  • text-unidecode ==1.3
  • tokenize-rt ==3.2.0
  • urllib3 ==1.26.5
  • webencodings ==0.5.1
  • xlrd ==1.2.0
  • xlwt ==1.3.0
.github/actions/cached-build/action.yml actions
  • docker/login-action f054a8b539a109f9f41c372932f1ae047eff08c9 composite
  • docker/metadata-action 98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 composite
.github/actions/in-container/action.yml actions
  • ./.github/actions/cached-build * composite
.github/workflows/build_dev_image.yml actions
  • ./.github/actions/cached-build * composite
  • actions/checkout v2 composite
.github/workflows/lint.yml actions
  • actions/checkout v2 composite
  • psf/black stable composite
.github/workflows/mirror.yml actions
  • actions/checkout v3 composite
  • mysociety/action-git-pusher v1.1.1 composite
.github/workflows/tests.yml actions
  • ./.github/actions/in-container * composite
  • actions/checkout v2 composite
.github/workflows/updata_data.yml actions
  • ./.github/actions/in-container * composite
  • actions/checkout v2 composite
Dockerfile docker
  • python 3.9.7 build
  • python 3.9.7-slim build
docker-compose.yml docker
  • mysociety/caps ${TAG
  • postgres 11
  • solr 6.5
.devcontainer/docker-compose-extend-cached-image.yml docker
pyproject.toml pypi

Score: 6.723832440821209