DEV Community

Hasnain Qureshi
Hasnain Qureshi

Posted on Originally published at blinkshift.net

Don't Store "EEI Not Required" Until Someone Has Actually Decided

Most shipping screens can store an answer to "is an export filing required?" Far fewer store the decision. I have seen operators tick "no" and move on, while the record keeps neither the reason, nor the person who was allowed to say so, nor the commodity and value information the answer was based on.

That is a software design problem, not a small UI defect. On a high-value jewelry shipment, the same job may also be waiting on a coverage review or a credit hold. If those decisions share a single "approved" flag with the export question, a shipment can look ready to tender while an unresolved filing review is still sitting in someone's inbox.

This article is about the records I want in the system. It is not a filing determination for any shipment. Authorized business owners and filing specialists define the applicable rules, exceptions, and responsibilities. Trade.gov's AES overview describes filing requirements that include classification-based value considerations and mandatory filing circumstances. The U.S. Census Bureau maintains the Foreign Trade Regulations and related resources. A checkbox driven by one total-value test is not a complete decision model, and a software team should not pretend it is.

BlinkShift builds the software. We do not sell insurance, and we do not make the export decision that the record has to preserve.

Separate the review queue from the filing result

High-value shipping already stops work for a reason. An address that fails validation should not silently print a label. A declared value, commodity, or destination that triggers a coverage rule should go to a reviewer. Export review belongs in the same family of controls: a pending state, an owner, and a step it blocks.

I would keep two ideas apart in the schema.

First, a generic exception-review item: something about this shipment needs a person with the right permission, and the shipment may not proceed past a defined step until that item is resolved.

Second, an EEI/AES filing record: the assessment of whether filing is required, the basis for that assessment, and — only when the approved process says filing is required — the state of the filing itself. Assessment status and filing status are not the same column. "Not required" is a completed assessment. "Not yet assessed" is not.

create table shipment (
  id                       bigserial primary key,
  account_id               bigint not null,
  origin_country           char(2) not null,
  destination_country      char(2) not null,
  service_code             text,
  commodity_description    text,
  -- classification is versioned elsewhere; this is the code in force
  -- on this shipment at the time of the last assessment
  classification_code      text,
  classification_system    text,          -- e.g. schedule_b, as approved
  declared_value_amount    numeric(12,2),
  declared_value_currency  char(3),
  current_status           text not null  -- draft, in_review, ready, tendered, cancelled
);

create table review_queue_item (
  id              bigserial primary key,
  shipment_id     bigint not null references shipment(id),
  review_type     text not null,   -- coverage_eligibility, credit_hold, eei_filing, address
  status          text not null,   -- pending, in_review, resolved, needs_reassessment
  assigned_to     bigint,          -- authorized reviewer
  blocks_step     text not null,   -- label_create, tender, invoice
  opened_at       timestamptz not null default now(),
  trigger_reason  text,
  resolved_at     timestamptz,
  resolved_by     bigint
);

create table eei_filing_record (
  id                     bigserial primary key,
  shipment_id            bigint not null references shipment(id),
  -- assessment is complete only after an authorized decision
  assessment_status      text not null,  -- not_yet_assessed, in_review, required,
                                         -- not_required, exemption
  assessment_basis       text,           -- inputs and rule references actually used
  exemption_citation     text,
  reviewer_id            bigint,
  assessed_at            timestamptz,
  -- filing columns stay null until assessment_status = required
  filing_status          text,           -- not_started, submitted, accepted,
                                         -- rejected, cancelled
  provider_reference     text,           -- e.g. an ITN, when the process produces one
  classification_snapshot text,
  value_snapshot         numeric(12,2),
  value_basis            text,
  destination_snapshot   char(2),
  parties_snapshot       jsonb,
  filed_at               timestamptz,
  evidence_uri           text
);

create table shipment_change_event (
  id                     bigserial primary key,
  shipment_id            bigint not null references shipment(id),
  changed_fields         text[] not null,  -- value, commodity, classification,
                                           -- destination, parties, service
  changed_at             timestamptz not null default now(),
  changed_by             bigint,
  requires_reassessment  boolean not null
);
Enter fullscreen mode Exit fullscreen mode

The snapshots on eei_filing_record are deliberate. If the commodity classification or the value later changes, you still need to know what was assessed. Classification itself also needs a change process — codes become obsolete, and overwriting history hides what was filed — but that is a separate record. The filing row should not be treated as a live view of whatever is currently on the product master.

Do not let a prior decision ride along after a material change

The dangerous default is to copy yesterday's "not required" onto today's shipment because the operator is in a hurry and the checkbox is already ticked.

function onShipmentAmended(shipment, changedFields):
  material = {"value", "commodity", "classification",
              "destination", "parties", "service"}

  if changedFields ∩ material is empty:
    return

  record shipment_change_event(
    shipment,
    changedFields,
    requires_reassessment = true
  )

  for each open or resolved review_queue_item on shipment
      where review_type needs this field:
    set item.status = needs_reassessment
    keep item.blocks_step in force

  filing = eei_filing_record for shipment
  if filing exists and filing.assessment_status != not_yet_assessed:
    set filing.assessment_status = in_review
    clear filing.assessed_at as the current decision
    keep the previous snapshots and basis as history
      (insert a new filing record rather than overwriting,
       if you need a full audit trail)

  if shipment.current_status is ready or later:
    move shipment back to in_review
    do not request a label, or void a draft, according to
      the approved operational rule
Enter fullscreen mode Exit fullscreen mode

A few rules I would enforce in application code, not only in documentation:

  • There is no path that writes assessment_status = not_required without a reviewer, or without an approved automatic rule whose inputs are stored on the same row.
  • not_required and exemption are allowed outcomes. They are not placeholders for "we have not looked yet."
  • A successful carrier label is not evidence that the export decision is complete, and a failed label is not a reason to discard a review that already happened.
  • Coverage review, credit hold, and export review can block the same operational step, but they should remain separate queue items. One resolved item should not close the others.

Review the workflow with three cases, not one happy path

Before you call this done, walk a redacted high-value shipment through three paths with the people who actually own the process:

  1. A normal case where the approved rules produce a clear assessment and the shipment can move.
  2. A case that lacks enough commodity or value information and must sit in pending review. Confirm that the interface cannot honestly say "not required."
  3. A case that was assessed, then changed destination, classification, or value. Confirm that the earlier decision is reopened and that the first basis is still readable.

If the responsible team cannot explain the decision from the stored record, or if missing information is only noticed after the operational deadline, the schema is not finished — even if the checkbox works.

This kind of exception queue is one of the reasons teams look at software for high-value shipping workflows rather than adding another field to a label screen. Buy an existing product if it can hold the exception, including the reassessment path. Build or extend only if the unresolved filing decision still lives outside the system.

This article is a rewritten engineering treatment of a subject I first discussed for operators, originally published on Your Export Workflow Needs More Than an EEI Checkbox.


Hasnain Qureshi is co-founder of BlinkShift, which builds custom software for shipping, coverage workflows, and export documentation. BlinkShift does not sell insurance.

Top comments (0)