Skip to content

SchmidtDSE/plastics-prototype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plastics Prototype

Prototype for the plastics decision support tool with transparent intervention code / authoring. The tool is primarily available at https://global-plastics-tool.org/. This tool is in pre-release (like preprint), feedback welcome!


Related

See also source code for "main" pipeline and source code for the GHG pipeline. Further documentation for this effort can be found in our supplemental scripts and documentation repositories. This final repository produces the following documentation chapters:


Purpose

This tool allows users to explore potential future plastic outcomes including waste and consumption under different policy scenarios. It does this primarily through an interactive browser-based tool but also offers some static visualizations and the ability to run these policy scenarios through Node outside the browser. Altogther, this tool provides new perspective to policy makers and other stakeholders on how to address global plastic waste, hoping to help inform efforts such as UN INC on Plastic Pollution.


Usage

There are multiple ways to interact with the tool. Note that many of these require pt/index.json rendered via support/render_index.py.

In-browser

The primary way to interact with the tool is through the browser. See https://global-plastics-tool.org/ for the publicly available hosted version. To host it yourself or run it on your own machine, see the instructions below.

Command line

The policy simulation engine can also run externally to the browswer through Node. See js_standlaone for more details.

Writing new interventions

See the pt subdirectory (pt) for more details on how to add new interventions.


Modeling

Note that the model repository including data and source code is available at https://github.com/SchmidtDSE/plastics-pipeline.


Container Environment

A containerized environment is available for both local execution of the application as well as development.

Containerized execution

The application can be run through a Docker container. This will build the application as well as generate the static supporting graphs and selected static scenario outputs.

Containerized development

Note that a containerized cloud development environment is also available. See .gitpod.yml and GitPod for more details. After opening the repository, start running the application with python -m http.server.


Manual Environment

To run the tool locally with a custom or manual environment setup, some prerequisites are required:

  • Java allows for ANTLR source generation as required for the plastics intervention language.
  • Node is required in order to run grunt and webpack, enabling preparation of the front-end.
  • Python acts as automation scripting.

Having installed the above, execute the following to start the local server:

  • Install Python dependencies: pip install -r requirements.txt.
  • Setup the local environment with bash support/setup_local.sh which includes downloading a copy of the underlying data.
  • Execute a local web server for example python -m http.server.

Note that optional static visualizations are also available under image_gen. See that sub-directory's README for more details.


Deployment

There are two options for deploying the application.

CI / CD

CI / CD can deploy changes after they merge to deploy, releasing to the public version. Note that this tool does not have a backend and the contents of this repository simply need to be hosted as static files after building (see support/setup_local.sh for a minimal build).

Container

The Docker container can also be deployed to various different environments. By default, it will use nginx to host the static files on port 8080 but this may require port forwarding in your hosting environment. Furthermore, it does not run in a daemon. Please adjust Dockerfile and docker-compose.yml to fit your desired secuirty profile and hosting environment before deployment.


Development standards

This project uses the following:

  • Primarily, front-end tests are supported through Grunt (grunt) and QUnit. Meanwhile style is generally enforced eslint (npx eslint ./js/*.js).
  • Note that CI / CD may execute other tests and all pull requests should be passing all test and lint operations before merge.
  • When in doubt, please follow the JavaScript Style Guide.
  • Try to provide docstrings / JSDoc for public members (note that the support directory is excluded from this requirement at this time).
  • Reviewers may also impose certain requirements around usability and accessibility as to be discussed during reviews.

Please be kind. Open source is an act of love.


Data and Citation

Papers are still in process. Please cite preprint at 10.48550/arXiv.2312.11359 for now. Thank you! This tool's other repositories use the following:

We thank the community and authors for their contribution.


Open source

The project uses the following:

Note that the following may be invoked as executables like via the command line through CI / CD or by users of this tool but are not statically linked with the tool (and are not used during the execution of the web-based interactive tool):

Our CI / CD systems via GitHub Actions also use the libraries described in build.yml.

Meanwhile, the optional containerized environment uses the following:

Finally, thanks to the following some basic boilerplates / inspiration:

Note that additional open source libraries used by the model pipeline are discussed at https://github.com/SchmidtDSE/plastics-pipeline.