42AI / Subnational Carbon Budget Assessment

A django WebAPI and a React app to show a map of subnational carbon budget assessments

Team Name: 42AI

Participants: Amric Trudel, Arthur Lanter, Pablo Clement, Eric Parisot

Node: Paris, France (HEC Paris - Ecole 42)

Discord channel: https://discord.gg/9y3AQuf

Corresponding Prompt:

Submission summary

Our participation in the Open Climate Collabathon, 16-17 nov 2019. Our prompt was "Subnational Carbon Budget Assessments"

We decided to separate Backend and Frontend, using two servers communicating through APIs. This configuration allows us to work separately on both architecture sides, in case we want to improve or change the stack of one of them.

This structure with APIs from the backend is also in the spirit of the Collabathon. In deed, on the long term, data generated by the model could be accessible through APIs for other projects.

Code submission:

Demo example:

Backend Installation | Django API

Python3 and pip3 required Go to /dev_django

Install:

$ pip install -r requirements.txt

Run locally

$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver

and go to 127.0.0.1:8000 in your browser to test it localy

To use another IP address and serve on your network, simply add it to ALLOWED_HOSTS in settings.py and run with:

$ python manage.py runserver IP

Frontend Installation | React app

nodeJS and npm required

Go to /dev_react

install:

$ npm install

Run locally:

$ npm start

and go to 127.0.0.1:8080 in your browser to test it localy

edit API fetching:

Frontend is fetching map's data from 'http://127.0.0.1:8000/api/maps/USA?format=json' You can edit this parameter in app/containers/App.jsx on line 17.

TODO:

Select between 1.5 and 2 °C target

show data graph

add more countries and a world map