Skip to content

Add Swiss SECO sanctions source - #3

Open
CptDeclarium wants to merge 2 commits into
arshsingh:masterfrom
CptDeclarium:feature/seco-source
Open

Add Swiss SECO sanctions source#3
CptDeclarium wants to merge 2 commits into
arshsingh:masterfrom
CptDeclarium:feature/seco-source

Conversation

@CptDeclarium

@CptDeclarium CptDeclarium commented Jul 21, 2026

Copy link
Copy Markdown

Summary

  • Add the Swiss SECO consolidated sanctions list as the seco source.
  • Extend the database source constraint and schema snapshot.
  • Document the new source in the README.
  • Import only targets whose chronologically latest effective modification is active, while retaining targets that were de-listed and later listed again.

Implementation

The worker downloads the official SECO whole-list XML from SESAM and maps its current top-level target data into the existing sanction structure:

  • Uses the stable target SSID as source_id.
  • Maps individuals, entities, aircraft, and vessels to existing target types.
  • Builds names and aliases from ordered name parts, including coherent language and script spelling variants.
  • Combines justification and other-information fields into remarks.
  • Uses effective, publication, or enactment date for listed_on when available.
  • Determines current status from the latest effective-date rather than XML element order, because the live feed emits modification history newest-first.
  • Conservatively excludes legacy undated histories containing a de-listing.
  • Rejects unsupported SECO object types instead of silently omitting or misclassifying them.

The migration permits seco in the sanctions source constraint and removes SECO sanctions and source status during rollback.

Validation

Validation was rerun on 23 July 2026 using the PR head and, separately, the clean combined tree with PR #4:

  • Ran four focused status-history tests covering an active legacy listing, a current de-listing, a later re-listing, and an undated legacy de-listing.
  • Downloaded and transformed the live official SECO whole-list feed through the implemented request and parser path.
  • Confirmed the result contained 7,053 active entries with 7,053 unique source IDs.
  • Cleanly merged the heads of PR Add Swiss SECO sanctions source #3 and PR Keep sanction snapshots in sync #4 in a temporary worktree and ran all six tests successfully.
  • Loaded the combined real schema into a disposable PostgreSQL 17 instance and inserted all 7,053 active SECO entries.
  • Deliberately corrupted one stored SECO row and inserted a stale sentinel row, then resynchronized the same live snapshot. The original fields were restored, the stale row was deleted, the row count returned to 7,053, and the existing UUID and created_at remained unchanged.
  • Confirmed an empty snapshot does not erase the stored SECO data.

This gives confidence that active-status selection works on both representative histories and the current upstream feed, and that the result integrates cleanly with the snapshot reconciliation in PR #4.

Related PR

PR #4 provides generic database snapshot reconciliation. The PRs are based independently on master, modify separate files, and GitHub plus a local three-way merge report them clean and mergeable in either order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant