Skip to content

feat(regulatory): seed-regulatory-actions.mjs — classify + Redis write #2493

@koala73

Description

@koala73

Context

Part of the Regulatory RSS pipeline. Builds on #2492 (fetch + parse layer).

This is task 2/4.

What to build

Add tier classification and Redis write to scripts/seed-regulatory-actions.mjs.

Tier classification — keyword match on title

const HIGH_KEYWORDS = [
  'enforcement', 'charges', 'charged', 'fraud', 'failure', 'failed bank',
  'emergency', 'halt', 'suspension', 'suspended', 'cease', 'desist',
  'penalty', 'fine', 'fined', 'settlement', 'indictment', 'manipulation',
  'ban', 'revocation', 'insolvency',
];

const MEDIUM_KEYWORDS = [
  'proposed rule', 'final rule', 'rulemaking', 'guidance', 'warning',
  'notice', 'advisory', 'review', 'examination', 'investigation',
  'stress test', 'capital requirement', 'disclosure requirement',
];
// Everything else → 'low'

Output payload written to regulatory:actions:v1

{
  "actions": [
    {
      "id": "sec-enforcement-xyz-corp-20260329",
      "agency": "SEC",
      "title": "SEC Charges XYZ Corp with Accounting Fraud",
      "link": "https://www.sec.gov/...",
      "publishedAt": "2026-03-29T14:00:00Z",
      "tier": "high",
      "matchedKeywords": ["charges", "fraud"]
    }
  ],
  "fetchedAt": 1711718400000,
  "recordCount": 12,
  "highCount": 2,
  "mediumCount": 4
}

runSeed integration

  • Redis key: regulatory:actions:v1
  • TTL: 7200 (2h — matches cron cadence with 1× buffer)
  • validateFn: data => Array.isArray(data?.actions) (empty array is valid — no regulatory actions today is fine)
  • Domain: 'regulatory', name: 'actions'

Acceptance criteria

  • HIGH/MEDIUM/LOW classification correct for sample titles
  • matchedKeywords array populated for each action
  • Payload shape matches spec above
  • runSeed() wired with correct TTL and validate function
  • Empty actions array does not fail validation

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: AI/intelAI analysis, intelligence findings, summarizationarea: feedsRSS feeds, news aggregationarea: marketsMarkets, commodities, crypto, financeenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions