Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ per-file-ignores."src/gettsim/tests_germany/**/*.py" = [
per-file-ignores."src/gettsim/typing.py" = [
"F401", # Imported but unused — re-exports
]
pydocstyle.convention = "numpy"
pydocstyle.convention = "google"

[tool.pyproject-fmt]
column_width = 88
Expand Down
13 changes: 6 additions & 7 deletions src/gettsim/germany/grundsicherung/im_alter/einkommen.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ def erwerbseinkommen_m(

Legal reference: § 82 SGB XII Abs. 3

Notes
-----
- Freibeträge for income are currently not considered
- Start date is 2011 because of the reference to regelbedarfsstufen,
which was introduced in 2011.
- The cap at 1/2 of Regelbedarf was only introduced in 2006 (which is currently
not implemented): https://www.buzer.de/gesetz/3415/al3764-0.htm
Note:
- Freibeträge for income are currently not considered
- Start date is 2011 because of the reference to regelbedarfsstufen,
which was introduced in 2011.
- The cap at 1/2 of Regelbedarf was only introduced in 2006 (which is currently
not implemented): https://www.buzer.de/gesetz/3415/al3764-0.htm
"""
earnings = (
einnahmen__bruttolohn_m
Expand Down
115 changes: 47 additions & 68 deletions src/gettsim/plot/dag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,11 @@ def interface(
) -> go.Figure:
"""Plot the interface DAG.

Parameters
----------
include_fail_and_warn_nodes
Whether to include fail and warn nodes.
show_node_description
Whether to show the node description.
output_path
If provided, the figure is written to the path.
node_colormap
Dictionary mapping namespace tuples to colors.
Args:
include_fail_and_warn_nodes: Whether to include fail and warn nodes.
show_node_description: Whether to show the node description.
output_path: If provided, the figure is written to the path.
node_colormap: Dictionary mapping namespace tuples to colors.
- Tuples can represent any level of the namespace hierarchy (e.g.,
("input_data",) would be the first level,
("input_data", "df_and_mapper") the second level.
Expand All @@ -80,14 +75,14 @@ def interface(
match will be used.
- Fallback color is black.
- Use any color from https://plotly.com/python/css-colors/
If None, cycle through colors at the uppermost level of the namespace hierarchy.
kwargs
Additional keyword arguments. Will be passed to
plotly.graph_objects.Figure.layout.

Returns
-------
The figure.
If None, cycle through colors at the uppermost level of the namespace
hierarchy.
kwargs: Additional keyword arguments. Will be passed to
plotly.graph_objects.Figure.layout.

Returns:
The figure.

"""
return ttsim.plot.dag.interface(
include_fail_and_warn_nodes=include_fail_and_warn_nodes,
Expand Down Expand Up @@ -125,36 +120,29 @@ def tt(
) -> go.Figure:
"""Plot the TT DAG.

Parameters
----------
primary_nodes
The primary nodes, specified as tree paths (e.g.,
`{("einkommensteuer", "abgeltungssteuer", "betrag_y_sn")}`) or qualified names
(e.g., `{"einkommensteuer__abgeltungssteuer__betrag_y_sn"}`). Primary nodes are
used to determine which other nodes to include in the plot based on the
selection_type. They may be root nodes (for descendants), end nodes (for
ancestors), or middle nodes (for neighbors). If not provided, the entire DAG is
plotted.
selection_type
The type of the DAG to plot. Can be one of:
Args:
primary_nodes: The primary nodes, specified as tree paths (e.g.,
`{("einkommensteuer", "abgeltungssteuer", "betrag_y_sn")}`) or qualified
names (e.g., `{"einkommensteuer__abgeltungssteuer__betrag_y_sn"}`).
Primary nodes are used to determine which other nodes to include in the
plot based on the selection_type. They may be root nodes (for descendants),
end nodes (for ancestors), or middle nodes (for neighbors). If not
provided, the entire DAG is plotted.
selection_type: The type of the DAG to plot. Can be one of:
- "neighbors": Plot the neighbors of the primary nodes.
- "descendants": Plot the descendants of the primary nodes.
- "ancestors": Plot the ancestors of the primary nodes.
- "all_paths": All paths between the primary nodes are displayed (including
any other nodes lying on these paths). You must pass at least two primary
nodes.
If not provided, the entire DAG is plotted.
selection_depth
The depth of the selection. Only used if selection_type is "neighbors",
"descendants", or "ancestors".
include_params
Include params and param functions when plotting the DAG. Default is True.
show_node_description
Show a description of the node when hovering over it.
output_path
If provided, the figure is written to the path.
node_colormap
Dictionary mapping namespace tuples to colors.
If not provided, the entire DAG is plotted.
selection_depth: The depth of the selection. Only used if selection_type is
"neighbors", "descendants", or "ancestors".
include_params: Include params and param functions when plotting the DAG.
Default is True.
show_node_description: Show a description of the node when hovering over it.
output_path: If provided, the figure is written to the path.
node_colormap: Dictionary mapping namespace tuples to colors.
- Tuples can represent any level of the namespace hierarchy (e.g.,
("sozialversicherung",) would be the first level,
("sozialversicherung", "arbeitslosenversicherung") the second level.
Expand All @@ -164,32 +152,23 @@ def tt(
match will be used.
- Fallback color is black.
- Use any color from https://plotly.com/python/css-colors/
If None, cycle through colors at the uppermost level of the namespace hierarchy.
policy_date_str
The date for which to plot the DAG.
orig_policy_objects
The orig policy objects.
input_data
The input data.
processed_data
The processed data.
labels
The labels.
policy_environment
The policy environment.
backend
The backend to use when executing main.
include_fail_nodes
Whether to include fail nodes when executing main.
include_warn_nodes
Whether to include warn nodes when executing main.
kwargs
Additional keyword arguments. Will be passed to
plotly.graph_objects.Figure.layout.

Returns
-------
The figure.
If None, cycle through colors at the uppermost level of the namespace
hierarchy.
policy_date_str: The date for which to plot the DAG.
orig_policy_objects: The orig policy objects.
input_data: The input data.
processed_data: The processed data.
labels: The labels.
policy_environment: The policy environment.
backend: The backend to use when executing main.
include_fail_nodes: Whether to include fail nodes when executing main.
include_warn_nodes: Whether to include warn nodes when executing main.
kwargs: Additional keyword arguments. Will be passed to
plotly.graph_objects.Figure.layout.

Returns:
The figure.

"""
return ttsim.plot.dag.tt(
root=germany.ROOT_PATH,
Expand Down
Loading