cadrumo.domain.calculations.registry.period_offset_math module¶
Period-offset arithmetic shared by previous-filing and relation binding helpers.
Supports quarterly (1T..``4T``), pago-fraccionado (1P..``3P``), and
zero-padded monthly (01..``12``) period codes. Offsets wrap across
calendar-year boundaries and return the derived period plus the relative year
delta.
See also
cadrumo.domain.calculations.registry.bindings_previous_filingPrevious-filing selectors that derive target-relative source period anchors.
cadrumo.domain.calculations.registry.relationsRelation source requirements that use the same offset arithmetic.
- apply_period_offset(offset, *, target_period)[source]¶
Apply an integer period offset to a target period code.
Returns
(year_delta, derived_period)whereyear_deltais the number of calendar years by which the derived period precedes or follows the target year (negative = prior year, positive = following year). The tuple is consumed by previous-filing andRelationPrefillProvidersource_period_offset_from_targetresolution.
- same_ejercicio_prior_quarter_anchors(target_period)[source]¶
Return the same-ejercicio periods strictly preceding
target_period.The Modelo 130 cumulative carry needs every prior quarter from the current ejercicio, while Modelo 202’s prior-installment carry applies the same expanding-span rule to
1Pthrough3P. Derive both sequences by repeatedly applying the canonical offset authority, stopping precisely at the prior-year boundary. The returned anchors therefore always carry a zero year delta and are ordered from earliest to latest prior period.