Repository navigation
feat: add the figures to project.zip - #57
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
exports.figure_files renders every chart of the result view. An Altair chart becomes a standalone HTML page with its data inside. A word cloud stays a PNG. The group, date, and position charts appear only when their data exists. Without the document text, the document map holds no snippet, as the CSV holds no text. The download button builds the package only on a click, because the word clouds are slow under Pyodide. Closes #50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsEUVKgZPLky1kHXnU2aBW
Altair writes the chart JSON into a script block without escaping. A topic name, a document ID, or a snippet with </script> would close the block and run as markup when a reader opens the figure. The export now escapes <, >, and & as JSON unicode escapes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsEUVKgZPLky1kHXnU2aBW
7a7d630 to
83791e9
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the stated requirements and covers its conditional, privacy, security, and browser-specific behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Adds all result-view charts to project.zip while preserving privacy controls and browser performance.
Changes:
- Exports Altair charts as standalone HTML and word clouds as PNG.
- Builds ZIP files lazily and conditionally includes metadata/position figures.
- Adds script-safe serialization, documentation, and comprehensive tests.
| File | Description |
|---|---|
simple_topic_modeling/exports.py |
Generates figure files and adds them to the ZIP. |
simple_topic_modeling/plots.py |
Makes document snippets optional in tooltips. |
app.py |
Lazily builds the expanded package on download. |
tests/test_exports.py |
Tests figure contents, conditions, privacy, limits, and escaping. |
SPECS.md |
Specifies figure export behavior. |
README.md |
Documents figures in project.zip. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Closes #50.
exports.figure_filesrenders every chart of the result view. An Altair chart becomes a standalone HTML page with its data inside. A word cloud stays a PNG.project.zipwrites the files underfigures/.README.txtexplains the folder and says that an HTML figure loads Vega from a CDN.An Altair
PluginEnabler.__exit__annotation rejects a validwith. Onety: ignore[invalid-context-manager]line covers it.Test
topic_map.htmlanddocument_map.htmlrender outside the app.🤖 Generated with Claude Code
https://claude.ai/code/session_01EsEUVKgZPLky1kHXnU2aBW