Expand description
Workspace-internal shared types and utilities.
Contains fiscal-period parsing, sort-rank helpers, and the canonical set of CSV column names written by the data pipeline. This crate has no external dependencies and is not published to crates.io.
§Fiscal-period sorting
The SEC’s fp field on EDGAR observations uses a variety of tokens to
label fiscal periods: "Q1", "FY", "H1", "SA2", "6M", etc.
parse_period_slot_token normalises all of them into a comparable
integer rank so that rows can be sorted newest-first without a
hardcoded lookup table.
Enums§
- Period
- A parsed fiscal period — either a specific year+quarter or a bare year.
- Period
Slot - Canonical period-slot categories parsed from raw fiscal-period labels.
Constants§
- US_
GAAP_ CSV_ META_ COLUMNS - Ordered metadata columns present in every per-symbol US-GAAP CSV file.
Functions§
- extract_
first_ year - Extracts the first 4-digit year (1900–2100) from a string.
- normalize_
fp_ label - Normalises a raw SEC
fptoken to its canonical CSV label. - normalize_
symbol - Returns the set of candidate ticker symbols that a raw input string might
resolve to, normalised to uppercase and with
./-variants generated. - parse_
period - Parses a raw period string into a
Period. - parse_
period_ slot - Parses a raw fiscal-period token into a canonical
PeriodSlot. - parse_
period_ slot_ token - Returns the normalised quarter rank (1–4) for a raw fiscal-period token,
or
Noneif the token is not recognised. - parse_
quarter_ token - Extracts a quarter number (1–4) from tokens like
"Q1","Q3". ReturnsNonefor anything outside that range or without aQprefix.