Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sykefi/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
emissions pollutants
Last synced: about 1 month ago
JSON representation
A project for handling the European Pollutant Release and Transfer Register (E-PRTR) data and publishing it as a national web service
- Host: GitHub
- URL: https://github.com/sykefi/PRTR
- Owner: sykefi
- License: mit
- Created: 2021-07-15T10:32:17.000Z (over 3 years ago)
- Default Branch: dev
- Last Pushed: 2024-04-26T07:55:58.000Z (8 months ago)
- Last Synced: 2024-05-19T14:07:09.874Z (7 months ago)
- Topics: emissions, pollutants
- Language: TypeScript
- Homepage:
- Size: 8.7 MB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- open-sustainable-technology - PRTR - A project for handling the European Pollutant Release and Transfer Register (E-PRTR) data and publishing it as a national web service. (Emissions / Carbon Offsets and Trading)
README
[![API: tests & prod deploy](https://github.com/sykefi/PRTR/workflows/API%3A%20tests%20%26%20prod%20deploy/badge.svg)](https://github.com/sykefi/PRTR/actions)
[![UI: tests & prod deploy](https://github.com/sykefi/PRTR/workflows/UI%3A%20tests%20%26%20prod%20deploy/badge.svg)](https://github.com/sykefi/PRTR/actions)[![API: tests & dev deploy](https://github.com/sykefi/PRTR/workflows/API%3A%20tests%20%26%20dev%20deploy/badge.svg)](https://github.com/sykefi/PRTR/actions)
[![UI: tests & dev deploy](https://github.com/sykefi/PRTR/workflows/UI%3A%20tests%20%26%20dev%20deploy/badge.svg)](https://github.com/sykefi/PRTR/actions)# 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](https://ym.fi/en/front-page) and implemented by the [Finnish Environment Institute](https://www.syke.fi/en-US).
The development version of the UI is published at [syke-prtr-d-web.azurewebsites.net](https://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](https://syke-prtr-fastapi-d-cont.azurewebsites.net/docs).
A prototype of the user interface (or portal) is published at [prtr.fi](http://prtr.fi/).
## Getting Started with the UI
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). See the autogenerated documentation in the other [README.md](ui/README.md)
### Prerequisites
- [Node.js](https://nodejs.org/en/)
### 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](ui/.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](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](https://prettier.io/). In VSCode, the easiest way to format is to use the plugin [prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) and the following settings:
```
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
```## Getting Started with the API
### Prerequisites
[Miniconda](https://docs.conda.io/en/latest/miniconda.html) or [Anaconda](https://www.anaconda.com/products/individual) 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)
- E-PRTR data is available for download at [industry.eea.europa.eu/download](https://industry.eea.europa.eu/download) / [eea.europa.eu/data-and-maps/data](https://www.eea.europa.eu/data-and-maps/data/industrial-reporting-under-the-industrial-3) (e.g. _Industrial_Reporting_Database_v4_March_2021.accdb_)
- Previously imported PRTR dataset for Finland is already included as CSV files in [api/api/assets](api/api/assets)
- The data import script requires installation of [driver for MS for Access files](https://www.microsoft.com/en-us/download/details.aspx?id=54920)
- Prior to running the script, add a new file .env to `api/data_import/` containing at least the following environment variable: PRTR_DB_FILE_PATH=path\to\your\prtr\data\\\*.accdb
- Other settings (such as country code) can be adjusted in [data_import/conf.py](api/data_import/conf.py)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](http://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). 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](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](air-pollutant-map/README.md)