Skip to content

Efficency on Stoptbapp - #394

Merged
drtechie merged 8 commits into
feature/stoptb-sync-changes-feedfrom
vb/stoptb-worklist-batch
Oct 29, 2026
Merged

drtechie merged 8 commits into
feature/stoptb-sync-changes-feedfrom
vb/stoptb-worklist-batch

Conversation

@vishwab1

Copy link
Copy Markdown
Member

📋 Description

JIRA ID:

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 8 commits October 28, 2026 13:41
Load mapping, details, account, image, address, contact, beneficiary ID,
rmnch, born-birth, household, flow, anthropometry, vitals and user lookups
once per page instead of once per beneficiary. Read ABHA from
m_benhealthidmapping/t_healthid directly instead of calling FHIR-API per
beneficiary. Falls back to the existing per-row queries if the batch load
fails or a single-result lookup finds more than one row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
door-to-door-page-size 10 -> 50 so a village pull needs 5x fewer requests.
Log one [WORKLIST-TIMING] line per Stop TB village worklist page with the
time spent in count, ids, address, prefetch, build and JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Count village flow rows without the mapping join, and page with a deferred
join so OFFSET skips on idx_flow_psm_village_reg only and just the page's
rows are joined to the mapping. Ties on registrationDate are ordered by
ben_flow_id so a page boundary cannot skip or repeat a beneficiary. An
in-range page with no mapped rows returns an empty page instead of
"No record found".

Add ApiTimingFilter: one [API-TIMING] line per request with method, path,
status and time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TB suspected getAll looked up the full user detail (role + facility
queries) for every confirmed row only to read the state for the incentive
check; look it up once per user. The incentive rules and calls are
unchanged.

Stop TB general exam, screening, OPD and diagnostics getAll built the JSON
text, parsed it back and wrote it again; build the tree once via
OutputResponse.setResponse(JsonElement). Load those rows read-only.

Responses are byte-identical to before (Stop TB getAlls and the FLW app
worklist/suspected paths compared on the 3307 test DB).

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

Diagnostic status summary read each beneficiary's latest order five times,
once per status bucket; read beneficiaryId + status once and bucket in
Java with the same status groups (case-insensitive, like the database
comparison). Bucket contents are unchanged; order inside a bucket was never
fixed by the query.

TB suspected getAll copies the DTO fields directly instead of ModelMapper
per row, and its village subquery hints idx_flow_psm_village_reg (MySQL
ignores the hint where that index is absent).

Standard OPD records for a village start from the village's beneficiaries
instead of every visit of the PSM; the same visits match.

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

Restore IncentiveLogicService/IncentiveLogicImpl to their original code and
run the FLW (ashaId) path of TB suspected getAll exactly as before. The
Stop TB village path reads each user's state once and calls the unchanged
incentiveForTbSuspected only for CG users, the only state where it acts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The index-only count also counted flow rows that have no
i_beneficiarymapping row (423 on the reference DB, mostly PSM 1725),
so villages with such rows got extra or empty pages and a fully
unmapped village got an empty success instead of "No record found".
Put countVillageWorklist, getVillageWorklistAddressIds and the empty-page
handling back to the release-3.12.0 behaviour. The batch loader, page
size and timing logs stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved:
- BeneficiaryServiceImpl: keep the feed's buildBeneficiaryRecords /
  getBeneficiaryRecordsByRegIds split; the batched page loader stays inside
  buildBeneficiaryRecords, and getMappingsForAddressIDs keeps the page
  timing line.
- TBSuspectedServiceImpl: keep both the Stop TB village fast path and the
  feed's getRecordsByIds as written.
- StopTBPrescriptionService: take the feed's version (drops the village-first
  OPD query from this branch).

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

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a65e7a55-29c4-4136-a5ce-23673804386e
  • 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.

@drtechie
drtechie merged commit cd298ff into feature/stoptb-sync-changes-feed Oct 29, 2026
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.

2 participants