-
Notifications
You must be signed in to change notification settings - Fork 33
Add file size columns to download status table #272
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
base: master
Are you sure you want to change the base?
Conversation
Test verifies animint.js generates total_MB and mean_MB columns in download status table. Currently fails, demonstrating these size columns are not present in the table. Addresses #249
|
Add download size info to status table (#249) Adds total_MB, mean_MB, and rows columns to the download status table. Browser screenshot verification included showing new columns working. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #272 +/- ##
==========================================
+ Coverage 73.06% 77.89% +4.83%
==========================================
Files 164 164
Lines 8758 8845 +87
Branches 0 564 +564
==========================================
+ Hits 6399 6890 +491
+ Misses 2359 1955 -404
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Calculate file sizes using file.size() in saveChunks() - Store chunk_info (bytes, rows) in plot.json - Update table cells after download (not in draw_geom) - Remove 36-line JavaScript calculation loop
|
No obvious timing issues in HEAD=add-download-size-info Generated via commit 69bc4c7 Download link for the artifact containing the test results: ↓ atime-results.zip
|
|
Thanks! This is a good start. I see the result below using https://github.com/animint/animint2/blob/master/inst/examples/WorldBank-paper.R Can you please make the following changes?
|
- Remove 'selected chunk', 'status', and 'mean MB' columns - Add combined 'files', 'MB', and 'rows' columns (downloaded/total format) - Right-justify all numeric columns - Fix common chunk tracking: count in both downloaded and total counts - Track size (bytes/rows) for common chunks in R code - Filter chunk_info to only include each geom's own chunks - Count only .tsv files for accurate totals in JavaScript - Update tests to verify new column structure
Use 1048576 (1024*1024) consistently for MB conversion instead of mixing 1e6 (1000000) and 1048576. This ensures consistent size reporting for both common chunks and regular chunks in the download status table.
Switch test-download-status-table.R to validate rendered HTML instead of
the JS source. Verify headers and right-justified numeric columns via XPath.
Update test-renderer1-variable-value.R to read the combined
column ("downloaded / total") so the chunk count checks work again.
Remove the extra blank line in NEWS.md.
|
please click Resolve so I can see which previous comments you have already addressed |
|
can you please post a screenshot like this one #272 (comment) but created with the new code? |
|
Sir @tdhock Here's the updated screenshot with the new download status table format:
Changes implemented:
All values update correctly as data downloads, and common chunk is properly counted in both downloaded and total counts. Please give your feedback and suggest what changes I need to make so that the failing test can be passed on the GitHub , Thank You ! |
|
#272 (comment) seems to have the wrong old screenshot, please revise |
inst/htmljs/animint.js
Outdated
| g_info.data[tsv_name] = chunk; | ||
| g_info.tr.select("td.downloaded").text(d3.keys(g_info.data).length); | ||
| g_info.download_status[tsv_name] = "saved"; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please undo addition of empty lines
| expect_false("status" %in% header_text) | ||
| expect_false("mean MB" %in% header_text) | ||
| expect_false("selected chunk" %in% header_text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove
| table_headers <- getNodeSet(info$html, '//table[@id="download_status"]//th') | ||
| header_text <- sapply(table_headers, xmlValue) | ||
| expect_true("geom" %in% header_text) | ||
| expect_true("files" %in% header_text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect_in
- Change download_status table ID from fixed 'download_status' to viz_id + '_download_status' for unique IDs when multiple animints are on the same page - Update test XPath selectors to use contains() for flexibility
also please change the computation or column name "MB" to be consistent with "man du" which says in the example above we see 15.62 MB for geom2. > sum(size.dt[grep("geom2",name), R_bytes/1000/1000])
[1] 16.38009
> sum(size.dt[grep("geom2",name), R_bytes/1024/1024])
[1] 15.6212715.62 is the number you get when you divide by 1024, which should be MiB (not MB as currently written in column header) so please
thanks! |
- Add commas to large row numbers (e.g., 4,321 instead of 4321) - Show disk sizes in KiB or MiB based on size (binary 1024 divisor) - Rename column from 'MB' to 'disk' since values now include units - Update NEWS.md entry to reflect current features
Sir @tdhock can you please again review this PR . |
tdhock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also please post a screenshot of the new display?
and please add a test for the content of the output? (current test is only for header names and alignment)
- Add updateDownloadStatus() function to eliminate code duplication - Add formatWithCommas() for row numbers (4,321 instead of 4321) - Add formatBytes() for KiB/MiB display using 1024 divisor - Add test to verify table content format (files/disk/rows)
|
Sir @tdhock Updated screenshot showing the new download status table format:
|
Replace \d with [0-9] in regex patterns - \d is not recognized in R's base regex engine
|
the updated screenshot looks better, thanks! |
|
also can you please post updated screenshot? |
|
Yes Sir @tdhock I will definitely create a function and post the updated screenshot. |
|
Sir @tdhock Updated screenshot with table borders :- |
|
Sir @tdhock The CI test failures in test-compiler-ghpages.R are not related to this PR's changes.
|








Fixes #249
Summary
Adds file size information (total_MB, mean_MB, and rows) to the download status table, helping users understand disk usage for each geom.
Problem
Currently, the download status table shows how many TSV files need to be downloaded, but doesn't show file sizes. Users can't see if they're downloading 1MB or 100MB.
Test output:

Only added the test case in this first commit in the next commit will try to fix the issue !