The COMS is a control tower system, introduced to Nigeria by Chemonics. It controls the movements of stock around many facilities across a few 3PLs (third part logistics providers).
The tower gathers report files (in csv format) from all the 3PLs every night. It uses the information provided to decide who gets what stock and when. Stock movements are sent by shipment file (again in csv format) as required.
So, there are 2 parts to the interface as far as mSupply is concerned:
Detailed design information (for Sustainable Solutions only) is here: https://github.com/sussol/org-issues/issues/21
The setup of the interface is all done through the COMS interface tab of the Preferences (File > Preferences…):
Use the SFTP interface: If checked, the interface is turned on and the various schedulers which run it are activated. If unchecked, the interface is turned off and the various schedulers are de-activated. No report files will be created and no shipment files will be processed. The various fields below are only editable if this is checked.
SFTP server settings These are the settings for the remote server to be accessed by SFTP
Email settings These tell mSupply where to send errors and information emails. Multiple email addresses can be entered in each field and should be separated with a comma (,).
Temporary file download & report generation folder This is the folder on the local server where the locally generated files will be stored before being uploaded to the server described in the SFTP server settings section above. Click on the Choose button to select the folder on the server. Note that mSupply will automatically create OneNetwork/downloads, OneNetwork/inventory/errors, OneNetwork/inventory/transactionFiles and OneNetwork/inventory/inventoryFiles folders inside the folder you choose if they do not already exist.
Schedule settings New shipment files are checked for and the inventory and buffer reports files are created and uploaded on schedules, controlled by these settings. The inventory and buffer files are created at the same time but the buffer files have to be uploaded a set period after the inventory files. This is to allow time for the day's inventory files to be processed by the One tower before the buffer files arrive for processing.
Failure retry settings These settings give mSupply details about what to do if there is a failure uploading files to the remote server via SFTP
COMS site Code/Description and Store code table This table contains the mapping between the Site code used by COMS and the Store code used by mSupply. The One Network code actually refers to 2 stores in mSupply, the main store with a WH00X-Y-AXI-NCC code and its corresponding Malaria store with code Y-AXI-MAL-GF. The link to the malaria store isn't defined in the settings but hard coded using store code pattern matching because it will never change.
To edit a mapping double click on it in the table, to add or remove mappings click on the + and - buttons respectively.
Just as we were going live, another requirement was passed to us to only process shipment file lines that had 'confirmed' status. It requires big changes to make that work so Chemonics wrote a script that takes the files deposited by One in Axios' outbox folder and puts only those that we should process in another folder. mSupply then checks this folder for shipment files to process. At some point we might be asked to incorporate these changes into mSupply.
These files are retrieved from the remote SFTP server according to the schedule. A single file can contain multiple shipments but the rows for a shipment will always be grouped together. Depending on the identity of the source and destination store, a single shipment will either be turned into a supplier invoice (to receive stock) or a stock transfer customer invoice (to send stock to another store).
If the program of a shipment is “global-fund::malaria”, “global-fund::malaria-iccm” or “global-fund::malaria-idp” (these are transaction category codes in mSupply) then the transaction is for the malaria store attached to the corresponding main store (the relationships between main stores and their corresponding malaria stores are stored in the preferences as described above).
The shipment ID is stored in the Their ref field of each invoice created.
Before being processed, the shipment number of each shipment file is checked against the shipment number stored in the Their ref field of all other customer invoices in all the stores defined in the One site Code/Description and Store code table (described in the preferences above). If the shipment number isn't found in any of these customer invoices then processing can continue as normal. If the shipment number is found the shipment is not processed:
In a similar way, the status of the first line in every shipment (not shipment file 😉) is checked. If it is confirmed then the shipment is processed. If the status is not confirmed then the shipment is not processed:
After these checks, shipment files are validated before processing for valid item codes, unrecognised transaction category codes etc. If a shipment file fails validation then the whole file is rejected, an email is sent and the file is moved to the results > axioserror folder.
On finalisation of a customer invoice (carried out on one of the satellites), a pick list file needs to be created on the server. To do this, on customer invoice finalisation a sync message (type 'axiosRequestFilesCreate') is sent to the server. That message is processed by the sync queue and turned into a pick list file which is stored locally to await upload to the remote SFTP server according to the schedule.
There are 4 types of files that are sent automatically once a day at the time set in the preferences. They are:
1. Lot file (filename Axios.Lotddmmyyyy.csv.ready) Contains a line for each unique batch in stock in the site (main store plus secondary store).
2. Inventory file (filename )
3. Buffer file (filename )
4. BOH file (filename )
The pick list files generated by mSupply have the filename format:
Axios.PickList//ddmmyyyyhhmmss//ONE-S-//shipment Id//-//random number//.csv.ready
where:
An example is:
Axios.PickList26072019155745ONE-S-15049-30604.csv.ready