DMP 2025 Add QR concept data type#925
DMP 2025 Add QR concept data type#925ShivangMishra wants to merge 1 commit intoavniproject:masterfrom
Conversation
WalkthroughA new enum constant, QR, was added to ConceptDataType in avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java. No changes were made to existing static lists or other declarations. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java (2)
32-35: Confirm whether QR should be filterable and/or multi-select
- If QR values are intended to be queryable (e.g., exact/contains search), consider adding QR to dashboardFilterSupportedTypes.
- Multi-select: please confirm product intent; default assumption is single-value, so no change to multiSelectTypes.
If filterable, apply:
- public static final List<ConceptDataType> dashboardFilterSupportedTypes = Arrays.asList(Numeric, Text, Notes, Coded, Date, DateTime, Time, Id, Location); + public static final List<ConceptDataType> dashboardFilterSupportedTypes = Arrays.asList(Numeric, Text, Notes, Coded, Date, DateTime, Time, Id, Location, QR);
36-56: Add minimal tests for QR helpersAdd tests to lock expected behavior:
- matches(QR, "QR") → true; matches("QR", Numeric, Text) → false
- dateType("QR") → false
- isMedia("QR") → false
I can draft a small JUnit test class targeting ConceptDataType for these assertions—want me to add it?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java(1 hunks)
| Encounter, | ||
| QR; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Added QR enum: verify persistence and switch/if handling before merge
- Ensure all JPA mappings for this enum use EnumType.STRING, not ORDINAL, to avoid data corruption when adding new constants.
- Audit switch/if logic that branches on ConceptDataType and add case QR where needed (validators, serializers, UI mapping endpoints).
Run:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "1) Check for ORDINAL usage (should be none):"
rg -nP --glob '!.git/**' --glob '!**/target/**' '@Enumerated\s*\(\s*EnumType\.ORDINAL\s*\)' -C3 || true
echo "2) List all places ConceptDataType is persisted/used near @Enumerated:"
rg -nP --glob '!.git/**' --glob '!**/target/**' -C3 'ConceptDataType|@Enumerated' || true
echo "3) Find switch statements on ConceptDataType:"
rg -nP --glob '!.git/**' --glob '!**/target/**' -C3 '(?s)switch\s*\(\s*[^)]*\bConceptDataType\b[^)]*\)' || true
echo "4) Verify case QR is handled:"
rg -nP --glob '!.git/**' --glob '!**/target/**' -C2 '\bcase\s+QR\b' || trueLength of output: 188368
Handle newly added QR in ConceptDataType
- Confirmed no use of
@Enumerated(EnumType.ORDINAL); ConceptDataType is persisted as a String. - No
case QRin anyswitch(ConceptDataType.valueOf(...))—add QR handling in all such switches (RequestUtils, ObservationService, ViewGenService, ConceptService, etc.). - Audit all
if (ConceptDataType.X.toString().equals(...))branches (ImportController, FormController, serializers, UI mapping) and insert correspondingQRlogic.
🤖 Prompt for AI Agents
avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java lines
28-29: The enum now includes QR but the codebase lacks handling for it; confirm
persistence is String (no DB migration), then add explicit QR branches where
ConceptDataType is used: update every switch(ConceptDataType.valueOf(...)) to
include a case QR and implement the intended behavior (RequestUtils,
ObservationService, ViewGenService, ConceptService, etc.), and audit all
string-equality checks like if (ConceptDataType.X.toString().equals(...)) across
ImportController, FormController, serializers and UI mapping to add
corresponding QR logic or fallbacks; ensure tests and
serialization/deserialization handle QR and add unit tests for new branch
coverage.
|
This closes avniproject/avni-product#1712 |
a3cb55d to
d1d6215
Compare
8e8e401 to
e09541e
Compare
Summary by CodeRabbit