Offline Scope
Core offline scope should be limited to patient lookup, prescription retrieval, dispensing capture, stock deduction intent, and local receipt printing.
The PMIS URS makes offline capability important for dispensing and stock transactions.
This page sketches the realistic architecture choices, the conflict risks, and the safest
recommended delivery path for ERPNext and pharmacy_app.
Core offline scope should be limited to patient lookup, prescription retrieval, dispensing capture, stock deduction intent, and local receipt printing.
The biggest risk is stock and batch integrity when two sites or two devices dispense overlapping stock before synchronization.
Use an offline queue with conflict review first. Avoid pretending offline stock is final until the central server reconciles it.
These two requirements from the signed PDF are the real drivers for offline design. The architecture sketch below is an implementation interpretation of these exact requirements, not a replacement for them.
The system shall support offline operation for core dispensing and stock transactions in the event of internet connectivity loss, synchronizing with the server when connectivity is restored.
No data entered offline shall be lost in the event of a synchronization conflict; conflicts shall be flagged for manual review.
A browser-based offline web app stores transactions locally in the device and syncs them when connectivity returns. This looks attractive because it reuses the web UI, but it creates difficult multi-device consistency problems and stronger local-device security requirements.
Each site runs a small local node that continues serving pharmacy operations during internet loss. Transactions are written to the local node first, then synchronized to the central server when the connection returns. This is the safest realistic offline design for PMIS.
The system stays online-first, but adds contingency workflows for outages: cached read-only views, printable pick lists, manual temporary registers, and later controlled re-entry into the system. This is not full offline operation, but it is the fastest low-risk resilience layer.
This view is meant to help us organize implementation, not just describe architecture. Option B is the only path here that looks credible for true multi-user pharmacy operation.
| Option | Offline Depth | Build Effort | Operational Risk | Best Use | Recommended Phase |
|---|---|---|---|---|---|
| A. Browser PWA | Device-level offline capture with local browser storage | High | Very High | Narrow single-user capture only | Do not use as primary target |
| B. Site Local Node | Site-level transactional continuity with deferred sync | Very High | Medium to High | Real branch pharmacy continuity | Pilot after online-first core is stable |
| C. Assisted Offline | Read-only cache plus controlled outage procedures | Medium | Low to Medium | Phase-one resilience and fallback | Start here immediately |
The safest route is to avoid jumping straight into full device-level offline. Build this in stages so the pharmacy can validate process and reconciliation before deeper technical complexity.
Define exactly what must work offline, who can do it, which documents are authoritative, and how conflicts are approved.
Introduce outage procedures, cached views, printable artifacts, and controlled recovery workflows first.
Implement a local-site queue and sync service at one site, with conflict review screens and strong audit logging.
Only after pilot success should offline stock, dispensing, and controlled-drug logic be expanded to both sites.
If offline is important enough to plan now, it should be organized as a dedicated workstream with separate product, technical, and control deliverables.
If we pursue real offline capability, the minimum architecture should include: a site local node, encrypted local storage, transaction queueing, signed sync batches, replay protection, conflict review, and a ledger that separates local committed from central reconciled stock effects.