My App

Validation Rules

Built-in business rules for SFRS filings

SFRS includes built-in business rules that catch errors at filing time.

Balance Sheet Rules

RuleDescriptionSeverity
BAL001Total Assets = Total Liabilities + Total Stockholders' EquityError
BAL002Total Current Assets + Total Noncurrent Assets = Total AssetsError
BAL003Total Current Liabilities + Total Noncurrent Liabilities = Total LiabilitiesError

BAL001: Accounting Equation

totalAssets == totalLiabilities + totalStockholdersEquity

This is the fundamental accounting equation. Every filing must balance.

Income Statement Rules

RuleDescriptionSeverity
IS001Gross Profit = Revenue - Cost of RevenueError
IS002Operating Income = Gross Profit - Operating ExpensesError
IS003Net Income = Income Before Tax - Income Tax ExpenseWarning

IS001: Gross Profit Calculation

grossProfit == revenue - costOfRevenue

Cash Flow Rules

RuleDescriptionSeverity
CF001Net Change in Cash = Operating + Investing + FinancingError
CF002Free Cash Flow = Operating Cash Flow - CapExWarning

CF001: Cash Flow Reconciliation

netChangeInCash == netCashFromOperating + netCashFromInvesting + netCashFromFinancing

EPS Rules

RuleDescriptionSeverity
EPS001Basic EPS equals Net Income / Weighted Average SharesWarning
EPS002Diluted EPS must be less than or equal to Basic EPSWarning
EPS003Diluted Shares must be greater than or equal to Basic SharesWarning

EPS001: EPS Calculation Check

earningsPerShareBasic ~= netIncome / sharesOutstandingBasic

Allows for rounding tolerance based on decimals precision.

Dimension Rules

RuleDescriptionSeverity
DIM001Segment revenues must sum to total revenueError
DIM002Geographic revenues must sum to total revenueError

Extension Rules

RuleDescriptionSeverity
EXT001All extensions must have valid extensionApprovalIdError
EXT002extensionApprovalId must match pattern EXT-[A-Z]{2,4}-YYYY-NNNNNNError

Using the Validator

import { validateFiling } from '@sureshake/sfrs-validator';

const result = validateFiling(filing);

console.log('Valid:', result.valid);
console.log('Errors:', result.errors);
console.log('Warnings:', result.warnings);

// result.errors = [
//   {
//     code: 'BAL-001',
//     path: 'balanceSheet',
//     message: 'Total assets (6000000000) does not equal liabilities + equity (5900000000)',
//     severity: 'error'
//   }
// ]

Severity Levels

LevelDescriptionFiling Blocked?
ErrorCritical issue, filing is invalidYes
WarningPotential issue, should reviewNo
InfoInformational noticeNo

Custom Rules

The validator supports custom business rules:

import { SFRSFilingValidator } from '@sureshake/sfrs-validator';

const validator = new SFRSFilingValidator();

// Add custom rule
validator.addRule({
  id: 'CUSTOM-001',
  name: 'Revenue Growth Check',
  description: 'Revenue should not decrease by more than 50%',
  severity: 'warning',
  validate: (filing, priorFiling) => {
    if (!priorFiling) return { valid: true };
    const currentRevenue = filing.facts.revenue?.value || 0;
    const priorRevenue = priorFiling.facts.revenue?.value || 0;
    const decline = (priorRevenue - currentRevenue) / priorRevenue;
    return {
      valid: decline < 0.5,
      message: `Revenue declined by ${(decline * 100).toFixed(1)}%`
    };
  }
});

const result = validator.validate(filing);

On this page