netto.data_loader

Data loader for tax and social security data.

This module loads tax data from JSON files and provides validation using Pydantic models. All data is organized in individual yearly files for better maintainability and auditability.

The loaded data is exposed as module-level variables for easy import: - tax_curve: Tax brackets by year - social_security_curve: Social security rates by year - soli_curve: Solidarity tax parameters by year - correction_factor_pensions: Pension deduction factors by year

Attributes

DATA_DIR

tax_curve

social_security_curve

soli_curve

correction_factor_pensions

Classes

TaxBracket

!!! abstract "Usage Documentation"

TaxCurve

!!! abstract "Usage Documentation"

SocialSecurityEntry

!!! abstract "Usage Documentation"

SocialSecurity

!!! abstract "Usage Documentation"

SoliCurve

!!! abstract "Usage Documentation"

PensionFactor

!!! abstract "Usage Documentation"

Functions

load_tax_curve(→ dict[int, dict])

Load tax curve for a specific year.

load_social_security(→ dict)

Load social security data for a specific year.

load_soli(→ dict)

Load solidarity tax data for a specific year.

load_pension_factor(→ float)

Load pension correction factor for a specific year.

load_all_tax_curves(→ dict[int, dict[int, dict]])

Load tax curves for all available years.

load_all_social_security(→ dict[int, dict])

Load social security data for all available years.

load_all_soli(→ dict[int, dict])

Load solidarity tax data for all available years.

load_all_pension_factors(→ dict[int, float])

Load pension correction factors for all available years.

Module Contents

netto.data_loader.DATA_DIR[source]
class netto.data_loader.TaxBracket(/, **data: Any)[source]

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation”

[Models](../concepts/models.md)

A base class for creating Pydantic models.

__class_vars__[source]

The names of the class variables defined on the model.

__private_attributes__[source]

Metadata about the private attributes of the model.

__signature__[source]

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__[source]

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__[source]

The core schema of the model.

__pydantic_custom_init__[source]

Whether the model has a custom __init__ function.

__pydantic_decorators__[source]

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__[source]

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__[source]

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__[source]

The name of the post-init method for the model, if defined.

__pydantic_root_model__[source]

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__[source]

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__[source]

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__[source]

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__[source]

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__[source]

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__[source]

The names of fields explicitly set during instantiation.

__pydantic_private__[source]

Values of private attributes set on the model instance.

step: float = None[source]
rate: float = None[source]
const: list[float] | None = None[source]
classmethod validate_const_length(v, info)[source]
class netto.data_loader.TaxCurve(/, **data: Any)[source]

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation”

[Models](../concepts/models.md)

A base class for creating Pydantic models.

__class_vars__[source]

The names of the class variables defined on the model.

__private_attributes__[source]

Metadata about the private attributes of the model.

__signature__[source]

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__[source]

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__[source]

The core schema of the model.

__pydantic_custom_init__[source]

Whether the model has a custom __init__ function.

__pydantic_decorators__[source]

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__[source]

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__[source]

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__[source]

The name of the post-init method for the model, if defined.

__pydantic_root_model__[source]

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__[source]

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__[source]

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__[source]

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__[source]

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__[source]

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__[source]

The names of fields explicitly set during instantiation.

__pydantic_private__[source]

Values of private attributes set on the model instance.

year: int = None[source]
brackets: dict[str, TaxBracket] = None[source]
classmethod validate_brackets(v)[source]
class netto.data_loader.SocialSecurityEntry(/, **data: Any)[source]

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation”

[Models](../concepts/models.md)

A base class for creating Pydantic models.

__class_vars__[source]

The names of the class variables defined on the model.

__private_attributes__[source]

Metadata about the private attributes of the model.

__signature__[source]

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__[source]

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__[source]

The core schema of the model.

__pydantic_custom_init__[source]

Whether the model has a custom __init__ function.

__pydantic_decorators__[source]

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__[source]

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__[source]

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__[source]

The name of the post-init method for the model, if defined.

__pydantic_root_model__[source]

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__[source]

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__[source]

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__[source]

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__[source]

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__[source]

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__[source]

The names of fields explicitly set during instantiation.

__pydantic_private__[source]

Values of private attributes set on the model instance.

limit: float = None[source]
rate: float = None[source]
extra: float | None = None[source]
class netto.data_loader.SocialSecurity(/, **data: Any)[source]

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation”

[Models](../concepts/models.md)

A base class for creating Pydantic models.

__class_vars__[source]

The names of the class variables defined on the model.

__private_attributes__[source]

Metadata about the private attributes of the model.

__signature__[source]

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__[source]

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__[source]

The core schema of the model.

__pydantic_custom_init__[source]

Whether the model has a custom __init__ function.

__pydantic_decorators__[source]

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__[source]

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__[source]

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__[source]

The name of the post-init method for the model, if defined.

__pydantic_root_model__[source]

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__[source]

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__[source]

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__[source]

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__[source]

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__[source]

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__[source]

The names of fields explicitly set during instantiation.

__pydantic_private__[source]

Values of private attributes set on the model instance.

year: int = None[source]
pension: SocialSecurityEntry[source]
unemployment: SocialSecurityEntry[source]
health: SocialSecurityEntry[source]
nursing: SocialSecurityEntry[source]
class netto.data_loader.SoliCurve(/, **data: Any)[source]

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation”

[Models](../concepts/models.md)

A base class for creating Pydantic models.

__class_vars__[source]

The names of the class variables defined on the model.

__private_attributes__[source]

Metadata about the private attributes of the model.

__signature__[source]

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__[source]

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__[source]

The core schema of the model.

__pydantic_custom_init__[source]

Whether the model has a custom __init__ function.

__pydantic_decorators__[source]

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__[source]

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__[source]

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__[source]

The name of the post-init method for the model, if defined.

__pydantic_root_model__[source]

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__[source]

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__[source]

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__[source]

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__[source]

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__[source]

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__[source]

The names of fields explicitly set during instantiation.

__pydantic_private__[source]

Values of private attributes set on the model instance.

year: int = None[source]
start_taxable_income: float = None[source]
start_fraction: float = None[source]
end_rate: float = None[source]
class netto.data_loader.PensionFactor(/, **data: Any)[source]

Bases: pydantic.BaseModel

!!! abstract “Usage Documentation”

[Models](../concepts/models.md)

A base class for creating Pydantic models.

__class_vars__[source]

The names of the class variables defined on the model.

__private_attributes__[source]

Metadata about the private attributes of the model.

__signature__[source]

The synthesized __init__ [Signature][inspect.Signature] of the model.

__pydantic_complete__[source]

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__[source]

The core schema of the model.

__pydantic_custom_init__[source]

Whether the model has a custom __init__ function.

__pydantic_decorators__[source]

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__[source]

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__[source]

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__[source]

The name of the post-init method for the model, if defined.

__pydantic_root_model__[source]

Whether the model is a [RootModel][pydantic.root_model.RootModel].

__pydantic_serializer__[source]

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__[source]

The pydantic-core SchemaValidator used to validate instances of the model.

__pydantic_fields__[source]

A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.

__pydantic_computed_fields__[source]

A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.

__pydantic_extra__[source]

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_fields_set__[source]

The names of fields explicitly set during instantiation.

__pydantic_private__[source]

Values of private attributes set on the model instance.

year: int = None[source]
factor: float = None[source]
netto.data_loader.load_tax_curve(year: int) dict[int, dict][source]

Load tax curve for a specific year.

Parameters:

year (int) – Tax year to load

Returns:

Tax curve data as dictionary with integer keys (0-3)

Return type:

dict

Examples

>>> curve = load_tax_curve(2022)
>>> curve[0]['step']
10347
netto.data_loader.load_social_security(year: int) dict[source]

Load social security data for a specific year.

Parameters:

year (int) – Tax year to load

Returns:

Social security data

Return type:

dict

Examples

>>> social_sec = load_social_security(2022)
>>> social_sec['pension']['limit']
84600
netto.data_loader.load_soli(year: int) dict[source]

Load solidarity tax data for a specific year.

Parameters:

year (int) – Tax year to load

Returns:

Soli data

Return type:

dict

Examples

>>> soli = load_soli(2022)
>>> soli['end_rate']
0.055
netto.data_loader.load_pension_factor(year: int) float[source]

Load pension correction factor for a specific year.

Parameters:

year (int) – Tax year to load

Returns:

Pension correction factor

Return type:

float

Examples

>>> factor = load_pension_factor(2022)
>>> factor
0.88
netto.data_loader.load_all_tax_curves() dict[int, dict[int, dict]][source]

Load tax curves for all available years.

Returns:

Tax curves for all years

Return type:

dict

netto.data_loader.load_all_social_security() dict[int, dict][source]

Load social security data for all available years.

Returns:

Social security data for all years

Return type:

dict

netto.data_loader.load_all_soli() dict[int, dict][source]

Load solidarity tax data for all available years.

Returns:

Soli data for all years

Return type:

dict

netto.data_loader.load_all_pension_factors() dict[int, float][source]

Load pension correction factors for all available years.

Returns:

Pension correction factors for all years

Return type:

dict

netto.data_loader.tax_curve[source]
netto.data_loader.social_security_curve[source]
netto.data_loader.soli_curve[source]
netto.data_loader.correction_factor_pensions[source]