feat: added locations transformers based on shortcodes#360
Conversation
|
Warning Review limit reached
More reviews will be available in 24 minutes and 33 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR refactors photo attachment creation and field rendering from class-based dependency injection and dict-based field renderers to configuration-driven and shortcode-based approaches, enabling the application to shift toward declarative configuration while maintaining the same public API contract for location detail responses. ChangesConfiguration-Driven Attachment and Field Rendering
Sequence DiagramsequenceDiagram
participant Client
participant API as core_api
participant Formatter as prepare_pin()
participant Shortcodes as shortcodes
Client->>API: POST /api/suggest-new-point (multipart photo)
API->>API: create_attachment(file, config)
API->>API: store suggestion
Client->>API: GET /location/{id}
API->>Formatter: prepare_pin(place, visible_fields, shortcodes)
loop each visible field
Formatter->>Shortcodes: lookup field in shortcodes
alt shortcode exists
Shortcodes->>Formatter: transform_field_value(value)
end
end
Formatter->>API: formatted_data
API->>Client: location detail JSON
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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.
Actionable comments posted: 1
🤖 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 `@goodmap/formatter.py`:
- Around line 34-38: Update the formatter module docstring to reflect current
behavior: state that dict-valued fields whose field name matches a shortcode are
transformed via Shortcode.transform_field_value(), and that when no matching
shortcode exists the value is passed through after safe_gettext (not dropped).
Reference the shortcodes mapping, Shortcode.transform_field_value, and
safe_gettext in the docstring so it accurately describes the behavior
implemented in the formatter functions.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf548db4-ae35-495f-adc0-3907a8d5739e
⛔ Files ignored due to path filters (1)
poetry.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
goodmap/core_api.pygoodmap/formatter.pygoodmap/goodmap.pypyproject.tomltests/unit_tests/test_core_api.pytests/unit_tests/test_formatter.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
🧪 E2E Test Results📊 View full workflow run
|
1 similar comment
🧪 E2E Test Results📊 View full workflow run
|
|
🧪 E2E Test Results📊 View full workflow run 📊 E2E Stress Test Performance✅ Status: PASSED (12141.24ms max < 25000ms limit)
📈 Individual Run Times
|



Summary by CodeRabbit
Refactor
Chores