Health Connect 2021.2 introduces Python fully integrated into the kernel, making Python a full peer to ObjectScript. Almost anything that you can do in ObjectScript, you can now also do in Python, including defining class methods. You can also interleave Python and ObjectScript, including directly calling Python libraries from ObjectScript without writing any Python code. Python provides access to many thousands of high-quality pre-built libraries, which can speed development and lower your maintenance cost. Python developers who are not familiar with ObjectScript can start developing without learning a new language.
Any Health Connect object can be created and accessed with Embedded Python:
Objects implemented in Embedded Python are treated the same as objects implemented in ObjectScript.
In Embedded Python you have full and direct access from Python objects to ObjectScript objects and from ObjectScript objects to Python objects.
Embedded Python has full access to globals, which are accessed as normal Python objects. You can use Health Connect persistence to store objects in the database, making them available in future sessions until the objects are explicitly deleted.
Embedded Python augments the Health Connect Python SDK, which includes client libraries and the external Python gateway.
For an introduction to embedded Python, see the Embedded Python Overview.
Embedded Python is designed to run with whatever version of Python you have installed on your machine.
If you are running Microsoft Windows and do not have Python already installed, the InterSystems IRIS installation kit installs it for you.
Many flavors of UNIX or Linux come with Python installed. If you need to install it, use the version recommended for your operating system by your package manager, for example:
If you get an error that says “Failed to load python,” it means that you either don’t have Python installed or an unexpected version of Python is installed on your system. Install it or reinstall it using one of the above methods.
On a UNIX-based system, you may want to install Python packages with the pip3 command. If you do not have pip3 installed already, install the package python3-pip with your system’s package manager.
Interoperability Productions in Python
In this release, you can develop interoperability productions in Python using the Production EXtension (PEX) framework. This gives you the choice of developing productions in Python, Java, .NET, or ObjectScript. You can easily combine production components developed in different languages. You can develop in the language you are familiar with even if the other production components were developed in a different language. You can use Python with PEX to create new protocol adapter, perform complex analysis or calculations, and to create persistent messaging and long-running business processes. For more information, see Developing Production Components with External Languages.