This is an old revision of the document!
21.03. mSupply eLMIS interface
eLMIS stands for Electronic Logistics Management and Information System and is a version of OpenLMIS developed under the USAID Deliver project. mSupply has an interface for receiving orders from eLMIS and sending shipment details back to it.
Because eLMIS does not have an API, the mSupply interface uses files stored in a commonly accessible location to share information.
Setup
Before the interface can be used it has to be setup correctly. These are the setup steps you need to follow:
1. Create folders in a commonly accessible location
A computer file storage location must be created somewhere that is accessible by both the mSupply and eLMIS servers to directly write files. If a common location does not exist because the mSupply and eLMIS servers are on separate non-linked networks you can create a separate location on each of the mSupply and eLMIS servers and link them using a file synchronisation utility such as Dropbox.
When you have the centrally accessible location sorted out, create a main folder then some sub-folders according to the following:
In this picture we have called the main folder Transfer. You can name yours anything you like but the other folders must have exactly the same names as shown.
2. Enter the setup information into mSupply
Go to the mSupply Special > Preferences window and select the eLMIS tab. Please see the 16.01. General preferences > elmis_tab section in this user guide for information on these settings.
3. Setup eLMIS
- Set eLMIS to export its order files to the main folder/Order/Incoming folder when orders are created.
- Set eLMIS to look for incoming shipment files in the main folder/Shipment/Incoming folder on a regular basis.
Please consult your eLMIS documentation for information on these steps.
What the interface does
When it's running the interface does 2 things:
1. Processes new orders from eLMIS
Each time the interval set in the settings elapses, mSupply checks the main folder/Order/Incoming folder for new order files from eLMIS. If it finds one it reads the file and turns it into a customer invoice. The customer invoice will have these features:
- its status will be “sg” (suggested)
- its Their ref field will have the value “eLMIS:XXXX.” where XXXX is the eLMIS order number
- it will have a placeholder line for every item in the order file
The Their ref field makes a customer invoice created by the interface easy to spot. Feel free to add anything to the Their ref field after what the interface has put in there but not before. mSupply uses it to generate the shipment file for this order later on.
See the Order file format section below to see the format the order file must have.
If the order is successfully converted into a customer invoice the eLMIS order file is moved from main folder/Order/Incoming to main folder/Order/Processed.
If there is a problem and the order file is not converted into a customer invoice then the order file is moved to main folder/Order/Error. In addition, an error file is created and is also placed in main folder/Order/Error. The error file has the name “XXXX-YYYY-MM-DD-HH-MM.err.csv” where XXXX is the order file's filename without its extension. See the Error file format section below for the format of the error file. An error email with the error file attached will also be sent to the error email address set in the mSupply preferences.
2. Creates eLMIS shipment files for confirmed customer invoices
When a customer invoice that was created by this eLMIS interface (mSupply recognises them by the contents of the “Their ref” field) is confirmed then mSupply will create a shipment file for it. The shipment file will have the filename “SHPXXXX.csv” (where XXXX is the invoice number of the customer invoice) and will be saved to the main folder/Shipment/Incoming folder.
See the Shipment file format section below for the format of this file.
If there are any problems creating the shipment file, mSupply will display a message describing the problem. Please note that you will not be able to confirm the customer invoice until all the problems preventing the creation of the shipment file are corrected.
Using the interface
Well, the good news is that day-to-day you don't have to do anything. The interface will continue running quietly in the background processing order files and creating shipment files as the customer invoices are confirmed.
Periodically you should check the error email address set in the eLMIS preferences for messages about errors. Remember the order files that have caused errors can be found on the main folder/Order/Error folder. Note that mSupply does not put anything in the main folder/Shipment/Error folder - eLMIS only uses that folder when processing the shipment files.
The only other time you will hear anything from the interface is if mSupply detects an item on a customer invoice that wasn't in the original eLMIS order. This will happen if one of the item placeholder lines was replaced with a different item (e.g. because of low stock or a preferred item is to be used). In this case, mSupply will show a window and ask you to tell it which item on the original order you replaced with the item in question. Once you have selected the item that has been replaced mSupply will continue creating the shipment file.
eLMIS order file format
This a text file in csv format, each element of data is enclosed in “ characters. The first line of the file will contain headers only (ignored by mSupply), subsequent lines contain data in the following order:
- Warehouse code. This is the code the store in mSupply that this order (customer invoice) belongs to.
- eLMIS order ID. Stored in the Their ref field of the customer invoice.
- Item code. The code of the item being ordered.
- Product name. The name of the item, as stored in eLMIS. For reference only, not used by mSupply.
- Customer ID. The code of the customer this order is from.
- Quantity. The number of packs (default pack size) of this item ordered.
- First day of reporting Period. The date of the first day of the reporting period (budget period in mSupply) to which this customer invoice is to belong in the format YYYY-MM-DD.
- Line number. The number of this line in the order.
- Order date. Date the order was placed.
- Price. The unit price of the item. Optional, might not be sent from eLMIS, not used by mSupply.
Shipment file format
This a text file in csv format with the name “SHPinvoice number.csv” where invoice number is the customer invoice's number in mSupply (e.g. “SHP1234.csv”). The first line will always be “Order No, Product Code, Batch, Quantity Shipped, Cost, Packed Date, Shipped Date, Facility Code, Quantity Ordered, Substituted Product Code, Substituted Product Name, Substituted Product Quantity” (i.e. the column headers only), subsequent lines contain data in the same column order, each element enclosed in ” characters.
Error file format
A text file with the name “filename without extension-YYYY-MM-DD-HH-MM.err.csv” where filename without extension is the filename of the order file which the error file is generated for and YYYY-MM-DD-HH-MM is the current date and time in 24 hour format (e.g. ORD12345-2015-05-30-14-35.err.csv).
The file contains 3 lines:
- file name without extension: Error description where file name without extension is the eLMIS order file name without its extension and Error description is a description of the error that has been found e.g. “ORD10002: Facility code not found”
- Line number: XX where XX is the number of the line in the order file which has the error. e.g. “Line number: 3”
- Hint: Hint to fix it where Hint to fix it is a hint on how to fix the error e.g. “Hint: Make sure facility code is available in eLMIS, enter the facility code into the file”
Previous: 23.03. FrontlineSMS integration | | Next: 23.05. Moneyworks integration |