Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visualization: Add line types split indicator, similar to languages split indicator on GitHub #55

Merged
merged 7 commits into from
Nov 26, 2024

Conversation

jnareb
Copy link
Member

@jnareb jnareb commented Nov 26, 2024

This change makes the per-author plots more correct by filling missing periods with zeros, instead of skipping them.

The main part is however adding the indicator for split between different line types, as % of total number of changed lines. This indicator and its legend is patterned after the programming languages split indicator that GitHub uses (in GitHub it is shown on the right hand side, in the sidebar, in the repository view).

The "No plot" selection for the contribution makes it possible to see on one screen both the per-repo indicator, and many per-author indicators. See the relevant fragment of the screenshot below:

apps_contributors-qtile_repo-no_plot-line_types_split

TODO: Make it update when changing the value of the "Period:" widget (it should, but it does not).

TODO: Fix an earlier but that makes it impossible to change the JSON data file. Or add a workaround, at least. (!!!)

The resample+groupby process creates sparsified dataframe, with periods
in which there are no samples entirely missing, instead of having one
entry per given frequency, even if some of them would be all zeros.

This however matters for plots, so fill the dataframe with per-author
data with zeros, if needed, before plotting.  The author_timeline_df_freq()
function was created for this purpose.  It is based on experiments in
the "Un-sparseify time series" section:
  notebooks/panel/02-contributors_graph.ipynb#Un-sparseify-time-series

TimeseriesPlotForAuthor now uses this function (with the help of pn.rx()).

While at it, comment-out remaining debug-print command.
Without this change the per-repo plot (the main plot) takes up toomuch
space.  It is most probably not the optimal solution...
This will be quite useful to show how different types of lines are
distributed among changed lines per-repo, and per-author for each author
shown on the authors grid.

While at it, rename SpecialColumns enum to SpecialColumnsEnum.
This adds indicator for split between different line types in changed
lines (both deleted and added lines).  This indicator is similar to
the "Languages" information in the sidebar on the right side of the
repo view on GitHub.

Currently it does not yet include the legend for the indicator,
beside the use of the "title" attribute.

The look of the indicator was developed using CodePen:
https://codepen.io/jnareb/pen/jOgQYxg

.
TODO: fix a bug with the indicator not refreshing after changing
the "Period:" widget value, as it should (similar code does work
correctly in other places).
The ContributionsPercHeader now can provide legend (description) of the
indicator for split between different line types in changed lines
(both deleted and added lines).

The legend follow style of "Languages" indicator and its legend in
GitHub (present in sidebar in the repository view); though it uses
slightly different SVG, and uses CSS classes instead of in-line styling.
See https://codepen.io/jnareb/pen/jOgQYxg - where both SVG codes
are shown.
It is now present for each author, but without the legend.  You can
either use mouseover, or rely on the fact that per-repo indicator has
legend, and that colors match between per-repo and per-author
indicators.
The 'tensorflow' dataset has only two authors, and somehow some watcher
tries to run author_timeline_df_freq() with updated dataframe, but with
old author_id...

This workaround is not entirely succesfull, as there is still the same
error: KeyError in author_timeline_df_freq().
Copy link

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/diffannotator
   __init__.py00100% 
   annotate.py79813483%52, 74–75, 84, 91, 100–103, 105–107, 109, 333–334, 338–339, 341, 378, 380–382, 384, 386–388, 390–391, 393–395, 493, 496, 499–500, 541, 682, 711, 754–756, 760, 791, 869, 1082, 1096–1099, 1101, 1105–1108, 1110, 1269, 1271, 1424, 1426, 1463, 1480–1481, 1567, 1570, 1682–1683, 1685, 1702, 1744–1745, 1761, 1776, 1791–1792, 1823, 1886, 1897, 1922, 1931, 1933, 1940–1944, 1948–1952, 1954, 1980, 2067, 2081, 2083–2084, 2086–2088, 2090, 2092–2094, 2096–2097, 2099, 2101, 2114, 2117, 2132–2134, 2140, 2153, 2162, 2170, 2173, 2243, 2249, 2251–2252, 2265, 2274–2279, 2393–2394, 2397–2398, 2402, 2447
   config.py50786%52–56, 58, 93
   gather_data.py3103389%61, 87, 91, 93, 101, 106, 108, 121, 129, 159, 240–241, 261–262, 277, 295, 317–318, 475, 479, 635, 648, 650, 653, 657, 659, 697, 723–724, 777, 829, 999, 1011
   generate_patches.py38392%102, 104, 126
   languages.py1011684%170, 173, 176, 179, 182, 186, 217–218, 230, 249, 261, 263–264, 267, 273, 311
   lexer.py29293%87–88
src/diffannotator/utils
   __init__.py00100% 
   git.py4878582%107, 233, 316, 318, 321–322, 324, 326–329, 331–333, 335–337, 342–343, 347, 349–350, 354–356, 358–359, 361–362, 364–365, 367, 475–476, 479, 516, 526, 529–531, 537, 568, 572, 579, 603, 616, 671, 753, 800, 807, 837, 841, 845, 885, 887, 898, 903, 908, 999–1000, 1047–1049, 1052–1053, 1087, 1091, 1157, 1162, 1164, 1167–1168, 1170, 1229–1230, 1344, 1346, 1369–1370, 1382, 1384, 1396–1397, 1431, 1445
TOTAL181328084% 

Tests Skipped Failures Errors Time
75 2 💤 0 ❌ 0 🔥 10.155s ⏱️

@jnareb jnareb merged commit db54f5c into main Nov 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant