feat(interactions): add medicine interaction checker#1754
feat(interactions): add medicine interaction checker#1754shashank03-dev wants to merge 3 commits into
Conversation
|
@shashank03-dev, we can't merge this as-is due to a major N+1 query issue in the backend. In Plz refactor this logic. Instead of querying inside the loop, fetch all interactions in a single database call by passing all the selected drug IDs to a Let me know once u push the fix. |
|
yoh @dipexplorer, I have pushed the fix for the N+1 query issue and i'm sorry about the logic which was previously implemented by me. Earlier, the GET /api/v1/interactions endpoint was calling findInteraction() inside the nested medicine-pair loop. I refactored it so the endpoint now fetches all matching interaction records in one database query using the selected generic medicine names, then maps the pair results in memory. I also updated the API test to check that the endpoint only does one drug_interactions lookup for multiple selected medicines, so this should not regress back to per-pair queries. Verified locally:
The branch is updated with the fix now. |
d8e30e0 to
b583065
Compare
|
@dipexplorer updated this branch and force-pushed latest changes. What changed:
Local verification:
Please review and merge if everything looks good. |
🛑 STOP: Assignment & File Scope Check
Warning
PRs with unrelated files will not be reviewed and may be closed.
📋 PR Summary & Link
📸 Proof of Work (Screenshots / Logs)
Important
No Pull Request will be merged without proof of testing!
Please drag & drop your screenshots/GIFs here:
Expected screenshot:
/en/comparewith three selected medicines, theInteraction warningspanel, and visibleHigh Risk,Moderate, andSafetags.Local checks run:
🏷️ PR Type
type: bugtype: featuretype: docstype: testingtype: securitytype: performancetype: designtype: refactortype: devopstype: accessibility✅ Checklist
Closes #123)mainand resolved any conflicts