Skip to content

feat(AMM-2342): StopTB General OPD prescription and camp-store dispensing on AMRIT standard tables - #381

Merged
SauravBizbRolly merged 20 commits into
release-3.12.0from
vb/stoptb-3.12.0
Oct 21, 2026
Merged

SauravBizbRolly merged 20 commits into
release-3.12.0from
vb/stoptb-3.12.0

Conversation

@vishwab1

Copy link
Copy Markdown
Member

📋 Description

JIRA ID: AMM-2342

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

vishwab1 and others added 20 commits September 25, 2026 09:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pollOnce saved a stale copy of the order loaded before createAndPushOrder's
updateVanSerialNo() ran, writing vanSerialNo back to NULL. MMU sync keys
tb_diagnostic_order by vanSerialNo, so those rows could never sync and the
Stop TB sync group stayed partial.

- refill vanSerialNo after the scheduler's save in pollOnce
- mark vanSerialNo updatable=false on the diagnostic entities so entity
  saves can no longer overwrite it (updateVanSerialNo still sets it)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fill vanSerialNo before the (possibly slow) EMR Lite push instead of only
after it, so a crash or restart mid-push can't leave the order without
its sync key. Same value (= id); no change to status, push or response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tock

Same endpoint stoptb/nurse/generalOpd/save. When the app sends the new
fields (submissionId, chiefComplaints[], prescription.drugs[] with drugID
and qtyPrescribed) the save writes t_benchiefcomplaint, t_prescription,
t_prescribeddrug, t_patientissue and t_itemstockexit and reduces
t_itemstockentry from the van's store, like TM and Inventory-API. One
transaction: insufficient stock rejects the whole submit. submissionId
makes retries safe. Old payload behaves as before.

The configured stoptb.van.id is the source of truth; a different vanID from
the app is rejected. Parking place and store are read from m_van.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Always use stoptb.van.id; a vanID sent by the app is ignored (logged).
- Reduced batch gets Processed='N' so the new quantity uploads to central;
  removed chief complaints are re-sent the same way.
- Batches with no expiry date are usable, as in v_drugforprescription.
- Drug must be mapped to the store on its own service line, same join as
  the drug list, so the save accepts exactly what the list shows.
- Patient name, age and gender filled on t_patientissue for the
  Inventory dispense screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New payload (chiefComplaints[] / prescription.drugs[]) no longer writes
  tb_stoptb_general_opd; complaints, prescription and dispensing live only
  in t_benchiefcomplaint, t_prescription, t_prescribeddrug, t_patientissue,
  t_itemstockexit.
- generalOpd/getAll reads the standard tables first and falls back to
  tb_stoptb_general_opd only for older visits that exist only there.
  Response fields and formats are unchanged for the app.
- Old app payload keeps its current behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qtyPrescribed from the app is used as is. When it is missing, for
tablets and capsules (MMU's prescription screen asks quantity only for
other forms) it is doses per day x days from frequency and duration;
Single/Stat dose = 1, Once in a Week = 1 per 7 days. SOS or other forms
without a quantity are rejected. The calculated value is saved in
t_prescribeddrug.QtyPrescribed and dispensed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- chiefComplaintID is required for each chief complaint (getAll and
  reports identify standard-table records by it).
- prescription.instruction is saved in t_prescription even when no drug
  is given, as MMU does for the visit instruction.
- providerServiceMapID and createdBy give a clear error when missing
  instead of a database error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p sends none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- generalOpd/getAll returns a "drugs" list per record (drugID, drugName,
  itemFormID, drugForm, dose, frequency, duration, durationUnit,
  qtyPrescribed, instructions) from t_prescribeddrug, so a saved
  prescription can be shown with form and quantity. Existing fields are
  unchanged; old free-text records return an empty list.
- SOS tablets/capsules without a quantity: 1 per day of duration
  (1 when no duration) instead of rejecting the save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the branch onto the 3.12.0 line (includes PR #366 STOP-542
anthropometry reads, dynamic form versions, device integration).
Only conflict: pom.xml version, resolved to 3.12.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the diagnostic vanSerialNo fixes (stamp before vendor push;
vanSerialNo not updatable on diagnostic entities).
Conflicts:
- pom.xml: kept 3.12.0 (branch is on the 3.12.0 line)
- DiagnosticOrderServiceImpl: kept both — 3.12.0's ModifiedBy/Processed
  on the no-push-response path and 3.9.2's fill of a missing vanSerialNo
  after save.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TB suspected / confirmed / diagnostic saves create the visit with
ProviderServiceMapID null. When one of them syncs before TB screening
or OPD, the visit keeps null and getAll (filters by psm) skips it.
A later save that has a service line now fills it in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Quantity for tablets uses the dose like MMU (Half Tab 0.5, One Tab 1,
  One & Half Tab 1.5, Two Tabs 2 per intake), rounded up. No dose sent =
  one tablet, so today's results are unchanged.
- Dispense no longer marks the stock batch Processed='N'. Central gets the
  stock-out rows (standard MMU); re-sending a batch could insert a
  duplicate batch on central.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dispensed batch is marked Processed='N' again so the next upload updates
central's copy (matched by VanSerialNo + store, now kept by central MMU-API).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: afad0da0-489d-4533-ad44-4acf91b9d7da
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

@SauravBizbRolly
SauravBizbRolly merged commit 277db7a into release-3.12.0 Oct 21, 2026
1 of 2 checks passed
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.

3 participants