#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.

Announcement Emily Geary · Feb 29, 2024

Hi All,

On February 8, 2024, we asked for input from the IRIS community regarding exam topics for our InterSystems IRIS Developer Professional exam. We will close the window for providing feedback on the exam topics on Friday, March 8, 2024. If you would like to have your say in what topics are covered on the exam, this is your last chance!

How can I access the survey? You can access it here

  • Survey does not work well on mobile devices - you can access it, but it will involve a lot of scrolling
  • Survey can be resumable if you return to it on the same device in the same browser - answers sa
0
0 176
Article Dmitry Maslennikov · Sep 18, 2023 7m read

Nowadays so much noise around LLM, AI, and so on. Vector databases are kind of a part of it, and already many different realizations for the support in the world outside of IRIS. 

Why Vector?

  • Similarity Search: Vectors allow for efficient similarity search, such as finding the most similar items or documents in a dataset. Traditional relational databases are designed for exact match searches, which are not suitable for tasks like image or text similarity search.
  • Flexibility: Vector representations are versatile and can be derived from various data types, such as text (via embeddings like Word2Vec, BERT), images (via deep learning models), and more.
  • Cross-Modal Searches: Vectors enable searching across different data modalities. For instance, given a vector representation of an image, one can search for similar images or related texts in a multimodal database.

And many other reasons.

So, for this pyhon contest, I decided to try to implement this support. And unfortunately I did not manage to finish it in time, below I'll explain why.

7
3 1320
Announcement Emily Geary · Feb 8, 2024

Hello Everyone,

The Certification Team of InterSystems Learning Services is developing an InterSystems IRIS Developer Professional certification exam, and we are reaching out to our community for feedback that will help us evaluate and establish the contents of this exam.

Note: This exam will replace the current InterSystems IRIS Core Solutions Developer Specialist exam when it is released. Please note from the target role description below that the focus of the new exam will be more on developer best practices and a lot less on the ObjectScript programming language.

How do I provide my inp

0
1 419
Article Sylvain Guilbaud · Feb 1, 2024 5m read

Hello Community,

SQL language remains the most practical way to retrieve information stored in a database.

The JSON format is very often used in data exchange.

It is therefore common to seek to obtain data in JSON format from SQL queries.

Below you will find simple examples that can help you meet this need using ObjectScript and Python code.

ObjectScript : using Dynamic SQL with %SQL.StatementJSON structures with %DynamicObject and %DynamicArray

ClassMethod getJSON() As%String
{
    // declaration of an SQL queryset query = "SELECT top 3 name,age,to_char(dob,'Day DD Month YY
1
4 567
Article Oliver Wilms · Feb 3, 2024 2m read

The architect of the JSON schema (MS) asked if IRIS could  perform schema validation. I asked on Discord objectscript channel how we could validate a Dynamic Object against a JSON schema. Dmitry Maslennikov replied that probably the easiest way would be to use python, but it would require converting ObjectScript JSON to Python dict.

I refer to this as my first real use case for Embedded Python, because previous examples I had tried I could have implemented in ObjectScript just as easily as in Python.

Yesterday I worked with MS to use jsonschema project to validate one of my HL7 test messages

0
1 300
Question Cyril Grosjean · Jan 2, 2024

Hi,

I'm trying to access to my datas stored in a RecordMap from SQLAlchemy, and I need to access to any tables already created before using SQLAlchemy.

Here is some part of my code :

TestBase:

classTestBase(DeclarativeBase):
    CreatedAt: Mapped[int] = mapped_column(TIMESTAMP, default=func.now())
    UpdatedAt: Mapped[int] = mapped_column(TIMESTAMP, default=func.now(), onupdate=func.current_timestamp())

 

Engine creation and entities binding :

bases = {
    "TEST": TestBase.metadata.create_all,
}

defcreate_engine_and_session(namespace: str) -> Session:
    engine: Engine = cr
0
0 170
Announcement Bob Kuszewski · Dec 14, 2023

Embedded Python is about to get a whole lot more powerful, and we’re looking for a few volunteers to give it a try.

What’s the Flexible Python Runtime?

The Flexible Python Runtime option allows you to use a Python runtime of your choosing with Embedded Python. Previous to this, you could only use the operating system's default Python, which was limiting especially for customers using the latest and greatest AI & ML tools close to their data.

When InterSystems introduced Embedded Python in InterSystems IRIS in 2021.2, it was designed to work with just the version of Python that is pre-inst

1
0 392
Article Evgeny Shvarov · Sep 3, 2023 5m read

While starting the development with IRIS we have a distribution kit or in case of Docker we are pulling the docker image and then often we need to initialize it and setup the development environment. We might need to create databases, namespaces, turn on/off some services, create resources. We often need to import code and data into IRIS instance and run some custom code to init the solution.

And there plenty of templates on Open Exchange where we suggest how to init REST, Interoperability, Analytics, Fullstack and many other templates with ObjectScript. What if we want to use only Python to setup the development environment for Embedded Python project with IRIS?

So, the recent release of Embedded Python template is the pure python boilerplate that could be a starting point for developers that build python projects with no need to use and learn ObjectScript. This article expresses how this template could be used to initialize IRIS. Here we go!

1
2 789
Question Nay Chi Lynn · Nov 23, 2023

I'm currently facing an issue with a Python script in my IRISHealth environment and would appreciate your insights.

I've written a class method, `getTokenCount`, in Python, which uses the `tiktoken` module. However, when I run the script in the terminal using `do ##class(python.openaiUtils).getTokenCount("")`, I encounter the following error:

```
<THROW> *%Exception.PythonException <THROW> 230 ^^0^DO ##CLASS(python.openaiUtils).Test() <class 'ModuleNotFoundError'>: No module named 'tiktoken.core' -
```

I have already installed `tiktoken` in the correct directory (`C:\InterSystems\IRISHealth\b

3
0 477
Announcement Luis Angel Pérez Ramos · Oct 19, 2023

It's true! QuinielaML has incorporated the most important leagues in Europe (and Brazil) into its prediction service, so, dear members of the Developer Community, wherever you are from, you will be able to have the predictions of your favorite leagues at your disposal.

From the predictions screen you will have access to each of the new leagues included, being able to record the matches for each journey:

Taking advantage of the progress of the league, we have improved the QuinielaML prediction model by reducing the weight of historical results that weighed down some of the predictions and

Amazon Proclaims Amazon's 'Borat 2' To Be 'Great Success'

0
0 199
Question Robert Cemper · Oct 15, 2023

MIRROR is the best solution for almost immediate replications to a Failover Server.
The related mechanics are based on Global Journaling.

Globals hold Data and Classes and Routines and more ...
If Mirroring is in place all is in sync. With minimum delays
This is of course  rather useful for code changes in Classes, Routines, ....

To what extent is Embedded Python covered by Mirroring?
Or:
What is required to Synchronize EmbeddedPython like Mirroring. 

2
0 250
Question Robert Cemper · Oct 15, 2023

With ECP we have the option to have a collection of Frontend instances
All Frontend servers typically have a common Master in the background
Concentrating data on the Master server is the primary goal.

As a side effect, this applies also to Classes, Routines, .. anything stored in Globals.
This is probably not the most efficient setup. But rather common anyhow.

Is embedded Python code also stored in Globals?

What is the recommended solution for a similar installation?

2
0 264
Question Pietro Di Leo · Oct 13, 2023

Hi everyone, 

I'm attempting to compile a basic Python code on a remote server, but it appears that the compiler doesn't recognize the language.

The remote server is running a virtual machine with Oracle Linux Server 7.9 (64-bit), and it has IRIS for UNIX (Red Hat Enterprise Linux for x86-64) 2021.1 (Build 215U) [HealthConnect:3.3.0] installed.

When I try to compile a script that includes a Python ClassMethod, such as this "testpy.cls":

ClassMethod python() As%Status [ Language = python ]
{
    # prova python
    print("hello world")
}

This error returns (Error #5486: Invalid method

4
0 408
Article Rizmaan Marikar · Mar 20, 2023 8m read

Introduction

Data analytics is a crucial aspect of business decision-making in today's fast-paced world. Organizations rely heavily on data analysis to make informed decisions and stay ahead of the competition. In this article, we will explore how data analytics can be performed using Pandas and Intersystems Embedded Python. We will discuss the basics of Pandas, the benefits of using Intersystems Embedded Python, and how they can be used together to perform efficient data analytics.

7
8 1677
Article Alexey Nechaev · Sep 23, 2023 5m read

Hi folks

I want to tell you how you can make your own assistant based on IRIS and OpenAI (perhaps you can then move to your own AI models)

iris-recorder-helper

This is the first time I have fully tried developing an application for IRIS and I want to point out steps that may also be useful to you

  1. Deploy to google cloud via github workflows (One container with an IRIS database and a web server in Python (flask)) and placing secrets inside the application not through an environment variable
  2. Record audio from the browser and send to the server
  3. Launching cron jobs via the ZPM module
  4. Int
5
1 397
Announcement Evgeny Shvarov · Sep 20, 2023

Hi Developers!

Here is the bonus results for the applications in InterSystems Python Programming Contest 2023:

Project

Embedded Python

Python Native API

Python Pex Interoperability

Python libs: sqlalchemy and dbt

LLM AI or LangChain

NoObjectScriptLine

Questionnaire

Find a bug in Embedded Python

Docker

ZPM

Online Demo

Community Idea Implementation

First Article on DC

Second Article on DC

First Time Contribution

Video on YouTube

Total Bonus

Nominal 3 3 4 2 4 5 2 2 2 2 2 4 2 1 3 3
27
0 459
Article André Dienes Friedrich · Sep 21, 2023 3m read

In the ever-evolving landscape of data science and machine learning, having the right tools at your disposal can make all the difference. In this article, we want to shine a spotlight on two essential Python libraries that have become indispensable for data scientists and machine learning practitioners alike: Matplotlib and scikit-learn.

Matplotlib: Crafting Visualizations with Precision

Matplotlib is a versatile and powerful library for creating static, animated, and interactive visualizations in Python. Whether you need to create basic plots or intricate, customized visualizations, Matplot

2
2 293
Article Muhammad Waseem · Sep 18, 2023 5m read


Hi Community
In this article, I will introduce my application IRIS-GenLab.
IRIS-GenLab is a generative AI Application that leverages the functionality of Flask web framework, SQLALchemy ORM, and InterSystems IRIS to demonstrate Machine Learning, LLM, NLP, Generative AI API, Google AI LLM, Flan-T5-XXL model, Flask Login and OpenAI ChatGPT use cases.

Application Features

  • User registration and authentication
  • Chatbot functionality with the help of Torch (python machine learning library)
  • Named entity recognition (NER), natural language processing (NLP) method for text information extraction
  • Se






image

0
1 447
Announcement Evgeny Shvarov · Aug 29, 2023

Hi Developers!

Here're the technology bonuses for the InterSystems Python Contest 2023 that will give you extra points in the voting:

  • Embedded Python - 3
  • Python Native API  - 3
  • Python Pex Interoperability - 4
  • Python libs: sqlalchemy and dbt - 2
  • LLM AI or LangChain usage: Chat GPT, Bard and others - 4
  • NoObjectScriptLine - 5
  • Questionnaire - 2
  • Docker container usage - 2 
  • ZPM Package deployment - 2
  • Online Demo - 2
  • Implement InterSystems Community Idea - 4
  • Find a bug in Embedded Python - 2
  • First Article on Developer Community - 2
  • Second Article On DC - 1
  • First Time Contribution -

<--break->

5
1 516
Announcement John Murray · Jun 4, 2023

For several years now Visual Studio Code has supported the notebook coding paradigm with a maturing UX and an API that is enabling a notebook extensions ecosystem to grow. One of the best-known notebook platforms is Jupyter Notebooks. A Microsoft team publishes an extension that allows VS Code to handle .ipynb notebook files. These can either work against a local Python environment or connect to a Jupyter Server, which typically hosts remote Python environments with beefier resources.

What if your InterSystems IRIS environments, whether local on your workstation or remote in your organization / cloud, could operate as Jupyter Servers? And not only for Embedded Python but also for ObjectScript and SQL

"If we build it, will they come?"

5
2 913
Question Gautam Rishi · Sep 8, 2023

Hi all,
I am trying to execute a query like the below code.
set statement = ##class(%ResultSet).%New("some_class:query_method").   // here query method is empty and with rowspec some columname

statement.Execute(param1)

I want to fetch data type of column value returned from above. eg - Name - VARCHAR, amount - INTEGER etc.
How can I get it. Or if not possible directly. Is there any other way to validate or get datatype of values returned. Line we have type() in python3

5
0 1413
Article Robert Cemper · Sep 7, 2023 2m read

In a previous question, I have illustrated a few problems using Embedded Python
interactively as you would do from Docker console or IRIS terminal.
Investigation of the causes brought a rather clear picture. It's a classic impedance mismatch

  • While consoles act rather relaxed WebTerminal is very precise in output presentation line terminators from (Embedded) Python's print() function are typically <LF>  0x0A  $C(10) And WebTerminal does exactly this while eg. my console in Docker also does a <CR> und cover. So a sequence of print() looks like a scale
  • Compared to ObjectScript where a WRTE !  s

1
0 349
Question Robert Cemper · Sep 4, 2023

For my Embedded Python ONLY demo package I need some user input.
Similar to ObjectScript

read "say somthing",reply

I use the Python equivalent

reply = input("say something")

And this works excellent without problems  from Terminal or Doker console

BAD SURPRISE: 
with WebTermnial ObjectSscript works fine, but embedded Python fails badly.

I do not care about line terminators without <CR>
but it is just impossible to receive any input.

This is no improvement. The content is missing !!!!

QUESTION to the experts.
What is the Python way around this issue ?

I have of course a temporary ha

7
0 399