integration:nhlmis

Action unknown: copypageplugin__copy

23.06. 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 tab of the File > Preferences menu. The tab looks like this:

General preferences

  • Server URL: The URL of the NHLMIS interface. Enter everything without the resource to be called and the final “/” e.g. https://dev.api.nscip.field.supply/v1 (this is actually the URL of the NHLMIS test server).
  • API key: The authentication key for your organisation. This will be provided by the NHLMIS team.
  • Error email: The email address for error emails to be sent to. Separate multiple email addresses with a semicolon (;) if you want error emails to be sent to multiple addresses.
  • Stores to send stock and receive requisitions for table: This table contains a row for every store in the datafile. Check the checkbox in the Send stock & Fetch requisitions column (by clicking on it) for each store you want to send stock to and fetch requisitions for in the NHLMIS interface.

Send stock preferences

  • Send current stock to NHLMIS checkbox: If this is checked then mSupply will automatically send the current stock stock in each of the stores selected in the Stores to send stock and receive requisitions for table. If it is unchecked then no current stock is sent to NHLMIS.
  • No. of days between sends: The number of days to leave between each send of stock. If set to 0 then current stock is not sent to NHLMIS.
  • Time to send: The time of day to send the stock. Enter the value in 12 hour clock format and select whether it is AM or PM in the drop down list.
  • Manufacturer to use if none: By default, if the stock doesn't have a manufacturer set in mSupply then it is sent to NHLMIS with a blank manufacturer. If you enter something in this field then, if a line of stock has no manufacturer set, then the contents of this field are sent in the manufacturer field. Of course, if a line of stock does have a manufacturer set then it is sent with the name of that manufacturer, regardless of what is entered in this field.
  • Send now button: If this is clicked, the current stock in the stores selected in the Stores to send stock and receive requisitions for table will be sent to NHLMIS immediately. This will be an “extra” send and does not affect the automatic send defined by the No. of days between sends and Time to send fields.

Fetch requisitions preferences

  • Fetch requisitions from NHLMIS checkbox: If checked then mSupply will fetch all outstanding requisitions (NHLMIS orders) from NHLMIS. The stores they are received for depends on settings in NHLMIS (this is tied to the API key which identifies who is requesting the requisitions/orders).
  • No. of minutes between fetches: The number of minutes to leave between fetching requisitions from NHLMIS
  • Set “since” marker“ to drop down list: Will contain the date and time that up to 5 previous “since” markers were received from NHLMIS. Selecting one of these will reset the current “since” marker to the one selected and therefore cause mSupply to ask for requisitions ready since that date and time. Useful if you need to force the re-fetching of many previously fetched requisitions because of errors.
  • Order ID text box and Fetch now button: These are used to fetch a single order. Enter the NHLMIS order ID in the Order ID text box and click on the Fetch now button to fetch it immediately form NHLMIS. A progress indicator will show how the fetch is progressing.

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

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) 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) are sent to NHLMIS by calling the /stock-counts endpoint.
  3. The success or failure of each send for each store is logged.

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.

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.

If errors are encountered during the sending of stock or fetching orders 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.



  • Last modified: 2023/01/17 09:47
  • by Gary Willetts