API Reference
Main Entry Point
FinancialSankey
finflow_sankey.FinancialSankey
Main entry point for FinFlow Sankey.
Source code in finflow_sankey/__init__.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
income_statement(data, *, period=None, currency=None, mapping=None, layout=None)
classmethod
Create an income statement Sankey pipeline.
Source code in finflow_sankey/__init__.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
cash_flow_statement(data, *, period=None, currency=None, mapping=None, layout=None)
classmethod
Create a cash flow statement Sankey pipeline.
Source code in finflow_sankey/__init__.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
balance_sheet_reconciliation(data, *, as_of=None, currency=None, mapping=None, layout=None)
classmethod
Create a balance sheet reconciliation Sankey pipeline.
Source code in finflow_sankey/__init__.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
multi_period_compare(data, *, currency=None, mapping=None, layout=None)
classmethod
Create a multi-period comparison Sankey pipeline.
Source code in finflow_sankey/__init__.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
Pipeline
SankeyPipeline
finflow_sankey.core.pipeline.SankeyPipeline
Pipeline for building and rendering financial Sankey diagrams.
Source code in finflow_sankey/core/pipeline.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
validate(tolerance=0.01)
Validate input data.
Source code in finflow_sankey/core/pipeline.py
70 71 72 73 74 75 76 77 78 79 | |
group_minor(min_pct=None, min_value=None, top_n=None, label='Other')
Group minor accounts into Other.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_pct
|
float | None
|
Group accounts below this percentage of total sankey_value. |
None
|
min_value
|
float | None
|
Group accounts below this absolute sankey_value. |
None
|
top_n
|
int | None
|
Keep top_n accounts, group the rest. |
None
|
label
|
str
|
Label for the grouped accounts. |
'Other'
|
Source code in finflow_sankey/core/pipeline.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
with_palette(palette=None)
Set default palette for rendering.
Source code in finflow_sankey/core/pipeline.py
120 121 122 123 124 125 126 | |
render(title=None, renderer='plotly', palette=None, theme=None)
Render the Sankey graph.
Source code in finflow_sankey/core/pipeline.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
export_html(path, title=None, renderer='plotly', palette=None, theme=None, **render_kwargs)
Render and export the Sankey graph to HTML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Output HTML file path. |
required |
title
|
str | None
|
Chart title. |
None
|
renderer
|
str
|
Renderer name (default: "plotly"). |
'plotly'
|
palette
|
str | Path | dict[str, Any] | ColorPalette | None
|
Custom palette override. |
None
|
theme
|
str | None
|
Built-in theme name. |
None
|
**render_kwargs
|
Any
|
Additional kwargs passed to render(). |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
The output file path as a string. |
Source code in finflow_sankey/core/pipeline.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
Core Components
ColorPalette
finflow_sankey.core.palette.ColorPalette
dataclass
Complete color palette for rendering.
Source code in finflow_sankey/core/palette.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
from_yaml(path)
classmethod
Load palette from YAML file.
Source code in finflow_sankey/core/palette.py
104 105 106 107 108 109 110 | |
from_dict(data)
classmethod
Load palette from dict.
Source code in finflow_sankey/core/palette.py
112 113 114 115 | |
override(overrides)
Create a new palette with partial overrides.
Source code in finflow_sankey/core/palette.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
validate()
Validate palette.
Source code in finflow_sankey/core/palette.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
get_role_color(role)
Get color for a role, falling back to 'other'.
Source code in finflow_sankey/core/palette.py
166 167 168 | |
AccountMapper
finflow_sankey.core.mapper.AccountMapper
Maps raw account names to standard financial statement sections.
Source code in finflow_sankey/core/mapper.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
from_dict(mapping)
classmethod
Load mapping from dict (values may be list or single string).
Source code in finflow_sankey/core/mapper.py
34 35 36 37 38 39 40 41 42 43 | |
from_yaml(path)
classmethod
Load mapping from YAML file.
Source code in finflow_sankey/core/mapper.py
27 28 29 30 31 32 | |
apply(df, target_col='section')
Apply mapping to DataFrame.
Only overwrites target_col when it is null, preserving explicit sections.
Source code in finflow_sankey/core/mapper.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |