Quick start guide - kallitsis/ARIA GitHub Wiki

🚀 Quick start guide

This guide will help you set up and start using ARIA quickly. Running ARIA requires an active Ecoinvent license and an OpenAI API key.

🔹 Go to Purchasing OpenAI API Credits to learn more about how to set this up.


1️⃣ Setting up credentials

Before running ARIA, you need to create a credentials.py file on your local machine. This file is not included in the repository for security reasons, so you must create it manually.

steps to create credentials.py

  1. Navigate to the ARIA project folder:

    cd path/to/aria
    
  2. Create a new file named credentials.py:

    touch credentials.py
    
  3. Open credentials.py with a text editor of your choice:

    nano credentials.py
    

    (or use vim, code for VS Code, or any preferred editor.)

  4. Add the following content, replacing the placeholder values with your actual credentials:

    # credentials.py  
    
    ecoinvent_username = 'your_ecoinvent_username'
    ecoinvent_password = 'your_ecoinvent_password'
    openai_api_key = 'your_openai_api_key'
    
  5. Save and close the file.


2️⃣ Securing your credentials

Since credentials.py contains sensitive information, you should ensure it is not accidentally uploaded.

steps to prevent accidental uploads

  • Add credentials.py to your .gitignore file:
    echo "credentials.py" >> .gitignore
    
  • Verify that the file is ignored by running:
    git status
    
    The credentials.py file should not appear in the list of tracked files.

3️⃣ Setting up a brightway project

Once your credentials are set up, the next step is to initialise a Brightway project and load the Ecoinvent database.

Steps to set up a brightway project

  1. Ensure you have installed all dependencies, including Brightway2.

  2. Import the setup_brightway_project function from ARIA:

    from ARIA.project_setup import setup_brightway_project
    
  3. Define your preferred Ecoinvent version, system model, and project name:

    # define your preferred settings  
    project_name = "my brightway project"  # change this to your desired project name
    ecoinvent_version = "3.10.1"           # change this to your preferred version
    system_model = "cutoff"                # change this to "cutoff", "apos", or "consequential"
    
  4. Initialise or load the Brightway2 project and Ecoinvent database:

    ecoinvent_db = setup_brightway_project(project_name, ecoinvent_version, system_model)
    
  5. Verify that the database has loaded successfully:

    print(f"ecoinvent database '{ecoinvent_version} - {system_model}' loaded into project: {project_name}")
    

4️⃣ Loading data inputs from excel

Now that your Brightway project is set up, the next step is to load data inputs from an Excel file.

for macOS users

ARIA provides an AppleScript-based method to open Excel automatically.

steps to load data (macOS)

  1. Import the necessary functions:

    from ARIA.data_handling import open_excel_with_applescript, read_and_clean_excel
    
  2. Define the path to your Excel file (update it to your actual path):

    file_path = "/Users/your_username/Documents/GitHub/ARIA/Data_inputs.xlsx"
    
  3. Open the file in Excel for editing:

    open_excel_with_applescript(file_path)
    
  4. Wait for the user to make edits, then continue:

    input("after editing and saving the Excel file, press enter to continue...")
    
  5. Read and clean the data from Excel:

    data_frame = read_and_clean_excel(file_path, usecols="A:C", nrows="only_rows_that_include_data")
    
  6. Print the imported data:

    print("imported data:")
    print(data_frame)
    

For windows users

macOS-specific AppleScript won't work on Windows, so you should open the Excel file manually before proceeding.

steps to load data (windows)

  1. Open the Excel file manually:

    • Locate the file at:
      C:\Users\your_username\Documents\GitHub\ARIA\Data_inputs.xlsx
      
    • Open it in Microsoft Excel.
  2. Make necessary edits and save the file.

  3. Run the following code to load the data:

    from ARIA.data_handling import read_and_clean_excel
    
    file_path = "C:/Users/your_username/Documents/GitHub/ARIA/Data_inputs.xlsx"
    
    # read and clean data  
    data_frame = read_and_clean_excel(file_path, usecols="A:C", nrows=12)
    
    print("imported data:")
    print(data_frame)
    

What this does

  • opens the Excel file for user input (automated on macOS, manual on Windows).
  • reads specific columns and rows from the file.
  • cleans the data and loads it into a pandas dataframe for further processing.

5️⃣ Initialising the openAI API client

Once the data inputs are loaded, the next step is to initialize the openAI API client.

steps to initialize the openAI client

  1. Import the client creation function from ARIA:

    from ARIA.openai_client import create_openai_client
    from credentials import OPENAI_API_KEY as default_api_key
    
  2. Initialise the openAI client using the API key stored in credentials.py:

    client = create_openai_client(default_api_key)
    

this will allow ARIA to interact with openAI's API for various tasks. the client is now ready to be used in subsequent steps.


6️⃣ Running the analysis

once the data is loaded and the openAI API client is initialised, the final step is to run the analysis. this involves processing the data using ARIA’s search-and-select workflow.

steps to run the analysis

  1. import search_workflow module

    from ARIA.search_workflow import process_dataframe   
    
  2. run the search-and-select workflow

    processed_df = process_dataframe(
        data_frame,
        db=db,
        client=openai,
        system_message="You are an LCA domain expert. Please pick the best match.", #Optionally, add specific information related to your goal and scope definition
        locations=["GLO", "RoW", "UK"] #Add any locations of focus based on Ecoinvent country codes
    )
    
  3. print the final dataframe with chatGPT results

    print(processed_df.to_string(index=False))
    

What this does

  • loads the ecoinvent database into the brightway2 project.
  • configures the openAI API client.
  • reads the excel data inputs into a pandas dataframe.
  • processes the dataframe using ARIA’s search-and-select workflow.
  • outputs a final dataframe with chatGPT-generated results.

7️⃣ Processing the dataframe

after the initial analysis, the next step is to process the dataframe to refine and prepare the data for impact assessment.

steps to process the dataframe

  1. import the required function

    from ARIA.ecoinvent_processing import process_ecoinvent_dataframe
    
  2. process the dataframe

    processed_df = process_ecoinvent_dataframe(data_frame)
    
  3. print the processed dataframe

    print(processed_df.to_string(index=False))
    

What this does

  • cleans and processes the input dataframe.
  • structures the data for impact assessment.
  • prepares it for further LCA analysis.

8️⃣ Performing impact assessment

after processing the data, the next step is to run the life cycle impact assessment (LCIA).

steps to perform impact assessment

  1. import required modules

    from ARIA.impact_assessment import run_impact_assessment
    
  2. define LCIA methods

    lcia_method = [
        ('EF v3.1', 'climate change', 'global warming potential (GWP100)'),
        ('EF v3.1', 'material resources: metals/minerals', 'abiotic depletion potential (ADP)'),
        ('EF v3.1', 'water use', 'deprivation-weighted water consumption'),
        ('EF v3.1', 'acidification', 'accumulated exceedance (AE)'),
        ('EF v3.1', 'ecotoxicity: freshwater', 'comparative toxic unit for ecosystems (CTUe)'),
        ('EF v3.1', 'human toxicity: carcinogenic', 'comparative toxic unit for humans (CTUh)'),
        ('EF v3.1', 'ozone depletion', 'ozone depletion potential (ODP)'),
        ('EF v3.1', 'particulate matter formation', 'impact on human health'),
        ('EF v3.1', 'photochemical oxidant formation', 'tropospheric ozone increase'),
    ]
    
  3. run the impact assessment

    processed_df = run_impact_assessment(processed_df, lcia_method)
    
  4. print the updated dataframe

    print(processed_df)
    

what this does

  • applies life cycle impact assessment methods.
  • calculates environmental impact indicators.
  • updates the dataframe with impact results.

9️⃣ Visualising results

after performing the impact assessment, the final step is to visualise the results using waterfall charts.

steps to plot LCIA results

  1. import the plotting function

    from ARIA.plot_lcia import plot_lcia_waterfall_charts
    
  2. run the visualization function

    plot_lcia_waterfall_charts(processed_df)
    

What this does

  • generates waterfall charts for impact assessment results.
  • provides clear and structured visualizations of environmental impact indicators.
  • helps in interpreting and communicating LCA findings.

✅ With this final step, you have completed the full ARIA workflow! Your life cycle analysis results are now ready for interpretation and reporting.