Customs seed
Write friendly SQL, compile it to genuine ASYCUDA World (SYDONIA) customs SQL you can run read-only. A fully-sourced PostgreSQL reference model + query compiler + docs + Agent Skills for customs analytics, ML & selectivity.
npx -y skills add FrancoisChastel/sydonia-toolkit --skill customs-seedAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 21 days oldThe repository was created 21 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Add reference/code-table values or generate realistic sample operational data (manifests, SAD declarations with items, valuation notes, tax lines, payments) for the Sydonia Toolkit customs model, respecting every foreign key and the natural-key insert pattern. Use when the user wants more seed data, test declarations or manifests, demo data, or additional countries / tax types / HS codes / offices in the customs schema.
SKILL.md
3.6 KB, 796 tokens by cl100k_base, as published. Nobody here has run it
Customs seed
Two jobs: extend the reference tables with more code values, and generate operational sample data (declarations, manifests) that inserts cleanly.
When to use
"Add a country / currency / tax type / HS code / office"; "generate N sample declarations / manifests"; "give me demo data with 2–4 items each". If the schema is not loaded yet, use customs-schema-setup first.
Golden rules
- Insert into the
asycudaschema: begin scripts withSET search_path TO asycuda, public;inside aBEGIN … COMMIT;transaction. - Use natural-key subselects, never hard-coded surrogate ids — this is how
examples/e2e.sqlstays order-independent:(SELECT id FROM ref_country WHERE iso_alpha2 = 'CN') - Respect UNIQUE business codes — every
ref_*row andtrader.tin,bill_of_lading.bl_reference,receipt.receipt_number, etc. must be unique. - Keep it balanced — for a declaration, the per-item
tax_amounts should reconcile to thepayment.amountandreceipt.total_amount(as in the e2e).
Adding reference values
Insert into the relevant ref_* table. Provenance still matters:
- If the value comes from the referenced standard/source, note it
(
-- src: S008for a transport mode, ISO code, etc.). - If it is an illustrative sample you chose, note
-- inferred sample. - Standard code lists (ISO 3166/4217, HS, UN/LOCODE) are seeded as representative samples, not exhaustive catalogues — say so.
See reference/patterns.sql for copy-paste templates.
Generating a declaration
Follow the e2e ordering so foreign keys resolve:
trader(+trader_role) for any new parties,sys_userif needed.- (optional)
manifest→bill_of_lading→container→manifest_cargo_item. declaration(header) →declaration_item(lines).valuation_note+item_value_note(apportion freight/insurance to item CIF).declaration_tax_lineper item per tax (base · rate · amount).declaration_attached_document,declaration_previous_document(write-off).declaration_status_historytransitions;selectivity_result+inspection_actif not GREEN;payment+receipt; finalUPDATE declaration SET status_id = released.
The bundled reference/patterns.sql has a minimal but complete declaration
template you can duplicate and vary (different HS codes, item counts, values,
lane). Change the trader_reference / registration_number for each new one so
they stay unique.
Verify after seeding
Re-run the balance check (or the customs-validate skill):
SET search_path TO asycuda, public;
SELECT d.registration_number,
(SELECT sum(tl.tax_amount) FROM declaration_item di
JOIN declaration_tax_line tl ON tl.declaration_item_id = di.id
WHERE di.declaration_id = d.id) AS assessed,
(SELECT sum(amount) FROM payment WHERE declaration_id = d.id) AS paid
FROM declaration d;
Don't
- Don't invent real trader identities or real TINs — use obviously-synthetic names/ids for sample data.
- Don't disable constraints to force a load — if an insert fails, fix the data.