Initial Release
These demos are to make it easier for you to follow along with the webinar. Additional resources are available as well, details at the end.
WEBINAR> do ##class(%SYS.Python).Shell()
Python 3.9.5 (default, Jul 31 2023, 18:25:30) [MSC v.1927 64 bit (AMD64)] on win32
Type quit() or Ctrl-D to exit this shell.
>>>
>>> do iris.execute('zn "USER"')
>>> person = iris.cls('Webinar.Human')._OpenId(5)
>>> person.Name = "Golda Meir"
>>> st = person._Save()
>>> print(st)
1
>>>
>>> stmnt = iris.sql.prepare("Select ID, Name, Address, PostalCode From Webinar.Human WHERE ID < ?") >>> rs = stmnt.execute() >>> for idx, row in enumerate(rs): ... print(f"{row}")
...RESULTS HERE...
>>> myGref = iris.gref('^Days')
>>> myGref[None] = 7
>>> myGref[1] = 'Sunday'
>>> myGref[7] = 'Shabbat'
>>> print(myGref[7])
Powershell:
PS C:\InterSystems_Webinar\bin> .\irispip install --target C:\InterSystems_Webinar\mgr\python geopy
ObjectScript Shell:
WEBINAR> set geopy = ##class(%SYS.Python).Import("geopy.distance")
WEBINAR> set builtins = ##class(%SYS.Python).Builtins()
WEBINAR> set TelAviv = builtins.list()
WEBINAR> do TelAviv.append(32.0853)
WEBINAR> do TelAviv.append(34.7818)
WEBINAR> set Jerusalem = builtins.list()
WEBINAR> do Jerusalem.append(31.7683)
WEBINAR> do Jerusalem.append(35.2137)
WEBINAR> set route = geopy.distance(TelAviv, Jerusalem)
WEBINAR> write route.km
53.88684225580475839
Powershell:
PS C:\InterSystems_Webinar\bin> .\irispip install --target C:\InterSystems_Webinar\mgr\python jsondiff
Python Shell:
>> from jsondiff import diff
>>> diff({'a': 1, 'b': 2}, {'a': 1, 'b':3})
{'b':3}
Powershell:
PS C:\InterSystems_Webinar\bin> .\irispip install --target C:\InterSystems_Webinar\mgr\python json2excel
Python Shell:
>>> from json2excel import Json2Excel
>>> json2excel = Json2Excel()
>>> jsons = [{"studentNo":1001, "Name": "Rivka"},{"studentNo":1002, "Name":"Benny"}]
>>> print(json2excel.run(jsons))
<file location>
The TCP Service receives the HL7 message, and forwards it to the Buisness Process. Here it goes through a transformation, where the Name, Address, and Hebrew Update Date are put into the message and sent to the Buisness Operation. It in turn finds the postal code from the Python Library geopy, adds all fields from the message, and the postal code to the human, and saves the human into the table. We see the query results from the table using the SQL Tools InterSystems extension in Visual Studio code.
PS C:\InterSystems_Webinar\bin> $env:IRISUSERNAME = "aglikman" PS C:\InterSystems_Webinar\bin> $env:IRISPASSWORD = "1234" PS C:\InterSystems_Webinar\bin> $env:IRISNAMESPACE = "WEBINAR" PS C:\InterSystems_Webinar\bin> .\irispython C:\Users\aglikman\Documents\MyProjects\Webinar\test.py
Fibonacci series:
0 1 1 2 3 5 8
Run IRIS Code:
Hi! I'm Issac Herzog.
I live at 3 HaNassi, Jerusalem.
My postal code is: 9218801.
Want to learn more? Don’t speak Hebrew? There are numerous resources available for you:
Setting up InterSystems Development Environment with Python
But that’s not all. Check out our InterSystems Community, InterSystems Open Exchange, and Youtube Channel to find many more articles, videos, and information to help you advance your embedded python knowledge. Note that we have lots of content available in multiple languages, be it on the Community, or the Youtube Channel. Use what suits you best.
Namespace WEBINAR is prepared and IRIS classes ready to use
Webinar.Human is preloaded with 25 records
All requred Python libraries are loaded
Make sure you have git and Docker desktop installed.
Clone/git pull the repo into any local directory
$ git clone https://github.com/rcemper/PR_Webinar-Leveraging-Embedded-Python.git
to build and start the container run
$ docker compose up -d && docker compose logs -f
you can start Pythosn shell using alias :py
To open IRIS Terminal do:
$ docker-compose exec iris iris session iris USER>ZN "WEBINAR" WEBINAR>:py
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type quit() or Ctrl-D to exit this shell.
>>>
or using WebTerminal
http://localhost:42773/terminal/
To access IRIS System Management Portal
http://localhost:42773/csp/sys/UtilHome.csp