nycmeshnet / meshdb

A convenient, stable, and sane database for tracking Members and Nodes for use with robots and humans
https://db.nycmesh.net
MIT License
12 stars 14 forks source link

Add Stats Graph SVG Render View #707

Closed Andrew-Dickinson closed 1 day ago

Andrew-Dickinson commented 4 days ago

Adds an endpoint to render SVG files for the website to display, in the style of the current nycmesh.net/stats page

Also does a bit of refactoring and cleanup in meshweb, we should probably spread the views out into multiple files, and we don't need to use the DRF decorators for non-API views

codecov[bot] commented 4 days ago

Codecov Report

Attention: Patch coverage is 94.24460% with 8 lines in your changes missing coverage. Please review.

Project coverage is 94.21%. Comparing base (1496dbd) to head (73fb4b0). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/meshweb/views/website_stats.py 93.54% 8 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #707 +/- ## ========================================== + Coverage 94.11% 94.21% +0.09% ========================================== Files 82 86 +4 Lines 3418 3542 +124 ========================================== + Hits 3217 3337 +120 - Misses 201 205 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

Andrew-Dickinson commented 4 days ago

The new graphs aren't identical, but they're really close. The biggest thing that's missing is the little green % diff indicator. I don't think matplotlib can really draw that, but if anyone has tips I would appreciate them Screenshot 2024-11-17 at 23 55 14

Screenshot 2024-11-17 at 23 54 49

Andrew-Dickinson commented 1 day ago

Okay changed it so that we just render the graph in MeshDB. All the header stuff will be done on the website side, but I needed an API in order to expose the total counts publicly (using our standard API for this is a security hazard as the token would need to be public). Having this little JSON API also has the advantage of making it trivial to convert to a frontend graphing framework in the future if desired