Feat/examples#52
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a comprehensive Changesratiopath Documentation Examples and Navigation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive set of usage examples and end-to-end pipeline guides to the documentation, covering topics such as slide resolution selection, coordinate generation, tissue masking, stain augmentation, and leakage-safe dataset splitting. It also adds reference stubs for the tissue mask and split APIs and updates the MkDocs navigation. The review feedback highlights two issues in mkdocs.yml: a duplicate entry for Darwin7JSONParser in the Parsers section, and missing navigation entries for the newly added reference files tissue_mask.md and split.md.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
40b95c3 to
96dba8a
Compare
Documentation PreviewPreview URL: https://RationAI.github.io/ratiopath/feat-examples/ |
c774c32 to
5b4c78e
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
docs/index.md (1)
9-13: ⚡ Quick winRephrase the "How To Use These Docs" bullets to reduce repetition.
All three bullets in lines 11–13 start with "Use [...]", which linters flag as repetitive sentence structure. Consider varying the phrasing or restructuring to improve readability.
Suggested revision:
- Line 11: "Use Examples when you want to solve a concrete problem."
- Line 12: "Visit Installation for environment setup."
- Line 13: "Check the API Reference when you already know which function or class you need."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/index.md` around lines 9 - 13, The "How To Use These Docs" section has repetitive sentence structure with all three bullets starting with "Use [...]". Vary the phrasing across the three bullets to improve readability: keep the first bullet starting with "Use [Examples]", change the second bullet to start with "Visit" for the Installation link, and change the third bullet to start with "Check the" for the API Reference link while maintaining the same informative content for each entry.ratiopath/parsers/geojson_parser.py (2)
23-46: 💤 Low valueConsider using Markdown tables for better portability.
HTML tables work with mkdocstrings but Markdown tables are more conventional in Python docstrings and render correctly across more tools.
♻️ Example Markdown table format
| Feature | Geometry | Join key | Metadata | |------------|------------------------------|---------------------------------------|---------------------------------------------------| | Definition | `null` | `properties[join_key]` (e.g., `presetID`) | All properties merged into matching annotations | | Annotation | Spatial geometry (e.g., `Polygon`) | `properties[join_key]` (e.g., `presetID`) | Receives all properties from matching definition |🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ratiopath/parsers/geojson_parser.py` around lines 23 - 46, Replace the HTML table in the docstring of geojson_parser.py with a Markdown table format for better portability and consistency with Python documentation conventions. The table documents Feature types (Definition and Annotation) with their corresponding Geometry, Join key, and Metadata properties. Convert the HTML table structure to use Markdown pipe syntax with appropriate column alignment and formatting, ensuring the content matches the structure and meaning of the original HTML table while making it more portable across different documentation tools.
52-59: 🏗️ Heavy liftAdd an Examples section to illustrate solve_relations usage.
The solve_relations feature is complex and would benefit from a usage example showing how definition features (null geometry) are merged into annotation features via
join_key.As per coding guidelines: "Use Google-style docstrings with clear
Args:,Returns:,Yields:,Raises:, andExamples:sections when relevant."💡 Example section template
"""Read GeoJSON annotations from a file path or text stream. Args: file_path: GeoJSON file path or readable text stream. join_key: Shared property key used to merge geometry-less definition features into spatial annotation features. Set to `None` to skip relational metadata merging. Examples: Basic usage with relational metadata merging: >>> parser = GeoJSONParser("annotations.geojson", join_key="presetID") >>> parser.gdf.columns Index(['geometry', 'presetID', 'shared_attr', 'shared_attr_def', 'meta'], dtype='object') Skip relational merging: >>> parser = GeoJSONParser("annotations.geojson", join_key=None) """🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ratiopath/parsers/geojson_parser.py` around lines 52 - 59, Add an Examples section to the docstring of the GeoJSONParser read method (or constructor) in ratiopath/parsers/geojson_parser.py to illustrate the complex solve_relations functionality. The Examples section should come after the Args section and include at least two concrete examples: one demonstrating how to use the join_key parameter to merge geometry-less definition features into annotation features by matching on a shared property key, and another showing how to skip relational metadata merging by setting join_key to None. Each example should show the instantiation of GeoJSONParser with the relevant parameters and the resulting behavior or output structure.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/examples/pipelines/mask-first-tile-filtering-pipeline.md`:
- Around line 45-56: The tissue_mask function returns a single pyvips.Image
object, not a tuple, so the unpacking syntax in the generate_mask function is
incorrect. Change the line that calls tissue_mask from unpacking it as `mask, _
= tissue_mask(slide=slide, mpp=(8.0, 8.0))` to assigning it directly as `mask =
tissue_mask(slide=slide, mpp=(8.0, 8.0))` to match the actual return type and
prevent a runtime TypeError.
In `@ratiopath/parsers/geojson_parser.py`:
- Line 37: The documentation at line 37 inaccurately describes the merging
behavior by stating only properties.meta values are merged, when in fact the
implementation merges all properties from definition features into annotations.
Update the description to clarify that all properties from definitions are
merged, with columns unique to definitions added as-is and columns present in
both annotations and definitions receiving a _def suffix on the definition side,
per the _solve_relations logic referenced in the implementation.
---
Nitpick comments:
In `@docs/index.md`:
- Around line 9-13: The "How To Use These Docs" section has repetitive sentence
structure with all three bullets starting with "Use [...]". Vary the phrasing
across the three bullets to improve readability: keep the first bullet starting
with "Use [Examples]", change the second bullet to start with "Visit" for the
Installation link, and change the third bullet to start with "Check the" for the
API Reference link while maintaining the same informative content for each
entry.
In `@ratiopath/parsers/geojson_parser.py`:
- Around line 23-46: Replace the HTML table in the docstring of
geojson_parser.py with a Markdown table format for better portability and
consistency with Python documentation conventions. The table documents Feature
types (Definition and Annotation) with their corresponding Geometry, Join key,
and Metadata properties. Convert the HTML table structure to use Markdown pipe
syntax with appropriate column alignment and formatting, ensuring the content
matches the structure and meaning of the original HTML table while making it
more portable across different documentation tools.
- Around line 52-59: Add an Examples section to the docstring of the
GeoJSONParser read method (or constructor) in
ratiopath/parsers/geojson_parser.py to illustrate the complex solve_relations
functionality. The Examples section should come after the Args section and
include at least two concrete examples: one demonstrating how to use the
join_key parameter to merge geometry-less definition features into annotation
features by matching on a shared property key, and another showing how to skip
relational metadata merging by setting join_key to None. Each example should
show the instantiation of GeoJSONParser with the relevant parameters and the
resulting behavior or output structure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a9dcdeae-99ae-4a3e-be88-540c8b2c7d9e
⛔ Files ignored due to path filters (9)
docs/assets/examples/distributed-tiling-pipeline.pngis excluded by!**/*.pngdocs/assets/examples/ecdp-exported-tiles.pngis excluded by!**/*.pngdocs/assets/examples/ecdp-inspect-preview.pngis excluded by!**/*.pngdocs/assets/examples/ecdp-stain-augmentation-triptych.pngis excluded by!**/*.pngdocs/assets/examples/ecdp-tissue-mask-triptych.pngis excluded by!**/*.pngdocs/assets/examples/leakage-safe-splits.pngis excluded by!**/*.pngdocs/assets/examples/pyramid-level-selection.pngis excluded by!**/*.pngdocs/assets/examples/slide-row-to-tile-rows.pngis excluded by!**/*.pngdocs/assets/examples/tile-grid-boundary-strategies.pngis excluded by!**/*.png
📒 Files selected for processing (20)
docs/examples/basic-functionalities/annotation-and-overlay-enrichment.mddocs/examples/basic-functionalities/extract-tiles-locally-without-ray.mddocs/examples/basic-functionalities/group-aware-splitting.mddocs/examples/basic-functionalities/inspect-slides-and-preview-tiles.mddocs/examples/basic-functionalities/slide-metadata-and-resolution.mddocs/examples/basic-functionalities/stain-augmentation.mddocs/examples/basic-functionalities/tensor-aggregations.mddocs/examples/basic-functionalities/tile-grid-generation.mddocs/examples/basic-functionalities/tissue-mask-generation.mddocs/examples/basic-functionalities/write-tiff-outputs-from-ray.mddocs/examples/index.mddocs/examples/pipelines/annotation-aware-dataset-pipeline.mddocs/examples/pipelines/distributed-tiling-pipeline.mddocs/examples/pipelines/mask-first-tile-filtering-pipeline.mddocs/examples/pipelines/prepare-a-training-dataset-with-leakage-safe-splits.mddocs/index.mddocs/reference/masks/tissue_mask.mddocs/reference/model_selection/split.mdmkdocs.ymlratiopath/parsers/geojson_parser.py
Summary by CodeRabbit