Skip to content

Selega documentation

Selega is a control tool for legalizing financial statements (estados contables, EECC). It takes the canonical figures of a set of statements, runs a set of numeric cross-checks against them, walks a per-jurisdiction checklist, and proposes an outcome. This page describes each part.

The flow: upload → live validation → outcome

Section titled “The flow: upload → live validation → outcome”
  1. Bring in the figures. Selega fills a canonical schema of figures spread across the statement of financial position (ESP), income statement (ER), statement of changes in equity (EEPN), cash-flow statement (EFE), annexes and notes. The schema can be filled three ways:
    • Manually, in a grid — always available.
    • By the local extraction engine — a per-format template over a PDF canvas, with per-region OCR (Tesseract) and provenance. No network, private. This is the default path.
    • By the gated AI engine — generalizes to any format but sends data to the cloud, so it is off by default and opt-in (see Gated AI below).
  2. Live validation. As figures arrive, the cross-checks run continuously. Each figure is painted green when a cross-check corroborates it, or amber when it enters a check that does not balance. The reviewer confirms; no inconsistent number passes.
  3. Checklist. Alongside the numeric checks, the jurisdiction’s checklist of formal controls is reviewed.
  4. Outcome. The decision engine aggregates the failing checks and proposes the outcome — legalize, observe, certify the signature, or deny / return.

Selega models a set of financial statements as a flat schema of figures and flags (defined in src/core/schema.js), agnostic of the PDF format they came from. The figures span:

  • ESP (financial position): total assets, total liabilities, equity, cash and banks at close and at start.
  • EEPN (changes in equity): equity at close, result for the year.
  • ER (income statement): final result.
  • EFE (cash flow): method (direct / indirect), cash at start and close, cash variation, operating / investing / financing flows, RECPAM of cash.
  • Annexes: fixed-asset depreciation for the year, depreciation in the expenses annex.
  • Notes / cover: SIPA social-security debt, company type, note on dispensing with the statutory auditor, note on negative equity.

The cross-checks are the heart of Selega. They are universal — FACPCE standards apply across the country — so the same set seeds every jurisdiction; what changes per Council is the catalog of formal controls and their consequences. They are stored as data (a JSON cross-check set in the rule-pack) and evaluated by a generic engine, so an admin can edit them from a visual builder without touching code.

The default set ships with the cross-checks below. Comparisons use a small tolerance (default of 1 currency unit) to absorb rounding. Each is either a comparison (two sides must be equal) or a presence check (a figure or note must be present under a condition). By default, every cross-check in this set carries a direct-denial consequence, but the consequence is configurable per cross-check.

#Cross-checkWhat it validates
1Accounting equation (A = P + PN)Total assets equal total liabilities plus equity (ESP).
2Equity: ESP = EEPNEquity in the ESP equals equity at close in the EEPN.
3Result: ER = EEPNFinal result of the income statement equals the result carried in the EEPN.
4Cash: ESP = EFE (close)Cash and banks at close in the ESP equal cash at close in the EFE.
5EFE variation = close − startCash variation equals cash at close minus cash at start.
5bEFE variation = Op + Inv + FinCash variation equals operating plus investing plus financing flows.
6Result: ER = EFE (indirect)Final result reconciles to the EFE result. Only when the EFE method is indirect.
7Depreciation: ER = EFE (indirect)Depreciation in the income statement equals depreciation in the EFE. Indirect method only.
8Income tax: ER = EFE (indirect)Income tax in the income statement equals income tax in the EFE. Indirect method only.
9RECPAM of cash shown in EFEA dedicated RECPAM-of-cash line is present. Only when the EFE method is direct.
10Depreciation: Fixed-asset annex = Expenses annexDepreciation for the year matches between the two annexes.
11Social security art. 10, Law 17.250The SIPA social-security debt statement is present.
12Negative-equity noteWhen equity is below zero, the required note must be present.
13Statutory-auditor-dispensation noteFor SA / SAS companies, the note dispensing with the statutory auditor (art. 284) must be present.

Each cross-check evaluates to one of four states: OK (it balances), DIFIERE (it does not balance — the figures involved are flagged amber), NA (not applicable under the current conditions, e.g. an indirect-only check when the EFE is direct) or FALTA (a required figure is missing).

Cross-checks that come back as DIFIERE are turned into observations, each carrying the consequence defined by its cross-check. The decision engine (src/core/decision.js) then computes the aggregate outcome by priority of consequence:

  • Direct denial → the work is denied / returned. If a draft fee (tasa borrador) was paid, it is instead returned to be corrected.
  • Subsanable (correctable) → returned to be corrected if a draft fee was paid; otherwise, if the professional chooses not to correct, it is legalized.
  • Certify signature → it degrades to certifying only the signature.
  • No blocking observation → it is legalized.

An urgent fee (tasa urgente) combined with any observation loses its urgent status and the work returns to the general re-entry list. The possible outcomes are: Se legaliza (legalize), Se devuelve para corregir (return to correct, draft fee), Se certifica solo la firma (certify signature only) and Se deniega / se devuelve (deny / return).

  • Selega ships a registry of Argentina’s 24 jurisdictions; each is either fully defined or a template to be completed.
  • Each Council defines its own rule-pack: the catalog of formal controls, which cross-checks are enabled, and the consequences. A jurisdiction’s locally edited rule-pack overrides the one shipped in the repo.
  • The cross-checks are universal (FACPCE standards apply nationwide); the formal controls and consequences are what vary by Council.
  • An admin picks which jurisdictions a given installation serves, and switches the active jurisdiction from the header.

Selega has five roles — agent, supervisor, auditor, admin, superadmin — with a configurable review workflow, a traffic-light inbox, and an exportable read-only case file. Access is gated both visually (disabling what a role may not do) and for real in the backend.

AI is off by default and pluggable. It can run against a local engine (Ollama, e.g. Qwen2.5-VL on CPU) or the cloud (OpenRouter), local-first. The cloud path is gated on three conditions: enabled in Admin, an API key present, and per-document authorization — because it is the only path that sends data outside the box. The API key lives server-side (stored write-only when loaded from Admin).

Selega’s state lives in PostgreSQL (the db service of the compose file, connected via DATABASE_URL). The database persists in the selega-pg volume — it is the record of legalizations, so back it up. The application container itself only reads /app and writes OCR output to /tmp.

Everything is configured by environment variables (12-factor) — see Install Selega for the full table. Operationally, the things you set are POSTGRES_PASSWORD (required), the admin email, whether you are behind TLS (SELEGA_SECURE_COOKIE), the host port, and optionally the cloud AI key (better loaded from Admin). Per-jurisdiction rules, cross-checks, the checklist and users are all edited from the Administration and System panels in the UI — no code changes required.

Vanilla JS (ES modules, no framework) · Node.js (its own HTTP server) · PostgreSQL (pg) · Docker · pdf.js / Tesseract.js / pdf-lib vendored · optional Ollama for local AI.