Skip to content

Data Structure

AlexVialaBellander edited this page Nov 23, 2020 · 8 revisions

The data structure

The idea is to have the system behave like a tree where we have nodes and paths

image of tree

Objects

Product

{ 
    _id: ObjectID
    type: product
    tags: [STRING]
    type_description: STRING
    impact: { 
        co2: FLOAT
        measurement_error: FLOAT
        energy_sources: [STRING]
    }
    prod_name: STRING
    prod_id: STRING
    weight: FLOAT
    benchmarks: {
        date: {
            ObjectID product: ObjectID transport
        },,,
    }
}

Keys and Values

_id - Globally unique ID for MongoDB
type - product or transport
tags - tags are strings that explain what kind of product it is. type_description - description of what type of product. Is this a refinement of oil? Is it an assembly of a bed?
impact.co2 - kg of co2 emission when this specific part of the chain was processed
impact.measurement_error - percentage of how accurate the co2 data is
impact.energy_sources - an array of all the used energy sources used during this step
prod_name - Humanly readable name of the product
prod_id - unique id for this product from a specific company
weight - weight in kg for this product
benchmarks - all dependencies of this product, and how they were transported to this part of the chain.
benchmarks.date - which date this dependency is valid from, allows for historical data to be preserved during updates in the tree

Transport

{
    _id: ObjectID
    type: transport
    type_description: STRING (plane, boat, voi, etc.)
    impact: {
        co2: FLOAT (self co2)
        measurement_error: FLOAT (%)
        distance_travelled: FLOAT (in km)
        energy_sources: [STRING] (biofuel, electricity...)
    }
    actual_weight: NUMBER (kg)
    start_lat: LATITUDE
    start_lon: LONGITUDE
    end_lat: LATITUDE 
    end_lon: LONGITUDE
}

Keys and Values

_id - Globally unique ID for MongoDB
type - product or transport
type_description - description of what type of product. Is this a refinement of oil? Is it an assembly of a bed?
impact.co2 - kg of co2 emission when this specific part of the chain was processed
impact.measurement_error - percentage of how accurate the co2 data is
impact.distance_travelled - kilometers travelled using this transport option
impact.energy_sources - array or different energy sources that were used for this transport
start_lat - lat coordinate for where the transport begins
start_lon - lon coordinate for where the transport begins
end_lat - lat coordinate for where the transport ends
end_lon - lon coordinate for where the transport ends