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
padded_type VARCHAR
country_of_production_name VARCHAR
mass_tonnes_raw_equivalent DOUBLE
port_of_export_name VARCHAR
year BIGINT
branch VARCHAR
status VARCHAR
linear_programming_failure_reason VARCHAR
is_domestic BOOLEAN
domestic_consumption_region_geocode VARCHAR
production_geocode VARCHAR
domestic_consumption_region_name VARCHAR
domestic_consumption_region_gadm_level DOUBLE
_id BIGINT

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

Test column Test name Failing rows Last test run Last status Query in Metabase
country_of_production_name not_null_diet_trase_coffee_2020_other_country_of_production_name 2026-07-07 15:12 pass 🔍 run query
country_of_production_name relationships_diet_trase_coffee_2020_other_country_of_production_name__country_name__ref_postgres_countries_ 2026-07-07 15:13 pass 🔍 run query
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"])