Source code for T-reX.config_backup.queries_waste

"""
queries_waste Module
====================

This module defines the search parameters for each waste and material flow category. It is used in conjunction with `SearchWaste.py` and requires a .pickle file generated by `ExplodeDatabase.py`.

The queries are set up for different waste flow categories like digestion, composting, incineration, recycling, and landfill, among others. Each query is a dictionary containing search terms for the respective category.

The module creates two sets of queries:
1. `queries_kg` for waste flows measured in kilograms.
2. `queries_m3` for waste flows measured in cubic meters.

These queries are combined into the `queries_waste` list, which is then used by `SearchWaste.py` for filtering and extracting relevant data from the database.

"""


[docs] def make_queries_waste(): """ This function creates the queries_waste list, which is used by SearchWaste.py for filtering and extracting relevant data from the database. The queries are set up for different waste flow categories like digestion, composting, incineration, recycling, and landfill, among others. Each query is a dictionary containing search terms for the respective category. args: None returns: list queries_waste """ names = [ "digestion", "composting", "open burning", "incineration", "recycling", "landfill", "hazardous", "radioactive", # "non-hazardous", # not really needed, as it is just "total" - "hazardous", and it makes the process slower (20k+ more exchanges) "carbon dioxide", # in prospective databases, carbon capture and storage is included "total", ] # QUERY FORMAT # setup the dictionary of search terms for # each waste and material flow category queries_kg = [] for name in names: query = { "db_name": "", # db_name "db_custom": "", # db_T_reX_name "name": "", "code": "", "unit": "kilogram", "AND": ["waste"], # if you replace "None" below, it must be with a with a list of strings, like the other keywords have "OR": None, "NOT": None, } # define here what the search parameters mean for # each waste and material flow category # if you want to customize the search parameters, you will # likely need some trial and error to make sure you get what you want query.update({"name": "WasteFootprint_" + name}) if "landfill" in name: query.update({"OR": ["landfill", "dumped", "deposit"]}) if "hazardous" == name: query.update({"OR": ["hazardous", "radioactive"]}) query.update({"NOT": ["non-hazardous", "non-radioactive"]}) if "non-hazardous" == name: query.update({"NOT": ["hazardous", "radioactive"]}) if "incineration" in name: query["AND"] += ["incineration"] if "open burning" in name: query["AND"] += ["burning"] if "recycling" in name: query["AND"] += ["recycling"] if "composting" in name: query["AND"] += ["composting"] if "digestion" in name: query["AND"] += ["digestion"] if "radioactive" in name: query["AND"] += ["radioactive"] if "carbon dioxide" in name: query.update( { "OR": [ "carbon dioxide storage", "carbon dioxide, captured", ] } ) query.update({"NOT": ["methane"]}) query.update({"AND": [""]}) # add the query to the list of queries queries_kg.append(query) # add same queries defined above, now for liquid waste and material queries_m3 = [] for q in queries_kg: q = q.copy() q.update({"unit": "cubic meter"}) queries_m3.append(q) queries_waste = queries_kg + queries_m3 return queries_waste
queries_waste = make_queries_waste()