Skip to content

feat(adapters): read a filing from its Project Tavi compiled model - #50

Merged
jfrench9 merged 1 commit into
mainfrom
feature/tavi-adapter
Sep 6, 2026
Merged

jfrench9 merged 1 commit into
mainfrom
feature/tavi-adapter

Conversation

@jfrench9

@jfrench9 jfrench9 commented Sep 6, 2026

Copy link
Copy Markdown
Member

Summary

Read a filing from its tavi.json: the Project Tavi compiled model (XBRL International, PWD 2026-09-01) that xbrlkit writes beside every holon, and that the SEC pipeline now publishes per filing on the public CDN. With this the library renders both of xbrlkit's JSON projections, and a consumer can take either file through one sniffing entry. There is no RDF step, so a full 10-K parses in tens of milliseconds where the holon's JSON-LD expansion takes hundreds.

Changes

  • Adapter — src/adapters/tavi.ts: parseTavi(doc) (synchronous), taviFileAdapter, isTaviDocument. Concepts are typed from their Tavi datatype and xbrla:balance; share counts, which have no built-in Tavi type, are recognized from the xbrla:shares unit their facts carry. Headings, axes, domain classes and members become abstract elements with role tags stripped. Units include composites (iso4217:USD/xbrla:shares). Facts carry explicit and typed dimensions with labels. Each presentation network is a section whose fact set is the network; a fact belongs to every network that presents its concept (the SEC adapter's rule per structure), and the pivot's dimensional scope does the rest. Sections take their title, kind and order from the group's role definition label (9952153 - Statement - …). Presentation arcs resolve their preferred label to its text and keep the label type as the role; calculation arcs carry xbrl:weight. Periods normalize to the holon's inclusive dates from either the current exclusive-end dateTime form or the older date form.
  • Adapter — src/adapters/detect.ts: detectReportFormat(doc) → 'holon' | 'tavi' | null and parseReportDocument(doc), which dispatches to parseJsonld or parseTavi.
  • Exports — adapters/index.ts adds the five names above and the TaviDocument / ReportFormat types. README lists the adapter.
  • Engine, components — untouched. No source-specific branch anywhere below the adapter seam.

Consumer Impact

ADDITIVE. New exports only; nothing existing changes. No rendered number changes for any existing source.

For a Tavi-loaded report specifically: the same statements render as from the holon of the same filing (checked on 3M FY2024 and Workday FY2025: five primary statements each, same columns), and reportSections / buildPivots behave identically. Two things a consumer of the Tavi path should know: there is no RDF store, so anything that queried the holon's graph (the viewer's SPARQL chat) has nothing to query; and text blocks arrive inline (the CDN's holon carries them as URLs, its Tavi does not).

Testing

npm run test:all passes: 129 tests in 15 files (16 new), format, lint, typecheck and build. Fixtures: a hand-built model in the current emitter's form covering every mapping above (test/tavi.test.ts), and test/fixtures/mmm-fy2024-statements.tavi.json, the balance sheet and income statement of 3M's FY2024 10-K trimmed from a real xbrlkit output (231 KB), which the tests parse, section and pivot to known cell values. Also run once against two full filings on disk (3M FY2024 with date periods, Workday FY2025 with dateTime periods): every primary statement renders, no fact unassigned, parse 23 ms and 10 ms.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TBKj1VsfBpKsFY7PPcrCFu

A `tavi.json` is xbrlkit's second JSON projection of a filing beside the
holon: the taxonomy and report objects of XBRL International's Tavi draft
(PWD 2026-09-01) in one resolved document. `parseTavi` walks it straight
into the normalized report — concepts typed from their datatype and balance
(share counts from the unit their facts carry), headings, axes and members
as abstract elements, units with composites, facts with explicit and typed
dimensions, and one section per presentation network titled and ordered by
its group's role definition, a fact belonging to every network that presents
its concept. Preferred labels resolve to their text; calculation weights
ride along. Periods land as the holon's human dates whether the emitter
wrote exclusive-end dateTimes or inclusive dates.

`parseReportDocument` sniffs a holon from a Tavi so a consumer can take
either file through one door. No RDF step: a full 10-K parses in tens of
milliseconds where the holon's expansion takes hundreds.

Claude-Session: https://claude.ai/code/session_01TBKj1VsfBpKsFY7PPcrCFu
@jfrench9

jfrench9 commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

@claude please review this PR

@jfrench9
jfrench9 merged commit 78730c2 into main Sep 6, 2026
5 checks passed
@jfrench9
jfrench9 deleted the feature/tavi-adapter branch September 6, 2026 02:42
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