SOFI bill to Primmo

The sofi-bill-to-primmo tool is a script installed on the same server as the Primmo software and allows you to automate the transfer of billable A la carte services accepted in SOFI to the Primmo software. This avoids having to generate the transfer file (MDG format) manually in the “Billing Services” tile for each residence, thus eliminating the loss of time and the risk of human error.

In order to import into Primmo the care services dispensed in SOFI that will be billable, the client must purchase a “Master D” billing import module (MDG) from Hopem.

In short, this script performs the following operations:

  • For each residence configured in the configuration file
    • Get through SOFI's API the list of SACs with the status “Accepted” (referring to the “Service Billing” tile) in the date range configured in the sofi-bill-to-primmo config file (if there are no dates specified, then sofi-bill-to-primmo takes all the services with the status “Accepted” regardless of the dates)
    • Enter all accepted VS found in the previous step into a file compatible with Primmo import (MDG format) in order to bill them in Primmo. Note that as long as the transaction is not completed for the residence, then the results file is marked as temporary (.tmp).
    • Assign by SOFI API the status “Archived” to all SACs that have been extracted in the file (only if sofi-bill-to-primmo is not run in DryRun mode).
    • Remove the temporary status from the results file (csv).
  • The tool generates a log file locally (no email transmission). This log file is cycled every day and gives a summary of the operations and transactions performed.
  • If there are no accepted VS identified for a residence, then sofi-bill-to-primmo generates an empty result file.
  • The name of the generated result files as well as the content of the result files conform to the MDG format.
  • The log files generated by sofi-bill-to-primmo are saved in the directory specified in the “FilePath” configuration
  • The billing files are generated in the directory specified in the “OutputDirectory” configuration.

For a fixed frequency execution of the tool, you need to use an external task scheduler, such as Windows task scheduler.

To protect against import errors, sofi-bill-to-primmo will not do any processing if it is run when one or more .csv or .tmp files are still present in its billing file directory (OutputDirectory).

Running the tool requires a user with the rights and key to access the SOFI data.

You need to create an employee who is well identified in the SOFI instance with the API key and the secret used in the application needing access.

Make sure that the created user has the Login to API Allowed checkbox checked and that the access group of this user has all the required rights.

Download the latest version of the tool. Follow the link: https://gitlab.telemedic.ca/op-team/sofi-import-tool/-/releases and click on the “build” link under the “Assets” section.

Extract the contents of the compressed file into a subdirectory at the root of the C: drive (e.g. c:\telemedic\importation)

To configure sofisync, you need to have the following information.

The information from the SOFI instance that will allow sofisync to access the data and the information from Primmo that identifies the institution that needs to be synchronized.

ParameterDescription
From SOFI
urlURL to the SOFI API access point
API access keyAccess key's associated secret.
API secretpassword for the access key
From Primmo
VendorIdVendor ID (as configured in MDG)
MdgFormatCol09Value to be entered in column 9 of MDG file
MdgFormatCol11Value to be entered in column 11 of the MDG file
MdgFormatCol14Value to be entered in column 14 of the MDG file
MdgFormatCol15VValue to be entered in column 15V of the MDG file
MdgFormatCol15PValue to be entered in column 15P of the MDG file

All values are optional

ParameterValueDescription
“StartDate”YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZStart date and time for the search for accepted SAC.
“EndDate”YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZEnd date and time for the search for accepted SAC.
“Language”“FR” ou “EN”Language used for the description of services in Primmo files. (default=“FR”).
“DryRun”true or false Allows you to run the program in simulation mode, i.e. without archiving the accepted SAC. (défaut=false).
“OutputDirectory”Allows you to specify the directory where the billing files will be generated. (défaut=“output”).
“FileLogging” “FileLogging”: { “FilePath”: “log” }Allows you to specify the directory where the log files will be generated. (défaut=“log”).
{
	"Companies": [
		{
			"url": "https://siteduclient1.telemedic.ca",
			"apiaccesskey": "COMPANY1_API_ACCESS_KEY",
			"apisecret": "API_SECRET",
			"PrimmoBilling": {
				"VendorId": null, 
				"MdgFormatCol09": null, 
				"MdgFormatCol11": null, 
				"MdgFormatCol14": null, 
				"MdgFormatCol15V": null, 
				"MdgFormatCol15P": null
			}
		},
		{
			"url": "https://siteduclient2.telemedic.ca",
			"apiaccesskey": "COMPANY1_API_ACCESS_KEY",
			"apisecret": "API_SECRET",
			"PrimmoBilling": {
				"VendorId": null, 
				"MdgFormatCol09": null, 
				"MdgFormatCol11": null, 
				"MdgFormatCol14": null, 
				"MdgFormatCol15V": null, 
				"MdgFormatCol15P": null
			}
		}
	]
}

Rights needed

ModuleRights
AdminView
BillView
General InformationView

Warnings, informations and errors in logs

[WARN] IMPORTANT! DryRun will create the files but will not set archived status for charges. : Indicates that sofi-bill-to-primmo is running in DryRun mode and therefore will not archive billable SAC.

[ERROR] Files found in the output directory, check logs and clean output directory before retrying : sofi-bill-to-primmo stops its execution since there are already files of type .csv or .tmp in the output directory.

[ERROR] Invalid client credentials for VendorId X : The secret key information provided to connect to the vendor ID API is incorrect or the user does not have access rights to the API.

[ERROR] default - Invalid output directory 'XXXX' : The output directory for the billing files does not exist.

[INFO] default - Log directory 'XXXX' created : The sofi-bill-to-primmo tool informs about the creation of the XXXX logging directory.

[INFO] default - Output directory is set to 'output' : The sofi-bill-to-primmo tool informs that the default directory 'output' is used for the generation of invoice files.