Kausal Paths

A tool for predicting the future emissions of cities based on historical emission data and various climate actions.
https://github.com/kausaltech/kausal-paths

Category: Emissions
Sub Category: Emission Observation and Modeling

Keywords from Contributors

climate-change

Last synced: about 2 hours ago
JSON representation

Repository metadata

Kausal Paths to predict how the emissions of cities develop

README.md

Kausal Paths

Kausal Paths is a tool for predicting the future emissions of cities based on historical emission data and various climate actions. Users can compare how emissions develop in different scenarios. Data is provided using a GraphQL API.

Installation

Prerequisites

Make sure you have installed the following:

  • a package manager (e.g., homebrew for macOS, apt for Ubuntu, etc.)
  • git
  • python
  • uv (python package manager)
  • direnv (auto-loads environment variables)
    - Beginner Hints: before direnv works you need to hook it into your shell: depending on which shell you're using (find out with echo $SHELL)
    add eval "$(direnv hook bash)" to your ~/.bashrc OR eval "$(direnv hook zsh)" to your ~/.zshrc (create those files if they don't exist yet).
    After that, restart the terminal or run source ~/.bashrc OR source ~/.zshrc.

Development

After cloning the repository, move to your project root directory (paths folder) and allow loading environment variables:
direnv allow

In the project root directory, create and activate a Python virtual environment:

uv venv
source .venv/bin/activate

Install the required Python packages:

uv sync

Configure the PyPI index URL in your .envrc file (create it if it doesn't exist yet) if you have access to the Kausal private extensions (ask a team member for access):

export UV_INDEX_KAUSAL_USERNAME=...
export UV_INDEX_KAUSAL_PASSWORD=...

Then install the dependencies like this:

uv sync --extra kausal

If you need to run Jupyter notebooks, include the notebook dependency group:

uv sync --group notebook --extra kausal

Create a file called local_settings.py in your repository root with the following contents:

from paths.settings import BASE_DIR

DEBUG = True

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'paths',
        'ATOMIC_REQUESTS': True,
    }
}

Note for macOS users: You might need to install a few packages separately

brew install snappy
CPPFLAGS="-I/opt/homebrew/include -L/opt/homebrew/lib" pip install python-snappy
brew install postgresql@16
brew services start postgresql@16
cd ~/Documents/kausal-paths  # or wherever your project is
source .venv/bin/activate
uv pip install psycopg2
brew install gdal geos

then set the library path in your local kausal-paths/local_settings.py to the correct path shown in ls -la /opt/homebrew/lib/*gdal*:

GDAL_LIBRARY_PATH = '/opt/homebrew/lib/libgdal.dylib'
GEOS_LIBRARY_PATH = '/opt/homebrew/lib/libgeos_c.dylib' 
brew tap hashicorp/tap
brew install hashicorp/tap/vault

Run migrations:

python manage.py migrate

Create a superuser:

You might need the following translations during the createsuperuser operation: käyttäjätunnus = username, sähköpostiosoite = e-mail

python manage.py createsuperuser

Compile the translation files:

python manage.py compilemessages

Set Credentials and update database:

  • First, make sure your team added your access rights in Vault keycloak and send you the command to login again.

  • Clone the scripts repository (ask a team mate where to find it).

  • Go to paths root directory and run the script ../scripts/common/switch-region.sh while in paths root directory, which should automatically update all needed credentials in .secrets/db-backup

  • Follow the instructions the command gives you, there's a variable you need to put in .env and then the commands to restore the db

Then run

dropdb paths ; createdb paths && DB_BACKUP_SECRET_PATH=.secrets/db-backup kausal_common/docker/manage-db-backup.sh restore

You can now run the backend:

python manage.py runserver

The GraphQL API is now available at http://127.0.0.1:8000/v1/graphql/.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 12 days ago

Total Commits: 3,530
Total Committers: 16
Avg Commits per committer: 220.625
Development Distribution Score (DDS): 0.587

Commits in past year: 1,348
Committers in past year: 11
Avg Commits per committer in past year: 122.545
Development Distribution Score (DDS) in past year: 0.593

Name Email Commits
Jouni Tuomisto j****o@k****h 1457
Juha Yrjölä j****a@i****i 838
Michael Mechenich m****h@g****m 473
Timo Tuominen t****n@g****m 286
Bernhard Bliem b****d@b****z 225
Matias Wargelin m****n@k****h 111
Jan-Erik S. 6****u 100
Joe Smallwood j****d@k****h 13
Tero Tikkanen t****n@g****m 6
Nadine-Cyra Freistetter 8****r 5
philippestolz 1****z 4
samuelkwijaya-wong s****a@k****h 3
adinhodovic h****n@g****m 3
Nadine-Cyra Freistetter n****i@N****l 3
DeepL n****l@w****g 2
Lilia Sviridova s****a@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 4 days ago

Total issues: 11
Total pull requests: 317
Average time to close issues: about 2 months
Average time to close pull requests: 12 days
Total issue authors: 3
Total pull request authors: 11
Average comments per issue: 0.0
Average comments per pull request: 0.68
Merged pull request: 236
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 185
Past year average time to close issues: N/A
Past year average time to close pull requests: 4 days
Past year issue authors: 1
Past year pull request authors: 8
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.94
Past year merged pull request: 132
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/kausaltech/kausal-paths

Top Issue Authors

  • juyrjola (5)
  • terotik (5)
  • MWargelin (1)

Top Pull Request Authors

  • jtuomist (87)
  • Bhavatu (56)
  • MWargelin (54)
  • tituomin (53)
  • bbliem (26)
  • mechenich (19)
  • woodwoerk (11)
  • rominf (6)
  • ibrahim-string (2)
  • samuelkwijaya-wong (2)
  • lilia1891 (1)

Top Issue Labels

Top Pull Request Labels

  • New feature (4)
  • enhancement (2)
  • Dependencies (2)
  • Refactor (1)
  • Documentation update (1)
  • Bug fix (1)

Dependencies

.github/workflows/ci.yaml actions
  • actions/checkout v2 composite
  • docker/login-action v1 composite
docker/db/Dockerfile docker
  • postgres 13 build
docker-compose.yml docker
  • ${APP_IMAGE-kausal-paths} latest
  • ${DB_IMAGE-kausal-paths-postgres} latest
  • ${REDIS_IMAGE-redis 6.0-alpine}
.github/workflows/test.yaml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v5 composite
  • codecov/test-results-action v1 composite
  • harbor.kausal.tech/library/elasticsearch latest docker
  • postgis/postgis 16-3.4-alpine docker
uv.lock pypi
  • 429 dependencies
package-lock.json npm
  • 213 dependencies
e2e-tests/package.json npm
  • @playwright/test ^1.42.0 development
  • @types/node ^20.11.23 development
.devcontainer/Dockerfile docker
  • ghcr.io/astral-sh/uv latest build
  • mcr.microsoft.com/devcontainers/base debian build
.devcontainer/docker-compose.extend.yml docker
e2e-tests/package-lock.json npm
  • @playwright/test 1.55.1 development
  • @types/node 20.19.17 development
  • fsevents 2.3.2 development
  • playwright 1.55.1 development
  • playwright-core 1.55.1 development
  • undici-types 6.21.0 development
.github/workflows/lint.yaml actions
pyproject.toml pypi
package.json npm
  • mjml ^5.0.0-alpha.6
.github/workflows/ui-e2e-tests.yaml actions
  • actions/checkout v4 composite
  • actions/download-artifact v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v5 composite
  • daun/playwright-report-summary v3 composite
  • ${{inputs.backend_image}} * docker
  • ${{inputs.ui_image}} * docker
  • postgis/postgis 16-3.4-alpine docker
  • redis 7-alpine docker
docker-compose.dev.yml docker

Score: 5.662960480135945