The year field points at the filing, not the period
In the SEC's company facts data, fy is the year of the filing. A FY2025 10-K also reports FY2023 and FY2024, and all three carry fy=2025.
Fix: ignore fy and match every number on its period end date, keeping only 10-K figures that cover 340 to 380 days.
Old years get restated
The same period shows up in several filings, sometimes with different values after a restatement.
Fix: the most recently filed value wins, and each number keeps its accession number so you can trace it.
Companies label the same line differently
Revenue alone has at least six common tags, and companies switch over time. Ensign moved its capex to a company-specific tag after 2019, which the SEC's standardized feed leaves out.
Fix: a ranked list of tags for each line, the largest value for revenue, derived values where a line is missing, and a clear warning when the tool falls back.
Debt is split in different ways
Some companies report current and long-term debt separately. Others report a total that already includes the current portion.
Fix: assemble debt from its parts based on which layout the company uses, so nothing is counted twice.