PRTR

A project for handling the European Pollutant Release and Transfer Register (E-PRTR) data and publishing it as a national web service.
https://github.com/sykefi/prtr

Category: Emissions
Sub Category: Carbon Offsets and Trading

Keywords

emissions pollutants

Last synced: about 6 hours ago
JSON representation

Repository metadata

A project for handling the European Pollutant Release and Transfer Register (E-PRTR) data and publishing it as a national web service

README.md

API: tests & prod deploy
UI: tests & prod deploy

API: tests & dev deploy
UI: tests & dev deploy

PRTR

A project for handling the European Pollutant Release and Transfer Register (i.e. E-PRTR) data and publishing it as a national web service (API & user interface). The project is funded by the Ministry of the Environment and implemented by the Finnish Environment Institute.

The development version of the UI is published at syke-prtr-d-web.azurewebsites.net.

The development version of the API (serving only Finnish PRTR data) is published at syke-prtr-fastapi-d-cont.azurewebsites.net.

A prototype of the user interface (or portal) is published at prtr.fi.

Getting Started with the UI

This project was bootstrapped with Create React App. See the autogenerated documentation in the other README.md

Prerequisites

Installation

$ cd ui
$ npm install

Running the app locally

npm start

Running the tests

To open the interactive dashboard (Cypress) for running and debugging tests, run:

npm run cypress

Configuration

By default the app uses the PRTR API at the address defined in .env.development. To use local backend instead, you can add a new file .env.development.local and add the same environment variable there as REACT_APP_PRTR_SERVER=http://localhost:8000.

To disable query caching (with React Query) on local development, you can also add the environment variable REACT_APP_PRTR_DATA_CACHE_TIME=0.

Updating translations from external source

To keep the external translation source and the translation files of the project in sync, it is recommended to make the additions or edits first in the external translation source and only then update the project translation files as instructed below:

  1. Download and save the external translation table(s) as utf-8 encoded CSV file(s).
  2. In directory ui/translation_source, replace one or more of the current CSV files with (an) updated table(s).
  3. Check with git diff that the changes/additions seem as intended.
  4. cd ui (if not already there)
  5. python import_translations.py (with any Python 3.x)
  6. Check with git diff that the changes/additions to translation (JSON) files seem appropriate.
  7. Optional step: run npm start or npm run build to check that the project still compiles (if there were changes in the translation keys, there may be TS/compile errors now).
  8. Commit & push the changes and enjoy your new localized content.

Code style

The project is currently formatted with Prettier. In VSCode, the easiest way to format is to use the plugin prettier-vscode and the following settings:

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
}

Getting Started with the API

Prerequisites

Miniconda or Anaconda package manager for Python.

Installation

$ git clone https://github.com/sykefi/PRTR.git
$ cd PRTR/api
$ conda env create -f dev-env.yml
$ conda activate prtr

Data import (optional)

To execute the data import, run:

$ python data_import_main.py

Running the server locally

$ uvicorn main:app --reload

API should now be accessible at localhost:8000.

Running the tests

$ python -m pytest tests/

Getting Started with the Air-pollutant-map

Changes for the air-pollutant-map (tab Hajapäästöt in the application) are made in the directory air-pollutant-map. Air-pollutant-map is originally implemented with Vue, therefore it's code is maintained separately from UI. Build of air-pollutant-map is placed inside the public-directory of UI so that the build runs on the same server as the main app. Running air-pollutant-map is embedded in to the UI with an iframe.

Whenever new changes are made to the air-pollutant-map, new build needs to be made and copied in ui/public/air-pollutant-map. Dev-environment of air-pollutant-map can be used in local testing, but prod-environment needs to be used when changes are published. More information about updating the changes in the other README.md


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 466
Total Committers: 5
Avg Commits per committer: 93.2
Development Distribution Score (DDS): 0.335

Commits in past year: 6
Committers in past year: 2
Avg Commits per committer in past year: 3.0
Development Distribution Score (DDS) in past year: 0.5

Name Email Commits
Joose Helle j****e@g****m 310
Ismo Lahtinen i****n@s****i 98
Daniel d****n@g****m 41
mirkosillanp m****a@g****m 16
Haaranen Daniel D****n@e****i 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 0
Total pull requests: 90
Average time to close issues: N/A
Average time to close pull requests: 1 day
Total issue authors: 0
Total pull request authors: 4
Average comments per issue: 0
Average comments per pull request: 0.08
Merged pull request: 86
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: 6 minutes
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0

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

Top Issue Authors

Top Pull Request Authors

  • hellej (33)
  • sykelahtineni (26)
  • danielhaaranen (18)
  • mirkosillanp (13)

Top Issue Labels

Top Pull Request Labels

  • enhancement (1)

Dependencies

ui/package-lock.json npm
  • 1751 dependencies
ui/package.json npm
  • @types/react-router-dom ^5.1.8 development
  • @types/react-select ^4.0.17 development
  • @types/styled-components ^5.1.14 development
  • eslint ^7.32.0 development
  • eslint-plugin-cypress ^2.11.3 development
  • prettier ^2.4.1 development
  • @chakra-ui/icons ^1.0.15
  • @chakra-ui/react ^1.6.7
  • @emotion/react ^11.4.1
  • @emotion/styled ^11.3.0
  • @testing-library/jest-dom ^5.14.1
  • @testing-library/react ^11.2.7
  • @testing-library/user-event ^12.8.3
  • @types/jest ^26.0.24
  • @types/node ^12.20.23
  • @types/react ^17.0.20
  • @types/react-dom ^17.0.9
  • cypress ^8.3.1
  • framer-motion ^4.1.17
  • i18next ^20.6.0
  • i18next-browser-languagedetector ^6.1.2
  • i18next-http-backend ^1.3.1
  • ol ^6.7.0
  • react ^17.0.2
  • react-dom ^17.0.2
  • react-i18next ^11.11.4
  • react-icons ^4.2.0
  • react-query ^3.24.4
  • react-router-dom ^5.3.0
  • react-scripts 4.0.3
  • react-select ^4.3.1
  • styled-components ^5.3.1
  • typescript ^4.4.2
  • wait-on ^6.0.0
  • web-vitals ^1.1.2
api/requirements.txt pypi
  • flake8 <=3.9.2
  • pytest <=6.2.4
  • requests *
.github/workflows/api-build-test-container.yml actions
  • actions/checkout v2 composite
  • azure/docker-login v1 composite
.github/workflows/api-test-deploy-dev.yml actions
  • actions/checkout v2 composite
  • azure/docker-login v1 composite
  • azure/login v1 composite
  • azure/webapps-deploy v2 composite
.github/workflows/api-test-deploy-prod.yml actions
  • actions/checkout v2 composite
  • azure/docker-login v1 composite
  • azure/login v1 composite
  • azure/webapps-deploy v2 composite
.github/workflows/ui-test-deploy-dev.yml actions
  • actions/checkout v2 composite
  • actions/setup-node v2 composite
  • azure/login v1 composite
  • azure/webapps-deploy v2 composite
.github/workflows/ui-test-deploy-prod.yml actions
  • actions/checkout v2 composite
  • actions/setup-node v2 composite
  • azure/login v1 composite
  • azure/webapps-deploy v2 composite
Dockerfile docker
  • tiangolo/uvicorn-gunicorn-fastapi python3.8 build

Score: 1.6094379124341003