MSTR-Robotics-magerdaniel 0.3.1__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3/MSTR_Robotics_magerdaniel.egg-info}/PKG-INFO +6 -1
  2. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/MSTR_Robotics_magerdaniel.egg-info/SOURCES.txt +1 -0
  3. mstr_robotics_magerdaniel-0.3.3/MSTR_Robotics_magerdaniel.egg-info/requires.txt +4 -0
  4. {mstr_robotics_magerdaniel-0.3.1/MSTR_Robotics_magerdaniel.egg-info → mstr_robotics_magerdaniel-0.3.3}/PKG-INFO +6 -1
  5. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/_connectors.py +18 -0
  6. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/_helper.py +5 -0
  7. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/prepare_AI_data.py +45 -7
  8. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/read_out_prj_obj.py +0 -15
  9. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/report.py +1 -1
  10. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/setup.py +8 -1
  11. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/LICENSE +0 -0
  12. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/MANIFEST.in +0 -0
  13. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/MSTR_Robotics_magerdaniel.egg-info/dependency_links.txt +0 -0
  14. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/MSTR_Robotics_magerdaniel.egg-info/top_level.txt +0 -0
  15. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/README.md +0 -0
  16. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/__init__.py +0 -0
  17. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/_lu_data.py +0 -0
  18. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/_mod_prj_obj.py +0 -0
  19. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/ai_openAi_faisst.py +0 -0
  20. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/dossier.py +0 -0
  21. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/mstr_classes.py +0 -0
  22. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/mstr_robotics/mstr_pandas.py +0 -0
  23. {mstr_robotics_magerdaniel-0.3.1 → mstr_robotics_magerdaniel-0.3.3}/setup.cfg +0 -0
@@ -1,17 +1,22 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: MSTR_Robotics_magerdaniel
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: MicroStrateg(P)ython
5
5
  Home-page: https://github.com/magerdaniel
6
6
  Author: Daniel Mager
7
7
  Author-email: "danielmager@gmx.de"
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: mstrio-py==11.4.6.101
11
+ Requires-Dist: langchain
12
+ Requires-Dist: openai
13
+ Requires-Dist: flashtext
10
14
  Dynamic: author
11
15
  Dynamic: author-email
12
16
  Dynamic: description
13
17
  Dynamic: description-content-type
14
18
  Dynamic: home-page
19
+ Dynamic: requires-dist
15
20
  Dynamic: summary
16
21
 
17
22
  Hi,
@@ -5,6 +5,7 @@ setup.py
5
5
  MSTR_Robotics_magerdaniel.egg-info/PKG-INFO
6
6
  MSTR_Robotics_magerdaniel.egg-info/SOURCES.txt
7
7
  MSTR_Robotics_magerdaniel.egg-info/dependency_links.txt
8
+ MSTR_Robotics_magerdaniel.egg-info/requires.txt
8
9
  MSTR_Robotics_magerdaniel.egg-info/top_level.txt
9
10
  mstr_robotics/__init__.py
10
11
  mstr_robotics/_connectors.py
@@ -0,0 +1,4 @@
1
+ mstrio-py==11.4.6.101
2
+ langchain
3
+ openai
4
+ flashtext
@@ -1,17 +1,22 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: MSTR_Robotics_magerdaniel
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: MicroStrateg(P)ython
5
5
  Home-page: https://github.com/magerdaniel
6
6
  Author: Daniel Mager
7
7
  Author-email: "danielmager@gmx.de"
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: mstrio-py==11.4.6.101
11
+ Requires-Dist: langchain
12
+ Requires-Dist: openai
13
+ Requires-Dist: flashtext
10
14
  Dynamic: author
11
15
  Dynamic: author-email
12
16
  Dynamic: description
13
17
  Dynamic: description-content-type
14
18
  Dynamic: home-page
19
+ Dynamic: requires-dist
15
20
  Dynamic: summary
16
21
 
17
22
  Hi,
@@ -189,6 +189,24 @@ class mstr_api():
189
189
  url += f"{instance_id}/chapters/{chapter_key}/visualizations/{vis_id}?offset=0&limit=1000"
190
190
  return conn.get(url).json()
191
191
 
192
+ def get_v2_cube_instance(self,conn,cube_id,offset_val,limit_val):
193
+ url = f'{conn.base_url}/api/v2/cubes/{cube_id}/instances?offset={offset_val}&limit={limit_val}'
194
+ return conn.post(url)
195
+
196
+
197
+
198
+ def zzz_fetch_cube_elements(self,conn, cube_id, attribute_id, limit_val=100):
199
+ all_element_l = []
200
+ offset_val = 0
201
+ tot_count = 0
202
+ while tot_count >= offset_val:
203
+ url = f"{conn.base_url}/api/cubes/{cube_id}/attributes/{attribute_id}/elements?offset={offset_val}&limit={limit_val}"
204
+ resp = conn.get(url)
205
+ tot_count = int(resp.headers["x-mstr-total-count"])
206
+ offset_val += limit_val
207
+ all_element_l.extend(resp.json())
208
+ return all_element_l
209
+
192
210
 
193
211
 
194
212
  def ZZZ_get_cube_data(self,conn,cube_id,instance_id,offset,limit) :
@@ -81,6 +81,11 @@ class msic():
81
81
  new_dict_l.append(d)
82
82
  return new_dict_l
83
83
 
84
+ def get_obj_id_by_type_l(self,dict_l, obj_type_l):
85
+ obj_type_l = self.get_dict_with_id_in_l(dict_l=dict_l, search_l=obj_type_l, key="type")
86
+ obj_id_l = self.get_key_form_dict_l(dict_l=obj_type_l, key="id")
87
+ return obj_id_l
88
+
84
89
  def get_key_form_dict_l(self,dict_l,key="id"):
85
90
  #if you communicating over REST with MSTR, you of often
86
91
  #get list of dictionary, where you only need the object_id's.
@@ -7,8 +7,10 @@ from mstr_robotics._helper import msic
7
7
  from mstr_robotics._connectors import mstr_api
8
8
  from mstr_robotics.mstr_classes import mstr_global
9
9
  from mstrio.project_objects import OlapCube
10
- from flashtext import KeywordProcessor
10
+ from mstr_robotics.read_out_prj_obj import io_attributes
11
11
 
12
+ io_att=io_attributes()
13
+ from flashtext import KeywordProcessor
12
14
  from itertools import chain
13
15
  import json
14
16
 
@@ -65,13 +67,51 @@ class read_out_cube_att():
65
67
  rag_att_form_id_d["form_dataType"] = i_prompts.get_exp_prp_data_type(form["dataType"])
66
68
  if att["name"] == att_name and form["name"] == form_name:
67
69
  return rag_att_form_id_d
68
- elif att["name"] == att_name and form_name==None and i==0:
69
- return rag_att_form_id_d
70
+ #elif att["name"] == att_name and form_name==None and i==0:
71
+ # return rag_att_form_id_d
70
72
  i+=1
71
73
 
72
74
  return rag_att_form_id_d
73
75
 
74
- def read_cube_att_form_exp_val_l(self,conn,cube_list_l):
76
+ #def read_cube_att_form_exp_val_l(conn, cube_id,*args,**kwargs):
77
+
78
+
79
+ def fetch_cube_elements(self, conn, cube_id,limit_val=10000,*args,**kwargs):
80
+ rag_att_form_l = []
81
+ offset_val = 0
82
+ row_count = 1
83
+ while row_count > 0:
84
+ resp=i_mstr_api.get_v2_cube_instance(conn=conn, cube_id=cube_id, offset_val=offset_val,limit_val=limit_val,*args,**kwargs)
85
+ #url = f'{conn.base_url}/api/v2/cubes/{cube_id}/instances?offset={offset_val}&limit={limit_val}'
86
+ #resp = conn.post(url)
87
+ cube_def= resp.json()
88
+ for att in cube_def["definition"]["grid"]["rows"]:
89
+ form_nr = 0
90
+ rag_att_form_d = {}
91
+ rag_att_form_d["project_id"] = conn.project_id
92
+ rag_att_form_d["attribute_id"] = att["id"]
93
+ rag_att_form_d["attribute_name"] = att["name"]
94
+ row_count = len(att["elements"])
95
+ for form in att["forms"]:
96
+ rag_att_form_d["form_id"] = form["id"]
97
+ rag_att_form_d["form_name"] = form["name"]
98
+ rag_att_form_d["form_dataType"] = i_prompts.get_exp_prp_data_type(form["dataType"])
99
+ for element in att["elements"]:
100
+ rag_att_form_d["key"] = element["formValues"][form_nr]
101
+ rag_att_form_d["ele_prp_ans"] = element["id"]
102
+ rag_att_form_l.append(rag_att_form_d.copy())
103
+ offset_val += limit_val
104
+ resp.close()
105
+ return rag_att_form_l
106
+
107
+ def read_cube_att_form_exp_val_l(self, conn, cube_list_l,*args,**kwargs):
108
+ all_cube_element_l=[]
109
+ for cube in cube_list_l:
110
+ cube_element_l=self.fetch_cube_elements(conn=conn,cube_id=cube["id"],*args,**kwargs)
111
+ all_cube_element_l.extend(cube_element_l)
112
+ return all_cube_element_l
113
+
114
+ def zzz_read_cube_att_form_exp_val_l(self,conn,cube_list_l):
75
115
  element_d_l = []
76
116
  for cube_id in cube_list_l:
77
117
  cube = OlapCube(connection=conn, id=cube_id["id"])
@@ -90,7 +130,7 @@ class read_out_cube_att():
90
130
  distinct_val = cube_df[col].unique()
91
131
  for val in distinct_val:
92
132
  att_form_d["key"] = val
93
- att_form_d["prp_ans"] = val
133
+ #att_form_d["prp_ans"] = val
94
134
  element_d_l.append(att_form_d.copy())
95
135
  else:
96
136
  #print("col not added")
@@ -105,8 +145,6 @@ class read_out_cube_att():
105
145
 
106
146
  return element_d_l
107
147
 
108
-
109
-
110
148
  class map_objects():
111
149
 
112
150
  def get_doss_rep_prp(self,conn, object_l):
@@ -16,11 +16,6 @@ i_prompts=prompts()
16
16
  i_mstr_api=mstr_api()
17
17
 
18
18
 
19
- class ZZ_read_out_prp():
20
- def _read_metric_def(self):
21
- pass
22
-
23
-
24
19
  class read_out_hierarchy():
25
20
 
26
21
  def __init__(self):
@@ -131,18 +126,8 @@ class read_table_def():
131
126
 
132
127
  return prjtblcol
133
128
 
134
- def zzz_get_prj_tbl(self,conn):
135
- inst_u = f"{conn.base_url}/api/model/tables"
136
- r = conn.get(inst_u)
137
- return r
138
-
139
129
  def runreadout(self,conn,*args,**kwargs):
140
130
  #define target table for data upload
141
- tbl_name = "all_mppd_tbl_col"
142
- #initialize column order for pandas dataframe
143
- #load_col_ord_l=list(run_prop_d.keys())
144
-
145
-
146
131
  #do the readout
147
132
  tbl_id_l=[]
148
133
  all_tables_l= i_mstr_api.get_prj_tbl(conn).json()["tables"]
@@ -328,7 +328,7 @@ class prompts():
328
328
  if baseFormType in ["integer","double","numeric","decimal"]:
329
329
  exp_prp_data_type="Numeric"
330
330
 
331
- if baseFormType in ["big_decimal"]:
331
+ if baseFormType in ["big_decimal","bigDecimal"]:
332
332
  exp_prp_data_type="BigDecimal"
333
333
 
334
334
  if baseFormType in ["time_stamp"]:
@@ -9,7 +9,7 @@ for scheme in list(INSTALL_SCHEMES.values()):
9
9
 
10
10
  long_description = (this_directory / "README.md").read_text()
11
11
  setup(name='MSTR_Robotics_magerdaniel',
12
- version= "0.3.01",
12
+ version= "0.3.03",
13
13
  description="MicroStrateg(P)ython",
14
14
  author="Daniel Mager",
15
15
  author_email='"danielmager@gmx.de"',
@@ -17,5 +17,12 @@ setup(name='MSTR_Robotics_magerdaniel',
17
17
  long_description=long_description,
18
18
  long_description_content_type='text/markdown',
19
19
  packages=['mstr_robotics'],
20
+ install_requires=[
21
+ "mstrio-py==11.4.6.101", # MicroStrategy Python Library
22
+ "langchain", # Framework for developing LLM-powered applications
23
+ "openai", # OpenAI Python client
24
+ "flashtext", # Library for keyword extraction and replacement
25
+ # itertools is a standard Python library and does not need to be installed
26
+ ],
20
27
  package_data={'mstr_robotics': ['jup_schema_monitor.ipynb']},
21
28
  )