Financial statement extraction with normalization and standardization.
Three output views for each statement (:view option): :as-reported - raw XBRL observations for the statement's concepts, exactly as filed; no deduplication, no label mapping :normalized - (default) fallback chains map variant tags to canonical labels; restatements deduplicated by most-recent-filed :standardized - :normalized plus derived line items imputed from arithmetic identities (e.g. Gross Profit = Revenue - Cost of Revenue). Derived rows carry :method :derived and :derived-from for auditability.
Concept fallback chains: each line item is a vector of concept names tried in order; the first one present in the facts data wins. Chains are loaded from EDN files under resources/edgar/concepts/ and exposed as public vars, so power users can inspect them or pass their own via :concepts.
Industry routing: banks (SIC 6000-6199, 6712) and insurers (SIC 6300-6399, 6411) use fundamentally different income statement line items. When no explicit :industry or :concepts is given, income-statement auto-routes on the company's SIC code. Pass :industry :standard to force generic chains.
Duration vs instant: Income statement + cash flow -> duration observations (row has :start date) Balance sheet -> instant observations (row has no :start date)
Point-in-time / look-ahead-safe mode: Pass :as-of "YYYY-MM-DD" to any public function to restrict to filings where :filed <= as-of-date. Without :as-of the latest restated value is returned (always-latest behaviour).
Quarterly and LTM derivation (10-Q only, flow variables only): :duration-months - 3/6/9/12 classification of the observation window :val-q - single-quarter value. Derived from actual period dates: a ~3-month row is used as-is; a YTD row minus the YTD row one quarter shorter (same fiscal-year start) yields the quarter ending at the longer row's end. The SEC :fy/:fp fields are deliberately NOT used — they describe the filing, not the observation, and collide across comparative periods. :val-ltm - last-twelve-months: sum of four consecutive derived quarters matched on period-end dates (±14 days tolerance for 52/53-week fiscal calendars). 10-K annual rows participate in the derivation so that Q4 = FY - 9M YTD.
Unmapped-concept logging: every statement call records us-gaap concepts in the company's facts that no active chain matched. See unmapped-concepts, clear-unmapped-concepts!, save-unmapped-concepts!.
Financial statement extraction with normalization and standardization.
Three output views for each statement (:view option):
:as-reported - raw XBRL observations for the statement's concepts,
exactly as filed; no deduplication, no label mapping
:normalized - (default) fallback chains map variant tags to canonical
labels; restatements deduplicated by most-recent-filed
:standardized - :normalized plus derived line items imputed from
arithmetic identities (e.g. Gross Profit = Revenue -
Cost of Revenue). Derived rows carry :method :derived
and :derived-from for auditability.
Concept fallback chains: each line item is a vector of concept names tried
in order; the first one present in the facts data wins. Chains are loaded
from EDN files under resources/edgar/concepts/ and exposed as public vars,
so power users can inspect them or pass their own via :concepts.
Industry routing: banks (SIC 6000-6199, 6712) and insurers (SIC 6300-6399,
6411) use fundamentally different income statement line items. When no
explicit :industry or :concepts is given, income-statement auto-routes on
the company's SIC code. Pass :industry :standard to force generic chains.
Duration vs instant:
Income statement + cash flow -> duration observations (row has :start date)
Balance sheet -> instant observations (row has no :start date)
Point-in-time / look-ahead-safe mode:
Pass :as-of "YYYY-MM-DD" to any public function to restrict to filings
where :filed <= as-of-date. Without :as-of the latest restated value is
returned (always-latest behaviour).
Quarterly and LTM derivation (10-Q only, flow variables only):
:duration-months - 3/6/9/12 classification of the observation window
:val-q - single-quarter value. Derived from actual period dates:
a ~3-month row is used as-is; a YTD row minus the YTD row one
quarter shorter (same fiscal-year start) yields the quarter
ending at the longer row's end. The SEC :fy/:fp fields are
deliberately NOT used — they describe the filing, not the
observation, and collide across comparative periods.
:val-ltm - last-twelve-months: sum of four consecutive derived quarters
matched on period-end dates (±14 days tolerance for 52/53-week
fiscal calendars). 10-K annual rows participate in the
derivation so that Q4 = FY - 9M YTD.
Unmapped-concept logging: every statement call records us-gaap concepts in
the company's facts that no active chain matched. See unmapped-concepts,
clear-unmapped-concepts!, save-unmapped-concepts!.(balance-sheet ticker-or-cik & {:as opts})Return normalized balance sheet as a long-format dataset.
Options: :form - "10-K" (default) or "10-Q" :concepts - override balance-sheet-concepts :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized (:standardized imputes e.g. Total Liabilities, Total Equity = SE + NCI, and a derived-only "Working Capital" item) :as-of - ISO date string "YYYY-MM-DD" (default nil). When set, excludes filings where :filed > as-of-date, giving point-in-time / look-ahead-safe results.
Return normalized balance sheet as a long-format dataset.
Options:
:form - "10-K" (default) or "10-Q"
:concepts - override balance-sheet-concepts
:shape - :long (default) or :wide
:view - :normalized (default) | :as-reported | :standardized
(:standardized imputes e.g. Total Liabilities, Total Equity
= SE + NCI, and a derived-only "Working Capital" item)
:as-of - ISO date string "YYYY-MM-DD" (default nil).
When set, excludes filings where :filed > as-of-date,
giving point-in-time / look-ahead-safe results.Full EDN concept map (with metadata) for the balance sheet. Source: resources/edgar/concepts/balance-sheet.edn
Full EDN concept map (with metadata) for the balance sheet. Source: resources/edgar/concepts/balance-sheet.edn
Balance sheet fallback chains: [[label concept1 concept2 ...] ...]
Balance sheet fallback chains: [[label concept1 concept2 ...] ...]
Arithmetic identities for balance sheet imputation (:view :standardized). Working Capital is derived-only (never a reported XBRL line).
Arithmetic identities for balance sheet imputation (:view :standardized). Working Capital is derived-only (never a reported XBRL line).
Income statement concept map for banks (SIC 6000-6199, 6712). Source: resources/edgar/concepts/bank-income.edn
Income statement concept map for banks (SIC 6000-6199, 6712). Source: resources/edgar/concepts/bank-income.edn
Bank income statement fallback chains.
Bank income statement fallback chains.
(cash-flow ticker-or-cik & {:as opts})Return normalized cash flow statement as a long-format dataset.
Options: :form - "10-K" (default) or "10-Q" :concepts - override cash-flow-concepts :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized (:standardized adds a derived "Free Cash Flow" line item and imputes "D&A" for filers tagging depreciation and intangible amortization separately) :as-of - ISO date string "YYYY-MM-DD" (default nil). When set, excludes filings where :filed > as-of-date, giving point-in-time / look-ahead-safe results.
For 10-Q queries, long-format output includes :duration-months, :val-q (single-quarter value) and :val-ltm (trailing twelve months) columns derived from actual period-date windows.
Return normalized cash flow statement as a long-format dataset.
Options:
:form - "10-K" (default) or "10-Q"
:concepts - override cash-flow-concepts
:shape - :long (default) or :wide
:view - :normalized (default) | :as-reported | :standardized
(:standardized adds a derived "Free Cash Flow" line item
and imputes "D&A" for filers tagging depreciation and
intangible amortization separately)
:as-of - ISO date string "YYYY-MM-DD" (default nil).
When set, excludes filings where :filed > as-of-date,
giving point-in-time / look-ahead-safe results.
For 10-Q queries, long-format output includes :duration-months, :val-q
(single-quarter value) and :val-ltm (trailing twelve months) columns
derived from actual period-date windows.Full EDN concept map (with metadata) for the cash flow statement. Source: resources/edgar/concepts/cash-flow.edn
Full EDN concept map (with metadata) for the cash flow statement. Source: resources/edgar/concepts/cash-flow.edn
Cash flow fallback chains: [[label concept1 concept2 ...] ...]
Cash flow fallback chains: [[label concept1 concept2 ...] ...]
Arithmetic identities for cash flow imputation (:view :standardized). Free Cash Flow is a derived-only item (never reported directly in XBRL). D&A is imputed for filers that tag depreciation and intangible amortization separately (e.g. MSFT, IBM) instead of a combined tag.
Arithmetic identities for cash flow imputation (:view :standardized). Free Cash Flow is a derived-only item (never reported directly in XBRL). D&A is imputed for filers that tag depreciation and intangible amortization separately (e.g. MSFT, IBM) instead of a combined tag.
(clear-unmapped-concepts!)Reset the unmapped-concept registry.
Reset the unmapped-concept registry.
(concepts-for statement & {:keys [industry] :or {industry :standard}})Return the active concept chains for a statement, for inspection/extension. statement: :income | :balance | :cash-flow Options: :industry - :standard (default) | :bank | :insurance (income only) Returns {:chains [[label c1 c2 ...] ...] :meta <EDN map metadata>}
Return the active concept chains for a statement, for inspection/extension.
statement: :income | :balance | :cash-flow
Options:
:industry - :standard (default) | :bank | :insurance (income only)
Returns {:chains [[label c1 c2 ...] ...] :meta <EDN map metadata>}(get-financials ticker-or-cik
&
{:keys [form shape as-of view industry]
:or {form "10-K" shape :long view :normalized}})Return all three normalized statements for a company.
Returns {:income-statement ds :balance-sheet ds :cash-flow ds}
Options: :form - "10-K" (default) or "10-Q" :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized :industry - :standard | :bank | :insurance (income statement only; auto-detected from SIC when omitted) :as-of - ISO date string "YYYY-MM-DD" (default nil). All three statements use point-in-time deduplication: filings where :filed > as-of-date are excluded.
For 10-Q queries, long-format income and cash flow include :val-q and :val-ltm columns. Balance sheet is unaffected (instant observations).
Return all three normalized statements for a company.
Returns {:income-statement ds :balance-sheet ds :cash-flow ds}
Options:
:form - "10-K" (default) or "10-Q"
:shape - :long (default) or :wide
:view - :normalized (default) | :as-reported | :standardized
:industry - :standard | :bank | :insurance (income statement only;
auto-detected from SIC when omitted)
:as-of - ISO date string "YYYY-MM-DD" (default nil).
All three statements use point-in-time deduplication:
filings where :filed > as-of-date are excluded.
For 10-Q queries, long-format income and cash flow include :val-q and
:val-ltm columns. Balance sheet is unaffected (instant observations).(income-statement ticker-or-cik & {:as opts})Return normalized income statement as a long-format dataset.
Options: :form - "10-K" (default) or "10-Q" :concepts - override the fallback chains (disables industry routing) :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized :as-reported skips dedup and label mapping entirely; :standardized additionally imputes missing line items from arithmetic identities (rows carry :method :derived) :industry - :standard | :bank | :insurance. When omitted, auto-detected from the company's SIC code (banks and insurers get industry-specific chains) :as-of - ISO date string "YYYY-MM-DD" (default nil). When set, excludes filings where :filed > as-of-date, giving point-in-time / look-ahead-safe results suitable for backtesting and event studies.
For 10-Q queries, long-format output includes :duration-months, :val-q (single-quarter value) and :val-ltm (trailing twelve months) columns derived from actual period-date windows.
Return normalized income statement as a long-format dataset.
Options:
:form - "10-K" (default) or "10-Q"
:concepts - override the fallback chains (disables industry routing)
:shape - :long (default) or :wide
:view - :normalized (default) | :as-reported | :standardized
:as-reported skips dedup and label mapping entirely;
:standardized additionally imputes missing line items from
arithmetic identities (rows carry :method :derived)
:industry - :standard | :bank | :insurance. When omitted, auto-detected
from the company's SIC code (banks and insurers get
industry-specific chains)
:as-of - ISO date string "YYYY-MM-DD" (default nil).
When set, excludes filings where :filed > as-of-date,
giving point-in-time / look-ahead-safe results suitable
for backtesting and event studies.
For 10-Q queries, long-format output includes :duration-months, :val-q
(single-quarter value) and :val-ltm (trailing twelve months) columns
derived from actual period-date windows.Full EDN concept map (with metadata) for the standard income statement. Source: resources/edgar/concepts/income-statement.edn
Full EDN concept map (with metadata) for the standard income statement. Source: resources/edgar/concepts/income-statement.edn
Income statement fallback chains: [[label concept1 concept2 ...] ...]
Income statement fallback chains: [[label concept1 concept2 ...] ...]
Arithmetic identities used by :view :standardized to impute missing income statement line items. Applied per [unit start end] period group, only when the target is absent and all operands are present.
Arithmetic identities used by :view :standardized to impute missing income statement line items. Applied per [unit start end] period group, only when the target is absent and all operands are present.
(industry-for-sic sic)Map a SIC code (string or number) to an industry keyword: :bank - SIC 6000-6199 or 6712 (bank holding companies) :insurance - SIC 6300-6399 or 6411 :reit - SIC 6500-6553 (no dedicated chains yet; treated as :standard) :standard - everything else (or unknown SIC)
Map a SIC code (string or number) to an industry keyword: :bank - SIC 6000-6199 or 6712 (bank holding companies) :insurance - SIC 6300-6399 or 6411 :reit - SIC 6500-6553 (no dedicated chains yet; treated as :standard) :standard - everything else (or unknown SIC)
Income statement concept map for insurers (SIC 6300-6399, 6411). Source: resources/edgar/concepts/insurance-income.edn
Income statement concept map for insurers (SIC 6300-6399, 6411). Source: resources/edgar/concepts/insurance-income.edn
Insurance income statement fallback chains.
Insurance income statement fallback chains.
(save-unmapped-concepts! & {:keys [path]})Write the unmapped-concept registry as EDN. Options: :path - output file (default ~/.edgarjure/unmapped-concepts.edn) Returns the path written.
Write the unmapped-concept registry as EDN. Options: :path - output file (default ~/.edgarjure/unmapped-concepts.edn) Returns the path written.
(unmapped-concepts & {:keys [top]})Return the unmapped-concept registry accumulated this session: {concept {:count n :first-seen "YYYY-MM-DD" :example-ciks #{...}}} Options: :top - return only the n most frequent, as a seq of [concept info] pairs
Return the unmapped-concept registry accumulated this session:
{concept {:count n :first-seen "YYYY-MM-DD" :example-ciks #{...}}}
Options:
:top - return only the n most frequent, as a seq of [concept info] pairscljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |