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!
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:
- Machine learning base model for business as usual
- Sectorizing secondary material
- Polymer-level estimation and GHG calculations
- Policy engine overview
- Additives
- Consumption tax
- Incineration investment
- Maximum mismanaged rate
- Minimum recycled content
- Minimum recycling (collection) rate
- Minimum reuse rate
- Recycling investment
- Reduced packaging
- Virgin plastic production cap
- Waste management investment
- Waste trade
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.
There are multiple ways to interact with the tool. Note that many of these require pt/index.json
rendered via support/render_index.py
.
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.
The policy simulation engine can also run externally to the browswer through Node. See js_standlaone for more details.
See the pt subdirectory (pt
) for more details on how to add new interventions.
Note that the model repository including data and source code is available at https://github.com/SchmidtDSE/plastics-pipeline.
A containerized environment is available for both local execution of the application as well as development.
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.
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
.
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.
There are two options for deploying the application.
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).
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.
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.
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:
- DESA, World Population Prospects 2022 (2022).
- R. Geyer, J. R. Jambeck, K. L. Law, Production, use, and fate of all plastics ever made. Sci. Adv. 3, e1700782 (2017).
- C. Liu, S. Hu, R. Geyer. Manuscript in Process (2024).
- OECD, Real GDP long-term forecast (2023).
- J. Zheng, S. Suh, Strategies to reduce the global carbon footprint of plastics. Nat. Clim. Chang. 9, 374–378 (2019).
We thank the community and authors for their contribution.
The project uses the following:
- ANTLR under the BSD License.
- Ace Editor under the BSD License.
- Chart.js under the MIT License.
- ColorBrewer under the Apache v2 License.
- d3 under the ISC License.
- es-module-shims under the MIT License.
- Handlebars under the MIT License.
- League Spartan under the OFL License.
- Matplotlib under the PSF License.
- Pandas under the BSD License.
- Papa Parse under the MIT License.
- Polyfill.io under the MIT License.
- Popper under the MIT License.
- Pure CSS Custom Dropdown Arrow under the MIT License.
- Qunit under the MIT License.
- Simplebar under the MIT License.
- Tabby under the MIT License.
- Tippy under the MIT License.
- ua-parser 1.0.36 under the MIT License.
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):
- Grunt under the MIT License.
- grunt-contrib-connect under the
- grunt-contrib-qunit under the MIT License.
- Node under an open source set of licenses.
- npm under Artistic v2 License.
- OpenJDK under the GPL License.
- Processing under the GPL License.
- Webpack under the MIT License.
Our CI / CD systems via GitHub Actions also use the libraries described in build.yml
.
Meanwhile, the optional containerized environment uses the following:
- Docker under the Apache v2 License.
- Docker Compose under the Apache v2 License.
- Nginx under a BSD-like License.
Finally, thanks to the following some basic boilerplates / inspiration:
- ANTLR Mega Tutorial by Gabriele Tomassetti under the MIT License.
- AntlrCalc (the article) by Snorri Sturluson under the MIT License.
- arithmetic by Tom Everett under inline BSD License.
- Bret Victor's Inventing on Principle.
- Fernando Pérez's work on reproducible research.
- Maggie Appleton's Programming Portals.
- PlantLang under the MIT License.
- Pyafscgap under the BSD License.
- Tiny ANTLR Language under the Unlicense License.
Note that additional open source libraries used by the model pipeline are discussed at https://github.com/SchmidtDSE/plastics-pipeline.