chore: Modularize frontend architecture and remove ORCA code#33
chore: Modularize frontend architecture and remove ORCA code#33
Conversation
- Remove brand book file (reference material, not needed in repo) - Update README with new CLI commands and workflow documentation - Add inline documentation explaining DevSeed modifications - Remove commented-out code from index.js - Add docstrings to config.py
- Shorten print statements to fit 88 char line limit - Fix formatting in cli.py and config.py
after fixing Brianna's github handle, ran the discovery scripts again
- Resolved conflicts by keeping our refactored index.js - Accepted main's version for data files (links.csv, repositories.csv, and JSON files) - Synced branch with latest changes from main
|
@gadomski I think this is ready for a review. It's a big PR...as I was adding more features and making styling tweaks, it felt pretty brittle. So I thought it would be worth cleaning out a lot of the unused code so I can more easily experiment with new features next. |
gadomski
left a comment
There was a problem hiding this comment.
Awesome, thanks for taking this on. Totally agree that the monolith was heinous to deal with, this should improve. Couple of changes needed before I check functionality:
- Looks like some files got blown up to the top level that shouldn't have been
- Can we organize code like this, at the top level
python/js/package.jsonandpyproject.tomlcan both stay at the top level, and should just point to the correct source code locations
gadomski
left a comment
There was a problem hiding this comment.
Code organization change requests
gadomski
left a comment
There was a problem hiding this comment.
In general, it'd be better to keep the refactor and the functional changes (e.g. to client.py) separate, but since it's been done no need to rewind.
|
@gadomski okay I think this is ready for review now 😅 a good learning experience for me, sorry for the back and forth! |
Summary
This PR refactors the contributor network visualization from a 3,400+ line monolithic
index.jsinto a modular, maintainable architecture with 32 focused ES6 modules. The main entry point has been reduced by ~57% (from 3,400+ lines to 1,505 lines), with complex logic extracted into dedicated, testable modules.This refactoring also includes significant code cleanup, removing ~500+ lines of ORCA-specific code that was inherited from the original visualization but not used in our implementation. This includes ORCA data loading, ORCA-specific positioning logic, dual ring visualization, and highlight backgrounds.
1 Note: Vite was initially added during development to test bundling, but we ultimately decided against it to reduce complexity and use native ES modules instead.
Code Cleanup: ORCA-Specific Code Removal
Removed:
RADIUS_CONTRIBUTOR_NON_ORCA,ORCA_PRESENTflag)orca_receivedandorca_impacteddata propertiesRenamed for Clarity:
ORCA_RING_WIDTH→CONTRIBUTOR_RING_WIDTH(generic contributor ring)createORCAVisual→createContributorNetworkVisualdebug-orcaflag →debug-contributor-networkArchitecture Changes
1. Data Preparation Module (
src/js/data/prepare.js)prepareData()function (~515 lines → 673 lines with documentation)2. Layout & Positioning Module (
src/js/layout/positioning.js)positionContributorNodes()function (~117 lines → 179 lines)3. Render Orchestration Module (
src/js/render/draw.js)draw()function (~166 lines → 198 lines)Build System Changes
Native ES Modules (No Bundler)
Updated Build Process
src/contributor_network/cli.pyto copysrc/js/directory todist/type="module"File Structure
Migration Notes
For Developers
src/js/For Build Process
The build command remains the same:
The build process now:
top_contributors.csv,repositories.csv,links.csv) to the destination folderindex.js(main entry point) to the destinationsrc/js/modules to{destination}/src/js/for native ES module importsindex.htmlfrom the Jinja2 template with proper ES module script tags (type="module")