aeat.domain.contribuyente._marriage_facts module

Helpers for persisting and reloading marriage_date as profile facts.

marriage_date is stored as a single profile fact under renta_taxpayer.marriage_date. Three derived integer facts are stored alongside it so the registry binding resolver can look them up by a simple profile_key selector without a date-channel binding:

renta_taxpayer.marriage_date ISO-8601 date string renta_taxpayer.marriage_month_start month int (1-12) when year == filing_year renta_taxpayer.marriage_month_end 12 (always, when married) renta_taxpayer.marriage_full_year 1 when date.year < filing_year, else 0

When marital_status != 2 (CASADO) no marriage_date is stored.

The derived fact paths exposed here are consumed by registry bindings:

renta-20XX-profile-marriage-month-start → casilla 0246 renta-20XX-profile-marriage-month-end → casilla 0247 renta-20XX-profile-marriage-full-year → casilla 0245

marriage_full_year(marriage_date, filing_year)[source]

True when the marriage predates the filing year (vigente todo el año).

Return type:

bool

Parameters:
  • marriage_date (date)

  • filing_year (int)

marriage_month_start(marriage_date, filing_year)[source]

Return the first month married in filing_year, or None when full-year.

When the marriage occurred before the filing year the form’s casilla 0246 is left at 1 (the standard primer-mes for a full-year marriage). When the marriage occurred during the filing year the actual month is returned. When the marriage occurred after the filing year (future date) None is returned and no fact is written.

Return type:

int | None

Parameters:
  • marriage_date (date)

  • filing_year (int)

marriage_derived_facts(marriage_date, filing_year)[source]

Return (path, canonical-value-string) pairs for all marriage facts.

The caller converts these to domain.user_profile.UserProfileFact records. All four facts are always emitted when a marriage_date is present; downstream binding resolution ignores facts that no formula consumes.

Return type:

list[tuple[str, str]]

Parameters:
  • marriage_date (date)

  • filing_year (int)

marriage_date_from_facts(facts)[source]

Reconstruct the marriage date from a flat profile-fact dict.

Returns None when renta_taxpayer.marriage_date is absent.

Return type:

date | None

Parameters:

facts (dict[str, str])

parse_marriage_date_flag(raw)[source]

Parse a --taxpayer-marriage-date YYYY-MM-DD flag value.

Returns a validated datetime.date. Raises ValueError on invalid ISO-8601 format.

Return type:

date

Parameters:

raw (str)