Skip to content

Conversation

@ShivangMishra
Copy link

@ShivangMishra ShivangMishra commented Jun 22, 2025

related to avniproject/avni-client#1678

Summary by CodeRabbit

  • New Features
    • Added support for Signature as a media type across the app.
    • Signatures can now be captured/uploaded, stored, and processed similar to images and videos.
    • CSV imports and observation handling now recognize Signature values.
    • Validation now checks Signature inputs with the same rules used for images, improving data integrity.
    • Users will experience consistent behavior for Signature fields in forms and data entry workflows.

@ombhardwajj
Copy link
Member

Hey @ShivangMishra , even web-app requires some additions. Please go through the webapp, do the needful and make a PR in the web app as well

@ShivangMishra ShivangMishra force-pushed the dmp-2025-signature-capture branch from 23a9a87 to 4a4acbd Compare July 15, 2025 20:29
@ShivangMishra ShivangMishra marked this pull request as ready for review September 1, 2025 12:25
@coderabbitai
Copy link

coderabbitai bot commented Sep 1, 2025

Warning

Rate limit exceeded

@ShivangMishra has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 42 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ae94c9c and 7f5c31c.

📒 Files selected for processing (3)
  • avni-server-api/src/main/java/org/avni/server/importer/batch/csv/creator/ObservationCreator.java (1 hunks)
  • avni-server-api/src/main/java/org/avni/server/service/EnhancedValidationService.java (8 hunks)
  • avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java (1 hunks)

Walkthrough

Adds a new ConceptDataType enum value: Signature. Updates media-type handling to treat Signature like other media (Image/ImageV2/Video) in ObservationCreator and validation to route Signature through validateImageValue in EnhancedValidationService.

Changes

Cohort / File(s) Summary
Data model: Concept type
avni-server-data/src/main/java/.../ConceptDataType.java
Added enum constant Signature; included Signature in mediaDataTypes list.
Importer: Media observation handling
avni-server-api/src/main/java/.../importer/batch/csv/creator/ObservationCreator.java
Updated switch to route Signature to handleMediaValue, alongside Image/ImageV2/Video.
Validation: Media value validation
avni-server-api/src/main/java/.../service/EnhancedValidationService.java
Updated validation to process Signature via validateImageValue with Image/ImageV2; whitespace-only formatting elsewhere.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant CSV as CSV Import
  participant OC as ObservationCreator
  participant Media as handleMediaValue
  note over OC: getObservationValue(dataType, value)
  CSV->>OC: Provide value with dataType = Signature
  alt dataType is media (Image/ImageV2/Video/Signature)
    OC->>Media: handleMediaValue(value)
    Media-->>OC: MediaObservation
  else other data types
    OC-->>CSV: Other handling path
  end
  OC-->>CSV: Observation created
Loading
sequenceDiagram
  autonumber
  participant Client as Client
  participant EVS as EnhancedValidationService
  participant VImg as validateImageValue
  note over EVS: validateAnswer(concept.dataType, value)
  Client->>EVS: value with dataType = Signature
  alt Image/ImageV2/Signature
    EVS->>VImg: validateImageValue(value)
    VImg-->>EVS: Validation result
  else other data types
    EVS-->>Client: Other validation path
  end
  EVS-->>Client: Validation outcome
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I dip my ears in inky light,
A flourish—signature in byte—
New paws join media’s gentle queue,
Validated, handled, routed through.
Hop, stamp, save—then off I go,
Carrot signed: Delivered. ✅🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
avni-server-api/src/main/java/org/avni/server/importer/batch/csv/creator/ObservationCreator.java (1)

224-226: Routing Signature through handleMediaValue is consistent.

Good addition. Consider consolidating all S3-backed media (File/Audio) under the same handler for parity, if applicable.

If desired:

-        case Image, ImageV2, Video, Signature:
+        case Image, ImageV2, Video, Signature, File, Audio:
             return handleMediaValue(formElement, answerValue, errorMsgs, oldValue);

Does s3Service.getObservationValueForUpload accept signature payloads/keys identically to images?

avni-server-api/src/main/java/org/avni/server/service/EnhancedValidationService.java (1)

185-187: Signature validated via image path: OK; consider broader media parity.

If video/file/audio should be host-checked too, extend this case or introduce validateMediaValue.

-        case Image, ImageV2, Signature:
-            validateImageValue(question, value, errorMessages);
+        case Image, ImageV2, Signature/*, Video, File, Audio */:
+            validateImageValue(question, value, errorMessages); // or validateMediaValue(...)
             break;
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 1fd5d8d and ae94c9c.

📒 Files selected for processing (3)
  • avni-server-api/src/main/java/org/avni/server/importer/batch/csv/creator/ObservationCreator.java (1 hunks)
  • avni-server-api/src/main/java/org/avni/server/service/EnhancedValidationService.java (8 hunks)
  • avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java (1 hunks)
🔇 Additional comments (6)
avni-server-data/src/main/java/org/avni/server/domain/ConceptDataType.java (2)

33-33: Adding Signature to mediaDataTypes aligns isMedia() behavior.

LGTM. Also confirm we don’t need multi-select signatures (not included in multiSelectTypes).

If multi-signature capture is a requirement, we’ll need to add Signature to multiSelectTypes and ensure UI/importers support it. Do you expect multiple signatures per question?


28-29: No @Enumerated(EnumType.ORDINAL) usage found; adding Signature is safe.
The search didn’t uncover any EnumType.ORDINAL persistence for ConceptDataType, so introducing a new constant won’t shift stored values.

avni-server-api/src/main/java/org/avni/server/service/EnhancedValidationService.java (4)

327-334: Safer URL parsing; host/protocol check is good—validate endpoint assumptions.

Using new URI(...).toURL() is safer. Ensure the comparison against an upload URL (generateMediaUploadUrl) matches the domain used for stored media (e.g., CloudFront vs S3) to avoid false negatives.

If downloads use a CDN host, compare against that instead of the upload host, or relax validation to allow configured media hosts.


281-291: Typed, null-safe location validation improvements LGTM.

Use of instanceof with safe cast and stream pipeline reads well.


302-308: Clearer error messages for location key-values.

Improves debuggability without behavior changes.


388-390: Explicit error for invalid qGroup item types.

Good guardrail for malformed payloads.

@ShivangMishra ShivangMishra force-pushed the dmp-2025-signature-capture branch from ae94c9c to 7f5c31c Compare September 1, 2025 12:50
@ombhardwajj
Copy link
Member

This closes avniproject/avni-product#1712

@ombhardwajj ombhardwajj force-pushed the master branch 3 times, most recently from a3cb55d to d1d6215 Compare November 3, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants