Project

General

Profile

Actions

Feature #846

open
AV FM

Prescription drug search: tell the doctor when stock cannot be shown because Pharmacy is unavailable

Feature #846: Prescription drug search: tell the doctor when stock cannot be shown because Pharmacy is unavailable

Added by Alminta V. about 14 hours ago. Updated about 14 hours ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
-
Start date:
11/12/2026
Due date:
% Done:

0%

Estimated time:
Resolved By:

Description

When Pharmacy cannot be reached, the Prescription drug search silently falls back to the Admin drug master and shows no stock at all. The list looks normal, so the doctor cannot tell whether a drug is in stock, out of stock, or simply not checked.

Observed on https://vvmc.test.clinq.health (Dr. Sravan VS, consultation /doctor/consultation/399, Prescription tab, Drug name = "dol"):

  • GET /doctor/api/opd/proxy?path=/api/pharmacy/medications/search?q=dolo returns 200 with five drugs, all with quantityAvailable = null, inStock = false, isInFormulary = false, isLowStock = false.
  • No stock badge ("N in stock", "N left", "Out of stock") appears next to any drug. OPD normally shows these.
  • The prescription footer also shows "Est. total: not available - 1 unpriced: Dolo 650", so price lookup is failing for the same reason.

How it works today (by design):

  • PharmacyMedicationsController.Search (nuvita-opd) catches any Pharmacy exception, logs a warning and returns the Admin drug master with stock fields left at default, so QuantityAvailable is null ("unknown, not zero").
  • stockLabel() in the portal renders no badge for null, so an outage never reads as an empty shelf. That decision is correct and should stay.

Problem / request:

  • The doctor gets no signal that stock was not checked. Silence looks the same as a normal result.
  • Add a small notice in the drug dropdown (and/or above the drug field) when results come back with unknown stock, e.g. "Stock unavailable right now. Availability was not checked." Do not show "Out of stock".
  • Show it only when stock is unknown for the results, not when Pharmacy answered normally.
  • Same idea for the price footer: say why the estimate is unavailable (Pharmacy not reachable), not just "1 unpriced".

Related:

  • #844: Order procedure fails with "pharmacy is unreachable" on the same server (same underlying Pharmacy connectivity problem).
  • #634: earlier "stock not shown" ticket, closed after checking the code only, not a live Pharmacy connection.
  • Root cause on the test server (why OPD cannot reach Pharmacy) is pending. Search the OPD API log for "Pharmacy medication search failed for hospital" to read the exception.
  • OPD shared code: the fix belongs in nuvita-opd and reaches Doctor Desktop on the next npm run sync:opd.

Files

Actions

Also available in: PDF Atom