рдпрд╣ рд▓реЗрдЦ рдкрд╛рдпрдерди рдЧреЗрдЯрд╡реЗ рдкрд░ рдХреЗрдВрджреНрд░рд┐рдд рд╣реИ, рдЬреЛ рдЗрдВрдЯрд░рд╕рд┐рд╕реНрдЯрдореНрд╕ рдЖрдИрдЖрд░рдЖрдИрдПрд╕ рдбреЗрдЯрд╛ рдкреНрд▓реЗрдЯрдлреЙрд░реНрдо рдХреЗ рд▓рд┐рдП рдПрдХ рдЦреБрд▓рд╛ рд╕реНрд░реЛрдд рд╕рд╛рдореБрджрд╛рдпрд┐рдХ рдкрд░рд┐рдпреЛрдЬрдирд╛ рд╣реИред рдпрд╣ рдкрд░рд┐рдпреЛрдЬрдирд╛ рдЖрдкрдХреЛ рдкрд╛рдпрдерди (рдХрдИ рдбреЗрдЯрд╛ рд╡реИрдЬреНрдЮрд╛рдирд┐рдХреЛрдВ рдХреЗ рд▓рд┐рдП рдореБрдЦреНрдп рд╡рд╛рддрд╛рд╡рд░рдг) рдореЗрдВ рдмрдирд╛рдИ рдЧрдИ рдХрд┐рд╕реА рднреА рдорд╢реАрди рд▓рд░реНрдирд┐рдВрдЧ рдПрд▓реНрдЧреЛрд░рд┐рджрдо рдХреЛ рдСрд░реНрдХреЗрд╕реНрдЯреНрд░реЗрдЯ рдХрд░рдиреЗ рдХреА рдЕрдиреБрдорддрд┐ рджреЗрддреА рд╣реИ, рдЗрдВрдЯрд░рд╕реЗрд╕реНрдЯрдореЗрдВрдЯ рдЖрдИрдЖрд░рдЖрдИрдПрд╕ рдкреНрд▓реЗрдЯрдлреЙрд░реНрдо рдкрд░ рдЖрдзрд╛рд░рд┐рдд рдЕрдиреБрдХреВрд▓реА, рд░реЛрдмреЛрдЯ рд╡рд┐рд╢реНрд▓реЗрд╖рдгрд╛рддреНрдордХ рдПрдЖрдИ / рдПрдордПрд▓ рд╕рдорд╛рдзрд╛рди рдмрдирд╛рдиреЗ рдХреЗ рд▓рд┐рдП рдХрдИ рддреИрдпрд╛рд░ рдкреБрд╕реНрддрдХрд╛рд▓рдпреЛрдВ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рддреА рд╣реИред рдЗрд╕ рд▓реЗрдЦ рдореЗрдВ, рдореИрдВ рджрд┐рдЦрд╛рдКрдВрдЧрд╛ рдХрд┐ рдХреИрд╕реЗ рдЗрдВрдЯрд░рд╕рд┐рд╕реНрдЯрдореНрд╕ рдЖрдИрдЖрд░рдЖрдИрдПрд╕ рдкрд╛рдпрдерди рдореЗрдВ рдкреНрд░рдХреНрд░рд┐рдпрд╛рдУрдВ рдХреЛ рдСрд░реНрдХреЗрд╕реНрдЯреНрд░реЗрдЯ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ, рдХреБрд╢рд▓рддрд╛рдкреВрд░реНрд╡рдХ рджреЛ-рддрд░рдлрд╛ рдбреЗрдЯрд╛ рд╣рд╕реНрддрд╛рдВрддрд░рдг рдХреЛ рд▓рд╛рдЧреВ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВ, рдФрд░ рдмреБрджреНрдзрд┐рдорд╛рди рд╡реНрдпрд╛рдкрд╛рд░ рдкреНрд░рдХреНрд░рд┐рдпрд╛рдУрдВ рдХрд╛ рдирд┐рд░реНрдорд╛рдг рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред
рдпреЛрдЬрдирд╛
- рдкрд░рд┐рдЪрдп
- рдЙрдкрдХрд░рдгред
- рд╕реНрдерд╛рдкрдирд╛
- рдПрдкреАрдЖрдИ
- рдЗрдВрдЯрд░реЛрдСрдкрд░реЗрдмрд┐рд▓рд┐рдЯреА
- рдЬреНрдпреВрдкрд┐рдЯрд░ рдиреЛрдЯрдмреБрдХред
- рдЬрд╛рдБрдЪ - рдкрд░рд┐рдгрд╛рдоред
- рд╕рдВрджрд░реНрдн
- MLToolkitред
рдкрд░рд┐рдЪрдп
Python тАФ , . Python InterSystems IRIS, Python .
(ML) тАФ , , .
. , , . ?
, , , .
тАФ GUI- AI/ML-, , , , BI ( GUI- ), AI/ML. .
, , , . , .
, . , InterSystems IRIS, .
AI/ML- , -. , . , , , .
? . , . , ? . , . , . тАФ . , ? . , , - , .
ML Toolkit тАФ , : , -. Python Gateway ML Toolkit Python ( R Gateway, ML Toolkit R).
, Python, .
() :
AI/ML . , . AI/ML- , .
Python Gateway:
, . тАФ . , . 0.8, . / , .
Python Gateway , ( ) Python. :
- Python 3.6.7 64 bit. Python .
dill
: pip install dill
.- ObjectScript (..
do $system.OBJ.ImportDir("C:\InterSystems\Repos\Python\isc\py\", "*.cls", "c",,1)
) . , , , : write ##class(%EnsembleMgr).EnableNamespace($Namespace, 1)
. - callout DLL/SO/DYLIB
bin
InterSystems IRIS. , write ##class(isc.py.Callout).GetLib()
.
Windows
- ,
PYTHONHOME
Python 3.6.7. - ,
PATH
PYTHONHOME
( , ).
Linux (Debian/Ubuntu)
- ,
PATH
/usr/lib
/usr/lib/x86_64-linux-gnu
. /etc/environment
. undefined symbol: _Py_TrueStruct
PythonLib
. Readme Troubleshooting.
Mac
- 3.6.7 Python.org.
PATH
.
, InterSystems.
Docker
:
Docker InterSystems.
Python Gateway 2019.4
.
: docker run -d -p 52773:52773 --name irispy intersystemscommunity/irispy-community:latest
, Python Gateway InterSystems IRIS Community Edition. .
- : docker build --force-rm --tag intersystemscommunity/irispy:latest .
.
store/intersystems/iris-community:2019.4.0.383.0
, , IMAGE
.
InterSystems IRIS : `docker build --build-arg IMAGE=store/intersystems/iris:2019.4.0.383.0 --force-rm --tag intersystemscommunity/irispy:latest ``.
-:
docker run -d \
-p 52773:52773 \
-v /<HOST-DIR-WITH-iris.key>/:/mount \
--name irispy \
intersystemscommunity/irispy:latest \
--key /mount/iris.key
, InterSystems IRIS Community Edition, .
isc.py.test.Process
. , . WorkingDir
.- :
docker exec -it irispy sh
. SuperUser
/SYS
.- , :
docker stop irispy && docker rm --force irispy
.
, Python Gateway, , . InterSystems IRIS:
set sc = ##class(isc.py.Callout).Setup()
set sc = ##class(isc.py.Main).SimpleString("x='HELLO'", "x", , .var).
write var
HELLO
тАФ Python- x
. sc
var
, Readme тАФ Troubleshooting section.
API
Python Gateway , , . !
Python isc.py.Main
. ( %Status
):
Python-.
SimpleString
SimpleString
тАФ . 4 :
code
тАФ . : $c(10)
.returnVariable
тАФ .serialization
тАФ returnVariable
. 0 тАФ string ( ), 1 тАФ repr.result
тАФ ByRef , returnVariable
.
:
set sc = ##class(isc.py.Main).SimpleString("x='HELLO'", "x", , .var).
Python x
Hello
Python x
ObjectScript var
.
ExecuteCode
ExecuteCode SimpleString
.
InterSystems IRIS 3 641 144 , , .
:
code
тАФ Python .variable
тАФ () code
Python .
:
set sc = ##class(isc.py.Main).ExecuteCode("2*3", "y").
2 3 Python y
.
Python .
Python -> InterSystems IRIS
4 Python InterSystems IRIS, , :
String
.Repr
.JSON
InterSystems IRIS.Pickle
.
Python .
GetVariable(variable, serialization, .stream, useString)
тАФ serialization
variable
stream
. useString
1 , .GetVariableJson(variable, .stream, useString)
тАФ JSON .GetVariablePickle(variable, .stream, useString, useDill)
- Pickle ( Dill) .
y
.
set sc = ##class(isc.py.Main).GetVariable("y", , .val, 1)
write val
>6
InterSystems IRIS -> Python
InterSystems IRIS Python.
ExecuteQuery(query, variable, type, namespace)
тАФ (pandas dataframe
list
) sql Python variable
. isc.py
namespace
тАФ .ExecuteGlobal(global, variable, type, start, end, mask, labels, namespace)
тАФ global
start
end
Python type
: list
, pandas dataframe
. mask
and labels
Data Transfer docs.ExecuteClass(class, variable, type, start, end, properties, namespace)
тАФ class
id start
end
Python type
: list
, pandas dataframe
. properties
тАФ ( тАФ ) , . *
?
. тАФ *
( ). %%CLASSNAME
.ExecuteTable(table, variable, type, start, end, properties, namespace)
тАФ table
id start
end
Python.
ExecuteQuery
тАФ ( SQL- Python). , ExecuteGlobal
ExecuteClass
ExecuteTable
. ( 3-5 ODBC- 20 ExecuteQuery
). Data Transfer docs.
. isc.py
.
ExecuteQuery
ExecuteQuery(request, variable, type, namespace)
тАФ SQL- Python. . , ExecuteGlobal
.
:
query
тАФ sql .variable
тАФ Python .type
тАФ list
Pandas dataframe
.namespace
тАФ .
ExecuteGlobal
ExecuteGlobal(global, variable, type, start, end, mask, labelels, namespace)
тАФ Python.
:
global
тАФ ^
variable
тАФ Python .type
тАФ list
Pandas dataframe
.start
тАФ . %Integer
.end
тАФ . %Integer
.mask
тАФ . , ( ). :
+
.-
.b
тАФ (0
тАФ False
, тАФ True
).d
тАФ ( $horolog, Windows 1970, Linux 1900).t
тАФ ($horolog, ).m
тАФ ( YEAR-MONTH-DAY HOUR:MINUTE:SECOND).
labels
тАФ %List . тАФ .namespace
тАФ .
ExecuteClass
ExecuteGlobal
. ExecuteGlobal
.
ExecuteClass(class, variable, type, start, end, properties, namespace)
тАФ Python.
:
class
тАФvariable
тАФ Python .type
тАФ list
Pandas dataframe
.start
тАФ Id.end
тАФ Idproperties
тАФ ( тАФ ) , . *
?
. тАФ *
( ). %%CLASSNAME
.namespace
тАФ .
%Date
, %Time
, %Boolean
%TimeStamp
тАФ Python.
ExecuteTable
ExecuteClass
. ExecuteClass
. :
ExecuteTable(table, variable, type, start, end, properties, namespace)
тАФ Python.
:
ExecuteGlobal
, ExecuteClass
ExecuteTable
.ExecuteGlobal
20 ExecuteQuery
( >0.01 ).ExecuteGlobal
, ExecuteClass
ExecuteTable
: ^global(key) = $lb(prop1, prop2, ..., propN)
key
тАФ .ExecuteGlobal
, ExecuteClass
ExecuteTable
%Date
mktime
(windows: 1970-01-01, linux 1900-01-01, mac). %TimeStamp
pandas dataframe .. .ExecuteGlobal
, ExecuteClass
ExecuteTable
(, ) .
isc.py.test.Person , :
set global = "isc.py.test.PersonD"
set class = "isc.py.test.Person"
set table = "isc_py_test.Person"
set query = "SELECT * FROM isc_py_test.Person"
//
set variable = "df"
set type = "dataframe"
set start = 1
set end = $g(^isc.py.test.PersonD, start)
// 0: ExecuteGlobal
set sc = ##class(isc.py.Main).ExecuteGlobal(global, variable _ 0, type)
// 1: ExecuteGlobal
//
// globalKey -
set labels = $lb("globalKey", "Name", "DOB", "TS", "RandomTime", "AgeYears", "AgeDecimal", "AgeDouble", "Bool")
// mask 1 labels "globalKey" -
// %%CLASSNAME
set mask = "-+dmt+++b"
set sc = ##class(isc.py.Main).ExecuteGlobal(global, variable _ 1, type, start, end, mask, labels)
// 2: ExecuteClass
set sc = ##class(isc.py.Main).ExecuteClass(class, variable _ 2, type, start, end)
// 3: ExecuteTable
set sc = ##class(isc.py.Main).ExecuteTable(table, variable _ 3, type, start, end)
// 4: ExecuteTable
set sc = ##class(isc.py.Main).ExecuteQuery(query, variable _ 4, type)
do ##class(isc.py.test.Person).Test()
.
GetVariableInfo(variable, serialization, .defined, .type, .length)
тАФ : , .GetVariableDefined(variable, .defined)
тАФ .GetVariableType(variable, .type)
тАФ .GetStatus()
тАФ Python.GetModuleInfo(module, .imported, .alias)
тАФ .GetFunctionInfo(function, .defined, .type, .docs, .signature, .arguments)
тАФ .
Python Gateway , . Python тАФ isc.py.ens.Operation
. :
, Pyhton isc.py.Main
. isc.py.ens.Operation
Python InterSystems IRIS. :
-
, -:
isc.py.ens.ProcessUtils
.isc.py.util.BPEmulator
- Python. - ( Python) .
-, isc.py.ens.ProcessUtils
, GetAnnotation(name)
. , InterSystems IRIS Python. :
${class:method:arg1:...:argN}
тАФ#{expr}
тАФ ObjectScript.
- isc.py.test.Process
, , Correlation Matrix: Graph
: f.savefig(r'#{process.WorkDirectory}SHOWCASE${%PopulateUtils:Integer:1:100}.png')
. :
#{process.WorkDirectory}
WorkDirectory process
, isc.py.test.Process
.. -.${%PopulateUtils:Integer:1:100}
Integer
%PopulateUtils
, 1
100
, 1...100
.
-
- Python Gateway. :
- :
pip install pandas matplotlib seaborn
. - InterSystems IRIS :
do ##class(isc.py.test.CannibalizationData).Import()
. isc.py.test.Production
.Ens.Request
isc.py.test.Process
.
, . isc.py.test.Process
BPL:

тАФ Python :

isc.py.msg.ExecutionRequest
, :
Code
тАФ Python .SeparateLines
тАФ . $c(10)
(\n
) . , , def
. 0
.Variables
тАФ , .Serialization
тАФ , . : Str
, Repr
, JSON
, Pickle
Dill
, Str
.
, Code
, . process.GetAnnotation("Import pandas")
, . , import pandas as pd
Python. GetAnnotation
Python , . Code
.
isc.py.msg.ExecutionRequest
тАФ Correlation Matrix: Tabular
:

Python corrmat
InterSystems IRIS JSON, :
Variables
: "corrmat"
Serialization
: "JSON"
Visual Trace:

, : callresponse.Variables.GetAt("corrmat")
.
InterSystems IRIS Python, isc.py.msg.DataRequest
, :
Variable
тАФ Python .Type
тАФ : dataframe
(pandas dataframe) list
.Namespace
тАФ . isc.py
. .
4 :
isc.py.msg.QueryRequest
тАФ Query
SQL .isc.py.msg.ClassRequest
тАФ Class
.isc.py.msg.TableRequest
тАФ Table
.isc.py.msg.GlobalRequest
тАФ Global
.
RAW
, isc.py.msg.QueryRequest
.

/ Python
, Python InterSystems IRIS, , isc.py.msg.SaveRequest
:
Mask
тАФ , . *
?
. : "Data*, Figure?"
. *
.MaxLength
тАФ . , . 0, . $$$MaxStringLength
.Name
тАФ ().Description
тАФ ().
Ens.StringResponse
Id
. Save Context
.
isc.py.msg.RestoreRequest
InterSystems IRIS Python:
ContextId
тАФ .Clear
тАФ .
Jupyter Notebook
Jupyter Notebook тАФ - , , , . Python Gateway BPL- Jupyter Notebook. , executor Python 3.
, Python . - PythonGateway Jupyter Notebook. :
-. :


- InterSystems IRIS 2019.2+.
- PythonGateway v0.8+ (
isc.py.util.Jupyter
, isc.py.util.JupyterCheckpoints
isc.py.ens.ProcessUtils
). - ObjectScript .
do ##class(isc.py.util.Jupyter).Install()
.
.
MLToolkit тАФ , , -. Python Gateway MLToolkit Python , Python ( Data Scientists), , AI/ML- InterSystems IRIS.
MLToolkit тАФ GitHub-, GitHub- InterSystems. , , MLToolkit, Python Gateway. ( ) , , . ML Toolkit, , : MLToolkit@intersystems.com :
, InterSystems IRIS , , . ; AI/ML тАУ MLToolkit@intersystems.com.