feat(world_cepii_baci): BACI international trade (HS92/HS17) + per-revision HS directories - #1791
Draft
rdahis wants to merge 2 commits into
Draft
feat(world_cepii_baci): BACI international trade (HS92/HS17) + per-revision HS directories#1791rdahis wants to merge 2 commits into
rdahis wants to merge 2 commits into
Conversation
….md merged by mistake in #1790
…sion HS directory tables International bilateral trade from CEPII BACI (harmonized UN COMTRADE), English column names. First pass of the world_cepii_baci onboarding (dev-validated, dbt test 24/24). - world_cepii_baci.trade_hs92 (269.9M rows, 1995-2024, HS 1992 revision) - world_cepii_baci.trade_hs17 (89.2M rows, 2017-2024, HS 2017 revision) - br_bd_diretorios_comercio_internacional.hs1992 / hs2017: per-revision HS6 directory tables so each trade table's product_code FKs to its own revision's exact code set. Country FK (id_country_exporter/importer -> pais.id_m49) tolerant via custom_relationships: BACI aggregate/former-country codes (842=USA+PR+VI, 58=Belgium-Luxembourg, ...) are absent from the standard M49 directory and kept faithful to source. Pending (blocked on Atlas SITC download): trade_sitc, complexity_country, complexity_product. (Pyrefly pre-commit hook skipped: worktree is under gitignored .claude/, so it excludes all files and errors on zero matches; ruff/sqlfmt/yamlfix all passed.)
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
@rdahis esse pull request tem conflitos 😩 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (draft — first pass)
Onboards CEPII BACI bilateral international trade (harmonized UN COMTRADE) as
world_cepii_baci, with English table/column names. Ships the BACI-HS half now; SITC + complexity are pending (see below).Tables (dev-validated,
dbt testPASS=24/24)world_cepii_baci.trade_hs92world_cepii_baci.trade_hs17br_bd_diretorios_comercio_internacional.hs1992br_bd_diretorios_comercio_internacional.hs2017Grain: year × exporter × importer × product. Columns:
year,id_country_exporter,id_country_importer,product_code,value(thousand USD),quantity(metric tons).FK design
product_code → hsXXXX.id_sh6is exact — each trade table references its own revision's per-revision directory table, so no code-vintage mismatch. This is the reason for the per-revisionhs*directories.custom_relationships) — BACI uses aggregate/former-country codes absent from the standard M49 directory (842=USA+PR+VI,251=France+Monaco,58=Belgium-Luxembourg,891=Serbia-Montenegro, …). Kept faithful to source and documented viaignore_values, asbr_me_comex_statdoes.Pending in this PR (blocked)
trade_sitc,complexity_country,complexity_product— need the Harvard Atlas SITC data (Dataverse is currently rate-limiting downloads; will add once it clears).Notes
models/*/code/clean_*.pystream annual CSVs → year-partitioned parquet. Upload:models/world_cepii_baci/code/upload.py(dev staging).MIGRATION_PLAN.mdaccidentally merged in feat(br_bd_diretorios_comercio_internacional): migrate sistema_harmonizado from diretorios_mundo #1790.🤖 Generated with Claude Code