Browse Source

contesti singoli fixed

Leonardo Canova 1 year ago
parent
commit
cb337b7b75

+ 10 - 7
flask_be/engine/basic_queries.py

@@ -179,16 +179,18 @@ class basicQueries:
         if parole != 0:
             pointerlist = pd.DataFrame()
             for table in listOcc:
+                print(listOcc)
                 queryData = {'queryType': 'singlecontext', 'querySubtype': 'parole', 'parole': parole, 'periodi': periodi, 'brani': brani, 'table': table, 'ntxlocal': ntxlocal, 'mappalocal': mappalocal, 'periodlocal': periodlocal, 'numbranolocal': numbranolocal}
                 queryresponse = self.queryHandler.query(queryData, pandas=True)
                 pointerlist = pd.concat([pointerlist, queryresponse])
-                fileQueryData = {'sigla': sigla, 'minChar': pointerlist["pitxt"].min(), 'maxChar': pointerlist["pitxt"].max()}
-                cont = self.queryHandler.textQuery(fileQueryData)
-                contexts.append(cont)
-                form = self.queryHandler.formatQuery(fileQueryData)
-                formats.append(form)
-                context ['piniz'] = pointerlist["pitxt"].min()
-                context ['pfin'] = pointerlist["pitxt"].max()
+            print(pointerlist)
+            fileQueryData = {'sigla': sigla, 'minChar': pointerlist["pitxt"].min(), 'maxChar': pointerlist["pitxt"].max()}
+            cont = self.queryHandler.textQuery(fileQueryData)
+            contexts.append(cont)
+            form = self.queryHandler.formatQuery(fileQueryData)
+            formats.append(form)
+            context ['piniz'] = pointerlist["pitxt"].min()
+            context ['pfin'] = pointerlist["pitxt"].max()
         elif periodi != 0:
             queryData = {'queryType': 'singlecontext', 'querySubtype': 'parole', 'parole': parole, 'periodi': periodi, 'brani': brani, 'table': table, 'ntxlocal': ntxlocal, 'mappalocal': mappalocal, 'periodlocal': periodlocal, 'numbranolocal': numbranolocal}
             queryresponse = self.queryHandler.query(queryData, pandas=True)
@@ -215,6 +217,7 @@ class basicQueries:
         context['contesto'] = contexts [0]
         context['formattazione'] = formats
         return pd.DataFrame(context).T.reset_index(drop=True)
+    
     #%% funzione reperimento note e brani associati
     def findlinks (self, context):
         linkslocal = context.loc[0, "links"]

+ 1 - 1
flask_be/engine/handle_request.py

@@ -48,7 +48,7 @@ def handleSingleContext(elem, paramObj, dataConfig):
 
     queryHandler = basicQueries(dataConfig)
 
-    indice = int(paramObj['indice'])
+    indice = 0
     parole = int(paramObj['parole'])
     periodi = int(paramObj['periodi'])
     brani = int(paramObj['brani'])

+ 1 - 1
flask_be/engine/test/test_occorrenzario_pandas.py

@@ -158,7 +158,7 @@ def contestimultipli (tipo_ricerca, ricerca, listOcc, path):
 
 
 # %%
-path = "/Users/alessiaspadi/Desktop/Environments/Ricerche/dbfirst_db"
+path = "/Users/leonardocanova/Library/CloudStorage/OneDrive-ConsiglioNazionaledelleRicerche/TIGRO/Ricerche/db/first_db"
 listOcc = get_tables_occ(path)
 entry = "mezzo"
 tiporicerca= 1