Skip to content

This is a website built using FastAPI and contains summary information from three PRTR systems obtained by data engineering.

License

Notifications You must be signed in to change notification settings

jodhernandezbe/PRTR_transfers_FastAPI

Repository files navigation

PRTR transfers FastAPI

Overview

Data source

The API contains and deploys summary information for three Pollutant Release and Transfer Register (PRTR) systems. The three PRTR systems are the National Pollutant Release Inventory (NPRI), the National Pollutant Inventory (NPI), and the Toxics Release Inventory (TRI). The PRTR_transfers_summary database (see the SQLite database) provides the summary information for the data from the the PRTR_transfers database obtained by the data engineering procedure presented in the public GitHub repository PRTR_transfers.

Enhanced entity-relationship diagram (EERD) for the PRTR_transfers_summary database

The EERD model in the following figure represents the PRTR_transfers_summary database schema created based on the records from the PRTR_transfers database (see link).

Requirments

Developers

Creating conda environment

A conda environment can be created by executing the following command:

conda env create -n PRTR_FastAPI -f environment.yml

The above command is written assuming that you are in the folder containing the .yml file, i.e. the root folder PRTR_transfers_FastAPI.

Ovoiding ModuleNotFoundError and ImportError

If you are working as a Python developer, you should avoid both ModuleNotFoundError and ImportError (see the following link). Thus, follow the steps below to solve the above mentioned problems:

  1. Run the following command in order to obtain the PRTR_transfers_FastAPI project location and then saving its path into the variable PACKAGE
    PACKAGE=$(locate -br '^PRTR_transfers_FastAPI$')
    
  2. Check the PACKAGE value by running the following command
    echo $PACKAGE
    
  3. Run the following command to add the PRTR_transfers_FastAPI project to the system paths
    export PYTHONPATH="${PYTHONPATH}:$PACKAGE"
    

If you prefer to save the path to the PRTR_transfers_FastAPI project folder as a permanent environment variable, follow these steps:

  1. Open the .bashrc file with the text editor of your preference (e.g., Visual Studio Code)
    code ~/.bashrc
    
  2. Scroll to the bottom of the file and add the following lines
    export PACKAGE=$(locate -br '^PRTR_transfers_FastAPI$')
    export PYTHONPATH="${PYTHONPATH}:$PACKAGE"
    
  3. Save the file with the changes
  4. You can open another terminal to verify that the variable has been successfully saved by running the following command
    echo $PYTHONPATH
    

Remote deployment

This was deployed at AWS where you can also test it from the docs endpoint

WebSite: http://ec2-50-19-131-127.compute-1.amazonaws.com/

API documentation: http://ec2-50-19-131-127.compute-1.amazonaws.com/v1/api_documentation


Local deployment

Run the following command for local deployment

python run.py

Go to https://127.0.0.1:8000

Disclaimer

The views expressed in this GitHub repository are those of the authors and do not necessarily represent the views or policies of the U.S. Environmental Protection Agency (EPA). Any mention of trade names, products, or services does not imply an endorsement by the U.S. Government or the EPA. The EPA does not endorse any commercial products, services, or enterprises.

About

This is a website built using FastAPI and contains summary information from three PRTR systems obtained by data engineering.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published