Skip to content

Open-source web application used for managing, quantifying, and reporting methane emissions in upstream oil & gas industry.

Notifications You must be signed in to change notification settings

nomanleftbehind/methane-emissions-management

Repository files navigation

Methane Emissions Reduction Program

Open-source web application used for managing, quantifying, and reporting methane emissions in upstream oil and gas sector.

Methane is a potent greenhouse gas with at least 25 times the warming potential of carbon dioxide (CO2) over a 100-year period and scientists estimate that it is responsible for 30% of observed global warming to date. Therefore, cutting methane emissions is the most cost-effective way to reduce greenhouse gas emissions. Oil and gas sector is the largest source of methane emissions in US and Canada, accounting for 30% and 41% respectively in 2021.

Methane emission reduction efforts from petroleum and natural gas sector are underway in both countries. In US, EPA has introduced Methane Emissions Reduction Program, while in Canada's biggest oil and gas producing province Alberta, local energy regulator AER amended Directive 060: Upstream Petroleum Industry Flaring, Incinerating, and Venting and Manual 015: Estimating Methane Emissions to backstop methane emissions target.

This project was primarily started as a side hustle to learn Rust programming language in practice. Over time, as it grew in practical usefulness and, most importantly, became more compatible with specifications set out in AER's Directive 060 and Manual 015, it became a serious endeavour to develop an open-source tool to be used by those tasked with managing, quantifying, and reporting methane emissions.

Technology

Server

Database

Client

  • Yew a Rust framework for creating multi-threaded front-end web apps with WebAssembly

This documentation is written in a way to guide complete beginners through technology stack integration and towards successful compilation of the program.

Big shout-out to open-msupply, and Matt Wilkinson without whom this process would have taken a lot longer.

Setup

Backend

  • Install Rust and Cargo

    Follow the instructions on official Rust website to install the language.

  • Install WASM and Trunk

    rustup target add wasm32-unknown-unknown

    cargo install --locked trunk

  • Install PostgreSQL

    Download and install PostgreSQL. You will be asked to set up a password for superuser called "postgres" and port number at the end of the installation.

  • Install SQLx CLI

    cargo install sqlx-cli --no-default-features --features native-tls,postgres

  • Setup SQLx

    We need to tell SQLx where to find our database. We do this by setting the DATABASE_URL environment variable.

    Rename .env.example file to .env. Inside, replace the word 'password' of DATABASE_URL with earlier defined superuser password.

    The general form for a PostgreSQL connection URI is postgresql://[user[:password]@][host][:port][/dbname]

    Run sqlx database create

    Create database tables by running sqlx migrate run.

  • Build binary and run locally

    Client is rendered on server side so no need to serve with Trunk.

    Following command will produce index.html, along with the compiled css, WASM & the JS loader for the WASM, and it will run server in debug mode.

    On Mac run: ./build-debug.sh

    On Windows run: PowerShell.exe -File build-debug.ps1 -ExecutionPolicy Bypass

    Open http://localhost:8081/ in your browser to view the app.

    You can also test your queries and mutations in GraphQL Playground by opening http://localhost:8081/graphiql in you browser.

    Screenshots

    screenshot

Application Model

  Pneumatic Devices Compressor Seals Defined Vent Gas
Root Users
Reporting Level Facilities
Surface Lease Level Sites
Emitter Level Pneumatic Instruments Level Controllers Pneumatic Pumps Compressor Seals Storage Tanks
Calculation Level Emission Rates Controlled Characterizations Control Device Inactivity Month Hours Overrides Emission Rates Actuation Frequencies Controlled Characterizations Control Device Inactivity Month Hours Overrides Emission Rates Controlled Characterizations Control Device Inactivity Month Hours Overrides Tests Controlled Characterizations Control Device Inactivity Emission Surveys Month Hours Overrides Changes GIS Factors Liquid Hydrocarbon Entering Controlled Characterizations Control Device Inactivity Emission Surveys Overrides
Quantification Level Month Methane Emissions

About

Open-source web application used for managing, quantifying, and reporting methane emissions in upstream oil & gas industry.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages