This page represents a working draft with a proposed solution to address issues with Stock Management and the Stock-Requisition connection.

Background

A few recent improvements to Stock Management are interacting in a way that stops users from entering historical Physical Inventory data. Because Requisitions now save Physical Inventory data in the Stock Management service, this now blocks users from approving Requisitions in some cases. This is causing production issues in the Malawi implementation.

Two recent improvements to Stock Management in 3.2.0 have caused this issue:

The connection of these features are causing the following issues:

This is causing a production issue for the Malawi implementation with Requisition approvals, so the community has been asked to quickly identify a solution.

The proposed solution below is for community discussion and input. This is a planned topic for the Product Committee meeting on 19 Dec 2017.


Two-part solution (proposed)

The two-part solution below will allow Requisitions to be approved out of order. It will also have other benefits that improve the design and the timeliness of data.

1A. Allow Physical Inventory without requiring reasons for the entire quantity change (API only)

Remove the current validations from the Stock Management API that requires any Physical Inventory to include reasons that account for the entire quantity change. Under this proposal, we will remove the validations from the API, but the UI will still require those validations. That means that other services using the Stock Management API directly will have the flexibility to submit a past-dated or out-of-order Physical Inventory – this includes the Requisitions from the Requisition service. The UI, however, will still require reason quantities to account for the entire quantity from the system's last-known stock-on-hand.

When viewing a Stock Card, if the adjustment quantities do not fully account for the difference, a row showing "Overstock" or "Understock" will appear (similar to how version 3.1.0 worked before physical inventories used reasons).

Pros:

Cons:

Alternative 1B: Allow Physical Inventory without requiring reasons for the entire quantity change (both API and UI)

Remove the validations from the API, plus also remove the from the Physical Inventory screen of the UI. In either the API or Stock Management UI, it would now be possible to submit data for a past Physical Inventory.

Pros

Cons:

Alternative 1C: same as 1A, but make a separate API endpoint for submitting these Physical Inventories

(Suggestion from the comments below. Pros: same as 1A; Cons: Potential for duplicate code/added complexity)

2A. Requisitions Send Data to Stock Management at Authorized Step

Change the Requisition-Stock connection to send this data at the Authorized Step, which is sooner than the Approval Step currently used. This essentially means the Stock columns on the Requisition form get sent to the Stock Card when the form "leaves the facility" (after being Submitting and Authorized) and before the multi-step Approval workflow happens. Currently, data is synced at the final Approval, which can happen weeks or months later. That can mean a long delay before old data reaches the Stock Cards currently.

Once the stock data is sent, it can no longer be edited. So this would also change how Rejected Requisitions work. Rejected Requisitions would still go back to the start of the workflow, BUT the Requisition columns which were already synced to Stock Management would be read-only, not editable. Current behavior allows Rejected Requisitions to edit any columns. The columns impacted are: Beginning Balance, Received Quantity, Consumed Quantity, Losses and Adjustments, and Current Balance. Other columns would still be editable, such as Requested Quantity and Explanation. If they needed to change the stock columns, they could Delete the Requisition and re-initiate a new one; that would start a fresh "physical inventory" where the fields would be editable, although extra data entry would be required. (See alternatives below for other ways to address Rejected requisitions.)

Pros

Cons:

Alternative 2B: Rejected Requisitions still allow editing the stock columns, and when they are re-Authorized they submit a new Physical Inventory

Under this alternative, Requisitions would still send data to Stock Management at the Authorized Step (same as 2A), but Rejected Requisitions would also allow editing the 5 stock columns. The fields would not become read-only. When the Requisition moves to Authorized status again, the Requisition service would submit it again as an entirely new, second Physical Inventory.

Pros

Cons:

Alternative 2C: Rejected Requisitions Go to Authorized Status

Under this alternative, Requisitions would still send data to Stock Management at the Authorized Step (same as 2A), but we would change the workflow for Rejected Requisitions. Rejected Requisitions would go directly back to Authorized Status, not allowing edits by the facility, but still allowing changes to the Approved Quantity and Explanation. (This would be a significant change that might not be acceptable for existing country users, such as in Tanzania and Zambia.)

Long-Term Approach: Add Support for Reversals to Allow Corrections to Stock Data

In the longer term, we hope to add a significant new feature to Stock Management: support for Reversals of data. This is a strategy selected during design of the Stock service, but never implemented because of the time and effort required. This would allow the Requisition service to "reverse" the data submitted if a Requisition was Rejected. After that, it would be possible to re-submit new, corrected data. This feature, while it may be appealing, would take significant time and effort and would reduce the time remaining for other vaccines features. By using the Reversal mechanism, Rejected Requisitions could still allow editing of all the Stock columns.

Having Reversals in place could be used in combination with 2A/B/C to allow users to edit all the fields after a Rejection, and use the Reversal mechanism to reverse and re-submit Stock Card entries with improved data quality.

Pros

Cons:

Questions