Growth timeline¶
gutenberg_kg.viz_timeline
¶
viz_timeline.py — Corpus Growth Timeline Visualization for GutenbergKG.
Visualizes corpus expansion across snapshots using interactive 2D or 3D Plotly charts. Shows trends in book count, author count, nodes, and edges over time.
Features: - 2D mode: 2×2 subplots for Books, Authors, Nodes, Edges - 3D mode: normalized multi-metric scatter stacked by metric type - Text summary with first/latest/delta for each metric - Hover tooltips with snapshot version and timestamp
create_3d_timeline_figure(snapshots_dir)
¶
Create a 3D scatter plot showing normalized corpus growth metrics.
X: snapshot index | Y: normalized value (0–100 %) | Z: metric type
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshots_dir
|
Path
|
Path to |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
Plotly 3D Figure. |
Source code in src/gutenberg_kg/viz_timeline.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 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 | |
create_timeline_figure(snapshots_dir)
¶
Create a 2×2 interactive subplot figure of corpus growth metrics.
Panels: Books | Authors | Nodes | Edges, all plotted against snapshot date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshots_dir
|
Path
|
Path to |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
Plotly Figure ready for display. |
Source code in src/gutenberg_kg/viz_timeline.py
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 | |
display_timeline_summary(snapshots_dir)
¶
Return an ASCII-boxed summary of corpus growth across snapshots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshots_dir
|
Path
|
Path to |
required |
Returns:
| Type | Description |
|---|---|
str
|
Multi-line formatted string. |
Source code in src/gutenberg_kg/viz_timeline.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
load_snapshots_timeline(snapshots_dir)
¶
Load corpus snapshots and return parallel timeline lists.
Reads the snapshot manager's field names: metrics live under metrics as
total_books and friends, and a snapshot is identified by key — the
git tree hash, not a commit — which is what the charts label points with.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshots_dir
|
Path
|
Path to |
required |
Returns:
| Type | Description |
|---|---|
dict[str, list[Any]]
|
Dict with keys |
Source code in src/gutenberg_kg/viz_timeline.py
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 | |