#Embedded Python

4 Followers · 292 Posts

Embedded Python refers to the integration of the Python programming language into the InterSystems IRIS kernel, allowing developers to operate with data and develop business logic for server-side applications using Python.

Documentation.

New
Article Henry Pereira · Feb 14 3m read

cover

Picture a dark room. The only light comes from a wall of displays and a blinking prompt that politely informs you:

“LINK TO M-U5K-3T: HIGH LATENCY – DIRECT CONTROL DISABLED.”

Perfect.

You are supposed to be a Rover Commander in the Musketeer Corps. Somewhere absurdly far away, you have an autonomous unit parked on a hostile exoplanet. It wants you dead, but it’s also covered in minerals that could fund a small civilization.

The ore on M-U5K-3T is everywhere. Unfortunately, everything else on the surface is actively trying to kill you.

So, we don't pilot. We script.

You aren't driving a car; y

2
0 38
New
Discussion Jorge Jaramillo Herrera · Feb 23

Hello everyone,
I’m looking to implement Continuous Training (CT) as part of an MLOps strategy for some data science projects in IRIS. I want to automate the full cycle:


- Monitoring model performance & accuracy degradation.
- Retraining models automatically.
- Validating and updating production models.


I’ve looked into IntegratedML, but it seems more focused on the SQL interface for training (AutoML). Even with the new Custom Models (beta), which allows for more flexibility with Python, it doesn't seem to provide the "Continuous" orchestration out of the box.


I’d like to know:


1. Are there any estab

0
0 23
New
Article Alyssa Ross · Feb 20 6m read

One objective of vectorization is to render unstructured text more machine-usable. Vector embeddings accomplish this by encoding the semantics of text as high-dimensional numeric vectors, which can be employed by advanced search algorithms (normally an approximate nearest neighbor algorithm like Hierarchical Navigable Small World). This not only improves our ability to interact with unstructured text programmatically but makes it searchable by context and by meaning beyond what is captured literally by keyword.

In this article I will walk through a simple vector search implementation that Kwabena Ayim-Aboagye and I fleshed out using embedded python in InterSystems IRIS for Health. I'll also dive a bit into how to use embedded python and dynamic SQL generally, and how to take advantage of vector search features offered natively through IRIS.

0
0 123
New
Article Andrew Sklyarov · Feb 15 7m read

In this article, I aim to demonstrate a couple of methods for easily adding validation to REST APIs on InterSystems IRIS Data Platform. I believe a specification-first approach is an excellent idea for API development. IRIS already has features for generating an implementation stub from a specification and publishing that specification for external developers (use it with iris-web-swagger-ui for the best results). The remaining important thing not yet implemented in the platform is the request validator. Let's fix it!

0
0 44
Article Eduard Lebedyuk · Feb 5 3m read

PEP 578 added Python Audit hooks. A rich variety of events (module load, os interactions and so on) triggers audit events which you can subscribe to.

Here's how to do that. First create an embedded python hook:

Class User.Python
{

/// do ##class(User.Python).Audit()ClassMethod Audit() [ Language = python ]
{
import sys
import time
def logger(event,args):
     if event=='import':
        module = args[0]
        print(f"Loading {module}")
        if module == "numpy":
            print(f"Module {module} forbidden. Terminating process in 3.")
            time.sleep(3)
        
0
1 51
Article Jorge Jaramillo Herrera · Jan 9 9m read

1-command only required for an entire IRIS instance for Data Science projects, and leveraging this to compare query methods' speed (Dynamic SQL, Pandas Query, and Globals).

Before joining InterSystems, I worked in a team of web developers as a data scientist. Most of my day-to-day work involved training and embedding ML models in Python-based backend applications through microservices, mainly built with the Django framework and using Postgres SQL for sourcing the data. During development, testing, and deployment, I realized the importance of repeatability of results, both for the model’s infe


3
0 39
Announcement Evgeny Shvarov · Feb 2

Here are the technology bonuses for the InterSystems Full Stack Contest 2026, which will give you extra points in the voting:

  • IRIS Vector Search usage -3
  • InterSystems Native SDK for Python or Embedded Python usage -3
  • Developer Community Idea implemented - 2
  • Docker container usage -2 
  • IPM Package Deployment - 2
  • Online Demo -2 
  • Find and report a bug - 2
  • Article on Developer Community - 2
  • The second article on Developer Community - 1
  • Video on YouTube - 3
  • YouTube Short - 1
  • First Time Contribution - 3

See the details below.<--break->

0
0 75
Article Mihoko Iijima · Jan 31 31m read

Vector search is a retrieval method that converts text, images, audio, and other data into numeric vectors using an AI model, and then searches for items that are semantically close. It enables “semantic similarity search” from free text, which is difficult with keyword search alone.

However, in real use, I encountered cases where results that are “close in meaning” but logically the opposite appeared near the top of the search results.

This is a serious issue in situations where affirmation vs. negation matters. If the system returns the wrong answer, the impact can be significant, so we cannot ignore this problem.

This article does not propose a new algorithm. I wrote it to share a practical way I found useful when semantic search fails due to negation.

 

0
1 42
Article Ashok Kumar T · Dec 28, 2025 3m read

Embeddedpy-bridge: A Toolkit for Embedded Python

Overview

Embedded Python is a game-changer for InterSystems IRIS, offering access to the vast Python ecosystem directly within the database. However, bridging the gap between ObjectScript and Python can sometimes feel like translating between two different worlds.

To make this transition seamless using embeddedpy-bridge.

This package is a developer-centric utility kit designed to provide high-level ObjectScript wrappers, familiar syntax, and robust error handling for Embedded Python. It allows developers to interact with Python data structur

1
2 88
Question Evgeny Shvarov · Dec 26, 2025

Hi developers!
Happy holidays!

In ObjectScript there is neat option to log errors - call Log() method of an exception intance, e.g.:

ClassMethod MyMethod() {

Try {

w1/0

}

Catch e {

do e.Log() // logging error in the app logwrite"the error happened: "_e.DisplayString()

}

}

Is there anything like that for Embedded Python? e.g:

ClassMethod MyMethod() [Language = python] {

 try:

   print(1/0)

 except ZeroDivisionError as e:

   // how can I log e into IRIS App Error Log here?

   print("Caught exception: " + str(e))

}

Any ideas?

8
0 89
Article Henry Pereira · Apr 2, 2025 17m read

I'm a huge sci-fi fan, but while I'm fully onboard the Star Wars train (apologies to my fellow Trekkies!), but I've always appreciated the classic episodes of Star Trek from my childhood. The diverse crew of the USS Enterprise, each masterminding their unique roles, is a perfect metaphor for understanding AI agents and their power in projects like Facilis. So, let's embark on an intergalactic mission, leveraging AI as our ship's crew and  boldly go where no man has gone before!  This teamwork concept is a wonderful analogy to illustrate how AI agents work and how we use them in our DC-Facilis

the taken quote

2
2 260
Question Eduard Lebedyuk · Mar 4, 2025

I have an Embedded Python method, which is essentially a call to one third-party module.

Most of the time, the method takes <0.1 seconds to execute, but sometimes it takes 30 or 60 seconds.

The server is relatively idle (20-30% CPU load).

How can I debug this issue further? Ideally, I want to know where this library spends the time. The library is mainly Python code (it's boto3, so it's not a Python C API proxy library).

4
0 192
Article Luis Angel Pérez Ramos · Mar 11, 2025 53m read

Since the introduction of Embedded Python there has always been doubt about its performance compared to ObjectScript and on more than one occasion I have discussed this with @Guillaume Rongier , well, taking advantage of the fact that I was making a small application to capture data from public competitions in Spain and to be able to perform searches using the capabilities of VectorSearch I saw the opportunity to carry out a small test.

Data for the test

Public tender information is provided monthly in XML files from this URL  and the typical format of a tender information is as follows:


myth-busted – Mike Raffety, DTM, PID

7
3 419
Question Arber Limaj · Nov 19, 2025

Hi everyone,
I'm getting prepared to take the following certification exam: "InterSystems IRIS Development Professional".

Can you give some advice on how to prepare (aside from the official course page: https://www.intersystems.com/certifications/intersystems-iris-development-professional/ )?
Do you have examples of quiz questions that simulate the real exam or any material that helped you getting prepared?

Thanks you in advance,

Arber

1
0 104
Article Tani Frankel · Jan 14, 2025 6m read

Using embedded Python while building your InterSystems-based solution can add very powerful and deep capabilities to your toolbox.

I'd like to share one sample use-case I encountered - enabling a CDC (Change Data Capture) for a mongoDB Collection - capturing those changes, digesting them through an Interoperability flow, and eventually updating an EMR via a REST API.

2
2 636
InterSystems Official Aya Heshmat · Mar 27, 2025 4m read

The Interoperability user interface now includes modernized user experiences for the DTL Editor and Production Configuration applications that are available for opt-in in all interoperability products. You can switch between the modernized and standard views. All other Interoperability screens remain in the Standard user interface. Please note that changes are limited to these two applications and we identify below the functionality that is currently available. 

To try out the new screens prior to upgrading, you can download the 2025.1 version from our community kit webpage here: https://eval

23
4 813
Article Kate Lau · Oct 13, 2025 13m read

Hi all,

Let's do some more work about the testing data generation and export the result by REST API.😁

Here, I would like to reuse the datagen.restservice class which built in the pervious article Writing a REST api service for exporting the generated patient data in .csv

This time, we are planning to generate a FHIR bundle include multiple resources for testing the FHIR repository.

Here is some reference for you, if you want to know mare about FHIR The Concept of FHIR: A Healthcare Data Standard Designed for the Future

OK... Let's start😆

1. Create a new utility class datagen.utl




6
0 165
Article Piyush Adhikari · Dec 11, 2022 3m read

I am documenting a demo of InterSystems IRIS featuring Embedded Python and Jupyter Notebook deployed on the same container, and an Embedded Python application developed on that Jupyter Notebook IDE.

I have used the Docker container created by @Bob Kuszewski as a development environment to demonstrate how Embedded Python app can be developed in such a setting to push and retrieve data to and from InterSystems IRIS. The benefit of using this container as the development environment is that it is a virtual environment with Jupyter IDE and IRIS connected and running side by side. Using this se

1
2 728
Article Kate Lau · Oct 13, 2025 5m read

Hi all,

It's me again 😁. In the pervious article Writing a REST api service for exporting the generated FHIR bundle in JSON, we actually generated a resource DocumentReference, with the content data encoded in Base64

Question!! Is it possible to write a REST service for decoding it? Because I am very curious what is the message data talking about🤔🤔🤔

OK, Let's start!

1. Create a new utility class datagen.utli.decodefhirjson.cls for decoding the data inside the DocumentReference
 

Class datagen.utli.decodefhirjson Extends%RegisteredObject
{
}

2. Write a Python function decodebase



2
2 155
Question Oliver Wilms · Sep 8, 2025

I am trying to add Plotly Bar graph in a div to a CSPpage. I am working in IRIS 2022.1. I created persistent class.

I copied relevant code into github repo:

oliverwilms/iris-python-plotly
 

iris-python-plotly/csp/otwPlotly.csp at master · oliverwilms/iris-python-plotly
 

Set tPlotlyDiv = ##class(dc.python.test).PlotlyDiv(trnYear,trnMonth)

ClassMethod PlotlyDiv(pTrnYear = 2025, pTrnMonth = 8) As %String
{
    Set importlib = ##class(%SYS.Python).Import("importlib")
    Set plotdiv = ##class(%SYS.Python).Import("plotdiv")
    Do importlib.reload(plotdiv)
    Set div = plotdiv.gendiv(pTrnYear,p

6
0 103
Article Kate Lau · Oct 9, 2025 6m read

Hi,

It's me again😁, recently I am working on generating some fake patient data for testing purpose with the help of Chat-GPT by using Python. And, at the same time I would like to share my learning curve.😑

1st of all for building a custom REST api service is easy by extending the %CSP.REST

Creating a REST Service Manually

Let's Start !😂

1. Create a class datagen.restservice which extends  %CSP.REST 

Class datagen.restservice Extends%CSP.REST
{
Parameter CONTENTTYPE = "application/json";
}

 

2. Add a function genpatientcsv() to generate the patient data, and package it into csv s


3
1 126
Article Yu Han Eng · Oct 5, 2025 2m read

With the rapid adoption of telemedicine, remote consultations, and digital dictation, healthcare professionals are communicating more through voice than ever before. Patients engaging in virtual conversations generate vast amounts of unstructured audio data, so how can clinicians or administrators search and extract information from hours of voice recordings?

Enter IRIS Audio Query - a full-stack application that transforms audio into a searchable knowledge base. With it, you can:

  • Upload and store clinical conversations, consultation recordings, or dictations
  • Perform natural language

1
0 92
Article Yu Han Eng · Oct 5, 2025 3m read

IRIS Audio Query is a full-stack application that transforms audio into a searchable knowledge base.

Project Structure

community/
├── app/                   # FastAPI backend application
├── baml_client/           # Generated BAML client code
├── baml_src/              # BAML configuration files
├── interop/               # IRIS interoperability components
├── iris/                  # IRIS class definitions
├── models/                # Data models and schemas
├── twelvelabs_client/     # TwelveLabs API client
├── ui/                    # React frontend application
├── main.py  
0
0 82
Article Eric Fortenberry · Dec 20, 2024 9m read

Your Mission

Let's pretend for a moment that you're an international action spy who's dedicated your life to keeping the people of the world safe from danger. You recieve the following mission:

Good day, Agent IRIS,

We're sorry for interrupting your vacation in the Bahamas, but we just received word from our London agent that a "time bomb" is set to detonate in a highly populated area in Los Angeles. Our sources say that the "time bomb" is set to trigger at 3:14 PM this afternoon.

Hurry, the people are counting on you!

The Problem

You rush to your feet and get ready to head to Los Angeles,

Time zones of the world (Wikipedia)

4
5 535
Article Sammy Lee · Aug 28, 2025 1m read

As part of a recent documentation technical project to optimize the search, I needed to use Embedded Python in my ObjectScript code. The main blocker was passing a Python list from a Python class method to a ObjectScript method. Sending the list by reference to the python method, populating it with the Insert() method, and returning the reference to the ObjectScript method resulted in an list with type %SYS.Python, a process that was straightforward but not efficient.
I explored an alternative method: converting a Python list to an ObjectScript list using JSON as the intermediary format. This a

0
1 93
Article Muhammad Waseem · Aug 18, 2025 7m read

Interoperability on Python (IoP) is a proof-of-concept project designed to showcase the power of the InterSystems IRIS Interoperability Framework when combined with a Python-first approach.IoP leverages Embedded Python (a feature of InterSystems IRIS) to enable developers to write interoperability components in Python, which can seamlessly integrate with the robust IRIS platform. This guide has been crafted for beginners and provides a comprehensive introduction to IoP, its setup, and practical steps to create your first interoperability component. By the end of this article, you will get a clear understanding of how to use IoP to build scalable, Python-based interoperability solutions.

6
5 464
Article Ashok Kumar T · Jul 21, 2025 13m read

This article is a continuation of the IRIS JSON project and features additional methods and insights.

Let's continue with the instance methods

%GetTypeOf(Key)

This instance method is used to determine the JSON data type of the %DynamicObject or %DynamicArray.

It returns one of the following strings:

"null" - JSON null
"boolean" - Either "true" or "false"
"number" - Any numeric value
"oref" - An %ObjectHandle (an ObjectScript oref)
"object" - A nested object
"array" - A nested array
"string" - Normal text string
"unassigned" - The value is unassigned

USER>Set array = [1,"test",





1
4 303
Question Hannah Sullivan · Aug 6, 2025

I have a custom Buffer class which is designed to capture written/printed statements to the device, to be able to transform the captured text to string or stream type. I have used this in ObjectScript to capture ObjectScript write statements and return a string. I would like to try to use this with a [ Language = python ] method as follows. This class will be called by a scheduled task.

/// ObjectScript code which initializes buffer to capture statements written in nested method callClassMethod CollectStringFromBuffer() 
{
    set buffer = ##class(CustomClass.Buffer).%New()
    do buffer
4
0 101
Question David Hockenbroch · Oct 12, 2024

When I install the numpy package on Python on my PC using:

pip install numpy

I can use it in python on my machine. If I do:

pip install --target C:\InterSystems\IRIS\mgr\python numpy

I get errors any time I try to import it in embedded python.

Traceback (most recent call last):
  File "c:\intersystems\iris\mgr\python\numpy\_core\__init__.py", line 23, in <module>
    from . import multiarray
  File "c:\intersystems\iris\mgr\python\numpy\_core\multiarray.py", line 10, in <module>
    from . import overrides
  File "c:\intersystems\iris\mgr\python\numpy\_core\overrides.py", line 8, in 
4
0 539