Skip to content

DBT: Diet Trase Coffee 2020 Other

File location: s3://trase-storage/diet-trase/results/diet-trase-results-2020-other.parquet

DBT model name: diet_trase_coffee_2020_other

Explore on Metabase: Full table; summary statistics

Explore dependencies/lineage: link


Description

Results of the supply chain model for Diet Trase coffee in 2020 for all other countries.

Note that the LP for COTE D'IVOIRE and ETHIOPIA returns an error, which is expected, due to missing data. We only have the sub-national sourcing for 6 countries (instead of the 10 for which we have per-shipment data).


Details

Column Type Description
year BIGINT
country_of_production_name VARCHAR
port_of_export_name VARCHAR
mass_tonnes_raw_equivalent DOUBLE
padded_type VARCHAR
branch VARCHAR
status VARCHAR
linear_programming_failure_reason VARCHAR
is_domestic BOOLEAN
domestic_consumption_region_geocode VARCHAR
production_geocode VARCHAR
domestic_consumption_region_gadm_level DOUBLE
domestic_consumption_region_name VARCHAR
_id BIGINT

Review full report including sample errors records if they exist (link)

Test name Test column Last test run Last status
not_null_diet_trase_coffee_2020_other_country_of_production_name country_of_production_name 2026-04-25 13:23 pass
relationships_diet_trase_coffee_2020_other_country_of_production_name__country_name__ref_postgres_countries_ country_of_production_name 2026-04-25 13:23 pass
from trase.models.diet_trase.coffee_fullmodel.run_using_dbt import run


def model(dbt, cursor):
    dbt.config(materialized="external")

    # provide the SupplyChain class with data from DBT rather than allowing it to
    # read from S3. The keys in the dictionary relate to the "outname" properties of the
    # classes in trase/models/diet_trase/coffee_fullmodel/preparation.py
    data = {
        "jurisdictions": dbt.ref("diet_trase_subnational_regions").df(),
        "flows": dbt.ref("diet_trase_coffee_trade_padded_2020").df(),
        "production": dbt.ref("diet_trase_full_coffee_production_2020").df(),
        "population": dbt.source(
            "trase-storage-raw", "diet_trase_coffee_population_2020"
        ).df(),
        "distance_matrix_jur_jur": dbt.source(
            "trase-storage-raw", "diet_trase_coffee_2020_costmatrix_jur2jur"
        ).df(),
        "distance_matrix_jur_port": dbt.source(
            "trase-storage-raw", "diet_trase_coffee_2020_costmatrix_jur2port"
        ).df(),
    }

    return run(data, exclude=["BRAZIL", "TANZANIA"])