feat: link scanned barcodes and medicine IDs to incident reports#1912
Conversation
- Extended createReportSchema with optional scannedBarcode and medicineId fields - Updated database insert to store scanned_barcode and medicine_id in counterfeit_reports - Added useSearchParams hook to ReportWizard to capture URL query parameters - Updated ReportPayload type to include the new optional fields - Changes are backward compatible - fields are optional and default to null This connects the medicine scanner workflow to incident reports, allowing users to click 'Report' from a scan result and have the barcode/medicine data automatically linked to their counterfeit incident report. Fixes RatLoopz#1202
|
Updated PR with test mock fix: Added anonymizeIp to the reportValidation.service mock to prevent test failures. The implementation is working correctly and ready for review. The CI failures appear to be related to pre-existing rate limiting in the test infrastructure, not my code changes. The core feature (linking barcode/medicineId to reports) is sound and backward compatible. |
|
Root-cause analysis on the failing checks, since CI is red but the failures are not from this PR: This PR changes only 4 files ( Build & Test ( quality-check (lint): The 3 errors are The barcode/medicine linking itself is complete and backward compatible. Could a maintainer confirm whether the base-branch test/lint failures should be fixed here or tracked separately? Happy to open a focused follow-up PR to green them up. |
|
🎉 Congratulations @anshul23102! Your Pull Request "feat: link scanned barcodes and medicine IDs to incident reports" has been successfully merged by @dipexplorer. Thank you for your valuable contribution to SahiDawa! 🇮🇳 Follow us on LinkedIn: https://www.linkedin.com/company/ratloopz/ to get shoutout |
Summary
Connect medicine scanner data to counterfeit incident reports for better tracking and verification.
Problem
When a user gets a suspicious result in the medicine scanner and clicks "Report", the system cannot link the scanned barcode or database medicine entry to the final incident report. This disconnects the scanner workflow from the reporting workflow.
Solution Implemented
Backend Changes (POST /api/reports)
scannedBarcode: z.string().optional()medicineId: z.string().uuid().optional()Frontend Changes (ReportWizard)
barcodeandmedicineIdfrom URL on component mountData Flow
Testing
Fixes #1202
GSSoC 2026 Contribution