Table of Contents

23.07. NHLMIS integration

Before you turn on the NHLMIS integration two important setup steps must be taken:

  1. All store, item, customer and supplier codes must match those used in NHLMIS. If this step is not taken;
    1. stock data you send will be rejected by NHLMIS because the items the stock belongs to will not be recognised
    2. requisitions (orders) you receive from NHLMIS will not be added because the customer or items are not recognised by mSupply
  2. NHLMIS must be configured so that the API key relates to the correct stores in your mSupply installation.

Currently, there is no functionality to show the program a particular order is for or to force the selection of stock that belongs to the correct program. This might be added in a future upgrade.

mSupply has an interface with the Nigeria Health Logistics Information System. The interface allows the automatic sending of current stock and pulling of orders from NHLMIS.

The preferences that define how this interface works are managed on the NHLMIS and NHLMIS 2 tabs of the File > Preferences menu. The tabs looks like this:

General preferences

Send stock preferences

Fetch requisitions preferences

Send shipments preferences

Synchronise items preferences

Synchronise customers preferences

Click on the OK button to save any settings you have changed; changes will not be put into effect until they are saved by clicking this button

Other setup

What it does

Sending stock

The current stock in each store selected in the Stores to send stock and receive requisitions for table is sent to NHLMIS automatically on the schedule defined by the No. of days between sends and Time to send field.

Each time a send is made the following is done in this order, one store at a time:

  1. all the batches in stock (i.e. where available stock is more than 0) that have a program and donor assigned (any other stocklines are ignored) are sent to NHLMIS by calling the /batches endpoint. If all successful then proceed to the next step. If not all are successful then record error and stop.
  2. all current stock lines (i.e. where available stock is more than 0 and program and donor have been set) are sent to NHLMIS by calling the /stock-counts endpoint.
    1. Some items have an NHLMISChild property with values in the format ”code,pack_XXX“ where code is the item's code and XXX is the pack size. If the item of any stock line has an NHLMISChild property AND the line is not using the item's default pack size then the code of the item sent to NHLMIS for this line is replaced with the item code in the NHLMISChild property that has the matching pack size value (XXX in the example above). If there is no matching pack size value then no item code replacement is made.
  3. The success or failure of each send for each store is logged.

Fetching orders (requisitions)

All the outstanding orders (which become requisitions in mSupply) for this mSupply installation which have become outstanding since the last “since marker” are automatically fetched from NHLMIS on a schedule defined by the No. of minutes between fetches field. This is done by making a GET call to the /orders endpoint.

These calls are all made using genericParent=True which means that all items in the NHLMIS response will be replaced with their generic parent items (by NHLMIS). The quantities requested for each item in the order are multiplied by their default pack size to get the number of units for the requisition line.

If there are more than 50 outstanding orders then mSupply will automatically ask NHLMIS to send the next 50 until all outstanding orders have been retrieved.

Each time orders are successfully retrieved, the “since” marker that mSupply uses for the request is updated with the value returned by NHLMIS. And if the “since” marker is for a different day to the last since marker stored, it is added to the Set “since” marker” to drop down list (only the 5 most recent markers are stored in this drop down list - if there are already 5 then the oldest is replaced with the new one).

Each order received from NHLMIS is saved as a requisition in the appropriate store in mSupply. The NHLMIS order ID is stored in the Their ref field of each requisition.

Any orders that have already been received from NHLMIS and saved in mSupply are not saved again, they are ignored.

Fetching a single order (requisition)

This occurs when the Fetch now button shown above is clicked. This makes a GET call to the /orders/{suborderId} endpoint, where {suborderId} is the ID of the NHLMIS order to retrieve. As with the scheduled fetching of orders described above:

Sending shipments

When a customer invoice, which comes from a requisition generated from an NHLMIS order, is finalised it is sent to NHLMIs by making a PATCH call to the /orders endpoint. All shipments are sent with a “packed” status. If it is successful, all is well. If the send fails then it is added to a queue and the send is retried after the number of minutes in the Minutes between retries field. When the call is successful then the shipment is removed from the queue. If it fails the number of times in the No. times to retry sends field then the shipment is removed from the queue and an error email is sent to the email(s) in the Error email field.

Synchronising items

A GET call is made to the /products endpoint for all NHLMIS services. If an item code returned from these calls exists in mSupply already then it is ignored. If it does not exist in mSupply already then:

In addition, new items will be added to master lists that have tags matching the item's program name (master list tag format is “NHLMISProgram:program name”). If the master list does not exist then it will be crerated by mSupply.

The pack size sent with an item is set as its default pack size.

Synchronising customers

A GET call is made to the /services endpoint to get all the services that belong to programs in mSupply then a GET call is made to the /locations endpoint for each service in turn. If a customer with the same code exists in mSupply already then it is ignored. If it does not exist in mSupply already then it is created:

Errors

If errors are encountered during any of the processes then information about the error is saved in the log (see the 25.19. The system log page for details) and an email giving details of the error is sent to the email address stored in the Error email field.

Visible changes in mSupply

Requisitions

When an NHLMIS order is received it is turned into a requisition in mSupply. The requisition has its donor set to the donor in mSupply that matches the value after funder: in the NHLMIS order. The donor is show in the requisition in a Donor drop down list (which is only shown if the Fetch requisitions from NHLMIS checkbox is checked on the File > Preferences > NHLMIS tab), shown here:

The drop down list is active so the user can edit it if required.

Supplier invoices

Supplier invoices have a new Program drop down list, displayed ony when the Fetch requisitions from NHLMIS checkbox is checked on the File > Preferences > NHLMIS tab. It is shown here:

It is populated with the names of all the master lists with a tag of NHLMISProgram:XXX where XXX is the name of an NHLMIS program. The user can set the appropriate program for the stock on the supplier invoice.

Customer invoices

Read only Program and Donor fields are displayed on a customer invoice if the Fetch requisitions from NHLMIS checkbox is checked on the File > Preferences > NHLMIS tab. These fields display the NHLMIS progam and funder (mSupply donor) the customer invoice belongs to and are shown below:

The Program field is populated with the name of the master list which matches the NHLMIS program. It will be empty if there isn't a requisition linked ot the customer invoice.

The Donor field is populated with the name of the donor matching the NHLMIS funder (mSupply donor) associated with the requisition the customer invoice came from. It will be empty if there isn't a linked requisition.

The action of the Issue stock for all placeholder lines option on the grinder icon below the table on the left hand is modified if the Fetch requisitions from NHLMIS checkbox is checked on the File > Preferences > NHLMIS tab: it still applies stock in FEFO order but it only uses stock which has a donor and program matching the customer invoice's. If the customer invoice does not have a donor then donor matching is not carried out, if it has no program then program matching is not carried out. If it has neither then the functionality is exactly the same as normal and no additional filtering is carried out.

Stock lines

A Program drop down list is displayed on the stock line edit window (opened by choosing Item > Show items with stock from the menus and double-clicking a stock line on that window). The drop down list will be set to the NHLMIS program associated with the stock and looks like this:

If the Fetch requisitions from NHLMIS checkbox is checked on the File > Preferences > NHLMIS tab, the Program is also offered as a column selectable for display on the stock line edit window (opened by choosing Item > Show items with stock from the menus). If you click on the Customise button on that window, you will see the Program field in the available columns as shown here: