Skip to content

equinor/tocomo

Repository files navigation

ToCoMo

The Total Consumption Model (ToCoMo) calculator was made to democratize the dicussions about the consequences of mixing liquid CO2 with impurities. Current focus is to implement that algorithms as described by Sven Morten Hesjevik and Anne Marie Koren Halvorsen.

The application as hosted on Radix https://tocomo.radix.equinor.com

Local setup (also on Codespace)

The application can be run locally quite easily using Docker. A docker compose file has been added which will build and start all components necessary. The setup has also been tested in a codespace environment. Stand in root and run:

docker compose up

The required ports in codespace will automatically be forwarded and you can open the application in your web browser.

Developers

The application consist of a frontend in React and a backend in Python. Each component contains a Dockerfile to build them, although they can also be build natively (instructions follow). In addition a docker compose file is available to set up the entire application in one step.

Backend

The calculations are implemented in python and served through a web api using fastapi.

In order to start the backend, create a python environment and do then following

cd backend
pip install fastapi
uvicorn main:app --port 5005

Include --reload to have the backend rebuild on changes. It is also possible to start the backend using the Dockerfile:

docker build -t backend_image .
docker run -t backend_image --p 5005:5005

Go to http://127.0.0.1:5005/docs in your browser to see the swagger page for the backend

Frontend

The frontend is written in react. In order to start the frontend do the following:

cd frontend
npm install
npm run dev

It is also possible to start the backend using the Dockerfile:

docker build -t frontend_image .
docker run -t frontend_image --p 3000:3000

Navigate to http://localhost:3000 in your browser to see the frontend. Given that the backend exists it should now be possible to insert numbers and click the run reactions button

About

ToCoMo - Total Consumption Model

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 8