Wednesday, July 26, 2017

Compression / Optimization in OpenIZ

While deploying OpenIZ in a rural region of Tanzania, some of our users were noticing that initial synchronizations were taking quite a long amount of time. The users were attempting to download over 30,000 records over a 2g connection.

To begin with, the Edmonton CTP version of the OpenIZ IMS (0.9.6) did have some greedy database queries. After optimizing the server down to near 0 response times (using REDIS for example, first request for 5,000 facilities is about 20 seconds, second request for the same dataset is 1.5s), I decided it would be worthwhile to update the compression on the OpenIZ IMS.

After reading on the internet, I found some articles about SharpCompress (MIT licensed) which I could use to extend Edmonton CTP's compression providers. The deflate and gzip (compressors in SharpCompress were apparently faster than the default .NET ones). After some work, there are now four compression schemes supported for retrieving and sending data to the OpenIZ IMS:
  • LZMA - The compression scheme used by 7z, which can heavily compress data however requires quite a bit more resources (decompression does not)
  • BZIP2 - A burrows-wheeler compression algorithm which yields slightly higher compression rates than GZIP but is faster than LZMA
  • GZIP - The GNU Zip format, this is standard HTTP GZIP compression
  • Deflate - Again, standard deflate compression algorithm, OpenIZ uses the optimization for speed rather than compression.
Each one of these compression schemes is now supported in the Disconnected Client (Edmonton CTP3, they will require a server running Edmonton CTP3 as well). The settings are found in the "Network Options" section of the configuration UI.

For those that are interested in the trade-offs in terms of speed and bandwidth usage, I setup a small facility with 500 patients and downloaded the data. Please note that these are very specific to this particular use case, however are a good guide. Below are the results:

Algorithm Download Time Size
Broadband DSL 56k (like 2g)
LZMA 0:18.50 1:14.50 5:30.00 1.8 MB
BZ2 0:18:50 1:18.50 6:01.00 1.94 MB
GZIP 0:19.00 1:20.50 6:30.00 2.1 MB
Deflate 0:10.00 1:40.50 6:45.00 2.2 MB
RAW 0:08.50 5:00.00 24:50.50 8.3 MB

The differences in these results are more marked when dealing with larger clinics with 10,000's of patients and 100,000's of results. This illustrates the need for connection compression. The OpenIZ IMS always supported the submission and querying of data in compressed format, with these new schemes, it makes downloading a lot faster on 2g connections!

Sunday, July 23, 2017

OpenIZ Disconnected Client Community Technology Previews Released

Well, after about two years of toiling away, the team at MEDIC has finally released the OpenIZ Disconnected Client. As of this writing you can find the Community Technology Preview 2. There will be more coming soon, but for now you can access:
  • The Disconnected Client Vanilla Application
  • The Software Development Kit (SDK) for writing your own applications
  • Some tutorials and wiki articles (more are coming)
  • The OpenIZ IMS Server

Disconnected Client

The disconnected client is the user interface for OpenIZ. The disconnected client is a complete clinical software solution that does not require internet and can operate for days or even weeks without connectivity before synchronizing its local data to the server. All business rules are executed locally, so even server logic operates on the client.

The disconnected client works on
  • Microsoft Windows 7+ Operating Systems with .NET 4.5.2
  • Android 4.4 Tablets (running System Web View 44 or higher)
  • Ubuntu Operating Systems with Mono 4.x and GTK+
The main features that work for this CTP release of the Disconnected Client are:
  • Synchronization and conflict resolution with an OpenIZ IMS server
  • Over the air updates of applets, rules, reports, and protocols
  • Offline reporting engine
  • OpenIZ's care planning engine
  • JavaScript business rules engine
  • OpenIZ JavaScript bridge 0.9.8 (allowing you to query the data in the client)
  • Full RIM database running on the client
  • Auditing on the mobile client
  • Act/Entity templates and display
You can download from: (CTP 2)

Software Development Kit (SDK)

The OpenIZ SDK allows jurisdictions or independent firms to extend the platform to a variety of use cases. The OpenIZ database is based on a simplified version of the powerful HL7 Reference Information Model. This means that in addition to immunizations, it can be used for general encounter tracking, disease surveillance, general practice, etc.

The software development features the following tooling:
  • An applet compiler for bundling and signing your applets
  • LogViewer which is handy for sifting through large OpenIZ device logs
  • BrainBug which is a windows tool that can interpret Android ab files easily
  • OIZDT which includes tooling for debugging business rules and clinical protocols
  • MiniIms which allows developers to quickly test their applets on a self-hosted IMS in Linux, Windows or MacOS X.
You can download from: (CTP2)

Immunization Management Service (IMS)

The IMS is the main integration point for the OpenIZ solution. It is currently available in binary form for Microsoft Windows operating systems. Unfortunately this CTP doesn't include graphical configuration tools. We are preparing more documentation for the configuration of the IMS which should be available before the Edmonton release ships in September.

The current CTP IMS supports the following features:
  • Base IMSI, RISI, and AMI interfaces which OpenIZ tooling uses to communicate with the IMS
  • Full implementation of the simplified reference information model with versioning support for objects.
  • Base dataset for common materials, codes.
  • Persistence storage plugins for
    • PostgreSQL
    • Microsoft SQL Server (deprecated)
  • Support for fast no-SQL memory caching either in-memory or via REDIS
  • Full import capability from GIIS
  • Server side execution of applet business rules, and clinical protocols
  • Integration with Jasper Reports 6
  • Two factor authentication
    • Email supported via SMTP
    • SMS supported via Twilio
  • Standards based integration (please note these have not been taken to an integration testing event yet):
    • HL7 FHIR STU3 : Patient, Immunization, Immunization Recommendation, Condition, Adverse Event, Allergy Intolerance, Medication Administration, Observation, Substance, and Medication.
    • IHE CSD : Import facilities, villages, and relationships between from a CSD document
    • IHE ATNA : Supports DICOM and RFC-3881 audits. Note that the content of these audits are not standard
    • IHE PIX/PDQv2 & v3 : Supports the broadcasting of new patient registrations to a central EMPI, and can also receive ITI-10 and ITI-8 notifications from a central EMPI.
    • IHE SVS : For importing concept terminologies into the IMS data store
    • GS1 BMS : For order & shipping support.
      • Broadcasts: order, receivingAdvice
      • Receives: orderResposne, despatchAdvice, logisticsInventoryReportRequest
    • OAUTH 2.0 + JWT for authentication
We're currently updating so you can join a working OpenIZ realm.

You can download the CTP here: v.0.9.6 (CTP)

OpenIZ 2.0 / SanteDB Announcement

Well, it has been quite some time since the last OpenIZ blog post, and that is because we've been quite busy rolling our lessons learned...