Repository navigation
fix(parse): count dropped facts, and keep the ones whose undeclared context the filing dates itself - #113
Merged
Conversation
…n the filing states the period A fact whose contextRef names an id the instance never declares was skipped with no warning and no count. Some Indian exchange results filings put nearly every fact under two such ids, so the model held 4 facts of 99. Every fact the walk leaves out is now counted on model.parse_report by reason and context id, logged, and shown in the load receipt and describe_filing. An undeclared context is rebuilt when the filing reports exactly one start and one end date under that id; its facts carry provenance kind "recovered_context", which the holon and TAVI projections already keep. Refs #111
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #111 (steps 1 and 2 of the plan there; umbrella #60).
A fact whose
contextRefnames an id the instance never declares was skipped into_xbrl_modelwith no warning and no count. Some NSE quarterly-results filings put nearly every fact under two such ids (OneD,FourD), so the model held 4 facts of 99.Never silent. Every fact the walk leaves out is counted on a new
model.parse_report, by reason (undeclared_context,undefined_concept,invalid_period) and context id, with a sample of the concepts. It is logged as one warning and shown in theload_filingreceipt anddescribe_filing.parse_reportisNonewhen there is nothing to say, so an ordinary filing's output is unchanged.Recovered where the filing allows it. An undeclared context is rebuilt when the filing reports exactly one
DateOfStartOfReportingPeriodand oneDateOfEndOfReportingPeriodunder that same id. The rules are narrow:A recovered fact carries
provenance.kind == "recovered_context". The holon and TAVI projections already writeFactProvenanceand their readers restore it, so the mark survives an export with no serializer change.Results
OneD, 43 underFourD)These three were run against a stub schema generated from each instance, since the NSE taxonomy is not bundled yet. Types and labels are therefore not the real ones; the fact counts, periods and entity are. A run against the real taxonomy is still wanted.
Things a reviewer should know
XbrlModel.parse_reportand theParseReport,DroppedFacts,RecoveredContexttypes. Additive;parse_reportdoes not travel through holon or TAVI, only the per-fact mark does.Four…contexts that carry a quarter's dates on a year-to-date value are left exactly as the filing declares them, and taxonomy packaging is separate. Both are on Indian filings (NSE / BSE results, Ind AS) load cleanly in xbrlkit #60's checklist._REPORTING_PERIOD_FACTS). It is a filing pattern, not a standard.Testing
tests/test_parse_contexts.py: 12 tests on synthetic instances that load offline through Arelle, covering recovery, each refusal (half a period, conflicting dates, instant concept, disagreeing entities), distinct ids, the round trip through holon and TAVI, and the receipt. Full suite: 735 collected, 733 passed, 2 skipped; ruff, format and basedpyright clean.🤖 Generated with Claude Code