DEV Community

iCustoms
iCustoms

Posted on

Modelling the TSS At-Risk Decision Logic in Pseudocode

The TSS at-risk decision logic can be modelled as an ordered set of rules. Hard stops come first and always return at risk. The duty-rate test comes next and can return not at risk without any authorisation. UKIMS conditions follow. Anything left over is at risk and pays the applicable EU rate of duty.

The inputs the decision needs

If you build or maintain tools that prepare GB to NI declarations, these are the fields the rules depend on:

  • origin: GB_FREE_CIRCULATION or OUTSIDE_EU_UK
  • eu_rate and uk_rate: duty rates, compared in percentage points
  • processed_in_ni: whether the goods will be processed in Northern Ireland before sale or use
  • processing_condition_met: turnover under £2 million, quota sheepmeat, poultry or beef, or an approved purpose
  • trade_remedies: whether EU trade remedies such as anti-dumping or countervailing duty apply
  • importer_holds_ukims and uk_end_consumer ## The decision function

The order below follows the TSS at-risk decision rules published by iCustoms.

def at_risk_status(g):
    # Hard stops: UKIMS cannot offset these
    if g.trade_remedies:
        return "AT_RISK"
    if g.processed_in_ni and not g.processing_condition_met:
        return "AT_RISK"
    if g.origin == "OUTSIDE_EU_UK" and (g.eu_rate - g.uk_rate) > 3:
        return "AT_RISK"

    # Duty-rate test: no authorisation needed
    if g.origin == "GB_FREE_CIRCULATION" and g.eu_rate == 0:
        return "NOT_AT_RISK"
    if g.origin == "OUTSIDE_EU_UK" and g.uk_rate >= g.eu_rate - 3:
        return "NOT_AT_RISK"

    # UKIMS route
    if g.importer_holds_ukims and g.uk_end_consumer:
        return "NOT_AT_RISK"

    return "AT_RISK"
Enter fullscreen mode Exit fullscreen mode

Image suggestion: Image 3, Two Routes to Not at Risk
Alt text: Flow showing the duty-rate test and UKIMS authorisation as two routes to not at risk, with processing and trade remedy blocks

Mapping the result to duty

def duty_basis(g, status):
    if status == "AT_RISK":
        return "Applicable EU rate"
    if g.origin == "GB_FREE_CIRCULATION":
        return "No duty"
    return "UK duty"
Enter fullscreen mode Exit fullscreen mode

Where TSS fits in the workflow

TSS does not run this logic for you. It is where the result is declared, using the Additional Information code, and where the Trader Goods Profile and IMMI or declaration data come together. The judgement and the evidence behind it stay with the trader.

That evidence means commercial receipts and invoices, VAT invoices, commercial contracts and, where relevant, Northern Ireland end-use declarations, kept for five years and accessible in the UK.

A note on scope

This is a simplified model to show the rule order. It explains the logic; it does not replace a proper assessment of each movement.

Building GB to NI declaration workflows and want to see how iCustoms approaches them? Watch a demo.

Top comments (0)