sarapy 0.4.9__tar.gz → 1.0.1__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 (30) hide show
  1. {sarapy-0.4.9 → sarapy-1.0.1}/LICENCE +1 -1
  2. {sarapy-0.4.9/sarapy.egg-info → sarapy-1.0.1}/PKG-INFO +9 -1
  3. {sarapy-0.4.9 → sarapy-1.0.1}/README.md +8 -0
  4. {sarapy-0.4.9 → sarapy-1.0.1}/pyproject.toml +1 -1
  5. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/dataProcessing/OpsProcessor.py +16 -113
  6. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/dataProcessing/TLMSensorDataProcessor.py +1 -1
  7. sarapy-1.0.1/sarapy/preprocessing/TransformInputData.py +106 -0
  8. sarapy-1.0.1/sarapy/preprocessing/TransformToOutputData.py +63 -0
  9. sarapy-1.0.1/sarapy/utils/__init__.py +0 -0
  10. sarapy-1.0.1/sarapy/utils/amg_ppk.py +38 -0
  11. sarapy-1.0.1/sarapy/utils/getRawOperations.py +25 -0
  12. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/version.py +1 -1
  13. {sarapy-0.4.9 → sarapy-1.0.1/sarapy.egg-info}/PKG-INFO +9 -1
  14. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy.egg-info/SOURCES.txt +7 -2
  15. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/__init__.py +0 -0
  16. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/dataProcessing/GeoProcessor.py +0 -0
  17. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/dataProcessing/TimeSeriesProcessor.py +0 -0
  18. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/dataProcessing/__init__.py +0 -0
  19. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/mlProcessors/PlantinClassifier.py +0 -0
  20. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/mlProcessors/PlantinFMCreator.py +0 -0
  21. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/mlProcessors/__init__.py +0 -0
  22. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/preprocessing/DistancesImputer.py +0 -0
  23. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/preprocessing/FertilizerImputer.py +0 -0
  24. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy/preprocessing/__init__.py +0 -0
  25. {sarapy-0.4.9/sarapy/dataProcessing → sarapy-1.0.1/sarapy/utils}/amg_decoder.py +0 -0
  26. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy.egg-info/dependency_links.txt +0 -0
  27. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy.egg-info/requires.txt +0 -0
  28. {sarapy-0.4.9 → sarapy-1.0.1}/sarapy.egg-info/top_level.txt +0 -0
  29. {sarapy-0.4.9 → sarapy-1.0.1}/setup.cfg +0 -0
  30. {sarapy-0.4.9 → sarapy-1.0.1}/setup.py +0 -0
@@ -4,4 +4,4 @@ Permission is hereby granted, free of charge, to any person or organization with
4
4
 
5
5
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6
6
 
7
- For any inquiries or further information, please contact AMG SA at [contact email].
7
+ For any inquiries or further information, please contact AMG SA at lucas.baldezzari@amg.com.uy.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sarapy
3
- Version: 0.4.9
3
+ Version: 1.0.1
4
4
  Home-page: https://github.com/lucasbaldezzari/sarapy
5
5
  Author: Lucas Baldezzari
6
6
  Author-email: Lucas Baldezzari <lmbaldezzari@gmail.com>
@@ -19,6 +19,14 @@ Requires-Dist: geopy
19
19
 
20
20
  Library for processing SARAPICO project metadata of _AMG_.
21
21
 
22
+ #### Version 1.0.1
23
+
24
+ - Se agrega *__init.py__* dentro del mpdulo _utils_.
25
+
26
+ #### Version 1.0.0
27
+
28
+ - Se crean clases TransformInputData y TransformToOuputData dentro del módulo proprocessing. Se crean utils.
29
+
22
30
  #### Version 0.4.9
23
31
 
24
32
  - Se cierra la versión 0.4.8 y se crea la versión 0.4.9 para actualizar repositorio, diagrama de clases a esta versión y la Licencia de uso.
@@ -2,6 +2,14 @@
2
2
 
3
3
  Library for processing SARAPICO project metadata of _AMG_.
4
4
 
5
+ #### Version 1.0.1
6
+
7
+ - Se agrega *__init.py__* dentro del mpdulo _utils_.
8
+
9
+ #### Version 1.0.0
10
+
11
+ - Se crean clases TransformInputData y TransformToOuputData dentro del módulo proprocessing. Se crean utils.
12
+
5
13
  #### Version 0.4.9
6
14
 
7
15
  - Se cierra la versión 0.4.8 y se crea la versión 0.4.9 para actualizar repositorio, diagrama de clases a esta versión y la Licencia de uso.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "sarapy"
3
3
 
4
- version = "0.4.9"
4
+ version = "1.0.1"
5
5
  authors = [
6
6
  {name = "Lucas Baldezzari", email = "lmbaldezzari@gmail.com"},]
7
7
  maintainers = [
@@ -6,6 +6,7 @@ import numpy as np
6
6
  import pandas as pd
7
7
  # from sarapy.mlProcessors import PlantinFMCreator
8
8
  from sarapy.mlProcessors import PlantinClassifier
9
+ from sarapy.preprocessing import TransformInputData, TransformToOutputData
9
10
 
10
11
  class OpsProcessor():
11
12
  """Clase para procesar las operaciones de los operarios. La información se toma de la base de datos
@@ -41,6 +42,8 @@ class OpsProcessor():
41
42
  self._platin_classifiedOperations = np.array([]) ##array con las operaciones clasificadas para plantin
42
43
  self._fertilizer_classifiedOperations = np.array([]) ##array con las operaciones clasificadas para plantin
43
44
  self._last_row_db = 0 ##indicador de la última fila de los datos extraidos de la base de datos histórica
45
+ self.transformInputData = TransformInputData.TransformInputData()
46
+ self.transformToOutputData = TransformToOutputData.TransformToOutputData()
44
47
 
45
48
  def processOperations(self, data):
46
49
  """Método para procesar las operaciones de los operarios.
@@ -73,18 +76,18 @@ class OpsProcessor():
73
76
 
74
77
  ##chqueo que newSample no esté vacío
75
78
  if len(data) != 0:
76
- newSample = self.transformInputData(data)
79
+ newSample = self.transformInputData.fit_transform(data)
77
80
  #Si tenemos nuevas operaciones, actualizamos el diccionario de operaciones
78
81
  self.updateOperationsDict(newSample) #actualizamos diccionario interno de la clase
79
82
  pl_clas = self.classifyForPlantin() #clasificamos las operaciones para plantín
80
83
  ft_clas = newSample[:,7].astype(int) #clasificamos las operaciones para fertilizante
81
84
  id_db_h_nums, id_db_dw_nums = self.getActualOperationsNumbers() #obtenemos los números de operaciones desde el diccionario de operaciones
82
85
  date_oprc = newSample[:,3]
83
- return self.transformToOutputData(np.column_stack((id_db_h_nums,
84
- id_db_dw_nums,
85
- pl_clas,
86
- ft_clas,
87
- date_oprc)))
86
+ return self.transformToOutputData.fit_transform(np.column_stack((id_db_h_nums,
87
+ id_db_dw_nums,
88
+ pl_clas,
89
+ ft_clas,
90
+ date_oprc)))
88
91
  else:
89
92
  self.resetAllNewSamplesValues()
90
93
  return None
@@ -237,82 +240,6 @@ class OpsProcessor():
237
240
 
238
241
  for ID_NPDP in self.operationsDict.keys():
239
242
  self._operationsDict[ID_NPDP]["first_day_op_classified"] = False
240
-
241
- def transformInputData(self, data):
242
- """Función para transformar los datos de entrada que llegan del decoder
243
-
244
- Args:
245
- data: Es una lista de diccionario. Cada diccionario tiene los siguientes keys.
246
-
247
- Ejemplo:
248
-
249
- {
250
- "id_db_h":1, #int
251
- "ID_NPDP":"XXAA123", #string
252
- "FR": 1, #int
253
- "TLM_NPDP": b'\xfc\x01\t\t\x00\x00\x00\x98', #bytes
254
- "date_oprc":datetime.datetime(2024, 2, 16, 21, 2, 2, tzinfo=tzutc()),#datetime
255
- "Latitud":-32.145564789, #float
256
- "Longitud":-55.145564789, #float
257
- "Precision": 1000,
258
- "id_db_dw": 1 #int
259
- }
260
-
261
- NOTA: Los diccionarios de la lista tienen más datos, pero no se usan ahora.
262
-
263
- Returns:
264
- Retorna un array de strings con la siguiente estructura
265
- - 0: id_db_h
266
- - 1: ID_NPDP
267
- - 2: TLM_NPDP
268
- - 3: date_oprc
269
- - 4: latitud
270
- - 5: longitud
271
- - 6: Precision
272
- - 7: FR
273
- - 8: id_db_dw
274
- """
275
-
276
- ##convierto list_of_dics a un array de strings
277
- newSample = np.array([[d["id_db_h"],
278
- d["ID_NPDP"],
279
- ''.join([bin(byte)[2:].zfill(8) for byte in d["TLM_NPDP"]]),
280
- int(d["date_oprc"].timestamp()),
281
- d["Latitud"],
282
- d["Longitud"],
283
- d["Precision"],
284
- d["FR"],
285
- d["id_db_dw"]] for d in data])
286
- return newSample
287
-
288
- def transformToOutputData(self, dataToTransform):
289
- """Método para transformar los datos recibidos a una lista de diccionarios
290
-
291
- Args:
292
- - dataToTransform: array con los datos de las operaciones clasificadas.
293
- Actualmente el array de dataToTransform es de (n,4) con las columnas siguientes
294
-
295
- - 0: id_db_h
296
- - 1: id_db_dw
297
- - 2: tag_seedling
298
- - 3: tag_fertilizer
299
- - 4: date_oprc
300
- Returns:
301
- Retorna una lista de diccionarios con la siguiente estructura
302
- [{"id_db_h", },]
303
- """
304
-
305
- keys = ["id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer", "date_oprc"]
306
- temp_df = pd.DataFrame(dataToTransform, columns = keys)
307
-
308
- date_data = dataToTransform[:,4].astype(int)
309
- # date_oprc = [datetime.datetime.utcfromtimestamp(date).replace(tzinfo = tzutc()) for date in date_data]
310
- date_oprc = np.array([datetime.datetime.fromtimestamp(date, datetime.UTC) for date in date_data])
311
- temp_df.loc[:,"date_oprc"] = date_oprc.flatten()
312
- ##convierto las colmas "id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer" a int
313
- temp_df.loc[:,["id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer"]] = temp_df.loc[:,["id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer"]].astype(int)
314
-
315
- return temp_df.to_dict("records")
316
243
 
317
244
  def cleanSamplesOperations(self):
318
245
  """Método para limpiar las operaciones de un operario en el diccionario de operaciones.
@@ -343,41 +270,17 @@ if __name__ == "__main__":
343
270
  import pandas as pd
344
271
  import numpy as np
345
272
  import os
346
- from sarapy.dataProcessing import amg_decoder
347
-
348
- ##********************************************************************
349
- ## PREPARO LOS DATOS PARA HACER UNA PRUEBA
350
- ##********************************************************************
351
- from dateutil.tz import tzutc
352
- import datetime
353
- path = os.path.join(os.getcwd(), "examples\\volcado_17112023_NODE_encoded.csv")
354
- data_df = pd.read_csv(path, sep=";", )
355
- #tomo la columna TLM_NPDP y la convierto a bytes. La columna esta formada por un string the 8 bytes en binario
356
- data_df["TLM_NPDP"] = data_df["TLM_NPDP"].apply(lambda x: bytes([int(x[i:i+8], 2) for i in range(0, len(x), 8)]))
357
- data_df.loc[:,["date_oprc"]] = data_df.loc[:,"date_oprc"].apply(lambda fecha: datetime.datetime.utcfromtimestamp(fecha))
358
- ##le sumo a la date_oprc 53 años, 10 meses y 10 días
359
- data_df.loc[:,"date_oprc"] = data_df.loc[:,"date_oprc"].apply(lambda fecha: fecha + datetime.timedelta(days=53*365 + 10*30 + 10))
360
- ##agrego una columna con el id_db_dw
361
- data_df.loc[:,"id_db_dw"] = np.arange(0, data_df.shape[0])
362
- data_df.loc[:,"FR"] = 1
363
-
364
- data_df_raw = data_df.to_dict("records")
365
-
366
- ##********************************************************************
367
- ## PROCESAMOS LAS OPERACIONES
368
- ##********************************************************************
273
+ from sarapy.utils.getRawOperations import getRawOperations
274
+
275
+ data_df_raw = getRawOperations("examples\\2024-05-30\\UPM007N\\data.json", "examples\\2024-05-30\\UPM007N\\historical-data.json")
369
276
 
370
277
  import time
371
278
  start_time = time.time()
372
- ##simulamos el procesammiento de 10 sarapicos
373
- classifcations = []
374
- for i in range(10):
375
- op = OpsProcessor(classifier_file="examples\\pip_lda_imp.pkl", imputeDistances = False)
376
- ops_processed = op.processOperations(data_df_raw)
377
- classifcations.append(ops_processed)
378
- del op
279
+ op = OpsProcessor(classifier_file="examples\\pip_lda_imp.pkl", imputeDistances = False)
280
+ classifcations = op.processOperations(data_df_raw)
379
281
  end_time = time.time()
380
282
  execution_time = end_time - start_time
381
283
  print("Execution time:", execution_time, "seconds")
382
284
 
383
- classifcations[0][:2]
285
+ print(len(classifcations))
286
+ classifcations[:10]
@@ -110,7 +110,7 @@ class TLMSensorDataProcessor(BaseEstimator, TransformerMixin):
110
110
 
111
111
  ##chequeamos si se ha llamado a fit(). Sino, se arroja un error
112
112
  if not self.is_fitted:
113
- raise ValueError("MetadataManager no ha sido fitteado. Llame a fit() previamente.")
113
+ raise ValueError("TLMSensorDataProcessor no ha sido fitteado. Llame a fit() previamente.")
114
114
 
115
115
  return np.array([ self._RFFlag,
116
116
  self._GNSSFlag,
@@ -0,0 +1,106 @@
1
+ ###Documentación en https://github.com/lucasbaldezzari/sarapy/blob/main/docs/Docs.md
2
+
3
+ import numpy as np
4
+ from sklearn.base import BaseEstimator, TransformerMixin
5
+
6
+ class TransformInputData(BaseEstimator, TransformerMixin):
7
+ """
8
+ Clase para transformar los datos de entrada a un formato utilizable para procesar las operaciones.
9
+ """
10
+
11
+ def __init__(self):
12
+ """
13
+ Constructor de la clase TransformInputData.
14
+
15
+ Args:
16
+ - features_list: Lista con los nombres de las columnas a extraer de los datos recibidos de cada operación.
17
+ """
18
+ self.is_fitted = False
19
+ self.positions = {"id_db_h":0,
20
+ "ID_NPDP":1,
21
+ "TLM_NPDP":2,
22
+ "date_oprc":3,
23
+ "latitud":4,
24
+ "longitud":5,
25
+ "Precision":6,
26
+ "FR":7,
27
+ "id_db_dw":8}
28
+
29
+ def fit(self, X:np.array, y = None):
30
+ """
31
+ Fittea el objeto
32
+ """
33
+ self.is_fitted = True
34
+
35
+ self.newSample = np.array([[d["id_db_h"],
36
+ d["ID_NPDP"],
37
+ ''.join([bin(byte)[2:].zfill(8) for byte in d["TLM_NPDP"]]),
38
+ int(d["date_oprc"].timestamp()),
39
+ d["Latitud"],
40
+ d["Longitud"],
41
+ d["Precision"],
42
+ d["FR"],
43
+ d["id_db_dw"]] for d in X])
44
+
45
+ return self
46
+
47
+ def transform(self, X:np.array):
48
+ """
49
+ Transforma los datos de entrada a un formato utilizable para procesar las operaciones.
50
+
51
+ Args:
52
+ data: Es una lista de diccionario. Cada diccionario tiene los siguientes keys.
53
+
54
+ Ejemplo:
55
+
56
+ {
57
+ "id_db_h":1, #int
58
+ "ID_NPDP":"XXAA123", #string
59
+ "FR": 1, #int
60
+ "TLM_NPDP": b'\xfc\x01\t\t\x00\x00\x00\x98', #bytes
61
+ "date_oprc":datetime.datetime(2024, 2, 16, 21, 2, 2, tzinfo=tzutc()),#datetime
62
+ "Latitud":-32.145564789, #float
63
+ "Longitud":-55.145564789, #float
64
+ "Precision": 1000,
65
+ "id_db_dw": 1 #int
66
+ }
67
+
68
+ NOTA: Los diccionarios de la lista tienen más datos, pero no se usan ahora.
69
+
70
+ Returns:
71
+ Retorna un array de strings con la siguiente estructura
72
+ - 0: id_db_h
73
+ - 1: ID_NPDP
74
+ - 2: TLM_NPDP
75
+ - 3: date_oprc
76
+ - 4: latitud
77
+ - 5: longitud
78
+ - 6: Precision
79
+ - 7: FR
80
+ - 8: id_db_dw
81
+ """
82
+ ##chequeamos si se ha llamado a fit(). Sino, se arroja un error
83
+ if not self.is_fitted:
84
+ raise ValueError("TransformInputData no ha sido fitteado. Llame a fit() previamente.")
85
+
86
+ return self.newSample
87
+
88
+ def fit_transform(self, X:np.array, y=None):
89
+ self.fit(X)
90
+ return self.transform(X)
91
+
92
+ if __name__ == "__main__":
93
+ import pandas as pd
94
+ import numpy as np
95
+ import os
96
+ from sarapy.utils.getRawOperations import getRawOperations
97
+
98
+ # features=["id_db_h","ID_NPDP","TLM_NPDP","date_oprc","latitud","longitud","Precision","FR","id_db_dw",
99
+ # "INESTPT","INESTFT"]
100
+
101
+ transform_input_data = TransformInputData()
102
+
103
+ ppk_results = getRawOperations("examples\\2024-05-30\\UPM007N\\data.json", "examples\\2024-05-30\\UPM007N\\historical-data.json")
104
+
105
+ X = np.array(ppk_results)
106
+ print(transform_input_data.fit_transform(X))
@@ -0,0 +1,63 @@
1
+ import numpy as np
2
+ import pandas as pd
3
+ from sklearn.base import BaseEstimator, TransformerMixin
4
+ import datetime
5
+
6
+ class TransformToOutputData(BaseEstimator, TransformerMixin):
7
+ """Método para transformar los datos recibidos a una lista de diccionarios
8
+
9
+ Args:
10
+ - dataToTransform: array con los datos de las operaciones clasificadas.
11
+ Actualmente el array de dataToTransform es de (n,4) con las columnas siguientes
12
+
13
+ - 0: id_db_h
14
+ - 1: id_db_dw
15
+ - 2: tag_seedling
16
+ - 3: tag_fertilizer
17
+ - 4: date_oprc
18
+ Returns:
19
+ Retorna una lista de diccionarios con la siguiente estructura
20
+ [{"id_db_h", },]
21
+ """
22
+
23
+ def __init__(self):
24
+ """
25
+ Constructor de la clase TransformToOutputData.
26
+
27
+ Args:
28
+ - features_list: Lista con los nombres de las columnas a extraer de los datos recibidos de cada operación.
29
+ """
30
+ self.is_fitted = False
31
+ self.positions = {"id_db_h":0,
32
+ "id_db_dw":1,
33
+ "tag_seedling":2,
34
+ "tag_fertilizer":3,
35
+ "date_oprc":4}
36
+
37
+ def fit(self, X:np.array, y = None):
38
+ """
39
+ """
40
+ self.is_fitted = True
41
+ keys = ["id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer", "date_oprc"]
42
+ self.temp_df = pd.DataFrame(X, columns = keys)
43
+
44
+ date_data = X[:,4].astype(int)
45
+ date_oprc = np.array([datetime.datetime.fromtimestamp(date, datetime.timezone.utc) for date in date_data])
46
+ self.temp_df.loc[:,"date_oprc"] = date_oprc.flatten()
47
+ ##convierto las columnas "id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer" a int
48
+ self.temp_df.loc[:,["id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer"]] = self.temp_df.loc[:,["id_db_h", "id_db_dw", "tag_seedling", "tag_fertilizer"]].astype(int)
49
+
50
+ return self
51
+
52
+ def transform(self, X:np.array):
53
+ """
54
+ Retorna los datos de entrada a un formato utilizable para procesar las operaciones.
55
+ """
56
+
57
+ return self.temp_df.to_dict(orient = "records")
58
+
59
+ def fit_transform(self, X:np.array, y = None):
60
+ """
61
+ """
62
+ self.fit(X)
63
+ return self.transform(X)
File without changes
@@ -0,0 +1,38 @@
1
+ from base64 import b64decode
2
+
3
+ from sarapy.utils import amg_decoder
4
+
5
+
6
+ def main(hash_table, ppk_data):
7
+
8
+ ppk_results = []
9
+
10
+ for hash_table_entry_values in hash_table.values():
11
+
12
+ try:
13
+
14
+ serialized_datum = hash_table_entry_values["serialized_datum"]
15
+ raw_datum = bytes(b64decode(serialized_datum.encode("utf-8"))) # 'trama'
16
+ datum = amg_decoder.process_data(raw_datum)
17
+
18
+ if datum:
19
+
20
+ longitude, latitude, accuracy = "", "", 0 # ToDo: PPK (Fernando)
21
+
22
+ if longitude:
23
+ datum["Longitud"] = longitude
24
+ if latitude:
25
+ datum["Latitud"] = latitude
26
+ if accuracy != 0:
27
+ datum["Precision"] = accuracy
28
+
29
+ ppk_results.append({
30
+ "id_db_dw": hash_table_entry_values["id_db_dw"],
31
+ "id_db_h": hash_table_entry_values["id_db_h"],
32
+ **datum
33
+ })
34
+
35
+ except Exception as ex:
36
+ print(ex)
37
+
38
+ return ppk_results
@@ -0,0 +1,25 @@
1
+ import pandas as pd
2
+ from sarapy.utils import amg_ppk
3
+ import os
4
+ def getRawOperations(data_file, historical_data_file):
5
+ """
6
+ Args:
7
+ data_file: Path to the file with the data.
8
+ historical_data_file: Path to the file with the historical data.
9
+ Returns the raw operations from the database.
10
+ """
11
+ #cargo examples\2024-05-30\UPM007N\data.json
12
+ data = pd.read_json(os.path.join("examples","2024-05-30","UPM007N","data.json"))
13
+ historical_data = pd.read_json(os.path.join("examples","2024-05-30","UPM007N","historical-data.json"))
14
+ #convierto a lista de diccionarios
15
+ data=data.to_dict(orient="records")
16
+ historical_data=historical_data.to_dict(orient="records")
17
+ hash_table = {}
18
+ for datum in data:
19
+ hash_table[datum["timestamp"]] = {"id_db_dw": datum["id"], "id_db_h": 0, "serialized_datum": ""}
20
+ for historical_datum in historical_data:
21
+ if historical_datum["timestamp"] in hash_table:
22
+ hash_table[historical_datum["timestamp"]].update({"id_db_h": historical_datum["id"], "serialized_datum": historical_datum["datum"]})
23
+ ppk_results = amg_ppk.main(hash_table, []) # ToDo: PPK (Fernando)
24
+
25
+ return ppk_results
@@ -1,2 +1,2 @@
1
1
  ## Version of the package
2
- __version__ = "0.4.9"
2
+ __version__ = "1.0.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sarapy
3
- Version: 0.4.9
3
+ Version: 1.0.1
4
4
  Home-page: https://github.com/lucasbaldezzari/sarapy
5
5
  Author: Lucas Baldezzari
6
6
  Author-email: Lucas Baldezzari <lmbaldezzari@gmail.com>
@@ -19,6 +19,14 @@ Requires-Dist: geopy
19
19
 
20
20
  Library for processing SARAPICO project metadata of _AMG_.
21
21
 
22
+ #### Version 1.0.1
23
+
24
+ - Se agrega *__init.py__* dentro del mpdulo _utils_.
25
+
26
+ #### Version 1.0.0
27
+
28
+ - Se crean clases TransformInputData y TransformToOuputData dentro del módulo proprocessing. Se crean utils.
29
+
22
30
  #### Version 0.4.9
23
31
 
24
32
  - Se cierra la versión 0.4.8 y se crea la versión 0.4.9 para actualizar repositorio, diagrama de clases a esta versión y la Licencia de uso.
@@ -14,10 +14,15 @@ sarapy/dataProcessing/OpsProcessor.py
14
14
  sarapy/dataProcessing/TLMSensorDataProcessor.py
15
15
  sarapy/dataProcessing/TimeSeriesProcessor.py
16
16
  sarapy/dataProcessing/__init__.py
17
- sarapy/dataProcessing/amg_decoder.py
18
17
  sarapy/mlProcessors/PlantinClassifier.py
19
18
  sarapy/mlProcessors/PlantinFMCreator.py
20
19
  sarapy/mlProcessors/__init__.py
21
20
  sarapy/preprocessing/DistancesImputer.py
22
21
  sarapy/preprocessing/FertilizerImputer.py
23
- sarapy/preprocessing/__init__.py
22
+ sarapy/preprocessing/TransformInputData.py
23
+ sarapy/preprocessing/TransformToOutputData.py
24
+ sarapy/preprocessing/__init__.py
25
+ sarapy/utils/__init__.py
26
+ sarapy/utils/amg_decoder.py
27
+ sarapy/utils/amg_ppk.py
28
+ sarapy/utils/getRawOperations.py
File without changes
File without changes
File without changes