Skip to content
/ PRTR Public

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

License

Notifications You must be signed in to change notification settings

sykefi/PRTR

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •