Skip to content

StopTB camp laptop data sync – = sync, inventory upload fixes and master download - #201

Merged
vanitha1822 merged 9 commits into
release-3.12.0from
vb/3.12.0-auto-sync
Oct 21, 2026
Merged

vanitha1822 merged 9 commits into
release-3.12.0from
vb/3.12.0-auto-sync

Conversation

@vishwab1

Copy link
Copy Markdown
Member

📋 Description

JIRA ID: AMM-2491

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 9 commits October 15, 2026 09:38
…B laptops

- Upload (van to central) every 30 min and master download every 6 h,
  using the central connection of the automatic BenID download (no stored
  password; SyncedBy = operator who connected the laptop). Own thread and
  lock; skips while a manual master download runs.
- GET /dataSyncActivity/autoSyncStatus: last runs, last error, and rows
  central rejected (Processed='F') per table and SyncFailureReason.
- Active only where stoptb.enforce.vanid=true and stoptb.van.id>0; manual
  Upload / Download Masters unchanged. 6 unit tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refills and stock issued at central for this van's store (indents, indent
issues, stock transfers, stock entries) reach the laptop without pressing
Inventory Data Download. Runs after each automatic upload; its own failure
does not undo the upload; shown in autoSyncStatus. Switch:
sync.autoInventoryDownload.enabled (default true). 2 new unit tests.

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

The loop over the 5 tables also did i++ at the end of each pass, so only
t_indent, t_indentissue and t_itemstockentry were downloaded;
t_indentorder and t_stocktransfer never reached the van.

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

m_synctabledetail maps van columns to server columns by position (the van's
own ID sits where the server list has VanSerialNo); since the by-name record
mapping, VanSerialNo was stored NULL, so a re-sent row was inserted again
(duplicates) and joins on VanSerialNo broke. VanSerialNo now takes the van
row ID and SyncFacilityID the row's store when not sent by name
(dataSync.fillVanKeys, default true).

Master download on central logs the row count instead of every row (the
661k-row village table exhausted the heap).

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

- StopTB laptops (stoptb.enforce.vanid=true): service-line and van masters
  (hubs, vans, stores, items, item-store mapping, roles) are downloaded in full
  for the van's line, so a laptop set up from a copied database gets them all;
  shared masters (villages) stay incremental. Other MMU laptops unchanged.
- Automatic upload / master download / inventory download are off by default
  (manual sync until approved); when on, the automatic master download fetches
  only the inventory masters (sync.autoMasterDownload.inventoryOnly=true).

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

A van sends its own IDs in BenVisitID / PrescriptionID; on central those
numbers belong to other rows, so prescriptions and prescribed drugs were
linked to another van's visit/prescription, or rejected by the foreign key
when the number did not exist. With dataSync.translateVanLinks=true the link
is replaced by the central ID of the row the same van uploaded with that
VanSerialNo; if that row is not on central yet the record is not saved and is
sent again on the next upload. Off by default (other MMU servers unchanged);
to be switched on for the StopTB central.

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

Inventory tables are configured in group 5 (old lists: stock-outs without
FacilityID/SyncFacilityID, patient issues without SyncFacilityID, batch insert
fails) and in group 9 Inventory (complete). Group 5 runs first and marks the
rows uploaded, so central stored stock-outs without their camp store and
per-store reports missed them. On StopTB laptops (stoptb.enforce.vanid=true) a
table that a later group also uploads is skipped. Other MMU laptops unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…column and continues past a failing table

The laptop sync list still names tb_diagnostic_order.reason_for_refusal; V125 renamed it to
reason_to_close and the whole upload stopped with bad SQL grammar. The column name the table
really has is used for the van and server column lists, and a table that cannot be read is
recorded as failed while the other tables still upload. Both only on a StopTB laptop
(stoptb.enforce.vanid).

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: ccd73874-554f-4f4f-bb45-a66e9eadcd9c
  • 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.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Comment on lines +158 to +160
List<Map<String, Object>> rows = jdbcTemplate.queryForList("SELECT '" + table.getTableName()
+ "' AS tableName, SyncFailureReason AS reason, COUNT(*) AS failedRows, DATE_FORMAT(MAX(SyncedDate), '%d-%m-%Y %H:%i') AS lastTried "
+ "FROM " + qualified + " WHERE Processed = 'F' GROUP BY SyncFailureReason");
Comment on lines 186 to 187
@vanitha1822
vanitha1822 merged commit bbe70ed into release-3.12.0 Oct 21, 2026
2 of 5 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