@@ -3,43 +3,64 @@ Class isc.py.test.Process Extends (Ens.BusinessProcessBPL, isc.py.ens.ProcessUti
3
3
{
4
4
5
5
/// Бизнес-операция, запускающая ожидание поступления изменений объекта
6
- Property ConnectionType As %String (MAXLEN = 4 , VALUELIST = " ,JDBC,ODBC" ) [ InitialExpression = " ODBC " ];
6
+ Property ConnectionType As %String (MAXLEN = 4 , VALUELIST = " ,RAW, JDBC,ODBC" ) [ InitialExpression = " RAW " ];
7
7
8
8
Parameter SETTINGS = " ConnectionType:Basic" ;
9
9
10
10
/// BPL Definition
11
11
XData BPL [ XMLNamespace = " http://www.intersystems.com/bpl" ]
12
12
{
13
13
<process language ='objectscript ' request ='Ens .Request ' response ='Ens .Response ' height ='2000 ' width ='2000 ' >
14
- <sequence xend ='200 ' yend ='1300 ' >
15
- <if name ='is ODBC ' condition ='process .ConnectionType =" ODBC" ' xpos ='200 ' ypos ='250 ' xend ='200 ' yend ='500 ' >
16
- <true >
17
- <call name ='ODBC connect ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='470 ' ypos ='400 ' >
18
- <annotation ><![CDATA [import pyodbc
19
- cnxn =pyodbc .connect (('DSN =ENSEMBLE (PYTHON );UID=dev;PWD=123'),autocommit=True)
20
- y =1 ]]></annotation >
14
+ <sequence xend ='200 ' yend ='1500 ' >
15
+ <call name ='Import pandas ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='250 ' >
16
+ <annotation ><![CDATA [import pandas as pd ]]></annotation >
21
17
<request type ='isc .py .msg .ExecutionRequest ' >
22
- <assign property =" callrequest.Code" value =" process.GetAnnotation("ODBC connect ")" action =" set" />
18
+ <assign property =" callrequest.Code" value =" process.GetAnnotation("Import pandas ")" action =" set" />
23
19
</request >
24
20
<response type ='isc .py .msg .ExecutionResponse ' />
25
21
</call >
26
- </true >
27
- <false >
28
- <call name ='JDBC connect ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='400 ' >
22
+ <sync name ='Wait for import ' calls ='Import pandas ' type ='all ' xpos ='200 ' ypos ='350 ' />
23
+ <switch name ='Get Data ' xpos ='200 ' ypos ='450 ' xend ='200 ' yend ='700 ' >
24
+ <case condition ='process .ConnectionType =" RAW" ' name ='RAW ' >
25
+ <call name ='RAW ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='335 ' ypos ='600 ' >
26
+ <annotation ><![CDATA [SELECT * FROM isc _py _test .CannibalizationData ]]></annotation >
27
+ <request type ='isc .py .msg .QueryRequest ' >
28
+ <assign property =" callrequest.Query" value =" process.GetAnnotation("RAW")" action =" set" />
29
+ <assign property =" callrequest.Variable" value =" "Data"" action =" set" />
30
+ <assign property =" callrequest.Type" value =" "dataframe"" action =" set" />
31
+ </request >
32
+ <response type ='Ens .Response ' />
33
+ </call >
34
+ </case >
35
+ <case condition ='process .ConnectionType =" JDBC" ' name ='JDBC ' >
36
+ <call name ='JDBC ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='605 ' ypos ='600 ' >
29
37
<annotation ><![CDATA [import jaydebeapi
30
- cnxn =jaydebeapi .connect (" com.intersystems.jdbc.IRISDriver" ," jdbc:IRIS://localhost:51773/Python" , [" dev" , " 123" ], " /InterSystems/IRIS/dev/java/lib/JDK18/intersystems-jdbc-3.0.0.jar" )]]></annotation >
38
+ cnxn =jaydebeapi .connect (" com.intersystems.jdbc.IRISDriver" ," jdbc:IRIS://localhost:51773/Python" , [" dev" , " 123" ], " /InterSystems/IRIS/dev/java/lib/JDK18/intersystems-jdbc-3.0.0.jar" )
39
+ Data =pd .read _sql ('SELECT * FROM isc _py _test .CannibalizationData ',cnxn )
40
+ cnxn .close ()]]></annotation >
31
41
<request type ='isc .py .msg .ExecutionRequest ' >
32
- <assign property =" callrequest.Code" value =" process.GetAnnotation("JDBC connect ")" action =" set" />
42
+ <assign property =" callrequest.Code" value =" process.GetAnnotation("JDBC")" action =" set" />
33
43
</request >
34
44
<response type ='isc .py .msg .ExecutionResponse ' />
35
45
</call >
36
- </false >
37
- </ if >
38
- <sync name ='Wait for connection ' calls =' ODBC connect , JDBC connect ' type =' any ' xpos ='200 ' ypos ='600 ' / >
39
- <call name =' Correlation Matrix : Tabular ' target =' isc . py . ens . Operation ' async =' 1 ' xpos =' 200 ' ypos =' 700 ' >
40
- < annotation ><![ CDATA [ import pandas as pd
46
+ </case >
47
+ <case condition =' process . ConnectionType = " ODBC " ' name =' ODBC ' >
48
+ <call name ='ODBC ' target =' isc . py . ens . Operation ' async =' 1 ' xpos ='875 ' ypos ='600 ' >
49
+ <annotation ><![ CDATA [ import pyodbc
50
+ cnxn = pyodbc . connect ((' DSN = ENSEMBLE ( PYTHON ) ;UID=dev;PWD=123'),autocommit=True)
41
51
Data =pd .read _sql ('SELECT * FROM isc _py _test .CannibalizationData ',cnxn )
42
- Data0 =Data .drop (['WEEK '],axis =1 )
52
+ cnxn .close ()]]></annotation >
53
+ <request type ='isc .py .msg .ExecutionRequest ' >
54
+ <assign property =" callrequest.Code" value =" process.GetAnnotation("ODBC")" action =" set" />
55
+ </request >
56
+ <response type ='isc .py .msg .ExecutionResponse ' />
57
+ </call >
58
+ </case >
59
+ <default />
60
+ </switch >
61
+ <sync name ='Wait for data ' calls ='RAW ,ODBC ,JDBC ' type ='any ' xpos ='200 ' ypos ='800 ' />
62
+ <call name ='Correlation Matrix : Tabular ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='900 ' >
63
+ <annotation ><![CDATA [Data0 =Data .drop (['WEEK '],axis =1 )
43
64
Data0 ['BRATWURST ']=pd .to _numeric (Data0 ['BRATWURST '])
44
65
Data0 ['CERVELAS ']=pd .to _numeric (Data0 ['CERVELAS '])
45
66
Data0 ['CHARCUTERIE ']=pd .to _numeric (Data0 ['CHARCUTERIE '])
@@ -63,17 +84,15 @@ Data0['UEBRIGE_BRUEHWURST_STUECK']=pd.to_numeric(Data0['UEBRIGE_BRUEHWURST_STUEC
63
84
Data0 ['WIENERLI _KNACKERLI _FRANKFURTERLI ']=pd .to _numeric (Data0 ['WIENERLI _KNACKERLI _FRANKFURTERLI '])
64
85
corrmat =Data0 .corr ()
65
86
corrmat .columns .name ='CATEGORY '
66
- result =corrmat .to _string ()
67
- cnxn .close ()
68
- ]]></annotation >
87
+ result =corrmat .to _string ()]]></annotation >
69
88
<request type ='isc .py .msg .ExecutionRequest ' >
70
89
<assign property =" callrequest.Variables" value =" "result"" action =" set" />
71
90
<assign property =" callrequest.Code" value =" process.GetAnnotation("Correlation Matrix: Tabular")" action =" set" />
72
91
</request >
73
92
<response type ='isc .py .msg .ExecutionResponse ' />
74
93
</call >
75
- <sync name ='Wait Correlation Matrix : Tabular ' calls ='Correlation Matrix : Tabular ' type ='all ' xpos ='200 ' ypos ='800 ' />
76
- <call name ='Correlation Matrix : Graph ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='900 ' >
94
+ <sync name ='Wait Correlation Matrix : Tabular ' calls ='Correlation Matrix : Tabular ' type ='all ' xpos ='200 ' ypos ='1000 ' />
95
+ <call name ='Correlation Matrix : Graph ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='1100 ' >
77
96
<annotation ><![CDATA [import matplotlib
78
97
import matplotlib .pyplot as plt
79
98
import seaborn as sns
@@ -87,15 +106,27 @@ plt.close(f)]]></annotation>
87
106
</request >
88
107
<response type ='isc .py .msg .ExecutionResponse ' />
89
108
</call >
90
- <sync name ='Wait Correlation Matrix : Graph ' calls ='Correlation Matrix : Graph ' type ='all ' xpos ='200 ' ypos ='1000 ' />
91
- <call name ='Save Context ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='1100 ' >
109
+ <sync name ='Wait Correlation Matrix : Graph ' calls ='Correlation Matrix : Graph ' type ='all ' xpos ='200 ' ypos ='1200 ' />
110
+ <call name ='Save Context ' target ='isc .py .ens .Operation ' async ='1 ' xpos ='200 ' ypos ='1300 ' >
92
111
<request type ='isc .py .msg .SaveRequest ' />
93
112
<response type ='Ens .StringResponse ' />
94
113
</call >
95
- <sync name ='Wait : Save Context ' calls ='Save Context ' type ='all ' xpos ='200 ' ypos ='1200 ' />
114
+ <sync name ='Wait : Save Context ' calls ='Save Context ' type ='all ' xpos ='200 ' ypos ='1400 ' />
96
115
</sequence >
97
116
</process >
98
117
}
99
118
119
+ Storage Default
120
+ {
121
+ <Data name =" ProcessDefaultData" >
122
+ <Subscript >" Process" </Subscript >
123
+ <Value name =" 1" >
124
+ <Value >ConnectionType </Value >
125
+ </Value >
126
+ </Data >
127
+ <DefaultData >ProcessDefaultData </DefaultData >
128
+ <Type >%Library .CacheStorage </Type >
129
+ }
130
+
100
131
}
101
132
0 commit comments